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.dynacache/src/com/ibm/ws/cache/CacheOnDisk.java | CacheOnDisk.delCacheEntry | public void delCacheEntry(CacheEntry ce, int cause, int source, boolean fromDepIdTemplateInvalidation) {
htod.delCacheEntry(ce, cause, source, fromDepIdTemplateInvalidation);
} | java | public void delCacheEntry(CacheEntry ce, int cause, int source, boolean fromDepIdTemplateInvalidation) {
htod.delCacheEntry(ce, cause, source, fromDepIdTemplateInvalidation);
} | [
"public",
"void",
"delCacheEntry",
"(",
"CacheEntry",
"ce",
",",
"int",
"cause",
",",
"int",
"source",
",",
"boolean",
"fromDepIdTemplateInvalidation",
")",
"{",
"htod",
".",
"delCacheEntry",
"(",
"ce",
",",
"cause",
",",
"source",
",",
"fromDepIdTemplateInvalidation",
")",
";",
"}"
] | Call this method to a cache entry from the disk.
@param ce
- cache entry. | [
"Call",
"this",
"method",
"to",
"a",
"cache",
"entry",
"from",
"the",
"disk",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheOnDisk.java#L1287-L1289 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheOnDisk.java | CacheOnDisk.delCacheEntry | public void delCacheEntry(ValueSet removeList, int cause, int source, boolean fromDepIdTemplateInvalidation, boolean fireEvent) {
htod.delCacheEntry(removeList, cause, source, fromDepIdTemplateInvalidation, fireEvent);
} | java | public void delCacheEntry(ValueSet removeList, int cause, int source, boolean fromDepIdTemplateInvalidation, boolean fireEvent) {
htod.delCacheEntry(removeList, cause, source, fromDepIdTemplateInvalidation, fireEvent);
} | [
"public",
"void",
"delCacheEntry",
"(",
"ValueSet",
"removeList",
",",
"int",
"cause",
",",
"int",
"source",
",",
"boolean",
"fromDepIdTemplateInvalidation",
",",
"boolean",
"fireEvent",
")",
"{",
"htod",
".",
"delCacheEntry",
"(",
"removeList",
",",
"cause",
",",
"source",
",",
"fromDepIdTemplateInvalidation",
",",
"fireEvent",
")",
";",
"}"
] | Call this method to remove multiple of cache ids from the disk.
@param removeList
- a collection of cache ids. | [
"Call",
"this",
"method",
"to",
"remove",
"multiple",
"of",
"cache",
"ids",
"from",
"the",
"disk",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheOnDisk.java#L1297-L1299 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheOnDisk.java | CacheOnDisk.readDependency | public ValueSet readDependency(Object id, boolean delete) { // SKS-O
Result result = htod.readDependency(id, delete);
if (result.returnCode == HTODDynacache.DISK_EXCEPTION) {
stopOnError(result.diskException);
this.htod.returnToResultPool(result);
return HTODDynacache.EMPTY_VS;
}
ValueSet valueSet = (ValueSet) result.data;
if (valueSet == null) {
valueSet = HTODDynacache.EMPTY_VS;
}
this.htod.returnToResultPool(result);
return valueSet;
} | java | public ValueSet readDependency(Object id, boolean delete) { // SKS-O
Result result = htod.readDependency(id, delete);
if (result.returnCode == HTODDynacache.DISK_EXCEPTION) {
stopOnError(result.diskException);
this.htod.returnToResultPool(result);
return HTODDynacache.EMPTY_VS;
}
ValueSet valueSet = (ValueSet) result.data;
if (valueSet == null) {
valueSet = HTODDynacache.EMPTY_VS;
}
this.htod.returnToResultPool(result);
return valueSet;
} | [
"public",
"ValueSet",
"readDependency",
"(",
"Object",
"id",
",",
"boolean",
"delete",
")",
"{",
"// SKS-O",
"Result",
"result",
"=",
"htod",
".",
"readDependency",
"(",
"id",
",",
"delete",
")",
";",
"if",
"(",
"result",
".",
"returnCode",
"==",
"HTODDynacache",
".",
"DISK_EXCEPTION",
")",
"{",
"stopOnError",
"(",
"result",
".",
"diskException",
")",
";",
"this",
".",
"htod",
".",
"returnToResultPool",
"(",
"result",
")",
";",
"return",
"HTODDynacache",
".",
"EMPTY_VS",
";",
"}",
"ValueSet",
"valueSet",
"=",
"(",
"ValueSet",
")",
"result",
".",
"data",
";",
"if",
"(",
"valueSet",
"==",
"null",
")",
"{",
"valueSet",
"=",
"HTODDynacache",
".",
"EMPTY_VS",
";",
"}",
"this",
".",
"htod",
".",
"returnToResultPool",
"(",
"result",
")",
";",
"return",
"valueSet",
";",
"}"
] | Call this method to read a specified dependency id which contains the cache ids from the disk.
@param id
- dependency id.
@param delete
- boolean to delete the dependency id after reading
@return valueSet - the collection of cache ids. | [
"Call",
"this",
"method",
"to",
"read",
"a",
"specified",
"dependency",
"id",
"which",
"contains",
"the",
"cache",
"ids",
"from",
"the",
"disk",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheOnDisk.java#L1310-L1323 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheOnDisk.java | CacheOnDisk.readTemplate | public ValueSet readTemplate(String template, boolean delete) {
Result result = htod.readTemplate(template, delete);
if (result.returnCode == HTODDynacache.DISK_EXCEPTION) {
stopOnError(result.diskException);
this.htod.returnToResultPool(result);
return HTODDynacache.EMPTY_VS;
}
ValueSet valueSet = (ValueSet) result.data;
if (valueSet == null) {
valueSet = HTODDynacache.EMPTY_VS;
}
this.htod.returnToResultPool(result);
return valueSet;
} | java | public ValueSet readTemplate(String template, boolean delete) {
Result result = htod.readTemplate(template, delete);
if (result.returnCode == HTODDynacache.DISK_EXCEPTION) {
stopOnError(result.diskException);
this.htod.returnToResultPool(result);
return HTODDynacache.EMPTY_VS;
}
ValueSet valueSet = (ValueSet) result.data;
if (valueSet == null) {
valueSet = HTODDynacache.EMPTY_VS;
}
this.htod.returnToResultPool(result);
return valueSet;
} | [
"public",
"ValueSet",
"readTemplate",
"(",
"String",
"template",
",",
"boolean",
"delete",
")",
"{",
"Result",
"result",
"=",
"htod",
".",
"readTemplate",
"(",
"template",
",",
"delete",
")",
";",
"if",
"(",
"result",
".",
"returnCode",
"==",
"HTODDynacache",
".",
"DISK_EXCEPTION",
")",
"{",
"stopOnError",
"(",
"result",
".",
"diskException",
")",
";",
"this",
".",
"htod",
".",
"returnToResultPool",
"(",
"result",
")",
";",
"return",
"HTODDynacache",
".",
"EMPTY_VS",
";",
"}",
"ValueSet",
"valueSet",
"=",
"(",
"ValueSet",
")",
"result",
".",
"data",
";",
"if",
"(",
"valueSet",
"==",
"null",
")",
"{",
"valueSet",
"=",
"HTODDynacache",
".",
"EMPTY_VS",
";",
"}",
"this",
".",
"htod",
".",
"returnToResultPool",
"(",
"result",
")",
";",
"return",
"valueSet",
";",
"}"
] | Call this method to read a specified template which contains the cache ids from the disk.
@param template
- template id.
@param delete
- boolean to delete the template after reading
@return valueSet - the collection of cache ids. | [
"Call",
"this",
"method",
"to",
"read",
"a",
"specified",
"template",
"which",
"contains",
"the",
"cache",
"ids",
"from",
"the",
"disk",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheOnDisk.java#L1334-L1347 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheOnDisk.java | CacheOnDisk.readTemplatesByRange | public ValueSet readTemplatesByRange(int index, int length) {
Result result = htod.readTemplatesByRange(index, length);
if (result.returnCode == HTODDynacache.DISK_EXCEPTION) {
stopOnError(result.diskException);
this.htod.returnToResultPool(result);
return HTODDynacache.EMPTY_VS;
}
ValueSet valueSet = (ValueSet) result.data;
if (valueSet == null) {
valueSet = HTODDynacache.EMPTY_VS;
}
this.htod.returnToResultPool(result);
return valueSet;
} | java | public ValueSet readTemplatesByRange(int index, int length) {
Result result = htod.readTemplatesByRange(index, length);
if (result.returnCode == HTODDynacache.DISK_EXCEPTION) {
stopOnError(result.diskException);
this.htod.returnToResultPool(result);
return HTODDynacache.EMPTY_VS;
}
ValueSet valueSet = (ValueSet) result.data;
if (valueSet == null) {
valueSet = HTODDynacache.EMPTY_VS;
}
this.htod.returnToResultPool(result);
return valueSet;
} | [
"public",
"ValueSet",
"readTemplatesByRange",
"(",
"int",
"index",
",",
"int",
"length",
")",
"{",
"Result",
"result",
"=",
"htod",
".",
"readTemplatesByRange",
"(",
"index",
",",
"length",
")",
";",
"if",
"(",
"result",
".",
"returnCode",
"==",
"HTODDynacache",
".",
"DISK_EXCEPTION",
")",
"{",
"stopOnError",
"(",
"result",
".",
"diskException",
")",
";",
"this",
".",
"htod",
".",
"returnToResultPool",
"(",
"result",
")",
";",
"return",
"HTODDynacache",
".",
"EMPTY_VS",
";",
"}",
"ValueSet",
"valueSet",
"=",
"(",
"ValueSet",
")",
"result",
".",
"data",
";",
"if",
"(",
"valueSet",
"==",
"null",
")",
"{",
"valueSet",
"=",
"HTODDynacache",
".",
"EMPTY_VS",
";",
"}",
"this",
".",
"htod",
".",
"returnToResultPool",
"(",
"result",
")",
";",
"return",
"valueSet",
";",
"}"
] | Call this method to get the template ids based on the index and the length from the disk.
@param index
If index = 0, it starts the beginning. If index = 1, it means "next". If Index = -1, it means
"previous".
@param length
The max number of templates to be read. If length = -1, it reads all templates until the end.
@return valueSet - the collection of templates. | [
"Call",
"this",
"method",
"to",
"get",
"the",
"template",
"ids",
"based",
"on",
"the",
"index",
"and",
"the",
"length",
"from",
"the",
"disk",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheOnDisk.java#L1409-L1422 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheOnDisk.java | CacheOnDisk.getCacheIdsSize | public int getCacheIdsSize(boolean filter) {
if (filter == CacheOnDisk.FILTER) {
return htod.getCacheIdsSize(filter) - htod.invalidationBuffer.size();
} else {
return htod.getCacheIdsSize(filter);
}
} | java | public int getCacheIdsSize(boolean filter) {
if (filter == CacheOnDisk.FILTER) {
return htod.getCacheIdsSize(filter) - htod.invalidationBuffer.size();
} else {
return htod.getCacheIdsSize(filter);
}
} | [
"public",
"int",
"getCacheIdsSize",
"(",
"boolean",
"filter",
")",
"{",
"if",
"(",
"filter",
"==",
"CacheOnDisk",
".",
"FILTER",
")",
"{",
"return",
"htod",
".",
"getCacheIdsSize",
"(",
"filter",
")",
"-",
"htod",
".",
"invalidationBuffer",
".",
"size",
"(",
")",
";",
"}",
"else",
"{",
"return",
"htod",
".",
"getCacheIdsSize",
"(",
"filter",
")",
";",
"}",
"}"
] | Call this method to get the number of the cache ids in the disk.
@param filter
if true, filter the size from the invalidation buffer. Else, no filter - real size of entries in the
disk
@return int - the size | [
"Call",
"this",
"method",
"to",
"get",
"the",
"number",
"of",
"the",
"cache",
"ids",
"in",
"the",
"disk",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheOnDisk.java#L1432-L1439 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheOnDisk.java | CacheOnDisk.delDependencyEntry | public void delDependencyEntry(Object id, Object entry) { // SKS-O
if (htod.delDependencyEntry(id, entry) == HTODDynacache.DISK_EXCEPTION) {
stopOnError(this.htod.diskCacheException);
}
} | java | public void delDependencyEntry(Object id, Object entry) { // SKS-O
if (htod.delDependencyEntry(id, entry) == HTODDynacache.DISK_EXCEPTION) {
stopOnError(this.htod.diskCacheException);
}
} | [
"public",
"void",
"delDependencyEntry",
"(",
"Object",
"id",
",",
"Object",
"entry",
")",
"{",
"// SKS-O",
"if",
"(",
"htod",
".",
"delDependencyEntry",
"(",
"id",
",",
"entry",
")",
"==",
"HTODDynacache",
".",
"DISK_EXCEPTION",
")",
"{",
"stopOnError",
"(",
"this",
".",
"htod",
".",
"diskCacheException",
")",
";",
"}",
"}"
] | Call this method to delete a cache id from a specified dependency in the disk.
@param id
- dependency id.
@param entry
- cache id. | [
"Call",
"this",
"method",
"to",
"delete",
"a",
"cache",
"id",
"from",
"a",
"specified",
"dependency",
"in",
"the",
"disk",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheOnDisk.java#L1512-L1516 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheOnDisk.java | CacheOnDisk.delTemplateEntry | public void delTemplateEntry(String template, Object entry) {
if (htod.delTemplateEntry(template, entry) == HTODDynacache.DISK_EXCEPTION) {
stopOnError(this.htod.diskCacheException);
}
} | java | public void delTemplateEntry(String template, Object entry) {
if (htod.delTemplateEntry(template, entry) == HTODDynacache.DISK_EXCEPTION) {
stopOnError(this.htod.diskCacheException);
}
} | [
"public",
"void",
"delTemplateEntry",
"(",
"String",
"template",
",",
"Object",
"entry",
")",
"{",
"if",
"(",
"htod",
".",
"delTemplateEntry",
"(",
"template",
",",
"entry",
")",
"==",
"HTODDynacache",
".",
"DISK_EXCEPTION",
")",
"{",
"stopOnError",
"(",
"this",
".",
"htod",
".",
"diskCacheException",
")",
";",
"}",
"}"
] | Call this method to delete a cache id from a specified template in the disk.
@param template
- template id.
@param entry
- cache id. | [
"Call",
"this",
"method",
"to",
"delete",
"a",
"cache",
"id",
"from",
"a",
"specified",
"template",
"in",
"the",
"disk",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheOnDisk.java#L1526-L1530 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheOnDisk.java | CacheOnDisk.delDependency | public void delDependency(Object id) { // SKS-O
if (htod.delDependency(id) == HTODDynacache.DISK_EXCEPTION) {
stopOnError(this.htod.diskCacheException);
}
} | java | public void delDependency(Object id) { // SKS-O
if (htod.delDependency(id) == HTODDynacache.DISK_EXCEPTION) {
stopOnError(this.htod.diskCacheException);
}
} | [
"public",
"void",
"delDependency",
"(",
"Object",
"id",
")",
"{",
"// SKS-O",
"if",
"(",
"htod",
".",
"delDependency",
"(",
"id",
")",
"==",
"HTODDynacache",
".",
"DISK_EXCEPTION",
")",
"{",
"stopOnError",
"(",
"this",
".",
"htod",
".",
"diskCacheException",
")",
";",
"}",
"}"
] | Call this method to delete speciifed dependency id from the disk.
@param id
- dependency id. | [
"Call",
"this",
"method",
"to",
"delete",
"speciifed",
"dependency",
"id",
"from",
"the",
"disk",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheOnDisk.java#L1538-L1542 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheOnDisk.java | CacheOnDisk.delTemplate | public void delTemplate(String template) {
if (htod.delTemplate(template) == HTODDynacache.DISK_EXCEPTION) {
stopOnError(this.htod.diskCacheException);
}
} | java | public void delTemplate(String template) {
if (htod.delTemplate(template) == HTODDynacache.DISK_EXCEPTION) {
stopOnError(this.htod.diskCacheException);
}
} | [
"public",
"void",
"delTemplate",
"(",
"String",
"template",
")",
"{",
"if",
"(",
"htod",
".",
"delTemplate",
"(",
"template",
")",
"==",
"HTODDynacache",
".",
"DISK_EXCEPTION",
")",
"{",
"stopOnError",
"(",
"this",
".",
"htod",
".",
"diskCacheException",
")",
";",
"}",
"}"
] | Call this method to delete speciifed template from the disk.
@param id
- template id. | [
"Call",
"this",
"method",
"to",
"delete",
"speciifed",
"template",
"from",
"the",
"disk",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheOnDisk.java#L1550-L1554 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheOnDisk.java | CacheOnDisk.writeDependency | public int writeDependency(Object id, ValueSet vs) { // SKS-O
int returnCode = htod.writeDependency(id, vs);
if (returnCode == HTODDynacache.DISK_EXCEPTION) {
stopOnError(this.htod.diskCacheException);
}
return returnCode;
} | java | public int writeDependency(Object id, ValueSet vs) { // SKS-O
int returnCode = htod.writeDependency(id, vs);
if (returnCode == HTODDynacache.DISK_EXCEPTION) {
stopOnError(this.htod.diskCacheException);
}
return returnCode;
} | [
"public",
"int",
"writeDependency",
"(",
"Object",
"id",
",",
"ValueSet",
"vs",
")",
"{",
"// SKS-O",
"int",
"returnCode",
"=",
"htod",
".",
"writeDependency",
"(",
"id",
",",
"vs",
")",
";",
"if",
"(",
"returnCode",
"==",
"HTODDynacache",
".",
"DISK_EXCEPTION",
")",
"{",
"stopOnError",
"(",
"this",
".",
"htod",
".",
"diskCacheException",
")",
";",
"}",
"return",
"returnCode",
";",
"}"
] | Call this method to write a dependency id with a collection of cache ids to the disk.
@param id
- dependency id.
@param vs
- a collection of cache ids. | [
"Call",
"this",
"method",
"to",
"write",
"a",
"dependency",
"id",
"with",
"a",
"collection",
"of",
"cache",
"ids",
"to",
"the",
"disk",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheOnDisk.java#L1564-L1570 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheOnDisk.java | CacheOnDisk.writeTemplate | public int writeTemplate(String template, ValueSet vs) {
int returnCode = htod.writeTemplate(template, vs);
if (returnCode == HTODDynacache.DISK_EXCEPTION) {
stopOnError(this.htod.diskCacheException);
}
return returnCode;
} | java | public int writeTemplate(String template, ValueSet vs) {
int returnCode = htod.writeTemplate(template, vs);
if (returnCode == HTODDynacache.DISK_EXCEPTION) {
stopOnError(this.htod.diskCacheException);
}
return returnCode;
} | [
"public",
"int",
"writeTemplate",
"(",
"String",
"template",
",",
"ValueSet",
"vs",
")",
"{",
"int",
"returnCode",
"=",
"htod",
".",
"writeTemplate",
"(",
"template",
",",
"vs",
")",
";",
"if",
"(",
"returnCode",
"==",
"HTODDynacache",
".",
"DISK_EXCEPTION",
")",
"{",
"stopOnError",
"(",
"this",
".",
"htod",
".",
"diskCacheException",
")",
";",
"}",
"return",
"returnCode",
";",
"}"
] | Call this method to write a template with a collection of cache ids to the disk.
@param template
- template id.
@param vs
- a collection of cache ids. | [
"Call",
"this",
"method",
"to",
"write",
"a",
"template",
"with",
"a",
"collection",
"of",
"cache",
"ids",
"to",
"the",
"disk",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheOnDisk.java#L1580-L1586 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheOnDisk.java | CacheOnDisk.writeDependencyEntry | public int writeDependencyEntry(Object id, Object entry) { // SKS-O
int returnCode = htod.writeDependencyEntry(id, entry);
if (returnCode == HTODDynacache.DISK_EXCEPTION) {
stopOnError(this.htod.diskCacheException);
}
return returnCode;
} | java | public int writeDependencyEntry(Object id, Object entry) { // SKS-O
int returnCode = htod.writeDependencyEntry(id, entry);
if (returnCode == HTODDynacache.DISK_EXCEPTION) {
stopOnError(this.htod.diskCacheException);
}
return returnCode;
} | [
"public",
"int",
"writeDependencyEntry",
"(",
"Object",
"id",
",",
"Object",
"entry",
")",
"{",
"// SKS-O",
"int",
"returnCode",
"=",
"htod",
".",
"writeDependencyEntry",
"(",
"id",
",",
"entry",
")",
";",
"if",
"(",
"returnCode",
"==",
"HTODDynacache",
".",
"DISK_EXCEPTION",
")",
"{",
"stopOnError",
"(",
"this",
".",
"htod",
".",
"diskCacheException",
")",
";",
"}",
"return",
"returnCode",
";",
"}"
] | Call this method to add a cache id for a specified dependency id to the disk.
@param id
- dependency id.
@param entry
- cache id. | [
"Call",
"this",
"method",
"to",
"add",
"a",
"cache",
"id",
"for",
"a",
"specified",
"dependency",
"id",
"to",
"the",
"disk",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheOnDisk.java#L1596-L1602 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheOnDisk.java | CacheOnDisk.writeTemplateEntry | public int writeTemplateEntry(String template, Object entry) {
int returnCode = htod.writeTemplateEntry(template, entry);
if (returnCode == HTODDynacache.DISK_EXCEPTION) {
stopOnError(this.htod.diskCacheException);
}
return returnCode;
} | java | public int writeTemplateEntry(String template, Object entry) {
int returnCode = htod.writeTemplateEntry(template, entry);
if (returnCode == HTODDynacache.DISK_EXCEPTION) {
stopOnError(this.htod.diskCacheException);
}
return returnCode;
} | [
"public",
"int",
"writeTemplateEntry",
"(",
"String",
"template",
",",
"Object",
"entry",
")",
"{",
"int",
"returnCode",
"=",
"htod",
".",
"writeTemplateEntry",
"(",
"template",
",",
"entry",
")",
";",
"if",
"(",
"returnCode",
"==",
"HTODDynacache",
".",
"DISK_EXCEPTION",
")",
"{",
"stopOnError",
"(",
"this",
".",
"htod",
".",
"diskCacheException",
")",
";",
"}",
"return",
"returnCode",
";",
"}"
] | Call this method to add a cache id for a specified template to the disk.
@param template
- template id.
@param entry
- cache id. | [
"Call",
"this",
"method",
"to",
"add",
"a",
"cache",
"id",
"for",
"a",
"specified",
"template",
"to",
"the",
"disk",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheOnDisk.java#L1612-L1618 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheOnDisk.java | CacheOnDisk.calculateSleepTime | protected long calculateSleepTime() {
Calendar c = new GregorianCalendar();
int currentHour = c.get(Calendar.HOUR_OF_DAY);
int currentMin = c.get(Calendar.MINUTE);
int currentSec = c.get(Calendar.SECOND);
long stime = SECONDS_FOR_24_HOURS - ((currentHour * 60 + currentMin) * 60 + currentSec) + cleanupHour * 60 * 60;
if (stime > SECONDS_FOR_24_HOURS) {
stime = stime - SECONDS_FOR_24_HOURS;
}
if (stime < 10) {
stime = 10;
}
stime = stime * 1000; // convert to msec
return stime;
} | java | protected long calculateSleepTime() {
Calendar c = new GregorianCalendar();
int currentHour = c.get(Calendar.HOUR_OF_DAY);
int currentMin = c.get(Calendar.MINUTE);
int currentSec = c.get(Calendar.SECOND);
long stime = SECONDS_FOR_24_HOURS - ((currentHour * 60 + currentMin) * 60 + currentSec) + cleanupHour * 60 * 60;
if (stime > SECONDS_FOR_24_HOURS) {
stime = stime - SECONDS_FOR_24_HOURS;
}
if (stime < 10) {
stime = 10;
}
stime = stime * 1000; // convert to msec
return stime;
} | [
"protected",
"long",
"calculateSleepTime",
"(",
")",
"{",
"Calendar",
"c",
"=",
"new",
"GregorianCalendar",
"(",
")",
";",
"int",
"currentHour",
"=",
"c",
".",
"get",
"(",
"Calendar",
".",
"HOUR_OF_DAY",
")",
";",
"int",
"currentMin",
"=",
"c",
".",
"get",
"(",
"Calendar",
".",
"MINUTE",
")",
";",
"int",
"currentSec",
"=",
"c",
".",
"get",
"(",
"Calendar",
".",
"SECOND",
")",
";",
"long",
"stime",
"=",
"SECONDS_FOR_24_HOURS",
"-",
"(",
"(",
"currentHour",
"*",
"60",
"+",
"currentMin",
")",
"*",
"60",
"+",
"currentSec",
")",
"+",
"cleanupHour",
"*",
"60",
"*",
"60",
";",
"if",
"(",
"stime",
">",
"SECONDS_FOR_24_HOURS",
")",
"{",
"stime",
"=",
"stime",
"-",
"SECONDS_FOR_24_HOURS",
";",
"}",
"if",
"(",
"stime",
"<",
"10",
")",
"{",
"stime",
"=",
"10",
";",
"}",
"stime",
"=",
"stime",
"*",
"1000",
";",
"// convert to msec",
"return",
"stime",
";",
"}"
] | return the sleep time in msec | [
"return",
"the",
"sleep",
"time",
"in",
"msec"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheOnDisk.java#L1669-L1683 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheOnDisk.java | CacheOnDisk.clearInvalidationBuffers | public void clearInvalidationBuffers() {
this.htod.invalidationBuffer.clear(HTODInvalidationBuffer.EXPLICIT_BUFFER); // 3821 NK begin
this.htod.invalidationBuffer.clear(HTODInvalidationBuffer.SCAN_BUFFER);
if (this.evictionPolicy != CacheConfig.EVICTION_NONE) {
this.htod.invalidationBuffer.clear(HTODInvalidationBuffer.GC_BUFFER); // 3821 NK end
}
} | java | public void clearInvalidationBuffers() {
this.htod.invalidationBuffer.clear(HTODInvalidationBuffer.EXPLICIT_BUFFER); // 3821 NK begin
this.htod.invalidationBuffer.clear(HTODInvalidationBuffer.SCAN_BUFFER);
if (this.evictionPolicy != CacheConfig.EVICTION_NONE) {
this.htod.invalidationBuffer.clear(HTODInvalidationBuffer.GC_BUFFER); // 3821 NK end
}
} | [
"public",
"void",
"clearInvalidationBuffers",
"(",
")",
"{",
"this",
".",
"htod",
".",
"invalidationBuffer",
".",
"clear",
"(",
"HTODInvalidationBuffer",
".",
"EXPLICIT_BUFFER",
")",
";",
"// 3821 NK begin",
"this",
".",
"htod",
".",
"invalidationBuffer",
".",
"clear",
"(",
"HTODInvalidationBuffer",
".",
"SCAN_BUFFER",
")",
";",
"if",
"(",
"this",
".",
"evictionPolicy",
"!=",
"CacheConfig",
".",
"EVICTION_NONE",
")",
"{",
"this",
".",
"htod",
".",
"invalidationBuffer",
".",
"clear",
"(",
"HTODInvalidationBuffer",
".",
"GC_BUFFER",
")",
";",
"// 3821 NK end",
"}",
"}"
] | This method clears invalidaiton buffers in HTODDynacache | [
"This",
"method",
"clears",
"invalidaiton",
"buffers",
"in",
"HTODDynacache"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheOnDisk.java#L1695-L1701 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheOnDisk.java | CacheOnDisk.readHashcodeByRange | public Result readHashcodeByRange(int index, int length, boolean debug, boolean useValue) { // LI4337-17
Result result = this.htod.readHashcodeByRange(index, length, debug, useValue);
if (result.returnCode == HTODDynacache.DISK_EXCEPTION) {
stopOnError(result.diskException);
}
return result;
} | java | public Result readHashcodeByRange(int index, int length, boolean debug, boolean useValue) { // LI4337-17
Result result = this.htod.readHashcodeByRange(index, length, debug, useValue);
if (result.returnCode == HTODDynacache.DISK_EXCEPTION) {
stopOnError(result.diskException);
}
return result;
} | [
"public",
"Result",
"readHashcodeByRange",
"(",
"int",
"index",
",",
"int",
"length",
",",
"boolean",
"debug",
",",
"boolean",
"useValue",
")",
"{",
"// LI4337-17",
"Result",
"result",
"=",
"this",
".",
"htod",
".",
"readHashcodeByRange",
"(",
"index",
",",
"length",
",",
"debug",
",",
"useValue",
")",
";",
"if",
"(",
"result",
".",
"returnCode",
"==",
"HTODDynacache",
".",
"DISK_EXCEPTION",
")",
"{",
"stopOnError",
"(",
"result",
".",
"diskException",
")",
";",
"}",
"return",
"result",
";",
"}"
] | This method find the hashcode based on index and length.
@param index
If index = 0, it starts the beginning. If index = 1, it means "next". If Index = -1, it means
"previous".
@param length
The max number of cache ids to be read. If length = -1, it reads all cache ids until the end.
@param debug
true to output id and its hashcode to systemout.log
@param useValue
true to calculate hashcode including value | [
"This",
"method",
"find",
"the",
"hashcode",
"based",
"on",
"index",
"and",
"length",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheOnDisk.java#L1731-L1737 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheOnDisk.java | CacheOnDisk.updateExpirationTime | public int updateExpirationTime(Object id, long oldExpirationTime, int size, long newExpirationTime, long newValidatorExpirationTime) {
int returnCode = this.htod.updateExpirationTime(id, oldExpirationTime, size, newExpirationTime, newValidatorExpirationTime);
if (returnCode == HTODDynacache.DISK_EXCEPTION) {
stopOnError(this.htod.diskCacheException);
}
return returnCode;
} | java | public int updateExpirationTime(Object id, long oldExpirationTime, int size, long newExpirationTime, long newValidatorExpirationTime) {
int returnCode = this.htod.updateExpirationTime(id, oldExpirationTime, size, newExpirationTime, newValidatorExpirationTime);
if (returnCode == HTODDynacache.DISK_EXCEPTION) {
stopOnError(this.htod.diskCacheException);
}
return returnCode;
} | [
"public",
"int",
"updateExpirationTime",
"(",
"Object",
"id",
",",
"long",
"oldExpirationTime",
",",
"int",
"size",
",",
"long",
"newExpirationTime",
",",
"long",
"newValidatorExpirationTime",
")",
"{",
"int",
"returnCode",
"=",
"this",
".",
"htod",
".",
"updateExpirationTime",
"(",
"id",
",",
"oldExpirationTime",
",",
"size",
",",
"newExpirationTime",
",",
"newValidatorExpirationTime",
")",
";",
"if",
"(",
"returnCode",
"==",
"HTODDynacache",
".",
"DISK_EXCEPTION",
")",
"{",
"stopOnError",
"(",
"this",
".",
"htod",
".",
"diskCacheException",
")",
";",
"}",
"return",
"returnCode",
";",
"}"
] | This method is used to update expiration times in GC and disk emtry header | [
"This",
"method",
"is",
"used",
"to",
"update",
"expiration",
"times",
"in",
"GC",
"and",
"disk",
"emtry",
"header"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheOnDisk.java#L1742-L1748 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheOnDisk.java | CacheOnDisk.checkDirectoryWriteable | protected int checkDirectoryWriteable(String location) {
final String methodName = "checkDirectoryWriteable()";
int rc = CacheOnDisk.LOCATION_OK;
if (location.equals("")) {
rc = CacheOnDisk.LOCATION_NOT_DEFINED;
} else if (location.startsWith("${") && location.indexOf("}") > 0) {
rc = CacheOnDisk.LOCATION_NOT_VALID;
} else {
try {
File f = new File(location);
if (!f.exists()) {
if (!f.mkdirs()) {
rc = CacheOnDisk.LOCATION_CANNOT_MAKE_DIR;
}
} else if (!f.isDirectory()) {
rc = CacheOnDisk.LOCATION_NOT_DIRECTORY;
} else if (!f.canWrite()) {
rc = CacheOnDisk.LOCATION_NOT_WRITABLE;
}
} catch (Throwable t) {
rc = CacheOnDisk.LOCATION_NOT_WRITABLE;
com.ibm.ws.ffdc.FFDCFilter.processException(t, "com.ibm.ws.cache.CacheOnDisk.checkDirectoryWriteable", "1779", this);
traceDebug(methodName, "cacheName=" + this.cacheName + " location=" + location + "\nException: " + ExceptionUtility.getStackTrace(t));
}
}
traceDebug(methodName, "cacheName=" + this.cacheName + " location=" + location + " rc=" + rc);
return rc;
} | java | protected int checkDirectoryWriteable(String location) {
final String methodName = "checkDirectoryWriteable()";
int rc = CacheOnDisk.LOCATION_OK;
if (location.equals("")) {
rc = CacheOnDisk.LOCATION_NOT_DEFINED;
} else if (location.startsWith("${") && location.indexOf("}") > 0) {
rc = CacheOnDisk.LOCATION_NOT_VALID;
} else {
try {
File f = new File(location);
if (!f.exists()) {
if (!f.mkdirs()) {
rc = CacheOnDisk.LOCATION_CANNOT_MAKE_DIR;
}
} else if (!f.isDirectory()) {
rc = CacheOnDisk.LOCATION_NOT_DIRECTORY;
} else if (!f.canWrite()) {
rc = CacheOnDisk.LOCATION_NOT_WRITABLE;
}
} catch (Throwable t) {
rc = CacheOnDisk.LOCATION_NOT_WRITABLE;
com.ibm.ws.ffdc.FFDCFilter.processException(t, "com.ibm.ws.cache.CacheOnDisk.checkDirectoryWriteable", "1779", this);
traceDebug(methodName, "cacheName=" + this.cacheName + " location=" + location + "\nException: " + ExceptionUtility.getStackTrace(t));
}
}
traceDebug(methodName, "cacheName=" + this.cacheName + " location=" + location + " rc=" + rc);
return rc;
} | [
"protected",
"int",
"checkDirectoryWriteable",
"(",
"String",
"location",
")",
"{",
"final",
"String",
"methodName",
"=",
"\"checkDirectoryWriteable()\"",
";",
"int",
"rc",
"=",
"CacheOnDisk",
".",
"LOCATION_OK",
";",
"if",
"(",
"location",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",
"rc",
"=",
"CacheOnDisk",
".",
"LOCATION_NOT_DEFINED",
";",
"}",
"else",
"if",
"(",
"location",
".",
"startsWith",
"(",
"\"${\"",
")",
"&&",
"location",
".",
"indexOf",
"(",
"\"}\"",
")",
">",
"0",
")",
"{",
"rc",
"=",
"CacheOnDisk",
".",
"LOCATION_NOT_VALID",
";",
"}",
"else",
"{",
"try",
"{",
"File",
"f",
"=",
"new",
"File",
"(",
"location",
")",
";",
"if",
"(",
"!",
"f",
".",
"exists",
"(",
")",
")",
"{",
"if",
"(",
"!",
"f",
".",
"mkdirs",
"(",
")",
")",
"{",
"rc",
"=",
"CacheOnDisk",
".",
"LOCATION_CANNOT_MAKE_DIR",
";",
"}",
"}",
"else",
"if",
"(",
"!",
"f",
".",
"isDirectory",
"(",
")",
")",
"{",
"rc",
"=",
"CacheOnDisk",
".",
"LOCATION_NOT_DIRECTORY",
";",
"}",
"else",
"if",
"(",
"!",
"f",
".",
"canWrite",
"(",
")",
")",
"{",
"rc",
"=",
"CacheOnDisk",
".",
"LOCATION_NOT_WRITABLE",
";",
"}",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"rc",
"=",
"CacheOnDisk",
".",
"LOCATION_NOT_WRITABLE",
";",
"com",
".",
"ibm",
".",
"ws",
".",
"ffdc",
".",
"FFDCFilter",
".",
"processException",
"(",
"t",
",",
"\"com.ibm.ws.cache.CacheOnDisk.checkDirectoryWriteable\"",
",",
"\"1779\"",
",",
"this",
")",
";",
"traceDebug",
"(",
"methodName",
",",
"\"cacheName=\"",
"+",
"this",
".",
"cacheName",
"+",
"\" location=\"",
"+",
"location",
"+",
"\"\\nException: \"",
"+",
"ExceptionUtility",
".",
"getStackTrace",
"(",
"t",
")",
")",
";",
"}",
"}",
"traceDebug",
"(",
"methodName",
",",
"\"cacheName=\"",
"+",
"this",
".",
"cacheName",
"+",
"\" location=\"",
"+",
"location",
"+",
"\" rc=\"",
"+",
"rc",
")",
";",
"return",
"rc",
";",
"}"
] | Check the location whether it is writable or not
@param location
@return int 0 = OK 1 = LOCATION_NOT_DEFINED 2 = INVALID_LOCATION 3 = LOCATION_NOT_DIRECTORY 4 =
LOCATION_NOT_WRITABLE 5 = LOCATION_CANNOT_MAKE_DIR | [
"Check",
"the",
"location",
"whether",
"it",
"is",
"writable",
"or",
"not"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheOnDisk.java#L1841-L1869 | train |
OpenLiberty/open-liberty | dev/wlp-mavenRepoTasks/src/com/ibm/ws/wlp/mavenFeatures/utils/Utils.java | Utils.getRepositorySubpath | public static String getRepositorySubpath(MavenCoordinates artifact) {
StringBuffer buf = new StringBuffer();
String[] groupDirs = artifact.getGroupId().split("\\.");
for (String dir : groupDirs) {
buf.append(dir).append("/");
}
buf.append(artifact.getArtifactId()).append("/").append(artifact.getVersion());
return buf.toString();
} | java | public static String getRepositorySubpath(MavenCoordinates artifact) {
StringBuffer buf = new StringBuffer();
String[] groupDirs = artifact.getGroupId().split("\\.");
for (String dir : groupDirs) {
buf.append(dir).append("/");
}
buf.append(artifact.getArtifactId()).append("/").append(artifact.getVersion());
return buf.toString();
} | [
"public",
"static",
"String",
"getRepositorySubpath",
"(",
"MavenCoordinates",
"artifact",
")",
"{",
"StringBuffer",
"buf",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"String",
"[",
"]",
"groupDirs",
"=",
"artifact",
".",
"getGroupId",
"(",
")",
".",
"split",
"(",
"\"\\\\.\"",
")",
";",
"for",
"(",
"String",
"dir",
":",
"groupDirs",
")",
"{",
"buf",
".",
"append",
"(",
"dir",
")",
".",
"append",
"(",
"\"/\"",
")",
";",
"}",
"buf",
".",
"append",
"(",
"artifact",
".",
"getArtifactId",
"(",
")",
")",
".",
"append",
"(",
"\"/\"",
")",
".",
"append",
"(",
"artifact",
".",
"getVersion",
"(",
")",
")",
";",
"return",
"buf",
".",
"toString",
"(",
")",
";",
"}"
] | Gets the expected path within a Maven repository for the given Maven
artifact, based on its Maven coordinates.
@param artifact
the MavenArtifact whose path you want
@return the path within a Maven repository where the artifact should be
stored | [
"Gets",
"the",
"expected",
"path",
"within",
"a",
"Maven",
"repository",
"for",
"the",
"given",
"Maven",
"artifact",
"based",
"on",
"its",
"Maven",
"coordinates",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/wlp-mavenRepoTasks/src/com/ibm/ws/wlp/mavenFeatures/utils/Utils.java#L26-L34 | train |
OpenLiberty/open-liberty | dev/wlp-mavenRepoTasks/src/com/ibm/ws/wlp/mavenFeatures/utils/Utils.java | Utils.getFileName | public static String getFileName(MavenCoordinates artifact, Constants.ArtifactType type) {
return artifact.getArtifactId() + "-" + artifact.getVersion() + type.getMavenFileExtension();
} | java | public static String getFileName(MavenCoordinates artifact, Constants.ArtifactType type) {
return artifact.getArtifactId() + "-" + artifact.getVersion() + type.getMavenFileExtension();
} | [
"public",
"static",
"String",
"getFileName",
"(",
"MavenCoordinates",
"artifact",
",",
"Constants",
".",
"ArtifactType",
"type",
")",
"{",
"return",
"artifact",
".",
"getArtifactId",
"(",
")",
"+",
"\"-\"",
"+",
"artifact",
".",
"getVersion",
"(",
")",
"+",
"type",
".",
"getMavenFileExtension",
"(",
")",
";",
"}"
] | Gets the expected file name for a Maven artifact, based on its Maven
coordinates.
@param artifact
the MavenArtifact whose file name you want
@param type
the type of artifact
@return the file name including extension | [
"Gets",
"the",
"expected",
"file",
"name",
"for",
"a",
"Maven",
"artifact",
"based",
"on",
"its",
"Maven",
"coordinates",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/wlp-mavenRepoTasks/src/com/ibm/ws/wlp/mavenFeatures/utils/Utils.java#L46-L48 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsBytesMessageImpl.java | JmsBytesMessageImpl.clearBody | @Override
public void clearBody() throws javax.jms.JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "clearBody");
// Set the message into write-only mode, handle generic actions
super.clearBody();
// Clear the locally stored reference to body of the message, and ensure the
// 'read' stream is set to null
dataBuffer = null;
dataStart = 0; // @P2A
readStream = null;
// remove the encoding and character set properties as these pertain to the
// body which is being cleared.
// SIB0121: also clear the underlying MFP payload
if (jsBytesMsg != null) {
jsBytesMsg.setBytes(null);
jsBytesMsg.setObjectProperty(ApiJmsConstants.ENCODING_PROPERTY, null);
jsBytesMsg.setObjectProperty(ApiJmsConstants.CHARSET_PROPERTY, null);
}
integerEncoding = ApiJmsConstants.ENC_INTEGER_NORMAL; // reset to standard Java encoding
floatEncoding = ApiJmsConstants.ENC_FLOAT_IEEE_NORMAL; // reset to standard Java encoding
// Invalidate the cached toString object.
cachedBytesToString = null;
// This class has different behaviour depending on the whether the
// producer might modify the payload after it's been set or not
if (!producerWontModifyPayloadAfterSet) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Producer might modify the payload after set - encoding is required, so reinitialise encoding relating variables");
// Prepare a new stream for the client to write to
_writeBytes = new ByteArrayOutputStream();
writeStream = new DataOutputStream(_writeBytes);
// Initialise the arrays used to record the position of numeric items
integer_count = 0;
// number of integer items recorded in the current arrays
integer_offsets = new int[ARRAY_SIZE];
// offset of start of each numeric item
integer_sizes = new int[ARRAY_SIZE];
// length in byte of the item in question
if (integers != null)
integers.removeAllElements();
// arrays which we filled up are stored in this vector - remove them all
if (float_offsets != null)
float_offsets.removeAllElements();
if (float_values != null)
float_values.removeAllElements();
// Ensure that the new data gets exported when the time comes.
bodySetInJsMsg = false;
}
else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Producer has promised not to modify payload - ensure write streams used for encoding are null");
// Ensure the write stream variables are null - they are never used when the
// producer has promised not to modify the payload after it's been set
_writeBytes = null;
writeStream = null;
// Ensure the producer promise flag is checked correctly in the writeBytes method
writeByteArrayCalled = false;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "clearBody");
} | java | @Override
public void clearBody() throws javax.jms.JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "clearBody");
// Set the message into write-only mode, handle generic actions
super.clearBody();
// Clear the locally stored reference to body of the message, and ensure the
// 'read' stream is set to null
dataBuffer = null;
dataStart = 0; // @P2A
readStream = null;
// remove the encoding and character set properties as these pertain to the
// body which is being cleared.
// SIB0121: also clear the underlying MFP payload
if (jsBytesMsg != null) {
jsBytesMsg.setBytes(null);
jsBytesMsg.setObjectProperty(ApiJmsConstants.ENCODING_PROPERTY, null);
jsBytesMsg.setObjectProperty(ApiJmsConstants.CHARSET_PROPERTY, null);
}
integerEncoding = ApiJmsConstants.ENC_INTEGER_NORMAL; // reset to standard Java encoding
floatEncoding = ApiJmsConstants.ENC_FLOAT_IEEE_NORMAL; // reset to standard Java encoding
// Invalidate the cached toString object.
cachedBytesToString = null;
// This class has different behaviour depending on the whether the
// producer might modify the payload after it's been set or not
if (!producerWontModifyPayloadAfterSet) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Producer might modify the payload after set - encoding is required, so reinitialise encoding relating variables");
// Prepare a new stream for the client to write to
_writeBytes = new ByteArrayOutputStream();
writeStream = new DataOutputStream(_writeBytes);
// Initialise the arrays used to record the position of numeric items
integer_count = 0;
// number of integer items recorded in the current arrays
integer_offsets = new int[ARRAY_SIZE];
// offset of start of each numeric item
integer_sizes = new int[ARRAY_SIZE];
// length in byte of the item in question
if (integers != null)
integers.removeAllElements();
// arrays which we filled up are stored in this vector - remove them all
if (float_offsets != null)
float_offsets.removeAllElements();
if (float_values != null)
float_values.removeAllElements();
// Ensure that the new data gets exported when the time comes.
bodySetInJsMsg = false;
}
else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Producer has promised not to modify payload - ensure write streams used for encoding are null");
// Ensure the write stream variables are null - they are never used when the
// producer has promised not to modify the payload after it's been set
_writeBytes = null;
writeStream = null;
// Ensure the producer promise flag is checked correctly in the writeBytes method
writeByteArrayCalled = false;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "clearBody");
} | [
"@",
"Override",
"public",
"void",
"clearBody",
"(",
")",
"throws",
"javax",
".",
"jms",
".",
"JMSException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"clearBody\"",
")",
";",
"// Set the message into write-only mode, handle generic actions",
"super",
".",
"clearBody",
"(",
")",
";",
"// Clear the locally stored reference to body of the message, and ensure the",
"// 'read' stream is set to null",
"dataBuffer",
"=",
"null",
";",
"dataStart",
"=",
"0",
";",
"// @P2A",
"readStream",
"=",
"null",
";",
"// remove the encoding and character set properties as these pertain to the",
"// body which is being cleared.",
"// SIB0121: also clear the underlying MFP payload",
"if",
"(",
"jsBytesMsg",
"!=",
"null",
")",
"{",
"jsBytesMsg",
".",
"setBytes",
"(",
"null",
")",
";",
"jsBytesMsg",
".",
"setObjectProperty",
"(",
"ApiJmsConstants",
".",
"ENCODING_PROPERTY",
",",
"null",
")",
";",
"jsBytesMsg",
".",
"setObjectProperty",
"(",
"ApiJmsConstants",
".",
"CHARSET_PROPERTY",
",",
"null",
")",
";",
"}",
"integerEncoding",
"=",
"ApiJmsConstants",
".",
"ENC_INTEGER_NORMAL",
";",
"// reset to standard Java encoding",
"floatEncoding",
"=",
"ApiJmsConstants",
".",
"ENC_FLOAT_IEEE_NORMAL",
";",
"// reset to standard Java encoding",
"// Invalidate the cached toString object.",
"cachedBytesToString",
"=",
"null",
";",
"// This class has different behaviour depending on the whether the",
"// producer might modify the payload after it's been set or not",
"if",
"(",
"!",
"producerWontModifyPayloadAfterSet",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Producer might modify the payload after set - encoding is required, so reinitialise encoding relating variables\"",
")",
";",
"// Prepare a new stream for the client to write to",
"_writeBytes",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"writeStream",
"=",
"new",
"DataOutputStream",
"(",
"_writeBytes",
")",
";",
"// Initialise the arrays used to record the position of numeric items",
"integer_count",
"=",
"0",
";",
"// number of integer items recorded in the current arrays",
"integer_offsets",
"=",
"new",
"int",
"[",
"ARRAY_SIZE",
"]",
";",
"// offset of start of each numeric item",
"integer_sizes",
"=",
"new",
"int",
"[",
"ARRAY_SIZE",
"]",
";",
"// length in byte of the item in question",
"if",
"(",
"integers",
"!=",
"null",
")",
"integers",
".",
"removeAllElements",
"(",
")",
";",
"// arrays which we filled up are stored in this vector - remove them all",
"if",
"(",
"float_offsets",
"!=",
"null",
")",
"float_offsets",
".",
"removeAllElements",
"(",
")",
";",
"if",
"(",
"float_values",
"!=",
"null",
")",
"float_values",
".",
"removeAllElements",
"(",
")",
";",
"// Ensure that the new data gets exported when the time comes.",
"bodySetInJsMsg",
"=",
"false",
";",
"}",
"else",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Producer has promised not to modify payload - ensure write streams used for encoding are null\"",
")",
";",
"// Ensure the write stream variables are null - they are never used when the",
"// producer has promised not to modify the payload after it's been set",
"_writeBytes",
"=",
"null",
";",
"writeStream",
"=",
"null",
";",
"// Ensure the producer promise flag is checked correctly in the writeBytes method",
"writeByteArrayCalled",
"=",
"false",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"clearBody\"",
")",
";",
"}"
] | Clear out the message body. All other parts of the message are left
untouched.
@exception JMSException if JMS fails to due to some internal JMS error. | [
"Clear",
"out",
"the",
"message",
"body",
".",
"All",
"other",
"parts",
"of",
"the",
"message",
"are",
"left",
"untouched",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsBytesMessageImpl.java#L240-L314 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsBytesMessageImpl.java | JmsBytesMessageImpl.readByte | @Override
public byte readByte() throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "readByte");
try {
// Check that we are in read mode
checkBodyReadable("readByte");
if (requiresInit)
lazyInitForReading();
// Read the byte from the input stream
byte byteRead = readStream.readByte(); // read the byte
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "readByte", byteRead);
return byteRead;
} catch (IOException e) {
JMSException jmse = (JMSException) JmsErrorUtils.newThrowable(
MessageEOFException.class,
"END_BYTESMESSAGE_CWSIA0183",
null,
tc);
jmse.initCause(e);
throw jmse;
}
} | java | @Override
public byte readByte() throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "readByte");
try {
// Check that we are in read mode
checkBodyReadable("readByte");
if (requiresInit)
lazyInitForReading();
// Read the byte from the input stream
byte byteRead = readStream.readByte(); // read the byte
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "readByte", byteRead);
return byteRead;
} catch (IOException e) {
JMSException jmse = (JMSException) JmsErrorUtils.newThrowable(
MessageEOFException.class,
"END_BYTESMESSAGE_CWSIA0183",
null,
tc);
jmse.initCause(e);
throw jmse;
}
} | [
"@",
"Override",
"public",
"byte",
"readByte",
"(",
")",
"throws",
"JMSException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"readByte\"",
")",
";",
"try",
"{",
"// Check that we are in read mode",
"checkBodyReadable",
"(",
"\"readByte\"",
")",
";",
"if",
"(",
"requiresInit",
")",
"lazyInitForReading",
"(",
")",
";",
"// Read the byte from the input stream",
"byte",
"byteRead",
"=",
"readStream",
".",
"readByte",
"(",
")",
";",
"// read the byte",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"readByte\"",
",",
"byteRead",
")",
";",
"return",
"byteRead",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"JMSException",
"jmse",
"=",
"(",
"JMSException",
")",
"JmsErrorUtils",
".",
"newThrowable",
"(",
"MessageEOFException",
".",
"class",
",",
"\"END_BYTESMESSAGE_CWSIA0183\"",
",",
"null",
",",
"tc",
")",
";",
"jmse",
".",
"initCause",
"(",
"e",
")",
";",
"throw",
"jmse",
";",
"}",
"}"
] | Read a signed 8-bit value from the stream message.
@return the next byte from the stream message as a signed 8-bit
<code>byte</code>.
@exception MessageNotReadableException if message in write-only mode.
@exception MessageEOFException if end of message stream
@exception JMSException if JMS fails to read message due to
some internal JMS error. | [
"Read",
"a",
"signed",
"8",
"-",
"bit",
"value",
"from",
"the",
"stream",
"message",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsBytesMessageImpl.java#L354-L380 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsBytesMessageImpl.java | JmsBytesMessageImpl.readBytes | @Override
public int readBytes(byte[] value, int length) throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "readBytes", new Object[] { value, length });
try {
// Check that we are in read mode
checkBodyReadable("readBytes");
if (requiresInit)
lazyInitForReading();
// Check that there's enough room in the byte array supplied by the application for the number of
// bytes requested
if (value.length < length || length < 0)
throw new IndexOutOfBoundsException();
// Attempt to read into the application's byte array. If there are insufficient bytes in the message readStream
// then this method returns the number actually read. If we've reached the end of data, it returns -1
int result = readStream.read(value, 0, length);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "readBytes", result);
return result;
} catch (IOException e) {
JMSException jmse = (JMSException) JmsErrorUtils.newThrowable(
MessageEOFException.class,
"END_BYTESMESSAGE_CWSIA0183",
null,
tc);
jmse.initCause(e);
throw jmse;
}
} | java | @Override
public int readBytes(byte[] value, int length) throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "readBytes", new Object[] { value, length });
try {
// Check that we are in read mode
checkBodyReadable("readBytes");
if (requiresInit)
lazyInitForReading();
// Check that there's enough room in the byte array supplied by the application for the number of
// bytes requested
if (value.length < length || length < 0)
throw new IndexOutOfBoundsException();
// Attempt to read into the application's byte array. If there are insufficient bytes in the message readStream
// then this method returns the number actually read. If we've reached the end of data, it returns -1
int result = readStream.read(value, 0, length);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "readBytes", result);
return result;
} catch (IOException e) {
JMSException jmse = (JMSException) JmsErrorUtils.newThrowable(
MessageEOFException.class,
"END_BYTESMESSAGE_CWSIA0183",
null,
tc);
jmse.initCause(e);
throw jmse;
}
} | [
"@",
"Override",
"public",
"int",
"readBytes",
"(",
"byte",
"[",
"]",
"value",
",",
"int",
"length",
")",
"throws",
"JMSException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"readBytes\"",
",",
"new",
"Object",
"[",
"]",
"{",
"value",
",",
"length",
"}",
")",
";",
"try",
"{",
"// Check that we are in read mode",
"checkBodyReadable",
"(",
"\"readBytes\"",
")",
";",
"if",
"(",
"requiresInit",
")",
"lazyInitForReading",
"(",
")",
";",
"// Check that there's enough room in the byte array supplied by the application for the number of",
"// bytes requested",
"if",
"(",
"value",
".",
"length",
"<",
"length",
"||",
"length",
"<",
"0",
")",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
")",
";",
"// Attempt to read into the application's byte array. If there are insufficient bytes in the message readStream",
"// then this method returns the number actually read. If we've reached the end of data, it returns -1",
"int",
"result",
"=",
"readStream",
".",
"read",
"(",
"value",
",",
"0",
",",
"length",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"readBytes\"",
",",
"result",
")",
";",
"return",
"result",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"JMSException",
"jmse",
"=",
"(",
"JMSException",
")",
"JmsErrorUtils",
".",
"newThrowable",
"(",
"MessageEOFException",
".",
"class",
",",
"\"END_BYTESMESSAGE_CWSIA0183\"",
",",
"null",
",",
"tc",
")",
";",
"jmse",
".",
"initCause",
"(",
"e",
")",
";",
"throw",
"jmse",
";",
"}",
"}"
] | Read a portion of the bytes message stream.
<P>If the length of array <code>value</code> is less than
the bytes remaining to be read from the stream, the array should
be filled. A subsequent call reads the next increment, etc.
<P>If the bytes remaining in the stream is less than the length of
array <code>value</code>, the bytes should be read into the array.
The return value of the total number of bytes read will be less than
the length of the array, indicating that there are no more bytes left
to be read from the stream. The next read of the stream returns -1.
<p> If <code>length</code> is negative, or
<code>length</code> is greater than the length of the array
<code>value</code>, then an <code>IndexOutOfBoundsException</code> is
thrown. No bytes will be read from the stream for this exception case.
@param value the buffer into which the data is read.
@param length the number of bytes to read. Must be less than or equal to value.length.
@return the total number of bytes read into the buffer, or -1 if
there is no more data because the end of the stream has been reached.
@exception MessageNotReadableException if message in write-only mode.
@exception JMSException if JMS fails to read message due to
some internal JMS error | [
"Read",
"a",
"portion",
"of",
"the",
"bytes",
"message",
"stream",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsBytesMessageImpl.java#L438-L470 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsBytesMessageImpl.java | JmsBytesMessageImpl.readChar | @Override
public char readChar() throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "readChar");
try {
// Check that we are in read mode
checkBodyReadable("readChar");
if (requiresInit)
lazyInitForReading();
// Mark the current position, so we can return to it if there's an error
readStream.mark(2);
char result = readStream.readChar();
// Byte swap the character if required
if (integerEncoding == ApiJmsConstants.ENC_INTEGER_REVERSED) {
result = Character.reverseBytes(result);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "readChar", result);
return result;
} catch (IOException e) {
try {
readStream.reset(); // return to the marked position
} catch (IOException e2) {
}
JMSException jmse = (JMSException) JmsErrorUtils.newThrowable(
MessageEOFException.class,
"END_BYTESMESSAGE_CWSIA0183",
null,
tc);
jmse.initCause(e);
throw jmse;
}
} | java | @Override
public char readChar() throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "readChar");
try {
// Check that we are in read mode
checkBodyReadable("readChar");
if (requiresInit)
lazyInitForReading();
// Mark the current position, so we can return to it if there's an error
readStream.mark(2);
char result = readStream.readChar();
// Byte swap the character if required
if (integerEncoding == ApiJmsConstants.ENC_INTEGER_REVERSED) {
result = Character.reverseBytes(result);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "readChar", result);
return result;
} catch (IOException e) {
try {
readStream.reset(); // return to the marked position
} catch (IOException e2) {
}
JMSException jmse = (JMSException) JmsErrorUtils.newThrowable(
MessageEOFException.class,
"END_BYTESMESSAGE_CWSIA0183",
null,
tc);
jmse.initCause(e);
throw jmse;
}
} | [
"@",
"Override",
"public",
"char",
"readChar",
"(",
")",
"throws",
"JMSException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"readChar\"",
")",
";",
"try",
"{",
"// Check that we are in read mode",
"checkBodyReadable",
"(",
"\"readChar\"",
")",
";",
"if",
"(",
"requiresInit",
")",
"lazyInitForReading",
"(",
")",
";",
"// Mark the current position, so we can return to it if there's an error",
"readStream",
".",
"mark",
"(",
"2",
")",
";",
"char",
"result",
"=",
"readStream",
".",
"readChar",
"(",
")",
";",
"// Byte swap the character if required",
"if",
"(",
"integerEncoding",
"==",
"ApiJmsConstants",
".",
"ENC_INTEGER_REVERSED",
")",
"{",
"result",
"=",
"Character",
".",
"reverseBytes",
"(",
"result",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"readChar\"",
",",
"result",
")",
";",
"return",
"result",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"try",
"{",
"readStream",
".",
"reset",
"(",
")",
";",
"// return to the marked position",
"}",
"catch",
"(",
"IOException",
"e2",
")",
"{",
"}",
"JMSException",
"jmse",
"=",
"(",
"JMSException",
")",
"JmsErrorUtils",
".",
"newThrowable",
"(",
"MessageEOFException",
".",
"class",
",",
"\"END_BYTESMESSAGE_CWSIA0183\"",
",",
"null",
",",
"tc",
")",
";",
"jmse",
".",
"initCause",
"(",
"e",
")",
";",
"throw",
"jmse",
";",
"}",
"}"
] | Read a Unicode character value from the stream message.
@return the next two bytes from the stream message as a Unicode
character.
@exception MessageNotReadableException if message in write-only mode.
@exception MessageEOFException if end of message stream
@exception JMSException if JMS fails to read message due to
some internal JMS error. | [
"Read",
"a",
"Unicode",
"character",
"value",
"from",
"the",
"stream",
"message",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsBytesMessageImpl.java#L483-L518 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsBytesMessageImpl.java | JmsBytesMessageImpl.readLong | @Override
public long readLong() throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "readLong");
try {
// Check that we are in read mode
checkBodyReadable("readLong");
if (requiresInit)
lazyInitForReading();
// Mark the current position, so we can return to it if there's an error
readStream.mark(8); // the argument appears to be ignored
long result = readStream.readLong();
// Byte swap the long if required
if (integerEncoding == ApiJmsConstants.ENC_INTEGER_REVERSED) {
result = Long.reverseBytes(result);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "readLong", result);
return result;
} catch (IOException e) {
try {
readStream.reset();
} catch (IOException e2) {
}
throw (JMSException) JmsErrorUtils.newThrowable(
JMSException.class,
"EXCEPTION_RECEIVED_CWSIA0190",
new Object[] { e, "JmsBytesMessageImpl.readLong" },
e,
"JmsBytesMessageImpl.readLong#1",
this,
tc);
}
} | java | @Override
public long readLong() throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "readLong");
try {
// Check that we are in read mode
checkBodyReadable("readLong");
if (requiresInit)
lazyInitForReading();
// Mark the current position, so we can return to it if there's an error
readStream.mark(8); // the argument appears to be ignored
long result = readStream.readLong();
// Byte swap the long if required
if (integerEncoding == ApiJmsConstants.ENC_INTEGER_REVERSED) {
result = Long.reverseBytes(result);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "readLong", result);
return result;
} catch (IOException e) {
try {
readStream.reset();
} catch (IOException e2) {
}
throw (JMSException) JmsErrorUtils.newThrowable(
JMSException.class,
"EXCEPTION_RECEIVED_CWSIA0190",
new Object[] { e, "JmsBytesMessageImpl.readLong" },
e,
"JmsBytesMessageImpl.readLong#1",
this,
tc);
}
} | [
"@",
"Override",
"public",
"long",
"readLong",
"(",
")",
"throws",
"JMSException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"readLong\"",
")",
";",
"try",
"{",
"// Check that we are in read mode",
"checkBodyReadable",
"(",
"\"readLong\"",
")",
";",
"if",
"(",
"requiresInit",
")",
"lazyInitForReading",
"(",
")",
";",
"// Mark the current position, so we can return to it if there's an error",
"readStream",
".",
"mark",
"(",
"8",
")",
";",
"// the argument appears to be ignored",
"long",
"result",
"=",
"readStream",
".",
"readLong",
"(",
")",
";",
"// Byte swap the long if required",
"if",
"(",
"integerEncoding",
"==",
"ApiJmsConstants",
".",
"ENC_INTEGER_REVERSED",
")",
"{",
"result",
"=",
"Long",
".",
"reverseBytes",
"(",
"result",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"readLong\"",
",",
"result",
")",
";",
"return",
"result",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"try",
"{",
"readStream",
".",
"reset",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e2",
")",
"{",
"}",
"throw",
"(",
"JMSException",
")",
"JmsErrorUtils",
".",
"newThrowable",
"(",
"JMSException",
".",
"class",
",",
"\"EXCEPTION_RECEIVED_CWSIA0190\"",
",",
"new",
"Object",
"[",
"]",
"{",
"e",
",",
"\"JmsBytesMessageImpl.readLong\"",
"}",
",",
"e",
",",
"\"JmsBytesMessageImpl.readLong#1\"",
",",
"this",
",",
"tc",
")",
";",
"}",
"}"
] | Read a signed 64-bit integer from the stream message.
@return the next eight bytes from the stream message, interpreted as
a <code>long</code>.
@exception MessageNotReadableException if message in write-only mode.
@exception MessageEOFException if end of message stream
@exception JMSException if JMS fails to read message due to
some internal JMS error. | [
"Read",
"a",
"signed",
"64",
"-",
"bit",
"integer",
"from",
"the",
"stream",
"message",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsBytesMessageImpl.java#L716-L752 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsBytesMessageImpl.java | JmsBytesMessageImpl.readUTF | @Override
public String readUTF() throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "readUTF");
String result;
try {
// Check that we are in read mode
checkBodyReadable("readUTF");
if (requiresInit)
lazyInitForReading();
// Mark the current position, so we can return to it if there's an error
readStream.mark(8); // the argument appears to be ignored
result = readStream.readUTF();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "readUTF", result);
return result;
} catch (IOException e) {
try {
readStream.reset(); // return to the marked position
} catch (IOException e2) {
}
JMSException jmse = (JMSException) JmsErrorUtils.newThrowable(
MessageEOFException.class,
"END_BYTESMESSAGE_CWSIA0183",
null,
tc);
jmse.initCause(e);
throw jmse;
}
} | java | @Override
public String readUTF() throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "readUTF");
String result;
try {
// Check that we are in read mode
checkBodyReadable("readUTF");
if (requiresInit)
lazyInitForReading();
// Mark the current position, so we can return to it if there's an error
readStream.mark(8); // the argument appears to be ignored
result = readStream.readUTF();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "readUTF", result);
return result;
} catch (IOException e) {
try {
readStream.reset(); // return to the marked position
} catch (IOException e2) {
}
JMSException jmse = (JMSException) JmsErrorUtils.newThrowable(
MessageEOFException.class,
"END_BYTESMESSAGE_CWSIA0183",
null,
tc);
jmse.initCause(e);
throw jmse;
}
} | [
"@",
"Override",
"public",
"String",
"readUTF",
"(",
")",
"throws",
"JMSException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"readUTF\"",
")",
";",
"String",
"result",
";",
"try",
"{",
"// Check that we are in read mode",
"checkBodyReadable",
"(",
"\"readUTF\"",
")",
";",
"if",
"(",
"requiresInit",
")",
"lazyInitForReading",
"(",
")",
";",
"// Mark the current position, so we can return to it if there's an error",
"readStream",
".",
"mark",
"(",
"8",
")",
";",
"// the argument appears to be ignored",
"result",
"=",
"readStream",
".",
"readUTF",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"readUTF\"",
",",
"result",
")",
";",
"return",
"result",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"try",
"{",
"readStream",
".",
"reset",
"(",
")",
";",
"// return to the marked position",
"}",
"catch",
"(",
"IOException",
"e2",
")",
"{",
"}",
"JMSException",
"jmse",
"=",
"(",
"JMSException",
")",
"JmsErrorUtils",
".",
"newThrowable",
"(",
"MessageEOFException",
".",
"class",
",",
"\"END_BYTESMESSAGE_CWSIA0183\"",
",",
"null",
",",
"tc",
")",
";",
"jmse",
".",
"initCause",
"(",
"e",
")",
";",
"throw",
"jmse",
";",
"}",
"}"
] | Read in a string that has been encoded using a modified UTF-8
format from the stream message.
<P>For more information on the UTF-8 format, see "File System Safe
UCS Transformation Format (FSS_UFT)", X/Open Preliminary Specification,
X/Open Company Ltd., Document Number: P316. This information also
appears in ISO/IEC 10646, Annex P.
@return a Unicode string from the stream message.
@exception MessageNotReadableException if message in write-only mode.
@exception MessageEOFException if end of message stream
@exception JMSException if JMS fails to read message due to
some internal JMS error. | [
"Read",
"in",
"a",
"string",
"that",
"has",
"been",
"encoded",
"using",
"a",
"modified",
"UTF",
"-",
"8",
"format",
"from",
"the",
"stream",
"message",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsBytesMessageImpl.java#L912-L944 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsBytesMessageImpl.java | JmsBytesMessageImpl.reset | @Override
public void reset() throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "reset");
// After reset has been called, the message body is immutable (the only way of changing it is to
// call clearBody and start again). If we're in Write Mode, we need to convert the writeStream
// to a byte array and switch into read mode. If we're in Read Mode, we must have already done this,
// so we don't want to do it again
if (!isBodyReadOnly()) {
// If the producer won't modify the payload after set,skip the
// encoding of the write stream because encoding is not needed
if (!producerWontModifyPayloadAfterSet) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Body is writeable & producer might modify the payload, so encode the write stream");
// Convert the stream in which the message was being assembled to a byte array
dataBuffer = _writeBytes.toByteArray();
// store the content in the JS msg
lastEncoding = integerEncoding | floatEncoding;
jsBytesMsg.setBytes(_exportBody(lastEncoding));
bodySetInJsMsg = true;
// Throw away the write stream
writeStream = null;
_writeBytes = null;
}
dataStart = 0; // start from the first byte in the buffer
// The message is now read only
setBodyReadOnly();
}
// For some odd reason, after receiving an 'empty' message the dataBuffer
// is null rather than pointing to an empty array. This will compensate
// hopefully without any side effects - SXA #58832
if (dataBuffer == null)
dataBuffer = new byte[0];
// Create a Byte array input stream for the readxxx methods to operate on. We have to create a new
// stream each time (rather than call the stream's read method), as the stream may have a position
// marked in it that isn't at the start.
_readBytes = new ByteArrayInputStream(dataBuffer);
readStream = new DataInputStream(_readBytes);
// Jump over any header that might be present in the dataBuffer
// JBK - I don't think we will ever have dataStart!=0 in JS, but I'm
// leaving the capability here until I understand better.
try {
readStream.skip(dataStart);
} catch (IOException e) {
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "reset");
} | java | @Override
public void reset() throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "reset");
// After reset has been called, the message body is immutable (the only way of changing it is to
// call clearBody and start again). If we're in Write Mode, we need to convert the writeStream
// to a byte array and switch into read mode. If we're in Read Mode, we must have already done this,
// so we don't want to do it again
if (!isBodyReadOnly()) {
// If the producer won't modify the payload after set,skip the
// encoding of the write stream because encoding is not needed
if (!producerWontModifyPayloadAfterSet) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Body is writeable & producer might modify the payload, so encode the write stream");
// Convert the stream in which the message was being assembled to a byte array
dataBuffer = _writeBytes.toByteArray();
// store the content in the JS msg
lastEncoding = integerEncoding | floatEncoding;
jsBytesMsg.setBytes(_exportBody(lastEncoding));
bodySetInJsMsg = true;
// Throw away the write stream
writeStream = null;
_writeBytes = null;
}
dataStart = 0; // start from the first byte in the buffer
// The message is now read only
setBodyReadOnly();
}
// For some odd reason, after receiving an 'empty' message the dataBuffer
// is null rather than pointing to an empty array. This will compensate
// hopefully without any side effects - SXA #58832
if (dataBuffer == null)
dataBuffer = new byte[0];
// Create a Byte array input stream for the readxxx methods to operate on. We have to create a new
// stream each time (rather than call the stream's read method), as the stream may have a position
// marked in it that isn't at the start.
_readBytes = new ByteArrayInputStream(dataBuffer);
readStream = new DataInputStream(_readBytes);
// Jump over any header that might be present in the dataBuffer
// JBK - I don't think we will ever have dataStart!=0 in JS, but I'm
// leaving the capability here until I understand better.
try {
readStream.skip(dataStart);
} catch (IOException e) {
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "reset");
} | [
"@",
"Override",
"public",
"void",
"reset",
"(",
")",
"throws",
"JMSException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"reset\"",
")",
";",
"// After reset has been called, the message body is immutable (the only way of changing it is to",
"// call clearBody and start again). If we're in Write Mode, we need to convert the writeStream",
"// to a byte array and switch into read mode. If we're in Read Mode, we must have already done this,",
"// so we don't want to do it again",
"if",
"(",
"!",
"isBodyReadOnly",
"(",
")",
")",
"{",
"// If the producer won't modify the payload after set,skip the",
"// encoding of the write stream because encoding is not needed",
"if",
"(",
"!",
"producerWontModifyPayloadAfterSet",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Body is writeable & producer might modify the payload, so encode the write stream\"",
")",
";",
"// Convert the stream in which the message was being assembled to a byte array",
"dataBuffer",
"=",
"_writeBytes",
".",
"toByteArray",
"(",
")",
";",
"// store the content in the JS msg",
"lastEncoding",
"=",
"integerEncoding",
"|",
"floatEncoding",
";",
"jsBytesMsg",
".",
"setBytes",
"(",
"_exportBody",
"(",
"lastEncoding",
")",
")",
";",
"bodySetInJsMsg",
"=",
"true",
";",
"// Throw away the write stream",
"writeStream",
"=",
"null",
";",
"_writeBytes",
"=",
"null",
";",
"}",
"dataStart",
"=",
"0",
";",
"// start from the first byte in the buffer",
"// The message is now read only",
"setBodyReadOnly",
"(",
")",
";",
"}",
"// For some odd reason, after receiving an 'empty' message the dataBuffer",
"// is null rather than pointing to an empty array. This will compensate",
"// hopefully without any side effects - SXA #58832",
"if",
"(",
"dataBuffer",
"==",
"null",
")",
"dataBuffer",
"=",
"new",
"byte",
"[",
"0",
"]",
";",
"// Create a Byte array input stream for the readxxx methods to operate on. We have to create a new",
"// stream each time (rather than call the stream's read method), as the stream may have a position",
"// marked in it that isn't at the start.",
"_readBytes",
"=",
"new",
"ByteArrayInputStream",
"(",
"dataBuffer",
")",
";",
"readStream",
"=",
"new",
"DataInputStream",
"(",
"_readBytes",
")",
";",
"// Jump over any header that might be present in the dataBuffer",
"// JBK - I don't think we will ever have dataStart!=0 in JS, but I'm",
"// leaving the capability here until I understand better.",
"try",
"{",
"readStream",
".",
"skip",
"(",
"dataStart",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"reset\"",
")",
";",
"}"
] | Put the message in read-only mode, and reposition the stream of
bytes to the beginning.
@exception JMSException if JMS fails to reset the message due to
some internal JMS error.
@exception MessageFormatException if message has an invalid
format. | [
"Put",
"the",
"message",
"in",
"read",
"-",
"only",
"mode",
"and",
"reposition",
"the",
"stream",
"of",
"bytes",
"to",
"the",
"beginning",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsBytesMessageImpl.java#L955-L1013 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsBytesMessageImpl.java | JmsBytesMessageImpl.writeBytes | @Override
public void writeBytes(byte[] value) throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "writeBytes", value);
try {
// Check that we are in write mode
checkBodyWriteable("writeBytes");
// This method has different behaviours for storing the byte array, based on the whether the producer
// has promised not to mess with data after it's been written...
if (producerWontModifyPayloadAfterSet) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Producer has promised not to modify the payload after setting it in the message - check if they've violated that promise");
// The producer has promised not to modify the payload after it's been set, so check
// the flag to see whether this is the first, or a subsequent call to writeBytes.
if (!writeByteArrayCalled) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "This is the first call to writeBytes(byte[] value) - storing the byte array reference directly in the underlying MFP object");
writeByteArrayCalled = true;
// Set the data buffer & MFP data references to the value param & reset
// the dataStart attribute
jsBytesMsg.setBytes(value);
dataBuffer = value;
dataStart = 0;
}
else {
// The producer has promised not to modify the payload after it's been set, but the producer has
// been naughty by calling this method more than once! Throw exception to admonish the producer.
throw (JMSException) JmsErrorUtils.newThrowable(
IllegalStateException.class, // JMS illegal state exception
"PROMISE_BROKEN_EXCEPTION_CWSIA0511", // promise broken
null, // No inserts
null, // no cause - original exception
"JmsBytesMessageImpl.writeBytes#3", // Probe ID
this, // Caller (?)
tc); // Trace component
}
}
else {
// Producer makes no promises relating to the accessing the message payload, so
// make a copy of the byte array at this point to ensure the message is transmitted safely.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Producer 'payload modification' promise is not in place - make a copy of the byte array");
// Write the byte array to the output stream
// We don't check for value==null as JDK1.1.6 DataOutputStream doesn't
writeStream.write(value, 0, value.length);
// Ensure that the new data gets exported when the time comes.
bodySetInJsMsg = false;
}
// Invalidate the cached toString object, because the message payload has changed.
cachedBytesToString = null;
}
catch (IOException ex) {
// No FFDC code needed
//(exception repro'ed from 3-param writeBytes method)
throw (JMSException) JmsErrorUtils.newThrowable(
ResourceAllocationException.class,
"WRITE_PROBLEM_CWSIA0186",
null,
ex,
"JmsBytesMessageImpl.writeBytes#4",
this,
tc);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "writeBytes");
} | java | @Override
public void writeBytes(byte[] value) throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "writeBytes", value);
try {
// Check that we are in write mode
checkBodyWriteable("writeBytes");
// This method has different behaviours for storing the byte array, based on the whether the producer
// has promised not to mess with data after it's been written...
if (producerWontModifyPayloadAfterSet) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Producer has promised not to modify the payload after setting it in the message - check if they've violated that promise");
// The producer has promised not to modify the payload after it's been set, so check
// the flag to see whether this is the first, or a subsequent call to writeBytes.
if (!writeByteArrayCalled) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "This is the first call to writeBytes(byte[] value) - storing the byte array reference directly in the underlying MFP object");
writeByteArrayCalled = true;
// Set the data buffer & MFP data references to the value param & reset
// the dataStart attribute
jsBytesMsg.setBytes(value);
dataBuffer = value;
dataStart = 0;
}
else {
// The producer has promised not to modify the payload after it's been set, but the producer has
// been naughty by calling this method more than once! Throw exception to admonish the producer.
throw (JMSException) JmsErrorUtils.newThrowable(
IllegalStateException.class, // JMS illegal state exception
"PROMISE_BROKEN_EXCEPTION_CWSIA0511", // promise broken
null, // No inserts
null, // no cause - original exception
"JmsBytesMessageImpl.writeBytes#3", // Probe ID
this, // Caller (?)
tc); // Trace component
}
}
else {
// Producer makes no promises relating to the accessing the message payload, so
// make a copy of the byte array at this point to ensure the message is transmitted safely.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Producer 'payload modification' promise is not in place - make a copy of the byte array");
// Write the byte array to the output stream
// We don't check for value==null as JDK1.1.6 DataOutputStream doesn't
writeStream.write(value, 0, value.length);
// Ensure that the new data gets exported when the time comes.
bodySetInJsMsg = false;
}
// Invalidate the cached toString object, because the message payload has changed.
cachedBytesToString = null;
}
catch (IOException ex) {
// No FFDC code needed
//(exception repro'ed from 3-param writeBytes method)
throw (JMSException) JmsErrorUtils.newThrowable(
ResourceAllocationException.class,
"WRITE_PROBLEM_CWSIA0186",
null,
ex,
"JmsBytesMessageImpl.writeBytes#4",
this,
tc);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "writeBytes");
} | [
"@",
"Override",
"public",
"void",
"writeBytes",
"(",
"byte",
"[",
"]",
"value",
")",
"throws",
"JMSException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"writeBytes\"",
",",
"value",
")",
";",
"try",
"{",
"// Check that we are in write mode",
"checkBodyWriteable",
"(",
"\"writeBytes\"",
")",
";",
"// This method has different behaviours for storing the byte array, based on the whether the producer",
"// has promised not to mess with data after it's been written...",
"if",
"(",
"producerWontModifyPayloadAfterSet",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Producer has promised not to modify the payload after setting it in the message - check if they've violated that promise\"",
")",
";",
"// The producer has promised not to modify the payload after it's been set, so check",
"// the flag to see whether this is the first, or a subsequent call to writeBytes.",
"if",
"(",
"!",
"writeByteArrayCalled",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"This is the first call to writeBytes(byte[] value) - storing the byte array reference directly in the underlying MFP object\"",
")",
";",
"writeByteArrayCalled",
"=",
"true",
";",
"// Set the data buffer & MFP data references to the value param & reset",
"// the dataStart attribute",
"jsBytesMsg",
".",
"setBytes",
"(",
"value",
")",
";",
"dataBuffer",
"=",
"value",
";",
"dataStart",
"=",
"0",
";",
"}",
"else",
"{",
"// The producer has promised not to modify the payload after it's been set, but the producer has",
"// been naughty by calling this method more than once! Throw exception to admonish the producer.",
"throw",
"(",
"JMSException",
")",
"JmsErrorUtils",
".",
"newThrowable",
"(",
"IllegalStateException",
".",
"class",
",",
"// JMS illegal state exception",
"\"PROMISE_BROKEN_EXCEPTION_CWSIA0511\"",
",",
"// promise broken",
"null",
",",
"// No inserts",
"null",
",",
"// no cause - original exception",
"\"JmsBytesMessageImpl.writeBytes#3\"",
",",
"// Probe ID",
"this",
",",
"// Caller (?)",
"tc",
")",
";",
"// Trace component",
"}",
"}",
"else",
"{",
"// Producer makes no promises relating to the accessing the message payload, so",
"// make a copy of the byte array at this point to ensure the message is transmitted safely.",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Producer 'payload modification' promise is not in place - make a copy of the byte array\"",
")",
";",
"// Write the byte array to the output stream",
"// We don't check for value==null as JDK1.1.6 DataOutputStream doesn't",
"writeStream",
".",
"write",
"(",
"value",
",",
"0",
",",
"value",
".",
"length",
")",
";",
"// Ensure that the new data gets exported when the time comes.",
"bodySetInJsMsg",
"=",
"false",
";",
"}",
"// Invalidate the cached toString object, because the message payload has changed.",
"cachedBytesToString",
"=",
"null",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"// No FFDC code needed",
"//(exception repro'ed from 3-param writeBytes method)",
"throw",
"(",
"JMSException",
")",
"JmsErrorUtils",
".",
"newThrowable",
"(",
"ResourceAllocationException",
".",
"class",
",",
"\"WRITE_PROBLEM_CWSIA0186\"",
",",
"null",
",",
"ex",
",",
"\"JmsBytesMessageImpl.writeBytes#4\"",
",",
"this",
",",
"tc",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"writeBytes\"",
")",
";",
"}"
] | Write a byte array to the stream message.
@param value of the byte array to be written.
@exception MessageNotWriteableException if message in read-only mode.
@exception JMSException if JMS fails to write message due to
some internal JMS error. | [
"Write",
"a",
"byte",
"array",
"to",
"the",
"stream",
"message",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsBytesMessageImpl.java#L1110-L1187 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsBytesMessageImpl.java | JmsBytesMessageImpl.writeBytes | @Override
public void writeBytes(byte[] value, int offset, int length) throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "writeBytes", new Object[] { value, offset, length });
try {
// Check if the producer has promised not to modify the payload after it's been set
checkProducerPromise("writeBytes(byte[], int, int)", "JmsBytesMessageImpl.writeBytes#2");
// Check that we are in write mode
checkBodyWriteable("writeBytes");
// Write the byte array to the output stream
// We don't check for value==null as JDK1.1.6 DataOutputStream doesn't
writeStream.write(value, offset, length);
// Invalidate the cached toString object.
cachedBytesToString = null;
// Ensure that the new data gets exported when the time comes.
bodySetInJsMsg = false;
}
// We don't expect the writeBytes to fail, but we need to catch the exception anyway
catch (IOException ex) {
// No FFDC code needed
// d238447 review. Generate FFDC for this case.
throw (JMSException) JmsErrorUtils.newThrowable(
ResourceAllocationException.class,
"WRITE_PROBLEM_CWSIA0186",
null,
ex,
"JmsBytesMessageImpl.writeBytes#1",
this,
tc);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "writeBytes");
} | java | @Override
public void writeBytes(byte[] value, int offset, int length) throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "writeBytes", new Object[] { value, offset, length });
try {
// Check if the producer has promised not to modify the payload after it's been set
checkProducerPromise("writeBytes(byte[], int, int)", "JmsBytesMessageImpl.writeBytes#2");
// Check that we are in write mode
checkBodyWriteable("writeBytes");
// Write the byte array to the output stream
// We don't check for value==null as JDK1.1.6 DataOutputStream doesn't
writeStream.write(value, offset, length);
// Invalidate the cached toString object.
cachedBytesToString = null;
// Ensure that the new data gets exported when the time comes.
bodySetInJsMsg = false;
}
// We don't expect the writeBytes to fail, but we need to catch the exception anyway
catch (IOException ex) {
// No FFDC code needed
// d238447 review. Generate FFDC for this case.
throw (JMSException) JmsErrorUtils.newThrowable(
ResourceAllocationException.class,
"WRITE_PROBLEM_CWSIA0186",
null,
ex,
"JmsBytesMessageImpl.writeBytes#1",
this,
tc);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "writeBytes");
} | [
"@",
"Override",
"public",
"void",
"writeBytes",
"(",
"byte",
"[",
"]",
"value",
",",
"int",
"offset",
",",
"int",
"length",
")",
"throws",
"JMSException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"writeBytes\"",
",",
"new",
"Object",
"[",
"]",
"{",
"value",
",",
"offset",
",",
"length",
"}",
")",
";",
"try",
"{",
"// Check if the producer has promised not to modify the payload after it's been set",
"checkProducerPromise",
"(",
"\"writeBytes(byte[], int, int)\"",
",",
"\"JmsBytesMessageImpl.writeBytes#2\"",
")",
";",
"// Check that we are in write mode",
"checkBodyWriteable",
"(",
"\"writeBytes\"",
")",
";",
"// Write the byte array to the output stream",
"// We don't check for value==null as JDK1.1.6 DataOutputStream doesn't",
"writeStream",
".",
"write",
"(",
"value",
",",
"offset",
",",
"length",
")",
";",
"// Invalidate the cached toString object.",
"cachedBytesToString",
"=",
"null",
";",
"// Ensure that the new data gets exported when the time comes.",
"bodySetInJsMsg",
"=",
"false",
";",
"}",
"// We don't expect the writeBytes to fail, but we need to catch the exception anyway",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"// No FFDC code needed",
"// d238447 review. Generate FFDC for this case.",
"throw",
"(",
"JMSException",
")",
"JmsErrorUtils",
".",
"newThrowable",
"(",
"ResourceAllocationException",
".",
"class",
",",
"\"WRITE_PROBLEM_CWSIA0186\"",
",",
"null",
",",
"ex",
",",
"\"JmsBytesMessageImpl.writeBytes#1\"",
",",
"this",
",",
"tc",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"writeBytes\"",
")",
";",
"}"
] | Write a portion of a byte array to the stream message.
@param value the byte array value to be written.
@param offset the initial offset within the byte array.
@param length the number of bytes to use.
@exception MessageNotWriteableException if message in read-only mode.
@exception JMSException if JMS fails to write message due to
some internal JMS error. | [
"Write",
"a",
"portion",
"of",
"a",
"byte",
"array",
"to",
"the",
"stream",
"message",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsBytesMessageImpl.java#L1200-L1239 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsBytesMessageImpl.java | JmsBytesMessageImpl.writeObject | @Override
public void writeObject(Object value) throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "writeObject");
// Check if the producer has promised not to modify the payload after it's been set
checkProducerPromise("writeObject(Object)", "JmsBytesMessageImpl.writeObject#1");
// Check that we are in write mode (doing this test here ensures
// any error message refers to the correct method)
checkBodyWriteable("writeObject");
if (value instanceof byte[])
writeBytes((byte[]) value);
else if (value instanceof String)
writeUTF((String) value);
else if (value instanceof Integer)
writeInt(((Integer) value).intValue());
else if (value instanceof Byte)
writeByte(((Byte) value).byteValue());
else if (value instanceof Short)
writeShort(((Short) value).shortValue());
else if (value instanceof Long)
writeLong(((Long) value).longValue());
else if (value instanceof Float)
writeFloat(((Float) value).floatValue());
else if (value instanceof Double)
writeDouble(((Double) value).doubleValue());
else if (value instanceof Character)
writeChar(((Character) value).charValue());
else if (value instanceof Boolean)
writeBoolean(((Boolean) value).booleanValue());
else if (value == null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "given null, throwing NPE");
throw new NullPointerException();
}
else {
// d238447 FFDC review. Passing in an object of the wrong type is an app error,
// so no FFDC needed here.
throw (JMSException) JmsErrorUtils.newThrowable(
MessageFormatException.class,
"BAD_OBJECT_CWSIA0185",
new Object[] { value.getClass().getName() },
tc);
}
// Invalidate the cached toString object.
cachedBytesToString = null;
// Ensure that the new data gets exported when the time comes.
bodySetInJsMsg = false;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "writeObject");
} | java | @Override
public void writeObject(Object value) throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "writeObject");
// Check if the producer has promised not to modify the payload after it's been set
checkProducerPromise("writeObject(Object)", "JmsBytesMessageImpl.writeObject#1");
// Check that we are in write mode (doing this test here ensures
// any error message refers to the correct method)
checkBodyWriteable("writeObject");
if (value instanceof byte[])
writeBytes((byte[]) value);
else if (value instanceof String)
writeUTF((String) value);
else if (value instanceof Integer)
writeInt(((Integer) value).intValue());
else if (value instanceof Byte)
writeByte(((Byte) value).byteValue());
else if (value instanceof Short)
writeShort(((Short) value).shortValue());
else if (value instanceof Long)
writeLong(((Long) value).longValue());
else if (value instanceof Float)
writeFloat(((Float) value).floatValue());
else if (value instanceof Double)
writeDouble(((Double) value).doubleValue());
else if (value instanceof Character)
writeChar(((Character) value).charValue());
else if (value instanceof Boolean)
writeBoolean(((Boolean) value).booleanValue());
else if (value == null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "given null, throwing NPE");
throw new NullPointerException();
}
else {
// d238447 FFDC review. Passing in an object of the wrong type is an app error,
// so no FFDC needed here.
throw (JMSException) JmsErrorUtils.newThrowable(
MessageFormatException.class,
"BAD_OBJECT_CWSIA0185",
new Object[] { value.getClass().getName() },
tc);
}
// Invalidate the cached toString object.
cachedBytesToString = null;
// Ensure that the new data gets exported when the time comes.
bodySetInJsMsg = false;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "writeObject");
} | [
"@",
"Override",
"public",
"void",
"writeObject",
"(",
"Object",
"value",
")",
"throws",
"JMSException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"writeObject\"",
")",
";",
"// Check if the producer has promised not to modify the payload after it's been set",
"checkProducerPromise",
"(",
"\"writeObject(Object)\"",
",",
"\"JmsBytesMessageImpl.writeObject#1\"",
")",
";",
"// Check that we are in write mode (doing this test here ensures",
"// any error message refers to the correct method)",
"checkBodyWriteable",
"(",
"\"writeObject\"",
")",
";",
"if",
"(",
"value",
"instanceof",
"byte",
"[",
"]",
")",
"writeBytes",
"(",
"(",
"byte",
"[",
"]",
")",
"value",
")",
";",
"else",
"if",
"",
"(",
"value",
"instanceof",
"String",
")",
"",
"writeUTF",
"(",
"(",
"String",
")",
"value",
")",
";",
"else",
"if",
"",
"(",
"value",
"instanceof",
"Integer",
")",
"",
"writeInt",
"(",
"(",
"(",
"Integer",
")",
"value",
")",
".",
"intValue",
"(",
")",
")",
";",
"else",
"if",
"",
"(",
"value",
"instanceof",
"Byte",
")",
"",
"writeByte",
"(",
"(",
"(",
"Byte",
")",
"value",
")",
".",
"byteValue",
"(",
")",
")",
";",
"else",
"if",
"",
"(",
"value",
"instanceof",
"Short",
")",
"",
"writeShort",
"(",
"(",
"(",
"Short",
")",
"value",
")",
".",
"shortValue",
"(",
")",
")",
";",
"else",
"if",
"",
"(",
"value",
"instanceof",
"Long",
")",
"",
"writeLong",
"(",
"(",
"(",
"Long",
")",
"value",
")",
".",
"longValue",
"(",
")",
")",
";",
"else",
"if",
"",
"(",
"value",
"instanceof",
"Float",
")",
"",
"writeFloat",
"(",
"(",
"(",
"Float",
")",
"value",
")",
".",
"floatValue",
"(",
")",
")",
";",
"else",
"if",
"",
"(",
"value",
"instanceof",
"Double",
")",
"",
"writeDouble",
"(",
"(",
"(",
"Double",
")",
"value",
")",
".",
"doubleValue",
"(",
")",
")",
";",
"else",
"if",
"",
"(",
"value",
"instanceof",
"Character",
")",
"",
"writeChar",
"(",
"(",
"(",
"Character",
")",
"value",
")",
".",
"charValue",
"(",
")",
")",
";",
"else",
"if",
"",
"(",
"value",
"instanceof",
"Boolean",
")",
"",
"writeBoolean",
"(",
"(",
"(",
"Boolean",
")",
"value",
")",
".",
"booleanValue",
"(",
")",
")",
";",
"else",
"if",
"",
"(",
"value",
"==",
"null",
")",
"",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"given null, throwing NPE\"",
")",
";",
"throw",
"new",
"NullPointerException",
"(",
")",
";",
"}",
"else",
"",
"{",
"// d238447 FFDC review. Passing in an object of the wrong type is an app error,",
"// so no FFDC needed here.",
"throw",
"(",
"JMSException",
")",
"JmsErrorUtils",
".",
"newThrowable",
"(",
"MessageFormatException",
".",
"class",
",",
"\"BAD_OBJECT_CWSIA0185\"",
",",
"new",
"Object",
"[",
"]",
"{",
"value",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
"}",
",",
"tc",
")",
";",
"}",
"// Invalidate the cached toString object.",
"cachedBytesToString",
"=",
"null",
";",
"// Ensure that the new data gets exported when the time comes.",
"bodySetInJsMsg",
"=",
"false",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"writeObject\"",
")",
";",
"}"
] | Write a Java object to the stream message.
<P>Note that this method only works for the objectified primitive
object types (Integer, Double, Long ...), String's and byte arrays.
@param value the Java object to be written.
@exception MessageNotWriteableException if message in read-only mode.
@exception MessageFormatException if object is invalid type.
@exception JMSException if JMS fails to write message due to
some internal JMS error. | [
"Write",
"a",
"Java",
"object",
"to",
"the",
"stream",
"message",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsBytesMessageImpl.java#L1540-L1595 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsBytesMessageImpl.java | JmsBytesMessageImpl.getMsgReference | @Override
protected JsJmsMessage getMsgReference() throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "getMsgReference");
// If the body is read only, the contents should already be in the
// JS message, so only do the copy over if we are in write mode.
// SIB0121: ... and if the producer might modify the payload after it's been set
if (!isBodyReadOnly() && !producerWontModifyPayloadAfterSet) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Body is writeable & producer hasn't promised not to modify the payload - attempt encoding");
try {
int encoding = integerEncoding | floatEncoding; // NB bitwise or (|), not logical or (||)
// check if JMS_IBM_Encoding has been set
if (propertyExists(ApiJmsConstants.ENCODING_PROPERTY)) {
encoding = getIntProperty(ApiJmsConstants.ENCODING_PROPERTY);
}
if (bodySetInJsMsg && (encoding == lastEncoding)) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Body cached - encoding not necessary");
}
else {
// flatten and encode the data streams
byte[] encodedBody = _exportBody(encoding);
// and set it into the Jetstream message
jsBytesMsg.setBytes(encodedBody);
lastEncoding = encoding;
bodySetInJsMsg = true;
}
}
catch (JMSException e) {
// No FFDC code needed
// d222942 review JMSException could be thrown by _exportBody if passed an unknown
// value for encoding, or if there was an IO error handling the streams. These already
// have good nls messages, so we should simply pass on, not wrap with a generic message.
// Similarly, getIntProperty can throw a JMSException which can also be passed on.
throw e;
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "getMsgReference", jsBytesMsg);
return jsBytesMsg;
} | java | @Override
protected JsJmsMessage getMsgReference() throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "getMsgReference");
// If the body is read only, the contents should already be in the
// JS message, so only do the copy over if we are in write mode.
// SIB0121: ... and if the producer might modify the payload after it's been set
if (!isBodyReadOnly() && !producerWontModifyPayloadAfterSet) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Body is writeable & producer hasn't promised not to modify the payload - attempt encoding");
try {
int encoding = integerEncoding | floatEncoding; // NB bitwise or (|), not logical or (||)
// check if JMS_IBM_Encoding has been set
if (propertyExists(ApiJmsConstants.ENCODING_PROPERTY)) {
encoding = getIntProperty(ApiJmsConstants.ENCODING_PROPERTY);
}
if (bodySetInJsMsg && (encoding == lastEncoding)) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Body cached - encoding not necessary");
}
else {
// flatten and encode the data streams
byte[] encodedBody = _exportBody(encoding);
// and set it into the Jetstream message
jsBytesMsg.setBytes(encodedBody);
lastEncoding = encoding;
bodySetInJsMsg = true;
}
}
catch (JMSException e) {
// No FFDC code needed
// d222942 review JMSException could be thrown by _exportBody if passed an unknown
// value for encoding, or if there was an IO error handling the streams. These already
// have good nls messages, so we should simply pass on, not wrap with a generic message.
// Similarly, getIntProperty can throw a JMSException which can also be passed on.
throw e;
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "getMsgReference", jsBytesMsg);
return jsBytesMsg;
} | [
"@",
"Override",
"protected",
"JsJmsMessage",
"getMsgReference",
"(",
")",
"throws",
"JMSException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"getMsgReference\"",
")",
";",
"// If the body is read only, the contents should already be in the",
"// JS message, so only do the copy over if we are in write mode.",
"// SIB0121: ... and if the producer might modify the payload after it's been set",
"if",
"(",
"!",
"isBodyReadOnly",
"(",
")",
"&&",
"!",
"producerWontModifyPayloadAfterSet",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Body is writeable & producer hasn't promised not to modify the payload - attempt encoding\"",
")",
";",
"try",
"{",
"int",
"encoding",
"=",
"integerEncoding",
"|",
"floatEncoding",
";",
"// NB bitwise or (|), not logical or (||)",
"// check if JMS_IBM_Encoding has been set",
"if",
"(",
"propertyExists",
"(",
"ApiJmsConstants",
".",
"ENCODING_PROPERTY",
")",
")",
"{",
"encoding",
"=",
"getIntProperty",
"(",
"ApiJmsConstants",
".",
"ENCODING_PROPERTY",
")",
";",
"}",
"if",
"(",
"bodySetInJsMsg",
"&&",
"(",
"encoding",
"==",
"lastEncoding",
")",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Body cached - encoding not necessary\"",
")",
";",
"}",
"else",
"{",
"// flatten and encode the data streams",
"byte",
"[",
"]",
"encodedBody",
"=",
"_exportBody",
"(",
"encoding",
")",
";",
"// and set it into the Jetstream message",
"jsBytesMsg",
".",
"setBytes",
"(",
"encodedBody",
")",
";",
"lastEncoding",
"=",
"encoding",
";",
"bodySetInJsMsg",
"=",
"true",
";",
"}",
"}",
"catch",
"(",
"JMSException",
"e",
")",
"{",
"// No FFDC code needed",
"// d222942 review JMSException could be thrown by _exportBody if passed an unknown",
"// value for encoding, or if there was an IO error handling the streams. These already",
"// have good nls messages, so we should simply pass on, not wrap with a generic message.",
"// Similarly, getIntProperty can throw a JMSException which can also be passed on.",
"throw",
"e",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"getMsgReference\"",
",",
"jsBytesMsg",
")",
";",
"return",
"jsBytesMsg",
";",
"}"
] | override the getMsgReference method of the parent class.
We need to ensure that the message body is written into the JS message
before returning the reference to it. | [
"override",
"the",
"getMsgReference",
"method",
"of",
"the",
"parent",
"class",
".",
"We",
"need",
"to",
"ensure",
"that",
"the",
"message",
"body",
"is",
"written",
"into",
"the",
"JS",
"message",
"before",
"returning",
"the",
"reference",
"to",
"it",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsBytesMessageImpl.java#L2002-L2050 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsBytesMessageImpl.java | JmsBytesMessageImpl.recordInteger | private void recordInteger(int offset, int length) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "recordInteger", new Object[] { offset, length });
// If the current arrays are full, save them in the vector and allocate some new ones
if (integer_count == ARRAY_SIZE) {
if (integers == null)
integers = new Vector();
integers.addElement(integer_offsets);
integers.addElement(integer_sizes);
integer_offsets = new int[ARRAY_SIZE];
integer_sizes = new int[ARRAY_SIZE];
integer_count = 0;
}
// Add the offset and size of the current numeric item to the arrays
integer_offsets[integer_count] = offset;
integer_sizes[integer_count++] = length;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "recordInteger");
} | java | private void recordInteger(int offset, int length) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "recordInteger", new Object[] { offset, length });
// If the current arrays are full, save them in the vector and allocate some new ones
if (integer_count == ARRAY_SIZE) {
if (integers == null)
integers = new Vector();
integers.addElement(integer_offsets);
integers.addElement(integer_sizes);
integer_offsets = new int[ARRAY_SIZE];
integer_sizes = new int[ARRAY_SIZE];
integer_count = 0;
}
// Add the offset and size of the current numeric item to the arrays
integer_offsets[integer_count] = offset;
integer_sizes[integer_count++] = length;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "recordInteger");
} | [
"private",
"void",
"recordInteger",
"(",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"recordInteger\"",
",",
"new",
"Object",
"[",
"]",
"{",
"offset",
",",
"length",
"}",
")",
";",
"// If the current arrays are full, save them in the vector and allocate some new ones",
"if",
"(",
"integer_count",
"==",
"ARRAY_SIZE",
")",
"{",
"if",
"(",
"integers",
"==",
"null",
")",
"integers",
"=",
"new",
"Vector",
"(",
")",
";",
"integers",
".",
"addElement",
"(",
"integer_offsets",
")",
";",
"integers",
".",
"addElement",
"(",
"integer_sizes",
")",
";",
"integer_offsets",
"=",
"new",
"int",
"[",
"ARRAY_SIZE",
"]",
";",
"integer_sizes",
"=",
"new",
"int",
"[",
"ARRAY_SIZE",
"]",
";",
"integer_count",
"=",
"0",
";",
"}",
"// Add the offset and size of the current numeric item to the arrays",
"integer_offsets",
"[",
"integer_count",
"]",
"=",
"offset",
";",
"integer_sizes",
"[",
"integer_count",
"++",
"]",
"=",
"length",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"recordInteger\"",
")",
";",
"}"
] | Records the presence of an integer-style item in the bytes message stream. This method is called by the writeXXX methods
to keep a track of where the integer items are, so they can be byteswapped if necessary at send time.
NB. The arrays and vector maintained by this method are read directly by the _exportBody() method, so these two method
implementations need to be kept in step
@param offset int offset of start of numeric item
@param length int length of the item (2,4,8 bytes) | [
"Records",
"the",
"presence",
"of",
"an",
"integer",
"-",
"style",
"item",
"in",
"the",
"bytes",
"message",
"stream",
".",
"This",
"method",
"is",
"called",
"by",
"the",
"writeXXX",
"methods",
"to",
"keep",
"a",
"track",
"of",
"where",
"the",
"integer",
"items",
"are",
"so",
"they",
"can",
"be",
"byteswapped",
"if",
"necessary",
"at",
"send",
"time",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsBytesMessageImpl.java#L2226-L2247 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsBytesMessageImpl.java | JmsBytesMessageImpl.reverse | private void reverse(byte[] buffer, int offset, int length) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "reverse", new Object[] { buffer, offset, length });
byte temp;
for (int i = 0; i < length / 2; i++) {
temp = buffer[offset + i];
buffer[offset + i] = buffer[offset + (length - 1) - i];
buffer[offset + (length - 1) - i] = temp;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "reverse");
} | java | private void reverse(byte[] buffer, int offset, int length) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "reverse", new Object[] { buffer, offset, length });
byte temp;
for (int i = 0; i < length / 2; i++) {
temp = buffer[offset + i];
buffer[offset + i] = buffer[offset + (length - 1) - i];
buffer[offset + (length - 1) - i] = temp;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "reverse");
} | [
"private",
"void",
"reverse",
"(",
"byte",
"[",
"]",
"buffer",
",",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"reverse\"",
",",
"new",
"Object",
"[",
"]",
"{",
"buffer",
",",
"offset",
",",
"length",
"}",
")",
";",
"byte",
"temp",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
"/",
"2",
";",
"i",
"++",
")",
"{",
"temp",
"=",
"buffer",
"[",
"offset",
"+",
"i",
"]",
";",
"buffer",
"[",
"offset",
"+",
"i",
"]",
"=",
"buffer",
"[",
"offset",
"+",
"(",
"length",
"-",
"1",
")",
"-",
"i",
"]",
";",
"buffer",
"[",
"offset",
"+",
"(",
"length",
"-",
"1",
")",
"-",
"i",
"]",
"=",
"temp",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"reverse\"",
")",
";",
"}"
] | This method reverses a sequence of bytes within a byte array. It is used for byte swapping numeric values
@param buffer byte[]
@param offset int offset of start of sequence
@param length int length of sequence in bytes | [
"This",
"method",
"reverses",
"a",
"sequence",
"of",
"bytes",
"within",
"a",
"byte",
"array",
".",
"It",
"is",
"used",
"for",
"byte",
"swapping",
"numeric",
"values"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsBytesMessageImpl.java#L2256-L2269 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsBytesMessageImpl.java | JmsBytesMessageImpl.checkProducerPromise | private void checkProducerPromise(String jmsMethod, String ffdcProbeID) throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "checkProducerPromise", new Object[] { jmsMethod, ffdcProbeID });
// Only proceed if the producer hasn't promised not to modify the payload
// after setting it.
if (producerWontModifyPayloadAfterSet) {
throw (JMSException) JmsErrorUtils.newThrowable(
IllegalStateException.class, // JMS illegal state exception
"PROMISE_BROKEN_EXCEPTION_CWSIA0510", // promise broken
new Object[] { jmsMethod }, // insert = jms method name
null, // no cause, original exception
ffdcProbeID, // Probe ID
this, // caller (?)
tc); // Trace component
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "checkProducerPromise");
} | java | private void checkProducerPromise(String jmsMethod, String ffdcProbeID) throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "checkProducerPromise", new Object[] { jmsMethod, ffdcProbeID });
// Only proceed if the producer hasn't promised not to modify the payload
// after setting it.
if (producerWontModifyPayloadAfterSet) {
throw (JMSException) JmsErrorUtils.newThrowable(
IllegalStateException.class, // JMS illegal state exception
"PROMISE_BROKEN_EXCEPTION_CWSIA0510", // promise broken
new Object[] { jmsMethod }, // insert = jms method name
null, // no cause, original exception
ffdcProbeID, // Probe ID
this, // caller (?)
tc); // Trace component
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "checkProducerPromise");
} | [
"private",
"void",
"checkProducerPromise",
"(",
"String",
"jmsMethod",
",",
"String",
"ffdcProbeID",
")",
"throws",
"JMSException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"checkProducerPromise\"",
",",
"new",
"Object",
"[",
"]",
"{",
"jmsMethod",
",",
"ffdcProbeID",
"}",
")",
";",
"// Only proceed if the producer hasn't promised not to modify the payload",
"// after setting it.",
"if",
"(",
"producerWontModifyPayloadAfterSet",
")",
"{",
"throw",
"(",
"JMSException",
")",
"JmsErrorUtils",
".",
"newThrowable",
"(",
"IllegalStateException",
".",
"class",
",",
"// JMS illegal state exception",
"\"PROMISE_BROKEN_EXCEPTION_CWSIA0510\"",
",",
"// promise broken",
"new",
"Object",
"[",
"]",
"{",
"jmsMethod",
"}",
",",
"// insert = jms method name",
"null",
",",
"// no cause, original exception",
"ffdcProbeID",
",",
"// Probe ID",
"this",
",",
"// caller (?)",
"tc",
")",
";",
"// Trace component",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"checkProducerPromise\"",
")",
";",
"}"
] | Checks to see if the producer has promised not to modify the payload after it's been set.
If they have, then throw a JMS exception based on the parameters
@throws JMSException | [
"Checks",
"to",
"see",
"if",
"the",
"producer",
"has",
"promised",
"not",
"to",
"modify",
"the",
"payload",
"after",
"it",
"s",
"been",
"set",
".",
"If",
"they",
"have",
"then",
"throw",
"a",
"JMS",
"exception",
"based",
"on",
"the",
"parameters"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsBytesMessageImpl.java#L2277-L2295 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/CATAsynchReadAheadReader.java | CATAsynchReadAheadReader.stopConsumer | public void stopConsumer() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "stopConsumer");
try {
// lock the consumerSession to ensure visibility of update to started.
synchronized (consumerSession) {
consumerSession.getConsumerSession().stop();
consumerSession.started = false;
}
} catch (Throwable t) {
FFDCFilter.processException(t,
CLASS_NAME + ".consumeMessages",
CommsConstants.CATASYNCHRHREADER_CONSUME_MSGS_02,
this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Unable to stop consumer session due to Throwable: " + t);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "stopConsumer");
} | java | public void stopConsumer() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "stopConsumer");
try {
// lock the consumerSession to ensure visibility of update to started.
synchronized (consumerSession) {
consumerSession.getConsumerSession().stop();
consumerSession.started = false;
}
} catch (Throwable t) {
FFDCFilter.processException(t,
CLASS_NAME + ".consumeMessages",
CommsConstants.CATASYNCHRHREADER_CONSUME_MSGS_02,
this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Unable to stop consumer session due to Throwable: " + t);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "stopConsumer");
} | [
"public",
"void",
"stopConsumer",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"stopConsumer\"",
")",
";",
"try",
"{",
"// lock the consumerSession to ensure visibility of update to started.",
"synchronized",
"(",
"consumerSession",
")",
"{",
"consumerSession",
".",
"getConsumerSession",
"(",
")",
".",
"stop",
"(",
")",
";",
"consumerSession",
".",
"started",
"=",
"false",
";",
"}",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"t",
",",
"CLASS_NAME",
"+",
"\".consumeMessages\"",
",",
"CommsConstants",
".",
"CATASYNCHRHREADER_CONSUME_MSGS_02",
",",
"this",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Unable to stop consumer session due to Throwable: \"",
"+",
"t",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"stopConsumer\"",
")",
";",
"}"
] | Safely stop the consumer
@param Message to be traced for stop reason. | [
"Safely",
"stop",
"the",
"consumer"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/CATAsynchReadAheadReader.java#L175-L195 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSConsumerClassifications.java | JSConsumerClassifications.setClassifications | public boolean setClassifications(Flow[] newFlows)
throws InvalidFlowsException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "setClassifications", newFlows);
boolean noClassChange = true;
// Do we have the same set of flows but with different weightings only?
if(flows == null || (flows.length != newFlows.length))
{
// We know that this is more than a weight change
noClassChange = false;
}
// Set up the new data structures to hold classification information
ArrayList<String> newClassificationNames = new ArrayList<String>();
HashMap<String, ClassWeight> newMessageClasses = new HashMap<String, ClassWeight>();
HashMap<Integer, Integer> newWeightMap = new HashMap<Integer, Integer>();
// Set the new default classification
newClassificationNames.add(0, "$SIdefault");
// Iterate over the new flows
for(int i=0;i<newFlows.length;i++)
{
// Get the next classification name
String nextClassificationName = newFlows[i].getClassification();
if(noClassChange && !classificationNames.contains(nextClassificationName))
{
// This classification was not in the old list
noClassChange = false;
}
// The zeroth position is reserved for default, non-classified messages
ClassWeight classWeight = new ClassWeight(i+1, newFlows[i].getWeighting());
// Put the new weight in the messageClasses map
ClassWeight cw = newMessageClasses.put(nextClassificationName, classWeight);
// Check for duplicate classification names
if(cw != null)
{
InvalidFlowsException ife = new InvalidFlowsException();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "setClassifications", ife);
throw ife;
}
newClassificationNames.add(i+1, nextClassificationName);
// Put the new value in the weightMap
newWeightMap.put(Integer.valueOf(i+1), Integer.valueOf(newFlows[i].getWeighting()));
}
// Have set up the new data structures, reset the old ones.
classificationNames = newClassificationNames;
messageClasses = newMessageClasses;
weightMap = newWeightMap;
// And clone the flows
this.flows = newFlows.clone();
// The number of classifications
numberOfClasses = flows.length;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "setClassifications", Boolean.valueOf(noClassChange));
return noClassChange;
} | java | public boolean setClassifications(Flow[] newFlows)
throws InvalidFlowsException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "setClassifications", newFlows);
boolean noClassChange = true;
// Do we have the same set of flows but with different weightings only?
if(flows == null || (flows.length != newFlows.length))
{
// We know that this is more than a weight change
noClassChange = false;
}
// Set up the new data structures to hold classification information
ArrayList<String> newClassificationNames = new ArrayList<String>();
HashMap<String, ClassWeight> newMessageClasses = new HashMap<String, ClassWeight>();
HashMap<Integer, Integer> newWeightMap = new HashMap<Integer, Integer>();
// Set the new default classification
newClassificationNames.add(0, "$SIdefault");
// Iterate over the new flows
for(int i=0;i<newFlows.length;i++)
{
// Get the next classification name
String nextClassificationName = newFlows[i].getClassification();
if(noClassChange && !classificationNames.contains(nextClassificationName))
{
// This classification was not in the old list
noClassChange = false;
}
// The zeroth position is reserved for default, non-classified messages
ClassWeight classWeight = new ClassWeight(i+1, newFlows[i].getWeighting());
// Put the new weight in the messageClasses map
ClassWeight cw = newMessageClasses.put(nextClassificationName, classWeight);
// Check for duplicate classification names
if(cw != null)
{
InvalidFlowsException ife = new InvalidFlowsException();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "setClassifications", ife);
throw ife;
}
newClassificationNames.add(i+1, nextClassificationName);
// Put the new value in the weightMap
newWeightMap.put(Integer.valueOf(i+1), Integer.valueOf(newFlows[i].getWeighting()));
}
// Have set up the new data structures, reset the old ones.
classificationNames = newClassificationNames;
messageClasses = newMessageClasses;
weightMap = newWeightMap;
// And clone the flows
this.flows = newFlows.clone();
// The number of classifications
numberOfClasses = flows.length;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "setClassifications", Boolean.valueOf(noClassChange));
return noClassChange;
} | [
"public",
"boolean",
"setClassifications",
"(",
"Flow",
"[",
"]",
"newFlows",
")",
"throws",
"InvalidFlowsException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"setClassifications\"",
",",
"newFlows",
")",
";",
"boolean",
"noClassChange",
"=",
"true",
";",
"// Do we have the same set of flows but with different weightings only?",
"if",
"(",
"flows",
"==",
"null",
"||",
"(",
"flows",
".",
"length",
"!=",
"newFlows",
".",
"length",
")",
")",
"{",
"// We know that this is more than a weight change",
"noClassChange",
"=",
"false",
";",
"}",
"// Set up the new data structures to hold classification information",
"ArrayList",
"<",
"String",
">",
"newClassificationNames",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"HashMap",
"<",
"String",
",",
"ClassWeight",
">",
"newMessageClasses",
"=",
"new",
"HashMap",
"<",
"String",
",",
"ClassWeight",
">",
"(",
")",
";",
"HashMap",
"<",
"Integer",
",",
"Integer",
">",
"newWeightMap",
"=",
"new",
"HashMap",
"<",
"Integer",
",",
"Integer",
">",
"(",
")",
";",
"// Set the new default classification",
"newClassificationNames",
".",
"add",
"(",
"0",
",",
"\"$SIdefault\"",
")",
";",
"// Iterate over the new flows",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"newFlows",
".",
"length",
";",
"i",
"++",
")",
"{",
"// Get the next classification name",
"String",
"nextClassificationName",
"=",
"newFlows",
"[",
"i",
"]",
".",
"getClassification",
"(",
")",
";",
"if",
"(",
"noClassChange",
"&&",
"!",
"classificationNames",
".",
"contains",
"(",
"nextClassificationName",
")",
")",
"{",
"// This classification was not in the old list",
"noClassChange",
"=",
"false",
";",
"}",
"// The zeroth position is reserved for default, non-classified messages",
"ClassWeight",
"classWeight",
"=",
"new",
"ClassWeight",
"(",
"i",
"+",
"1",
",",
"newFlows",
"[",
"i",
"]",
".",
"getWeighting",
"(",
")",
")",
";",
"// Put the new weight in the messageClasses map",
"ClassWeight",
"cw",
"=",
"newMessageClasses",
".",
"put",
"(",
"nextClassificationName",
",",
"classWeight",
")",
";",
"// Check for duplicate classification names",
"if",
"(",
"cw",
"!=",
"null",
")",
"{",
"InvalidFlowsException",
"ife",
"=",
"new",
"InvalidFlowsException",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"setClassifications\"",
",",
"ife",
")",
";",
"throw",
"ife",
";",
"}",
"newClassificationNames",
".",
"add",
"(",
"i",
"+",
"1",
",",
"nextClassificationName",
")",
";",
"// Put the new value in the weightMap",
"newWeightMap",
".",
"put",
"(",
"Integer",
".",
"valueOf",
"(",
"i",
"+",
"1",
")",
",",
"Integer",
".",
"valueOf",
"(",
"newFlows",
"[",
"i",
"]",
".",
"getWeighting",
"(",
")",
")",
")",
";",
"}",
"// Have set up the new data structures, reset the old ones.",
"classificationNames",
"=",
"newClassificationNames",
";",
"messageClasses",
"=",
"newMessageClasses",
";",
"weightMap",
"=",
"newWeightMap",
";",
"// And clone the flows",
"this",
".",
"flows",
"=",
"newFlows",
".",
"clone",
"(",
")",
";",
"// The number of classifications",
"numberOfClasses",
"=",
"flows",
".",
"length",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"setClassifications\"",
",",
"Boolean",
".",
"valueOf",
"(",
"noClassChange",
")",
")",
";",
"return",
"noClassChange",
";",
"}"
] | Supports the setting of a new set of classifications based on a set of
Flows provided by the caller.
The method is called by JSConsumerSet.setFlowProperites() under a Java 5 write lock that
ensures exclusive access when classifications are being set or changed. The specific lock
taken is JSConsumerSet.classificationWriteLock.
@param flows | [
"Supports",
"the",
"setting",
"of",
"a",
"new",
"set",
"of",
"classifications",
"based",
"on",
"a",
"set",
"of",
"Flows",
"provided",
"by",
"the",
"caller",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSConsumerClassifications.java#L81-L147 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSConsumerClassifications.java | JSConsumerClassifications.getNumberOfClasses | public int getNumberOfClasses()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "getNumberOfClasses");
SibTr.exit(tc, "getNumberOfClasses", Integer.valueOf(numberOfClasses));
}
return numberOfClasses;
} | java | public int getNumberOfClasses()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "getNumberOfClasses");
SibTr.exit(tc, "getNumberOfClasses", Integer.valueOf(numberOfClasses));
}
return numberOfClasses;
} | [
"public",
"int",
"getNumberOfClasses",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"getNumberOfClasses\"",
")",
";",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"getNumberOfClasses\"",
",",
"Integer",
".",
"valueOf",
"(",
"numberOfClasses",
")",
")",
";",
"}",
"return",
"numberOfClasses",
";",
"}"
] | Retrieve the number of classifications specified in the current set.
@return | [
"Retrieve",
"the",
"number",
"of",
"classifications",
"specified",
"in",
"the",
"current",
"set",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSConsumerClassifications.java#L154-L162 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSConsumerClassifications.java | JSConsumerClassifications.getPosition | public int getPosition(String classificationName)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getPosition", classificationName);
int classPos = 0;
// Get the position of the classification
ClassWeight cw = messageClasses.get(classificationName);
if(cw != null)
classPos = cw.getPosition();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getPosition", Integer.valueOf(classPos));
return classPos;
} | java | public int getPosition(String classificationName)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getPosition", classificationName);
int classPos = 0;
// Get the position of the classification
ClassWeight cw = messageClasses.get(classificationName);
if(cw != null)
classPos = cw.getPosition();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getPosition", Integer.valueOf(classPos));
return classPos;
} | [
"public",
"int",
"getPosition",
"(",
"String",
"classificationName",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"getPosition\"",
",",
"classificationName",
")",
";",
"int",
"classPos",
"=",
"0",
";",
"// Get the position of the classification",
"ClassWeight",
"cw",
"=",
"messageClasses",
".",
"get",
"(",
"classificationName",
")",
";",
"if",
"(",
"cw",
"!=",
"null",
")",
"classPos",
"=",
"cw",
".",
"getPosition",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"getPosition\"",
",",
"Integer",
".",
"valueOf",
"(",
"classPos",
")",
")",
";",
"return",
"classPos",
";",
"}"
] | Get the index of a named classification.
@param classificationName
@return | [
"Get",
"the",
"index",
"of",
"a",
"named",
"classification",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSConsumerClassifications.java#L170-L185 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSConsumerClassifications.java | JSConsumerClassifications.getWeight | public int getWeight(String classificationName)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getWeight", classificationName);
int weight = 0;
// Get the weight of the classification
ClassWeight cw = messageClasses.get(classificationName);
if(cw != null)
weight = cw.getWeight();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getWeight", Integer.valueOf(weight));
return weight;
} | java | public int getWeight(String classificationName)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getWeight", classificationName);
int weight = 0;
// Get the weight of the classification
ClassWeight cw = messageClasses.get(classificationName);
if(cw != null)
weight = cw.getWeight();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getWeight", Integer.valueOf(weight));
return weight;
} | [
"public",
"int",
"getWeight",
"(",
"String",
"classificationName",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"getWeight\"",
",",
"classificationName",
")",
";",
"int",
"weight",
"=",
"0",
";",
"// Get the weight of the classification",
"ClassWeight",
"cw",
"=",
"messageClasses",
".",
"get",
"(",
"classificationName",
")",
";",
"if",
"(",
"cw",
"!=",
"null",
")",
"weight",
"=",
"cw",
".",
"getWeight",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"getWeight\"",
",",
"Integer",
".",
"valueOf",
"(",
"weight",
")",
")",
";",
"return",
"weight",
";",
"}"
] | Get the weight of a named classification.
@param classificationName
@return | [
"Get",
"the",
"weight",
"of",
"a",
"named",
"classification",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSConsumerClassifications.java#L193-L208 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSConsumerClassifications.java | JSConsumerClassifications.findClassIndex | public int findClassIndex(HashMap<Integer, Integer> weightMap)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "findClassIndex");
int classPos = 0;
int randWeight = 0;
// First of all determine total weight
int totalWeight = 0;
Iterator<Integer> iter = weightMap.values().iterator();
while(iter.hasNext())
{
Integer weight = iter.next();
totalWeight = totalWeight + weight.intValue();
}
// TotalWeight might be zero if a zero weighting has been applied to a class. In
// that case we need to return a zero classPos
if(totalWeight > 0)
{
// Generate a random number that is between zero and the total weight
randWeight = Math.abs(rand.nextInt() % totalWeight);
// Iterate over the weightMap again so that we can find a class index to use.
// We search for the index that corresponds to the generated random value.
//
// So if we had 3 classes with weights 7, 2 and 1, then we'll have a total
// weight of 10 and will generate a pseudo random number between 0 and 10. The
// code will see if the random number...
// * is less than 7, in which case it chooses index 1,
// * is between 7 and 9, in which case it chooses index 2,
// * is between 9 and 10, in which case it chooses index 3.
Iterator<Map.Entry<Integer, Integer>> iter2 = weightMap.entrySet().iterator();
// An aggregate of the weight
int aggregateWeight = 0;
while(iter2.hasNext())
{
Map.Entry entry = (Map.Entry) iter2.next();
Integer mappos = (Integer) entry.getKey();
Integer weight = (Integer) entry.getValue();
aggregateWeight = aggregateWeight + weight.intValue();
// Move the classPos to the next value
classPos = mappos.intValue();
if(randWeight <= aggregateWeight)
break;
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "findClassIndex", classPos);
return classPos;
} | java | public int findClassIndex(HashMap<Integer, Integer> weightMap)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "findClassIndex");
int classPos = 0;
int randWeight = 0;
// First of all determine total weight
int totalWeight = 0;
Iterator<Integer> iter = weightMap.values().iterator();
while(iter.hasNext())
{
Integer weight = iter.next();
totalWeight = totalWeight + weight.intValue();
}
// TotalWeight might be zero if a zero weighting has been applied to a class. In
// that case we need to return a zero classPos
if(totalWeight > 0)
{
// Generate a random number that is between zero and the total weight
randWeight = Math.abs(rand.nextInt() % totalWeight);
// Iterate over the weightMap again so that we can find a class index to use.
// We search for the index that corresponds to the generated random value.
//
// So if we had 3 classes with weights 7, 2 and 1, then we'll have a total
// weight of 10 and will generate a pseudo random number between 0 and 10. The
// code will see if the random number...
// * is less than 7, in which case it chooses index 1,
// * is between 7 and 9, in which case it chooses index 2,
// * is between 9 and 10, in which case it chooses index 3.
Iterator<Map.Entry<Integer, Integer>> iter2 = weightMap.entrySet().iterator();
// An aggregate of the weight
int aggregateWeight = 0;
while(iter2.hasNext())
{
Map.Entry entry = (Map.Entry) iter2.next();
Integer mappos = (Integer) entry.getKey();
Integer weight = (Integer) entry.getValue();
aggregateWeight = aggregateWeight + weight.intValue();
// Move the classPos to the next value
classPos = mappos.intValue();
if(randWeight <= aggregateWeight)
break;
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "findClassIndex", classPos);
return classPos;
} | [
"public",
"int",
"findClassIndex",
"(",
"HashMap",
"<",
"Integer",
",",
"Integer",
">",
"weightMap",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"findClassIndex\"",
")",
";",
"int",
"classPos",
"=",
"0",
";",
"int",
"randWeight",
"=",
"0",
";",
"// First of all determine total weight",
"int",
"totalWeight",
"=",
"0",
";",
"Iterator",
"<",
"Integer",
">",
"iter",
"=",
"weightMap",
".",
"values",
"(",
")",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"iter",
".",
"hasNext",
"(",
")",
")",
"{",
"Integer",
"weight",
"=",
"iter",
".",
"next",
"(",
")",
";",
"totalWeight",
"=",
"totalWeight",
"+",
"weight",
".",
"intValue",
"(",
")",
";",
"}",
"// TotalWeight might be zero if a zero weighting has been applied to a class. In",
"// that case we need to return a zero classPos",
"if",
"(",
"totalWeight",
">",
"0",
")",
"{",
"// Generate a random number that is between zero and the total weight",
"randWeight",
"=",
"Math",
".",
"abs",
"(",
"rand",
".",
"nextInt",
"(",
")",
"%",
"totalWeight",
")",
";",
"// Iterate over the weightMap again so that we can find a class index to use.",
"// We search for the index that corresponds to the generated random value.",
"//",
"// So if we had 3 classes with weights 7, 2 and 1, then we'll have a total",
"// weight of 10 and will generate a pseudo random number between 0 and 10. The",
"// code will see if the random number...",
"// * is less than 7, in which case it chooses index 1,",
"// * is between 7 and 9, in which case it chooses index 2, ",
"// * is between 9 and 10, in which case it chooses index 3.",
"Iterator",
"<",
"Map",
".",
"Entry",
"<",
"Integer",
",",
"Integer",
">",
">",
"iter2",
"=",
"weightMap",
".",
"entrySet",
"(",
")",
".",
"iterator",
"(",
")",
";",
"// An aggregate of the weight",
"int",
"aggregateWeight",
"=",
"0",
";",
"while",
"(",
"iter2",
".",
"hasNext",
"(",
")",
")",
"{",
"Map",
".",
"Entry",
"entry",
"=",
"(",
"Map",
".",
"Entry",
")",
"iter2",
".",
"next",
"(",
")",
";",
"Integer",
"mappos",
"=",
"(",
"Integer",
")",
"entry",
".",
"getKey",
"(",
")",
";",
"Integer",
"weight",
"=",
"(",
"Integer",
")",
"entry",
".",
"getValue",
"(",
")",
";",
"aggregateWeight",
"=",
"aggregateWeight",
"+",
"weight",
".",
"intValue",
"(",
")",
";",
"// Move the classPos to the next value",
"classPos",
"=",
"mappos",
".",
"intValue",
"(",
")",
";",
"if",
"(",
"randWeight",
"<=",
"aggregateWeight",
")",
"break",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"findClassIndex\"",
",",
"classPos",
")",
";",
"return",
"classPos",
";",
"}"
] | Find a pseudo random classification index based on the weightings
table.
@param weightMap
@return | [
"Find",
"a",
"pseudo",
"random",
"classification",
"index",
"based",
"on",
"the",
"weightings",
"table",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSConsumerClassifications.java#L240-L295 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSConsumerClassifications.java | JSConsumerClassifications.getFlows | public Flow[] getFlows()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "getFlows");
}
Flow[] clonedFlows = flows.clone();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.exit(tc, "getFlows", clonedFlows);
}
return clonedFlows;
} | java | public Flow[] getFlows()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "getFlows");
}
Flow[] clonedFlows = flows.clone();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.exit(tc, "getFlows", clonedFlows);
}
return clonedFlows;
} | [
"public",
"Flow",
"[",
"]",
"getFlows",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"getFlows\"",
")",
";",
"}",
"Flow",
"[",
"]",
"clonedFlows",
"=",
"flows",
".",
"clone",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"getFlows\"",
",",
"clonedFlows",
")",
";",
"}",
"return",
"clonedFlows",
";",
"}"
] | Returns the array of flows defined in this classification specified by XD.
@return | [
"Returns",
"the",
"array",
"of",
"flows",
"defined",
"in",
"this",
"classification",
"specified",
"by",
"XD",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSConsumerClassifications.java#L318-L331 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChainDataImpl.java | ChainDataImpl.getPropertyBag | public Map<Object, Object> getPropertyBag() {
if (this.properties == null) {
this.properties = new HashMap<Object, Object>();
}
return this.properties;
} | java | public Map<Object, Object> getPropertyBag() {
if (this.properties == null) {
this.properties = new HashMap<Object, Object>();
}
return this.properties;
} | [
"public",
"Map",
"<",
"Object",
",",
"Object",
">",
"getPropertyBag",
"(",
")",
"{",
"if",
"(",
"this",
".",
"properties",
"==",
"null",
")",
"{",
"this",
".",
"properties",
"=",
"new",
"HashMap",
"<",
"Object",
",",
"Object",
">",
"(",
")",
";",
"}",
"return",
"this",
".",
"properties",
";",
"}"
] | Fetch the property bag associated with this Chain.
@return Map<Object,Object> | [
"Fetch",
"the",
"property",
"bag",
"associated",
"with",
"this",
"Chain",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChainDataImpl.java#L211-L216 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChainDataImpl.java | ChainDataImpl.getExternalChainData | public ChainDataImpl getExternalChainData() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(this, tc, "getExternalChainData");
}
// Create the list of the parents of the child data objects.
ChannelData[] parents = new ChannelData[this.channelDataArray.length];
for (int i = 0; i < parents.length; i++) {
parents[i] = ((ChildChannelDataImpl) this.channelDataArray[i]).getParent();
}
ChainDataImpl externalChainData = null;
try {
externalChainData = new ChainDataImpl(getName(), getType(), parents, null);
} catch (IncoherentChainException e) {
// No FFDC Needed
// This should never happen
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "Unable to build external version of chain data, " + getName());
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(this, tc, "getExternalChainData");
}
return externalChainData;
} | java | public ChainDataImpl getExternalChainData() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(this, tc, "getExternalChainData");
}
// Create the list of the parents of the child data objects.
ChannelData[] parents = new ChannelData[this.channelDataArray.length];
for (int i = 0; i < parents.length; i++) {
parents[i] = ((ChildChannelDataImpl) this.channelDataArray[i]).getParent();
}
ChainDataImpl externalChainData = null;
try {
externalChainData = new ChainDataImpl(getName(), getType(), parents, null);
} catch (IncoherentChainException e) {
// No FFDC Needed
// This should never happen
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "Unable to build external version of chain data, " + getName());
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(this, tc, "getExternalChainData");
}
return externalChainData;
} | [
"public",
"ChainDataImpl",
"getExternalChainData",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"getExternalChainData\"",
")",
";",
"}",
"// Create the list of the parents of the child data objects.",
"ChannelData",
"[",
"]",
"parents",
"=",
"new",
"ChannelData",
"[",
"this",
".",
"channelDataArray",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"parents",
".",
"length",
";",
"i",
"++",
")",
"{",
"parents",
"[",
"i",
"]",
"=",
"(",
"(",
"ChildChannelDataImpl",
")",
"this",
".",
"channelDataArray",
"[",
"i",
"]",
")",
".",
"getParent",
"(",
")",
";",
"}",
"ChainDataImpl",
"externalChainData",
"=",
"null",
";",
"try",
"{",
"externalChainData",
"=",
"new",
"ChainDataImpl",
"(",
"getName",
"(",
")",
",",
"getType",
"(",
")",
",",
"parents",
",",
"null",
")",
";",
"}",
"catch",
"(",
"IncoherentChainException",
"e",
")",
"{",
"// No FFDC Needed",
"// This should never happen",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Unable to build external version of chain data, \"",
"+",
"getName",
"(",
")",
")",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"getExternalChainData\"",
")",
";",
"}",
"return",
"externalChainData",
";",
"}"
] | Create a cloned representation of this chain data which only includes
references to parent channel data objects. It hides the children and
their names.
@return cloned chain data including parent channel data objects | [
"Create",
"a",
"cloned",
"representation",
"of",
"this",
"chain",
"data",
"which",
"only",
"includes",
"references",
"to",
"parent",
"channel",
"data",
"objects",
".",
"It",
"hides",
"the",
"children",
"and",
"their",
"names",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChainDataImpl.java#L255-L279 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChainDataImpl.java | ChainDataImpl.addChainEventListener | public final void addChainEventListener(ChainEventListener listener) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "addChainEventListener: " + listener);
}
if (null != listener) {
this.chainEventListeners.add(listener);
}
} | java | public final void addChainEventListener(ChainEventListener listener) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "addChainEventListener: " + listener);
}
if (null != listener) {
this.chainEventListeners.add(listener);
}
} | [
"public",
"final",
"void",
"addChainEventListener",
"(",
"ChainEventListener",
"listener",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"addChainEventListener: \"",
"+",
"listener",
")",
";",
"}",
"if",
"(",
"null",
"!=",
"listener",
")",
"{",
"this",
".",
"chainEventListeners",
".",
"add",
"(",
"listener",
")",
";",
"}",
"}"
] | Enables external entities to be notified of chain events described in
ChainEventListener interface.
@param listener | [
"Enables",
"external",
"entities",
"to",
"be",
"notified",
"of",
"chain",
"events",
"described",
"in",
"ChainEventListener",
"interface",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChainDataImpl.java#L291-L298 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChainDataImpl.java | ChainDataImpl.removeChainEventListener | public final void removeChainEventListener(ChainEventListener listener) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "removeChainEventListener: " + listener);
}
if (null != listener) {
if (!this.chainEventListeners.remove(listener)) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "Cannot find listener to be removed");
}
}
}
} | java | public final void removeChainEventListener(ChainEventListener listener) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "removeChainEventListener: " + listener);
}
if (null != listener) {
if (!this.chainEventListeners.remove(listener)) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "Cannot find listener to be removed");
}
}
}
} | [
"public",
"final",
"void",
"removeChainEventListener",
"(",
"ChainEventListener",
"listener",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"removeChainEventListener: \"",
"+",
"listener",
")",
";",
"}",
"if",
"(",
"null",
"!=",
"listener",
")",
"{",
"if",
"(",
"!",
"this",
".",
"chainEventListeners",
".",
"remove",
"(",
"listener",
")",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Cannot find listener to be removed\"",
")",
";",
"}",
"}",
"}",
"}"
] | Removes a listener from the list of those being informed of chain events
on this chain.
@param listener | [
"Removes",
"a",
"listener",
"from",
"the",
"list",
"of",
"those",
"being",
"informed",
"of",
"chain",
"events",
"on",
"this",
"chain",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChainDataImpl.java#L306-L317 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChainDataImpl.java | ChainDataImpl.removeAllChainEventListeners | public Set<ChainEventListener> removeAllChainEventListeners() {
Set<ChainEventListener> returnListeners = new HashSet<ChainEventListener>(this.chainEventListeners);
this.chainEventListeners.clear();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "removeAllChainEventListeners", returnListeners);
}
return returnListeners;
} | java | public Set<ChainEventListener> removeAllChainEventListeners() {
Set<ChainEventListener> returnListeners = new HashSet<ChainEventListener>(this.chainEventListeners);
this.chainEventListeners.clear();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "removeAllChainEventListeners", returnListeners);
}
return returnListeners;
} | [
"public",
"Set",
"<",
"ChainEventListener",
">",
"removeAllChainEventListeners",
"(",
")",
"{",
"Set",
"<",
"ChainEventListener",
">",
"returnListeners",
"=",
"new",
"HashSet",
"<",
"ChainEventListener",
">",
"(",
"this",
".",
"chainEventListeners",
")",
";",
"this",
".",
"chainEventListeners",
".",
"clear",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"removeAllChainEventListeners\"",
",",
"returnListeners",
")",
";",
"}",
"return",
"returnListeners",
";",
"}"
] | Remove the chain event listeners from this configuration and return them
in a new hash set. This method is called during the updateChain
in order to move the event listeners from the old config to the new one.
@return ArrayList<ChainEventListener> of chain event listeners | [
"Remove",
"the",
"chain",
"event",
"listeners",
"from",
"this",
"configuration",
"and",
"return",
"them",
"in",
"a",
"new",
"hash",
"set",
".",
"This",
"method",
"is",
"called",
"during",
"the",
"updateChain",
"in",
"order",
"to",
"move",
"the",
"event",
"listeners",
"from",
"the",
"old",
"config",
"to",
"the",
"new",
"one",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChainDataImpl.java#L326-L333 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChainDataImpl.java | ChainDataImpl.setChainEventListeners | public void setChainEventListeners(Set<ChainEventListener> newListeners) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "removeAllChainEventListeners", newListeners);
}
chainEventListeners.clear();
chainEventListeners.addAll(newListeners);
} | java | public void setChainEventListeners(Set<ChainEventListener> newListeners) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "removeAllChainEventListeners", newListeners);
}
chainEventListeners.clear();
chainEventListeners.addAll(newListeners);
} | [
"public",
"void",
"setChainEventListeners",
"(",
"Set",
"<",
"ChainEventListener",
">",
"newListeners",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"removeAllChainEventListeners\"",
",",
"newListeners",
")",
";",
"}",
"chainEventListeners",
".",
"clear",
"(",
")",
";",
"chainEventListeners",
".",
"addAll",
"(",
"newListeners",
")",
";",
"}"
] | Set the list of chain event listeners for this chain configuration. This
method was originally created to pass along chain event listeners from one
chain config to another chain config during the updateChain method.
@param newListeners | [
"Set",
"the",
"list",
"of",
"chain",
"event",
"listeners",
"for",
"this",
"chain",
"configuration",
".",
"This",
"method",
"was",
"originally",
"created",
"to",
"pass",
"along",
"chain",
"event",
"listeners",
"from",
"one",
"chain",
"config",
"to",
"another",
"chain",
"config",
"during",
"the",
"updateChain",
"method",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChainDataImpl.java#L342-L348 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChainDataImpl.java | ChainDataImpl.chainInitialized | public final void chainInitialized() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(this, tc, "chainInitialized, chain: " + this.name);
}
// Clone the list in case one of the event listeners modifies
// the chain during this iteration.
for (ChainEventListener listener : chainEventListeners) {
listener.chainInitialized(this);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(this, tc, "chainInitialized");
}
} | java | public final void chainInitialized() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(this, tc, "chainInitialized, chain: " + this.name);
}
// Clone the list in case one of the event listeners modifies
// the chain during this iteration.
for (ChainEventListener listener : chainEventListeners) {
listener.chainInitialized(this);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(this, tc, "chainInitialized");
}
} | [
"public",
"final",
"void",
"chainInitialized",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"chainInitialized, chain: \"",
"+",
"this",
".",
"name",
")",
";",
"}",
"// Clone the list in case one of the event listeners modifies",
"// the chain during this iteration.",
"for",
"(",
"ChainEventListener",
"listener",
":",
"chainEventListeners",
")",
"{",
"listener",
".",
"chainInitialized",
"(",
"this",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"chainInitialized\"",
")",
";",
"}",
"}"
] | This method is called when the chain has been initialized. It informs
each of the chain event listeners. | [
"This",
"method",
"is",
"called",
"when",
"the",
"chain",
"has",
"been",
"initialized",
".",
"It",
"informs",
"each",
"of",
"the",
"chain",
"event",
"listeners",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChainDataImpl.java#L362-L374 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChainDataImpl.java | ChainDataImpl.chainStartFailed | public final void chainStartFailed(int attemptsMade, int attemptsLeft) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(this, tc, "chainStartFailed, chain: " + this.name);
}
// Clone the list in case one of the event listeners modifies
// the chain during this iteration.
for (ChainEventListener listener : chainEventListeners) {
if (listener instanceof RetryableChainEventListener) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Calling chain retryable chain event listener");
}
((RetryableChainEventListener) listener).chainStartFailed(this, attemptsMade, attemptsLeft);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(this, tc, "chainStartFailed");
}
} | java | public final void chainStartFailed(int attemptsMade, int attemptsLeft) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(this, tc, "chainStartFailed, chain: " + this.name);
}
// Clone the list in case one of the event listeners modifies
// the chain during this iteration.
for (ChainEventListener listener : chainEventListeners) {
if (listener instanceof RetryableChainEventListener) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Calling chain retryable chain event listener");
}
((RetryableChainEventListener) listener).chainStartFailed(this, attemptsMade, attemptsLeft);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(this, tc, "chainStartFailed");
}
} | [
"public",
"final",
"void",
"chainStartFailed",
"(",
"int",
"attemptsMade",
",",
"int",
"attemptsLeft",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"chainStartFailed, chain: \"",
"+",
"this",
".",
"name",
")",
";",
"}",
"// Clone the list in case one of the event listeners modifies",
"// the chain during this iteration.",
"for",
"(",
"ChainEventListener",
"listener",
":",
"chainEventListeners",
")",
"{",
"if",
"(",
"listener",
"instanceof",
"RetryableChainEventListener",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Calling chain retryable chain event listener\"",
")",
";",
"}",
"(",
"(",
"RetryableChainEventListener",
")",
"listener",
")",
".",
"chainStartFailed",
"(",
"this",
",",
"attemptsMade",
",",
"attemptsLeft",
")",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"chainStartFailed\"",
")",
";",
"}",
"}"
] | This method is called when the chain start fails. It informs
each of the chain event listeners.
@param attemptsMade
@param attemptsLeft | [
"This",
"method",
"is",
"called",
"when",
"the",
"chain",
"start",
"fails",
".",
"It",
"informs",
"each",
"of",
"the",
"chain",
"event",
"listeners",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChainDataImpl.java#L401-L418 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChainDataImpl.java | ChainDataImpl.getEndPoint | public CFEndPoint getEndPoint() throws ChannelFrameworkException {
if (null == this.endPoint) {
if (FlowType.INBOUND.equals(this.type)) {
this.endPoint = new CFEndPointImpl(this);
} else {
throw new ChannelFrameworkException(this.name + " is not inbound chain");
}
}
return this.endPoint;
} | java | public CFEndPoint getEndPoint() throws ChannelFrameworkException {
if (null == this.endPoint) {
if (FlowType.INBOUND.equals(this.type)) {
this.endPoint = new CFEndPointImpl(this);
} else {
throw new ChannelFrameworkException(this.name + " is not inbound chain");
}
}
return this.endPoint;
} | [
"public",
"CFEndPoint",
"getEndPoint",
"(",
")",
"throws",
"ChannelFrameworkException",
"{",
"if",
"(",
"null",
"==",
"this",
".",
"endPoint",
")",
"{",
"if",
"(",
"FlowType",
".",
"INBOUND",
".",
"equals",
"(",
"this",
".",
"type",
")",
")",
"{",
"this",
".",
"endPoint",
"=",
"new",
"CFEndPointImpl",
"(",
"this",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"ChannelFrameworkException",
"(",
"this",
".",
"name",
"+",
"\" is not inbound chain\"",
")",
";",
"}",
"}",
"return",
"this",
".",
"endPoint",
";",
"}"
] | Access the possible endpoint representation of this chain. This will
throw an exception if the chain is not inbound.
@return CFEndPoint
@throws ChannelFrameworkException | [
"Access",
"the",
"possible",
"endpoint",
"representation",
"of",
"this",
"chain",
".",
"This",
"will",
"throw",
"an",
"exception",
"if",
"the",
"chain",
"is",
"not",
"inbound",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChainDataImpl.java#L499-L508 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.config.1.1/src/com/ibm/ws/microprofile/config/archaius/composite/PollingDynamicConfig.java | PollingDynamicConfig.getRawProperty | @Trivial
protected String getRawProperty(String key) {
String rawValue = source.getValue(key);
if (rawValue != null) {
current.put(key, rawValue);
}
return rawValue;
} | java | @Trivial
protected String getRawProperty(String key) {
String rawValue = source.getValue(key);
if (rawValue != null) {
current.put(key, rawValue);
}
return rawValue;
} | [
"@",
"Trivial",
"protected",
"String",
"getRawProperty",
"(",
"String",
"key",
")",
"{",
"String",
"rawValue",
"=",
"source",
".",
"getValue",
"(",
"key",
")",
";",
"if",
"(",
"rawValue",
"!=",
"null",
")",
"{",
"current",
".",
"put",
"(",
"key",
",",
"rawValue",
")",
";",
"}",
"return",
"rawValue",
";",
"}"
] | Return the raw, unconverted, String associated with a key.
@param key | [
"Return",
"the",
"raw",
"unconverted",
"String",
"associated",
"with",
"a",
"key",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.config.1.1/src/com/ibm/ws/microprofile/config/archaius/composite/PollingDynamicConfig.java#L242-L249 | train |
OpenLiberty/open-liberty | dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/view/facelets/TagHandler.java | TagHandler.getRequiredAttribute | protected final TagAttribute getRequiredAttribute(String localName) throws TagException
{
TagAttribute attr = this.getAttribute(localName);
if (attr == null)
{
throw new TagException(this.tag, "Attribute '" + localName + "' is required");
}
return attr;
} | java | protected final TagAttribute getRequiredAttribute(String localName) throws TagException
{
TagAttribute attr = this.getAttribute(localName);
if (attr == null)
{
throw new TagException(this.tag, "Attribute '" + localName + "' is required");
}
return attr;
} | [
"protected",
"final",
"TagAttribute",
"getRequiredAttribute",
"(",
"String",
"localName",
")",
"throws",
"TagException",
"{",
"TagAttribute",
"attr",
"=",
"this",
".",
"getAttribute",
"(",
"localName",
")",
";",
"if",
"(",
"attr",
"==",
"null",
")",
"{",
"throw",
"new",
"TagException",
"(",
"this",
".",
"tag",
",",
"\"Attribute '\"",
"+",
"localName",
"+",
"\"' is required\"",
")",
";",
"}",
"return",
"attr",
";",
"}"
] | Utility method for fetching a required TagAttribute
@param localName
name of the attribute
@return TagAttribute if found, otherwise error
@throws TagException
if the attribute was not found | [
"Utility",
"method",
"for",
"fetching",
"a",
"required",
"TagAttribute"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/view/facelets/TagHandler.java#L60-L69 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AbstractDestinationHandler.java | AbstractDestinationHandler.setInputHandler | public void setInputHandler(ProducerInputHandler inputHandler)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "setInputHandler", inputHandler);
this.inputHandler = inputHandler;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "setInputHandler");
} | java | public void setInputHandler(ProducerInputHandler inputHandler)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "setInputHandler", inputHandler);
this.inputHandler = inputHandler;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "setInputHandler");
} | [
"public",
"void",
"setInputHandler",
"(",
"ProducerInputHandler",
"inputHandler",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"setInputHandler\"",
",",
"inputHandler",
")",
";",
"this",
".",
"inputHandler",
"=",
"inputHandler",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"setInputHandler\"",
")",
";",
"}"
] | Sets the inputHandler for this destination.
@param inputHandler | [
"Sets",
"the",
"inputHandler",
"for",
"this",
"destination",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AbstractDestinationHandler.java#L406-L411 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AbstractDestinationHandler.java | AbstractDestinationHandler.setBus | void setBus(String busName)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "setBus", busName);
this.busName = busName;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "setBus");
} | java | void setBus(String busName)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "setBus", busName);
this.busName = busName;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "setBus");
} | [
"void",
"setBus",
"(",
"String",
"busName",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"setBus\"",
",",
"busName",
")",
";",
"this",
".",
"busName",
"=",
"busName",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"setBus\"",
")",
";",
"}"
] | Sets the bus name for this destination.
@param busName | [
"Sets",
"the",
"bus",
"name",
"for",
"this",
"destination",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AbstractDestinationHandler.java#L417-L422 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AbstractDestinationHandler.java | AbstractDestinationHandler.setForeignBusSendAllowed | public void setForeignBusSendAllowed(boolean sendAllowed)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "setForeignBusSendAllowed", Boolean.valueOf(sendAllowed));
}
// Set the flag on this handler
_sendAllowedOnTargetForeignBus = Boolean.valueOf(sendAllowed);
// Tell any destinations that target this destination to refresh their
// sendAllowed setting
if (aliasesThatTargetThisDest != null)
{
synchronized(aliasesThatTargetThisDest)
{
Iterator i = aliasesThatTargetThisDest.iterator();
while (i.hasNext())
{
AbstractAliasDestinationHandler abstractAliasDestinationHandler =
(AbstractAliasDestinationHandler) i.next();
abstractAliasDestinationHandler.setForeignBusSendAllowed(sendAllowed);
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.exit(tc, "setForeignBusSendAllowed");
}
} | java | public void setForeignBusSendAllowed(boolean sendAllowed)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "setForeignBusSendAllowed", Boolean.valueOf(sendAllowed));
}
// Set the flag on this handler
_sendAllowedOnTargetForeignBus = Boolean.valueOf(sendAllowed);
// Tell any destinations that target this destination to refresh their
// sendAllowed setting
if (aliasesThatTargetThisDest != null)
{
synchronized(aliasesThatTargetThisDest)
{
Iterator i = aliasesThatTargetThisDest.iterator();
while (i.hasNext())
{
AbstractAliasDestinationHandler abstractAliasDestinationHandler =
(AbstractAliasDestinationHandler) i.next();
abstractAliasDestinationHandler.setForeignBusSendAllowed(sendAllowed);
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.exit(tc, "setForeignBusSendAllowed");
}
} | [
"public",
"void",
"setForeignBusSendAllowed",
"(",
"boolean",
"sendAllowed",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"setForeignBusSendAllowed\"",
",",
"Boolean",
".",
"valueOf",
"(",
"sendAllowed",
")",
")",
";",
"}",
"// Set the flag on this handler",
"_sendAllowedOnTargetForeignBus",
"=",
"Boolean",
".",
"valueOf",
"(",
"sendAllowed",
")",
";",
"// Tell any destinations that target this destination to refresh their",
"// sendAllowed setting",
"if",
"(",
"aliasesThatTargetThisDest",
"!=",
"null",
")",
"{",
"synchronized",
"(",
"aliasesThatTargetThisDest",
")",
"{",
"Iterator",
"i",
"=",
"aliasesThatTargetThisDest",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"i",
".",
"hasNext",
"(",
")",
")",
"{",
"AbstractAliasDestinationHandler",
"abstractAliasDestinationHandler",
"=",
"(",
"AbstractAliasDestinationHandler",
")",
"i",
".",
"next",
"(",
")",
";",
"abstractAliasDestinationHandler",
".",
"setForeignBusSendAllowed",
"(",
"sendAllowed",
")",
";",
"}",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"setForeignBusSendAllowed\"",
")",
";",
"}",
"}"
] | Set the Foreign Bus Level sendAllowed flag
@param sendAllowed | [
"Set",
"the",
"Foreign",
"Bus",
"Level",
"sendAllowed",
"flag"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AbstractDestinationHandler.java#L651-L680 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.concurrent.mp.1.0/src/com/ibm/ws/concurrent/mp/ManagedCompletableFuture.java | ManagedCompletableFuture.failedFuture | @Trivial
public static <U> CompletableFuture<U> failedFuture(Throwable x) {
throw new UnsupportedOperationException(Tr.formatMessage(tc, "CWWKC1156.not.supported", "ManagedExecutor.failedFuture"));
} | java | @Trivial
public static <U> CompletableFuture<U> failedFuture(Throwable x) {
throw new UnsupportedOperationException(Tr.formatMessage(tc, "CWWKC1156.not.supported", "ManagedExecutor.failedFuture"));
} | [
"@",
"Trivial",
"public",
"static",
"<",
"U",
">",
"CompletableFuture",
"<",
"U",
">",
"failedFuture",
"(",
"Throwable",
"x",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
"Tr",
".",
"formatMessage",
"(",
"tc",
",",
"\"CWWKC1156.not.supported\"",
",",
"\"ManagedExecutor.failedFuture\"",
")",
")",
";",
"}"
] | Because CompletableFuture.failedFuture is static, this is not a true override.
It will be difficult for the user to invoke this method because they would need to get the class
of the CompletableFuture implementation and locate the static failedFuture method on that.
@throws UnsupportedOperationException directing the user to use the ManagedExecutor spec interface instead. | [
"Because",
"CompletableFuture",
".",
"failedFuture",
"is",
"static",
"this",
"is",
"not",
"a",
"true",
"override",
".",
"It",
"will",
"be",
"difficult",
"for",
"the",
"user",
"to",
"invoke",
"this",
"method",
"because",
"they",
"would",
"need",
"to",
"get",
"the",
"class",
"of",
"the",
"CompletableFuture",
"implementation",
"and",
"locate",
"the",
"static",
"failedFuture",
"method",
"on",
"that",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.concurrent.mp.1.0/src/com/ibm/ws/concurrent/mp/ManagedCompletableFuture.java#L354-L357 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.concurrent.mp.1.0/src/com/ibm/ws/concurrent/mp/ManagedCompletableFuture.java | ManagedCompletableFuture.failedStage | @Trivial
public static <U> CompletionStage<U> failedStage(Throwable x) {
throw new UnsupportedOperationException(Tr.formatMessage(tc, "CWWKC1156.not.supported", "ManagedExecutor.failedStage"));
} | java | @Trivial
public static <U> CompletionStage<U> failedStage(Throwable x) {
throw new UnsupportedOperationException(Tr.formatMessage(tc, "CWWKC1156.not.supported", "ManagedExecutor.failedStage"));
} | [
"@",
"Trivial",
"public",
"static",
"<",
"U",
">",
"CompletionStage",
"<",
"U",
">",
"failedStage",
"(",
"Throwable",
"x",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
"Tr",
".",
"formatMessage",
"(",
"tc",
",",
"\"CWWKC1156.not.supported\"",
",",
"\"ManagedExecutor.failedStage\"",
")",
")",
";",
"}"
] | Because CompletableFuture.failedStage is static, this is not a true override.
It will be difficult for the user to invoke this method because they would need to get the class
of the CompletableFuture implementation and locate the static failedStage method on that.
@throws UnsupportedOperationException directing the user to use the ManagedExecutor spec interface instead. | [
"Because",
"CompletableFuture",
".",
"failedStage",
"is",
"static",
"this",
"is",
"not",
"a",
"true",
"override",
".",
"It",
"will",
"be",
"difficult",
"for",
"the",
"user",
"to",
"invoke",
"this",
"method",
"because",
"they",
"would",
"need",
"to",
"get",
"the",
"class",
"of",
"the",
"CompletableFuture",
"implementation",
"and",
"locate",
"the",
"static",
"failedStage",
"method",
"on",
"that",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.concurrent.mp.1.0/src/com/ibm/ws/concurrent/mp/ManagedCompletableFuture.java#L387-L390 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.concurrent.mp.1.0/src/com/ibm/ws/concurrent/mp/ManagedCompletableFuture.java | ManagedCompletableFuture.newIncompleteFuture | public static <T> CompletableFuture<T> newIncompleteFuture(Executor executor) {
if (JAVA8)
return new ManagedCompletableFuture<T>(new CompletableFuture<T>(), executor, null);
else
return new ManagedCompletableFuture<T>(executor, null);
} | java | public static <T> CompletableFuture<T> newIncompleteFuture(Executor executor) {
if (JAVA8)
return new ManagedCompletableFuture<T>(new CompletableFuture<T>(), executor, null);
else
return new ManagedCompletableFuture<T>(executor, null);
} | [
"public",
"static",
"<",
"T",
">",
"CompletableFuture",
"<",
"T",
">",
"newIncompleteFuture",
"(",
"Executor",
"executor",
")",
"{",
"if",
"(",
"JAVA8",
")",
"return",
"new",
"ManagedCompletableFuture",
"<",
"T",
">",
"(",
"new",
"CompletableFuture",
"<",
"T",
">",
"(",
")",
",",
"executor",
",",
"null",
")",
";",
"else",
"return",
"new",
"ManagedCompletableFuture",
"<",
"T",
">",
"(",
"executor",
",",
"null",
")",
";",
"}"
] | Construct a new incomplete CompletableFuture that is backed by the specified executor.
@param executor the default asynchronous execution facility for the new CompletableFuture.
@return incomplete completable future where the specified executor is the default asynchronous execution facility. | [
"Construct",
"a",
"new",
"incomplete",
"CompletableFuture",
"that",
"is",
"backed",
"by",
"the",
"specified",
"executor",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.concurrent.mp.1.0/src/com/ibm/ws/concurrent/mp/ManagedCompletableFuture.java#L424-L429 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.concurrent.mp.1.0/src/com/ibm/ws/concurrent/mp/ManagedCompletableFuture.java | ManagedCompletableFuture.runAsync | @Trivial
public static CompletableFuture<Void> runAsync(Runnable action) {
throw new UnsupportedOperationException(Tr.formatMessage(tc, "CWWKC1156.not.supported", "ManagedExecutor.runAsync"));
} | java | @Trivial
public static CompletableFuture<Void> runAsync(Runnable action) {
throw new UnsupportedOperationException(Tr.formatMessage(tc, "CWWKC1156.not.supported", "ManagedExecutor.runAsync"));
} | [
"@",
"Trivial",
"public",
"static",
"CompletableFuture",
"<",
"Void",
">",
"runAsync",
"(",
"Runnable",
"action",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
"Tr",
".",
"formatMessage",
"(",
"tc",
",",
"\"CWWKC1156.not.supported\"",
",",
"\"ManagedExecutor.runAsync\"",
")",
")",
";",
"}"
] | Because CompletableFuture.runAsync is static, this is not a true override.
It will be difficult for the user to invoke this method because they would need to get the class
of the CompletableFuture implementation and locate the static runAsync method on that.
@throws UnsupportedOperationException directing the user to use the ManagedExecutor spec interface instead. | [
"Because",
"CompletableFuture",
".",
"runAsync",
"is",
"static",
"this",
"is",
"not",
"a",
"true",
"override",
".",
"It",
"will",
"be",
"difficult",
"for",
"the",
"user",
"to",
"invoke",
"this",
"method",
"because",
"they",
"would",
"need",
"to",
"get",
"the",
"class",
"of",
"the",
"CompletableFuture",
"implementation",
"and",
"locate",
"the",
"static",
"runAsync",
"method",
"on",
"that",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.concurrent.mp.1.0/src/com/ibm/ws/concurrent/mp/ManagedCompletableFuture.java#L438-L441 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.concurrent.mp.1.0/src/com/ibm/ws/concurrent/mp/ManagedCompletableFuture.java | ManagedCompletableFuture.supplyAsync | @Trivial
public static <U> CompletableFuture<U> supplyAsync(Supplier<U> action) {
throw new UnsupportedOperationException(Tr.formatMessage(tc, "CWWKC1156.not.supported", "ManagedExecutor.supplyAsync"));
} | java | @Trivial
public static <U> CompletableFuture<U> supplyAsync(Supplier<U> action) {
throw new UnsupportedOperationException(Tr.formatMessage(tc, "CWWKC1156.not.supported", "ManagedExecutor.supplyAsync"));
} | [
"@",
"Trivial",
"public",
"static",
"<",
"U",
">",
"CompletableFuture",
"<",
"U",
">",
"supplyAsync",
"(",
"Supplier",
"<",
"U",
">",
"action",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
"Tr",
".",
"formatMessage",
"(",
"tc",
",",
"\"CWWKC1156.not.supported\"",
",",
"\"ManagedExecutor.supplyAsync\"",
")",
")",
";",
"}"
] | Because CompletableFuture.supplyAsync is static, this is not a true override.
It will be difficult for the user to invoke this method because they would need to get the class
of the CompletableFuture implementation and locate the static supplyAsync method on that.
@throws UnsupportedOperationException directing the user to use the ManagedExecutor spec interface instead. | [
"Because",
"CompletableFuture",
".",
"supplyAsync",
"is",
"static",
"this",
"is",
"not",
"a",
"true",
"override",
".",
"It",
"will",
"be",
"difficult",
"for",
"the",
"user",
"to",
"invoke",
"this",
"method",
"because",
"they",
"would",
"need",
"to",
"get",
"the",
"class",
"of",
"the",
"CompletableFuture",
"implementation",
"and",
"locate",
"the",
"static",
"supplyAsync",
"method",
"on",
"that",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.concurrent.mp.1.0/src/com/ibm/ws/concurrent/mp/ManagedCompletableFuture.java#L490-L493 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.concurrent.mp.1.0/src/com/ibm/ws/concurrent/mp/ManagedCompletableFuture.java | ManagedCompletableFuture.captureThreadContext | private ThreadContextDescriptor captureThreadContext(Executor executor) {
WSManagedExecutorService managedExecutor = defaultExecutor instanceof WSManagedExecutorService //
? (WSManagedExecutorService) defaultExecutor //
: executor != defaultExecutor && executor instanceof WSManagedExecutorService //
? (WSManagedExecutorService) executor //
: null;
if (managedExecutor == null)
return null;
@SuppressWarnings("unchecked")
ThreadContextDescriptor contextDescriptor = managedExecutor.getContextService().captureThreadContext(XPROPS_SUSPEND_TRAN);
return contextDescriptor;
} | java | private ThreadContextDescriptor captureThreadContext(Executor executor) {
WSManagedExecutorService managedExecutor = defaultExecutor instanceof WSManagedExecutorService //
? (WSManagedExecutorService) defaultExecutor //
: executor != defaultExecutor && executor instanceof WSManagedExecutorService //
? (WSManagedExecutorService) executor //
: null;
if (managedExecutor == null)
return null;
@SuppressWarnings("unchecked")
ThreadContextDescriptor contextDescriptor = managedExecutor.getContextService().captureThreadContext(XPROPS_SUSPEND_TRAN);
return contextDescriptor;
} | [
"private",
"ThreadContextDescriptor",
"captureThreadContext",
"(",
"Executor",
"executor",
")",
"{",
"WSManagedExecutorService",
"managedExecutor",
"=",
"defaultExecutor",
"instanceof",
"WSManagedExecutorService",
"//",
"?",
"(",
"WSManagedExecutorService",
")",
"defaultExecutor",
"//",
":",
"executor",
"!=",
"defaultExecutor",
"&&",
"executor",
"instanceof",
"WSManagedExecutorService",
"//",
"?",
"(",
"WSManagedExecutorService",
")",
"executor",
"//",
":",
"null",
";",
"if",
"(",
"managedExecutor",
"==",
"null",
")",
"return",
"null",
";",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"ThreadContextDescriptor",
"contextDescriptor",
"=",
"managedExecutor",
".",
"getContextService",
"(",
")",
".",
"captureThreadContext",
"(",
"XPROPS_SUSPEND_TRAN",
")",
";",
"return",
"contextDescriptor",
";",
"}"
] | Captures thread context, if possible, first based on the default asynchronous execution facility,
otherwise based on the specified executor. If neither of these executors are a managed executor,
then thread context is not captured.
@param executor executor argument that is supplied when creating a dependent stage.
@return captured thread context. NULL neither the default asynchronous execution facility nor the
specified executor support capturing context. | [
"Captures",
"thread",
"context",
"if",
"possible",
"first",
"based",
"on",
"the",
"default",
"asynchronous",
"execution",
"facility",
"otherwise",
"based",
"on",
"the",
"specified",
"executor",
".",
"If",
"neither",
"of",
"these",
"executors",
"are",
"a",
"managed",
"executor",
"then",
"thread",
"context",
"is",
"not",
"captured",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.concurrent.mp.1.0/src/com/ibm/ws/concurrent/mp/ManagedCompletableFuture.java#L698-L711 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.concurrent.mp.1.0/src/com/ibm/ws/concurrent/mp/ManagedCompletableFuture.java | ManagedCompletableFuture.supportsAsync | @Trivial
private final static FutureRefExecutor supportsAsync(Executor executor) {
if (executor instanceof ExecutorService)
return new FutureRefExecutor((ExecutorService) executor); // valid
if (executor instanceof UnusableExecutor)
throw new UnsupportedOperationException(); // not valid for executing tasks
return null; // valid
} | java | @Trivial
private final static FutureRefExecutor supportsAsync(Executor executor) {
if (executor instanceof ExecutorService)
return new FutureRefExecutor((ExecutorService) executor); // valid
if (executor instanceof UnusableExecutor)
throw new UnsupportedOperationException(); // not valid for executing tasks
return null; // valid
} | [
"@",
"Trivial",
"private",
"final",
"static",
"FutureRefExecutor",
"supportsAsync",
"(",
"Executor",
"executor",
")",
"{",
"if",
"(",
"executor",
"instanceof",
"ExecutorService",
")",
"return",
"new",
"FutureRefExecutor",
"(",
"(",
"ExecutorService",
")",
"executor",
")",
";",
"// valid",
"if",
"(",
"executor",
"instanceof",
"UnusableExecutor",
")",
"throw",
"new",
"UnsupportedOperationException",
"(",
")",
";",
"// not valid for executing tasks",
"return",
"null",
";",
"// valid",
"}"
] | Convenience method to validate that an executor supports running asynchronously
and to wrap the executor, if an ExecutorService, with FutureRefExecutor.
This method is named supportsAsync to make failure stacks more meaningful to users.
@param executor executor instance supplied to *Async methods.
@return FutureRefExecutor if an ExecutorService is supplied. Null if a valid executor is supplied.
@throws UnsupportedOperation if the executor is incapable of running tasks. | [
"Convenience",
"method",
"to",
"validate",
"that",
"an",
"executor",
"supports",
"running",
"asynchronously",
"and",
"to",
"wrap",
"the",
"executor",
"if",
"an",
"ExecutorService",
"with",
"FutureRefExecutor",
".",
"This",
"method",
"is",
"named",
"supportsAsync",
"to",
"make",
"failure",
"stacks",
"more",
"meaningful",
"to",
"users",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.concurrent.mp.1.0/src/com/ibm/ws/concurrent/mp/ManagedCompletableFuture.java#L1365-L1372 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.audit.file/src/com/ibm/ws/security/audit/logutils/FileLogUtils.java | FileLogUtils.validateDirectory | static File validateDirectory(final File directory) {
File newDirectory = null;
try {
newDirectory = AccessController.doPrivileged(new java.security.PrivilegedExceptionAction<File>() {
@Override
public File run() throws Exception {
boolean ok = true;
if (!directory.exists())
ok = directory.mkdirs() || directory.exists(); //2nd exists check is necessary to close timing window
if (!ok) {
Tr.error(tc, "UNABLE_TO_DELETE_RESOURCE_NOEX", new Object[] { directory.getAbsolutePath() });
return null;
}
return directory;
}
});
} catch (PrivilegedActionException e) {
Tr.error(tc, "UNABLE_TO_DELETE_RESOURCE", new Object[] { directory.getAbsolutePath(), e });
}
return newDirectory;
} | java | static File validateDirectory(final File directory) {
File newDirectory = null;
try {
newDirectory = AccessController.doPrivileged(new java.security.PrivilegedExceptionAction<File>() {
@Override
public File run() throws Exception {
boolean ok = true;
if (!directory.exists())
ok = directory.mkdirs() || directory.exists(); //2nd exists check is necessary to close timing window
if (!ok) {
Tr.error(tc, "UNABLE_TO_DELETE_RESOURCE_NOEX", new Object[] { directory.getAbsolutePath() });
return null;
}
return directory;
}
});
} catch (PrivilegedActionException e) {
Tr.error(tc, "UNABLE_TO_DELETE_RESOURCE", new Object[] { directory.getAbsolutePath(), e });
}
return newDirectory;
} | [
"static",
"File",
"validateDirectory",
"(",
"final",
"File",
"directory",
")",
"{",
"File",
"newDirectory",
"=",
"null",
";",
"try",
"{",
"newDirectory",
"=",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"java",
".",
"security",
".",
"PrivilegedExceptionAction",
"<",
"File",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"File",
"run",
"(",
")",
"throws",
"Exception",
"{",
"boolean",
"ok",
"=",
"true",
";",
"if",
"(",
"!",
"directory",
".",
"exists",
"(",
")",
")",
"ok",
"=",
"directory",
".",
"mkdirs",
"(",
")",
"||",
"directory",
".",
"exists",
"(",
")",
";",
"//2nd exists check is necessary to close timing window",
"if",
"(",
"!",
"ok",
")",
"{",
"Tr",
".",
"error",
"(",
"tc",
",",
"\"UNABLE_TO_DELETE_RESOURCE_NOEX\"",
",",
"new",
"Object",
"[",
"]",
"{",
"directory",
".",
"getAbsolutePath",
"(",
")",
"}",
")",
";",
"return",
"null",
";",
"}",
"return",
"directory",
";",
"}",
"}",
")",
";",
"}",
"catch",
"(",
"PrivilegedActionException",
"e",
")",
"{",
"Tr",
".",
"error",
"(",
"tc",
",",
"\"UNABLE_TO_DELETE_RESOURCE\"",
",",
"new",
"Object",
"[",
"]",
"{",
"directory",
".",
"getAbsolutePath",
"(",
")",
",",
"e",
"}",
")",
";",
"}",
"return",
"newDirectory",
";",
"}"
] | This method will create the directory if it does not exist,
ensuring the specified location is writable.
@param The new directory location
@return A valid/accessible/created directory or null | [
"This",
"method",
"will",
"create",
"the",
"directory",
"if",
"it",
"does",
"not",
"exist",
"ensuring",
"the",
"specified",
"location",
"is",
"writable",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.audit.file/src/com/ibm/ws/security/audit/logutils/FileLogUtils.java#L88-L113 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.audit.file/src/com/ibm/ws/security/audit/logutils/FileLogUtils.java | FileLogUtils.createNewFile | static File createNewFile(final FileLogSet fileLogSet) {
final File directory = fileLogSet.getDirectory();
final String fileName = fileLogSet.getFileName();
final String fileExtension = fileLogSet.getFileExtension();
File f = null;
try {
f = AccessController.doPrivileged(new java.security.PrivilegedExceptionAction<File>() {
@Override
public File run() throws Exception {
return fileLogSet.createNewFile();
}
});
} catch (PrivilegedActionException e) {
File exf = new File(directory, fileName + fileExtension);
Tr.error(tc, "UNABLE_TO_DELETE_RESOURCE", new Object[] { exf.getAbsolutePath(), e });
}
return f;
} | java | static File createNewFile(final FileLogSet fileLogSet) {
final File directory = fileLogSet.getDirectory();
final String fileName = fileLogSet.getFileName();
final String fileExtension = fileLogSet.getFileExtension();
File f = null;
try {
f = AccessController.doPrivileged(new java.security.PrivilegedExceptionAction<File>() {
@Override
public File run() throws Exception {
return fileLogSet.createNewFile();
}
});
} catch (PrivilegedActionException e) {
File exf = new File(directory, fileName + fileExtension);
Tr.error(tc, "UNABLE_TO_DELETE_RESOURCE", new Object[] { exf.getAbsolutePath(), e });
}
return f;
} | [
"static",
"File",
"createNewFile",
"(",
"final",
"FileLogSet",
"fileLogSet",
")",
"{",
"final",
"File",
"directory",
"=",
"fileLogSet",
".",
"getDirectory",
"(",
")",
";",
"final",
"String",
"fileName",
"=",
"fileLogSet",
".",
"getFileName",
"(",
")",
";",
"final",
"String",
"fileExtension",
"=",
"fileLogSet",
".",
"getFileExtension",
"(",
")",
";",
"File",
"f",
"=",
"null",
";",
"try",
"{",
"f",
"=",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"java",
".",
"security",
".",
"PrivilegedExceptionAction",
"<",
"File",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"File",
"run",
"(",
")",
"throws",
"Exception",
"{",
"return",
"fileLogSet",
".",
"createNewFile",
"(",
")",
";",
"}",
"}",
")",
";",
"}",
"catch",
"(",
"PrivilegedActionException",
"e",
")",
"{",
"File",
"exf",
"=",
"new",
"File",
"(",
"directory",
",",
"fileName",
"+",
"fileExtension",
")",
";",
"Tr",
".",
"error",
"(",
"tc",
",",
"\"UNABLE_TO_DELETE_RESOURCE\"",
",",
"new",
"Object",
"[",
"]",
"{",
"exf",
".",
"getAbsolutePath",
"(",
")",
",",
"e",
"}",
")",
";",
"}",
"return",
"f",
";",
"}"
] | This method will create a new file with the specified name and extension in the specified directory. If a unique file is required then it will add a timestamp to the file
and if necessary a unqiue identifier to the file name.
@return The file or <code>null</code> if an error occurs
@see #getUniqueFile(File, String, String) | [
"This",
"method",
"will",
"create",
"a",
"new",
"file",
"with",
"the",
"specified",
"name",
"and",
"extension",
"in",
"the",
"specified",
"directory",
".",
"If",
"a",
"unique",
"file",
"is",
"required",
"then",
"it",
"will",
"add",
"a",
"timestamp",
"to",
"the",
"file",
"and",
"if",
"necessary",
"a",
"unqiue",
"identifier",
"to",
"the",
"file",
"name",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.audit.file/src/com/ibm/ws/security/audit/logutils/FileLogUtils.java#L122-L141 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.wsoc/src/com/ibm/ws/wsoc/MessageReader.java | MessageReader.releaseBuffers | public void releaseBuffers() {
// release buffers is desired
if (payloadBuffers != null) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "release payload buffers. number to release is: " + payloadCountOfBuffers);
}
// if the payload buffers have been set into here, then release those
for (int i = 0; i < payloadCountOfBuffers; i++) {
payloadBuffers[i].release();
}
// avoid double releasing by resetting these objects and variables
payloadBuffers = null;
payloadCountOfBuffers = 0;
} else {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "release buffers from frame list. number to release is: " + countOfIOFrames);
}
// payload buffers haven't been set into here yet, so release buffers on each frame processor
if (countOfIOFrames > 0) {
for (int i = 0; i < countOfIOFrames; i++) {
fpList[i].releaseBuffers();
}
} else {
frameProcessor.releaseBuffers();
}
}
} | java | public void releaseBuffers() {
// release buffers is desired
if (payloadBuffers != null) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "release payload buffers. number to release is: " + payloadCountOfBuffers);
}
// if the payload buffers have been set into here, then release those
for (int i = 0; i < payloadCountOfBuffers; i++) {
payloadBuffers[i].release();
}
// avoid double releasing by resetting these objects and variables
payloadBuffers = null;
payloadCountOfBuffers = 0;
} else {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "release buffers from frame list. number to release is: " + countOfIOFrames);
}
// payload buffers haven't been set into here yet, so release buffers on each frame processor
if (countOfIOFrames > 0) {
for (int i = 0; i < countOfIOFrames; i++) {
fpList[i].releaseBuffers();
}
} else {
frameProcessor.releaseBuffers();
}
}
} | [
"public",
"void",
"releaseBuffers",
"(",
")",
"{",
"// release buffers is desired",
"if",
"(",
"payloadBuffers",
"!=",
"null",
")",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"release payload buffers. number to release is: \"",
"+",
"payloadCountOfBuffers",
")",
";",
"}",
"// if the payload buffers have been set into here, then release those",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"payloadCountOfBuffers",
";",
"i",
"++",
")",
"{",
"payloadBuffers",
"[",
"i",
"]",
".",
"release",
"(",
")",
";",
"}",
"// avoid double releasing by resetting these objects and variables",
"payloadBuffers",
"=",
"null",
";",
"payloadCountOfBuffers",
"=",
"0",
";",
"}",
"else",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"release buffers from frame list. number to release is: \"",
"+",
"countOfIOFrames",
")",
";",
"}",
"// payload buffers haven't been set into here yet, so release buffers on each frame processor",
"if",
"(",
"countOfIOFrames",
">",
"0",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"countOfIOFrames",
";",
"i",
"++",
")",
"{",
"fpList",
"[",
"i",
"]",
".",
"releaseBuffers",
"(",
")",
";",
"}",
"}",
"else",
"{",
"frameProcessor",
".",
"releaseBuffers",
"(",
")",
";",
"}",
"}",
"}"
] | This is never called, except in an exception case. frame buffers should be cleaned up when reset is called on the FrameReadProcessor | [
"This",
"is",
"never",
"called",
"except",
"in",
"an",
"exception",
"case",
".",
"frame",
"buffers",
"should",
"be",
"cleaned",
"up",
"when",
"reset",
"is",
"called",
"on",
"the",
"FrameReadProcessor"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.wsoc/src/com/ibm/ws/wsoc/MessageReader.java#L275-L301 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/javaee/util/DDUtil.java | DDUtil.methodParamsMatch | public static boolean methodParamsMatch(List<String> typeNames, Class<?>[] types)
{
if (typeNames.size() != types.length)
{
return false;
}
for (int i = 0; i < types.length; i++)
{
String typeName = typeNames.get(i);
int typeNameEnd = typeName.length();
Class<?> type = types[i];
for (; type.isArray(); type = type.getComponentType())
{
if (typeNameEnd < 2 ||
typeName.charAt(--typeNameEnd) != ']' ||
typeName.charAt(--typeNameEnd) != '[')
{
return false;
}
}
if (!type.getName().regionMatches(0, typeName, 0, typeNameEnd))
{
return false;
}
}
return true;
} | java | public static boolean methodParamsMatch(List<String> typeNames, Class<?>[] types)
{
if (typeNames.size() != types.length)
{
return false;
}
for (int i = 0; i < types.length; i++)
{
String typeName = typeNames.get(i);
int typeNameEnd = typeName.length();
Class<?> type = types[i];
for (; type.isArray(); type = type.getComponentType())
{
if (typeNameEnd < 2 ||
typeName.charAt(--typeNameEnd) != ']' ||
typeName.charAt(--typeNameEnd) != '[')
{
return false;
}
}
if (!type.getName().regionMatches(0, typeName, 0, typeNameEnd))
{
return false;
}
}
return true;
} | [
"public",
"static",
"boolean",
"methodParamsMatch",
"(",
"List",
"<",
"String",
">",
"typeNames",
",",
"Class",
"<",
"?",
">",
"[",
"]",
"types",
")",
"{",
"if",
"(",
"typeNames",
".",
"size",
"(",
")",
"!=",
"types",
".",
"length",
")",
"{",
"return",
"false",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"types",
".",
"length",
";",
"i",
"++",
")",
"{",
"String",
"typeName",
"=",
"typeNames",
".",
"get",
"(",
"i",
")",
";",
"int",
"typeNameEnd",
"=",
"typeName",
".",
"length",
"(",
")",
";",
"Class",
"<",
"?",
">",
"type",
"=",
"types",
"[",
"i",
"]",
";",
"for",
"(",
";",
"type",
".",
"isArray",
"(",
")",
";",
"type",
"=",
"type",
".",
"getComponentType",
"(",
")",
")",
"{",
"if",
"(",
"typeNameEnd",
"<",
"2",
"||",
"typeName",
".",
"charAt",
"(",
"--",
"typeNameEnd",
")",
"!=",
"'",
"'",
"||",
"typeName",
".",
"charAt",
"(",
"--",
"typeNameEnd",
")",
"!=",
"'",
"'",
")",
"{",
"return",
"false",
";",
"}",
"}",
"if",
"(",
"!",
"type",
".",
"getName",
"(",
")",
".",
"regionMatches",
"(",
"0",
",",
"typeName",
",",
"0",
",",
"typeNameEnd",
")",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] | Checks if the specified method parameters object matches the specified
method parameter types.
@param parms the method parameters object
@param types the method parameter types
@return true if the object matches the types | [
"Checks",
"if",
"the",
"specified",
"method",
"parameters",
"object",
"matches",
"the",
"specified",
"method",
"parameter",
"types",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/javaee/util/DDUtil.java#L36-L66 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.config/src/com/ibm/ws/config/xml/internal/ConfigExpressionEvaluator.java | ConfigExpressionEvaluator.evaluateExpression | String evaluateExpression(String expr) throws ConfigEvaluatorException {
ConfigExpressionScanner scanner = new ConfigExpressionScanner(expr);
// Expression = Arithmetic | FilterCall
// Arithmetic = Operand [( "+" | "-" | "*" | "/") Operand]*
// Operand = VarName | Long | FunctionCall
// VarName = <Java identifier plus "." after start>
// Long = <[0-9]+ handled by Long.parseLong>
// FunctionCall = FunctionName "(" VarName ")"
// FunctionName = "count"
// FilterCall = "servicePidOrFilter(" VarName ")"
// Parse the first operand (or function name).
if (!parseOperand(expr, scanner, true)) {
return null;
}
if (resultExpr != null) {
return scanner.end() ? resultExpr : null;
}
subtotal = value;
while (!scanner.end()) {
// Parse operator.
ConfigExpressionScanner.NumericOperator op = scanner.scanNumericOperator();
if (op == null) {
return null;
}
if (!parseOperand(expr, scanner, false) || (resultExpr != null)) {
return null;
}
subtotal = op.evaluate(subtotal, value);
}
return String.valueOf(subtotal);
} | java | String evaluateExpression(String expr) throws ConfigEvaluatorException {
ConfigExpressionScanner scanner = new ConfigExpressionScanner(expr);
// Expression = Arithmetic | FilterCall
// Arithmetic = Operand [( "+" | "-" | "*" | "/") Operand]*
// Operand = VarName | Long | FunctionCall
// VarName = <Java identifier plus "." after start>
// Long = <[0-9]+ handled by Long.parseLong>
// FunctionCall = FunctionName "(" VarName ")"
// FunctionName = "count"
// FilterCall = "servicePidOrFilter(" VarName ")"
// Parse the first operand (or function name).
if (!parseOperand(expr, scanner, true)) {
return null;
}
if (resultExpr != null) {
return scanner.end() ? resultExpr : null;
}
subtotal = value;
while (!scanner.end()) {
// Parse operator.
ConfigExpressionScanner.NumericOperator op = scanner.scanNumericOperator();
if (op == null) {
return null;
}
if (!parseOperand(expr, scanner, false) || (resultExpr != null)) {
return null;
}
subtotal = op.evaluate(subtotal, value);
}
return String.valueOf(subtotal);
} | [
"String",
"evaluateExpression",
"(",
"String",
"expr",
")",
"throws",
"ConfigEvaluatorException",
"{",
"ConfigExpressionScanner",
"scanner",
"=",
"new",
"ConfigExpressionScanner",
"(",
"expr",
")",
";",
"// Expression = Arithmetic | FilterCall",
"// Arithmetic = Operand [( \"+\" | \"-\" | \"*\" | \"/\") Operand]*",
"// Operand = VarName | Long | FunctionCall",
"// VarName = <Java identifier plus \".\" after start>",
"// Long = <[0-9]+ handled by Long.parseLong>",
"// FunctionCall = FunctionName \"(\" VarName \")\"",
"// FunctionName = \"count\"",
"// FilterCall = \"servicePidOrFilter(\" VarName \")\"",
"// Parse the first operand (or function name).",
"if",
"(",
"!",
"parseOperand",
"(",
"expr",
",",
"scanner",
",",
"true",
")",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"resultExpr",
"!=",
"null",
")",
"{",
"return",
"scanner",
".",
"end",
"(",
")",
"?",
"resultExpr",
":",
"null",
";",
"}",
"subtotal",
"=",
"value",
";",
"while",
"(",
"!",
"scanner",
".",
"end",
"(",
")",
")",
"{",
"// Parse operator.",
"ConfigExpressionScanner",
".",
"NumericOperator",
"op",
"=",
"scanner",
".",
"scanNumericOperator",
"(",
")",
";",
"if",
"(",
"op",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"!",
"parseOperand",
"(",
"expr",
",",
"scanner",
",",
"false",
")",
"||",
"(",
"resultExpr",
"!=",
"null",
")",
")",
"{",
"return",
"null",
";",
"}",
"subtotal",
"=",
"op",
".",
"evaluate",
"(",
"subtotal",
",",
"value",
")",
";",
"}",
"return",
"String",
".",
"valueOf",
"(",
"subtotal",
")",
";",
"}"
] | Evaluate a variable expression.
@param expr the expression string (for example, "x+0")
@param context
@return the result, or null if the evaluation fails because the string
cannot be parsed, a referenced property does not exist, or some
other detectable errors occurs
@throws ConfigEvaluatorException if getPropertyObject fails
@throws NumberFormatException if a property contains a value that cannot
be parsed as a Long, or a literal with a too large number
@throws ArithmeticException if a division error occurs | [
"Evaluate",
"a",
"variable",
"expression",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.config/src/com/ibm/ws/config/xml/internal/ConfigExpressionEvaluator.java#L51-L89 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.config/src/com/ibm/ws/config/xml/internal/ConfigExpressionEvaluator.java | ConfigExpressionEvaluator.evaluateCountExpression | private int evaluateCountExpression(Object value) {
if (value == null) {
return 0;
}
if (value.getClass().isArray()) {
return Array.getLength(value);
}
if (value instanceof Vector<?>) {
return ((Vector<?>) value).size();
}
return 1;
} | java | private int evaluateCountExpression(Object value) {
if (value == null) {
return 0;
}
if (value.getClass().isArray()) {
return Array.getLength(value);
}
if (value instanceof Vector<?>) {
return ((Vector<?>) value).size();
}
return 1;
} | [
"private",
"int",
"evaluateCountExpression",
"(",
"Object",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"return",
"0",
";",
"}",
"if",
"(",
"value",
".",
"getClass",
"(",
")",
".",
"isArray",
"(",
")",
")",
"{",
"return",
"Array",
".",
"getLength",
"(",
"value",
")",
";",
"}",
"if",
"(",
"value",
"instanceof",
"Vector",
"<",
"?",
">",
")",
"{",
"return",
"(",
"(",
"Vector",
"<",
"?",
">",
")",
"value",
")",
".",
"size",
"(",
")",
";",
"}",
"return",
"1",
";",
"}"
] | Evaluates the count expression function. If the value is null, then 0 is
returned. If the value is an array, the length is returned. If the value
is a vector, the size is returned. Otherwise, 1 is returned.
@param value the value to evaluate
@return the count of the value | [
"Evaluates",
"the",
"count",
"expression",
"function",
".",
"If",
"the",
"value",
"is",
"null",
"then",
"0",
"is",
"returned",
".",
"If",
"the",
"value",
"is",
"an",
"array",
"the",
"length",
"is",
"returned",
".",
"If",
"the",
"value",
"is",
"a",
"vector",
"the",
"size",
"is",
"returned",
".",
"Otherwise",
"1",
"is",
"returned",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.config/src/com/ibm/ws/config/xml/internal/ConfigExpressionEvaluator.java#L189-L200 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/context/servlet/ServletExternalContextImpl.java | ServletExternalContextImpl.getRequestCookieMap | @Override
public Map<String, Object> getRequestCookieMap()
{
if (_requestCookieMap == null)
{
checkHttpServletRequest();
_requestCookieMap = new CookieMap(_httpServletRequest);
}
return _requestCookieMap;
} | java | @Override
public Map<String, Object> getRequestCookieMap()
{
if (_requestCookieMap == null)
{
checkHttpServletRequest();
_requestCookieMap = new CookieMap(_httpServletRequest);
}
return _requestCookieMap;
} | [
"@",
"Override",
"public",
"Map",
"<",
"String",
",",
"Object",
">",
"getRequestCookieMap",
"(",
")",
"{",
"if",
"(",
"_requestCookieMap",
"==",
"null",
")",
"{",
"checkHttpServletRequest",
"(",
")",
";",
"_requestCookieMap",
"=",
"new",
"CookieMap",
"(",
"_httpServletRequest",
")",
";",
"}",
"return",
"_requestCookieMap",
";",
"}"
] | would be more elegant -= Simon Lessard =- | [
"would",
"be",
"more",
"elegant",
"-",
"=",
"Simon",
"Lessard",
"=",
"-"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/context/servlet/ServletExternalContextImpl.java#L298-L308 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/LocalQPConsumerKey.java | LocalQPConsumerKey.getDefaultGetCursor | public LockingCursor getDefaultGetCursor()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getDefaultGetCursor");
LockingCursor cursor = consumerKeyFilter[0].getGetCursor();
if(keyGroup != null)
cursor = keyGroup.getDefaultGetCursor();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getDefaultGetCursor", cursor);
return cursor;
} | java | public LockingCursor getDefaultGetCursor()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getDefaultGetCursor");
LockingCursor cursor = consumerKeyFilter[0].getGetCursor();
if(keyGroup != null)
cursor = keyGroup.getDefaultGetCursor();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getDefaultGetCursor", cursor);
return cursor;
} | [
"public",
"LockingCursor",
"getDefaultGetCursor",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"getDefaultGetCursor\"",
")",
";",
"LockingCursor",
"cursor",
"=",
"consumerKeyFilter",
"[",
"0",
"]",
".",
"getGetCursor",
"(",
")",
";",
"if",
"(",
"keyGroup",
"!=",
"null",
")",
"cursor",
"=",
"keyGroup",
".",
"getDefaultGetCursor",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"getDefaultGetCursor\"",
",",
"cursor",
")",
";",
"return",
"cursor",
";",
"}"
] | Return the getCursor for this consumer. This method is only called in the
case where messages are not classified by XD. | [
"Return",
"the",
"getCursor",
"for",
"this",
"consumer",
".",
"This",
"method",
"is",
"only",
"called",
"in",
"the",
"case",
"where",
"messages",
"are",
"not",
"classified",
"by",
"XD",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/LocalQPConsumerKey.java#L372-L385 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/LocalQPConsumerKey.java | LocalQPConsumerKey.chooseGetCursorIndex | private int chooseGetCursorIndex(int classification)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "chooseGetCursorIndex");
int classIndex = 0;
if(classifyingMessages)
classIndex = consumerSet.chooseGetCursorIndex(classification);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "chooseGetCursorIndex", classIndex);
return classIndex;
} | java | private int chooseGetCursorIndex(int classification)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "chooseGetCursorIndex");
int classIndex = 0;
if(classifyingMessages)
classIndex = consumerSet.chooseGetCursorIndex(classification);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "chooseGetCursorIndex", classIndex);
return classIndex;
} | [
"private",
"int",
"chooseGetCursorIndex",
"(",
"int",
"classification",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"chooseGetCursorIndex\"",
")",
";",
"int",
"classIndex",
"=",
"0",
";",
"if",
"(",
"classifyingMessages",
")",
"classIndex",
"=",
"consumerSet",
".",
"chooseGetCursorIndex",
"(",
"classification",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"chooseGetCursorIndex\"",
",",
"classIndex",
")",
";",
"return",
"classIndex",
";",
"}"
] | Determine the index of the getCursor to use based on the classifications defined
for the ConsumerSet that a consumer belongs to. If SIB is not registered with
XD and no classification is being performed then the default index is returned
Delegates to the consumerSet if non-null, otherwise returns the
default zeroth index.
@param prevClassIndex index used previously
@return | [
"Determine",
"the",
"index",
"of",
"the",
"getCursor",
"to",
"use",
"based",
"on",
"the",
"classifications",
"defined",
"for",
"the",
"ConsumerSet",
"that",
"a",
"consumer",
"belongs",
"to",
".",
"If",
"SIB",
"is",
"not",
"registered",
"with",
"XD",
"and",
"no",
"classification",
"is",
"being",
"performed",
"then",
"the",
"default",
"index",
"is",
"returned"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/LocalQPConsumerKey.java#L473-L487 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/LocalQPConsumerKey.java | LocalQPConsumerKey.detach | public void detach() throws SIResourceException, SINotPossibleInCurrentConfigurationException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "detach");
// Make sure we are not ready
notReady();
// Remove us from any group we are a member of
if(keyGroup != null)
keyGroup.removeMember(this);
// Remove this consumer from the CD's knowledge
consumerDispatcher.detachConsumerPoint(this);
// Cleanly dispose of the getCursor
if(classifyingMessages)
{
// Take the classifications read lock
consumerSet.takeClassificationReadLock();
int numFilters = consumerKeyFilter.length;
for(int i=0;i<numFilters;i++)
consumerKeyFilter[i].detach();
// Free the classifications read lock
consumerSet.freeClassificationReadLock();
}
else
consumerKeyFilter[0].detach();
synchronized (this)
{
detached = true;
}
// Remove the consumerPoint to the consumerSet if the latter has been specified
if(classifyingMessages)
consumerSet.removeConsumer(consumerPoint);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "detach");
} | java | public void detach() throws SIResourceException, SINotPossibleInCurrentConfigurationException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "detach");
// Make sure we are not ready
notReady();
// Remove us from any group we are a member of
if(keyGroup != null)
keyGroup.removeMember(this);
// Remove this consumer from the CD's knowledge
consumerDispatcher.detachConsumerPoint(this);
// Cleanly dispose of the getCursor
if(classifyingMessages)
{
// Take the classifications read lock
consumerSet.takeClassificationReadLock();
int numFilters = consumerKeyFilter.length;
for(int i=0;i<numFilters;i++)
consumerKeyFilter[i].detach();
// Free the classifications read lock
consumerSet.freeClassificationReadLock();
}
else
consumerKeyFilter[0].detach();
synchronized (this)
{
detached = true;
}
// Remove the consumerPoint to the consumerSet if the latter has been specified
if(classifyingMessages)
consumerSet.removeConsumer(consumerPoint);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "detach");
} | [
"public",
"void",
"detach",
"(",
")",
"throws",
"SIResourceException",
",",
"SINotPossibleInCurrentConfigurationException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"detach\"",
")",
";",
"// Make sure we are not ready",
"notReady",
"(",
")",
";",
"// Remove us from any group we are a member of",
"if",
"(",
"keyGroup",
"!=",
"null",
")",
"keyGroup",
".",
"removeMember",
"(",
"this",
")",
";",
"// Remove this consumer from the CD's knowledge",
"consumerDispatcher",
".",
"detachConsumerPoint",
"(",
"this",
")",
";",
"// Cleanly dispose of the getCursor",
"if",
"(",
"classifyingMessages",
")",
"{",
"// Take the classifications read lock",
"consumerSet",
".",
"takeClassificationReadLock",
"(",
")",
";",
"int",
"numFilters",
"=",
"consumerKeyFilter",
".",
"length",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"numFilters",
";",
"i",
"++",
")",
"consumerKeyFilter",
"[",
"i",
"]",
".",
"detach",
"(",
")",
";",
"// Free the classifications read lock",
"consumerSet",
".",
"freeClassificationReadLock",
"(",
")",
";",
"}",
"else",
"consumerKeyFilter",
"[",
"0",
"]",
".",
"detach",
"(",
")",
";",
"synchronized",
"(",
"this",
")",
"{",
"detached",
"=",
"true",
";",
"}",
"// Remove the consumerPoint to the consumerSet if the latter has been specified",
"if",
"(",
"classifyingMessages",
")",
"consumerSet",
".",
"removeConsumer",
"(",
"consumerPoint",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"detach\"",
")",
";",
"}"
] | Detach this consumer | [
"Detach",
"this",
"consumer"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/LocalQPConsumerKey.java#L492-L534 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/LocalQPConsumerKey.java | LocalQPConsumerKey.getConnectionUuid | public SIBUuid12 getConnectionUuid()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "getConnectionUuid");
SibTr.exit(tc, "getConnectionUuid", connectionUuid);
}
return connectionUuid;
} | java | public SIBUuid12 getConnectionUuid()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "getConnectionUuid");
SibTr.exit(tc, "getConnectionUuid", connectionUuid);
}
return connectionUuid;
} | [
"public",
"SIBUuid12",
"getConnectionUuid",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"getConnectionUuid\"",
")",
";",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"getConnectionUuid\"",
",",
"connectionUuid",
")",
";",
"}",
"return",
"connectionUuid",
";",
"}"
] | Return the consumer's connection Uuid | [
"Return",
"the",
"consumer",
"s",
"connection",
"Uuid"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/LocalQPConsumerKey.java#L539-L547 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/LocalQPConsumerKey.java | LocalQPConsumerKey.requiresRecovery | public boolean requiresRecovery(SIMPMessage msg)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "requiresRecovery", new Object[] { msg });
boolean recoverable;
Reliability msgReliability = msg.getReliability();
recoverable = msgReliability.compareTo(unrecoverability) > 0;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "requiresRecovery", Boolean.valueOf(recoverable));
return recoverable;
} | java | public boolean requiresRecovery(SIMPMessage msg)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "requiresRecovery", new Object[] { msg });
boolean recoverable;
Reliability msgReliability = msg.getReliability();
recoverable = msgReliability.compareTo(unrecoverability) > 0;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "requiresRecovery", Boolean.valueOf(recoverable));
return recoverable;
} | [
"public",
"boolean",
"requiresRecovery",
"(",
"SIMPMessage",
"msg",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"requiresRecovery\"",
",",
"new",
"Object",
"[",
"]",
"{",
"msg",
"}",
")",
";",
"boolean",
"recoverable",
";",
"Reliability",
"msgReliability",
"=",
"msg",
".",
"getReliability",
"(",
")",
";",
"recoverable",
"=",
"msgReliability",
".",
"compareTo",
"(",
"unrecoverability",
")",
">",
"0",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"requiresRecovery\"",
",",
"Boolean",
".",
"valueOf",
"(",
"recoverable",
")",
")",
";",
"return",
"recoverable",
";",
"}"
] | Determine if this consumer will require this message to be recoverable
@param msg message to be delivered
@return true if recovery is required
@throws SIStoreException | [
"Determine",
"if",
"this",
"consumer",
"will",
"require",
"this",
"message",
"to",
"be",
"recoverable"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/LocalQPConsumerKey.java#L568-L582 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/LocalQPConsumerKey.java | LocalQPConsumerKey.markNotReady | public void markNotReady()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "markNotReady");
ready = false;
if(keyGroup != null)
keyGroup.markNotReady();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "markNotReady");
} | java | public void markNotReady()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "markNotReady");
ready = false;
if(keyGroup != null)
keyGroup.markNotReady();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "markNotReady");
} | [
"public",
"void",
"markNotReady",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"markNotReady\"",
")",
";",
"ready",
"=",
"false",
";",
"if",
"(",
"keyGroup",
"!=",
"null",
")",
"keyGroup",
".",
"markNotReady",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"markNotReady\"",
")",
";",
"}"
] | Make this key not ready | [
"Make",
"this",
"key",
"not",
"ready"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/LocalQPConsumerKey.java#L678-L690 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/LocalQPConsumerKey.java | LocalQPConsumerKey.getParent | public JSConsumerKey getParent()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getParent");
JSConsumerKey key = this;
if(keyGroup != null)
key = keyGroup;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getParent", key);
return key;
} | java | public JSConsumerKey getParent()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getParent");
JSConsumerKey key = this;
if(keyGroup != null)
key = keyGroup;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getParent", key);
return key;
} | [
"public",
"JSConsumerKey",
"getParent",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"getParent\"",
")",
";",
"JSConsumerKey",
"key",
"=",
"this",
";",
"if",
"(",
"keyGroup",
"!=",
"null",
")",
"key",
"=",
"keyGroup",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"getParent\"",
",",
"key",
")",
";",
"return",
"key",
";",
"}"
] | Return this key's parent if it is a member of a keyGroup | [
"Return",
"this",
"key",
"s",
"parent",
"if",
"it",
"is",
"a",
"member",
"of",
"a",
"keyGroup"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/LocalQPConsumerKey.java#L787-L800 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/LocalQPConsumerKey.java | LocalQPConsumerKey.start | public void start()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "start");
if(!started)
{
started = true;
if(keyGroup != null)
keyGroup.startMember();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "start");
} | java | public void start()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "start");
if(!started)
{
started = true;
if(keyGroup != null)
keyGroup.startMember();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "start");
} | [
"public",
"void",
"start",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"start\"",
")",
";",
"if",
"(",
"!",
"started",
")",
"{",
"started",
"=",
"true",
";",
"if",
"(",
"keyGroup",
"!=",
"null",
")",
"keyGroup",
".",
"startMember",
"(",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"start\"",
")",
";",
"}"
] | The ConsumerKey doesn't actually care if the consumer is started but its
ConsumerKey does | [
"The",
"ConsumerKey",
"doesn",
"t",
"actually",
"care",
"if",
"the",
"consumer",
"is",
"started",
"but",
"its",
"ConsumerKey",
"does"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/LocalQPConsumerKey.java#L806-L820 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/LocalQPConsumerKey.java | LocalQPConsumerKey.stop | public void stop()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "stop");
if(started)
{
started = false;
if(keyGroup != null)
keyGroup.stopMember();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "stop");
} | java | public void stop()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "stop");
if(started)
{
started = false;
if(keyGroup != null)
keyGroup.stopMember();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "stop");
} | [
"public",
"void",
"stop",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"stop\"",
")",
";",
"if",
"(",
"started",
")",
"{",
"started",
"=",
"false",
";",
"if",
"(",
"keyGroup",
"!=",
"null",
")",
"keyGroup",
".",
"stopMember",
"(",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"stop\"",
")",
";",
"}"
] | The ConsumerKey doesn't actually care if the consumer is stopped but its
ConsumerKey does | [
"The",
"ConsumerKey",
"doesn",
"t",
"actually",
"care",
"if",
"the",
"consumer",
"is",
"stopped",
"but",
"its",
"ConsumerKey",
"does"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/LocalQPConsumerKey.java#L826-L840 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/LocalQPConsumerKey.java | LocalQPConsumerKey.createNewFiltersAndCursors | private void createNewFiltersAndCursors(ItemStream itemStream)
throws SIResourceException, MessageStoreException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "createNewFiltersAndCursors", itemStream);
LockingCursor cursor = null;
// Instantiate a new array of Filters and associated cursors. If there is
// no message classification, then we'll instantiate a single filter and
// cursor pair.
if(classifyingMessages)
{
// Classifying messages for XD.
// this work should be done under the classifications readlock acquired higher
// up in the stack
JSConsumerClassifications classifications = consumerSet.getClassifications();
int numClasses = classifications.getNumberOfClasses();
consumerKeyFilter = new LocalQPConsumerKeyFilter[numClasses+1];
for(int i=0;i<numClasses+1;i++)
{
String classificationName = null;
// The zeroth filter belongs to the default classification, which has a
// null classification name
if(i > 0)
classificationName = classifications.getClassification(i);
consumerKeyFilter[i] = new LocalQPConsumerKeyFilter(this, i, classificationName);
cursor = itemStream.newLockingItemCursor(consumerKeyFilter[i], !forwardScanning);
consumerKeyFilter[i].setLockingCursor(cursor);
}
}
else
{
// No message classification
consumerKeyFilter = new LocalQPConsumerKeyFilter[1];
consumerKeyFilter[0] = new LocalQPConsumerKeyFilter(this, 0, null);
cursor = itemStream.newLockingItemCursor(consumerKeyFilter[0], !forwardScanning);
consumerKeyFilter[0].setLockingCursor(cursor);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "createNewFiltersAndCursors");
} | java | private void createNewFiltersAndCursors(ItemStream itemStream)
throws SIResourceException, MessageStoreException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "createNewFiltersAndCursors", itemStream);
LockingCursor cursor = null;
// Instantiate a new array of Filters and associated cursors. If there is
// no message classification, then we'll instantiate a single filter and
// cursor pair.
if(classifyingMessages)
{
// Classifying messages for XD.
// this work should be done under the classifications readlock acquired higher
// up in the stack
JSConsumerClassifications classifications = consumerSet.getClassifications();
int numClasses = classifications.getNumberOfClasses();
consumerKeyFilter = new LocalQPConsumerKeyFilter[numClasses+1];
for(int i=0;i<numClasses+1;i++)
{
String classificationName = null;
// The zeroth filter belongs to the default classification, which has a
// null classification name
if(i > 0)
classificationName = classifications.getClassification(i);
consumerKeyFilter[i] = new LocalQPConsumerKeyFilter(this, i, classificationName);
cursor = itemStream.newLockingItemCursor(consumerKeyFilter[i], !forwardScanning);
consumerKeyFilter[i].setLockingCursor(cursor);
}
}
else
{
// No message classification
consumerKeyFilter = new LocalQPConsumerKeyFilter[1];
consumerKeyFilter[0] = new LocalQPConsumerKeyFilter(this, 0, null);
cursor = itemStream.newLockingItemCursor(consumerKeyFilter[0], !forwardScanning);
consumerKeyFilter[0].setLockingCursor(cursor);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "createNewFiltersAndCursors");
} | [
"private",
"void",
"createNewFiltersAndCursors",
"(",
"ItemStream",
"itemStream",
")",
"throws",
"SIResourceException",
",",
"MessageStoreException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"createNewFiltersAndCursors\"",
",",
"itemStream",
")",
";",
"LockingCursor",
"cursor",
"=",
"null",
";",
"// Instantiate a new array of Filters and associated cursors. If there is",
"// no message classification, then we'll instantiate a single filter and ",
"// cursor pair.",
"if",
"(",
"classifyingMessages",
")",
"{",
"// Classifying messages for XD.",
"// this work should be done under the classifications readlock acquired higher",
"// up in the stack",
"JSConsumerClassifications",
"classifications",
"=",
"consumerSet",
".",
"getClassifications",
"(",
")",
";",
"int",
"numClasses",
"=",
"classifications",
".",
"getNumberOfClasses",
"(",
")",
";",
"consumerKeyFilter",
"=",
"new",
"LocalQPConsumerKeyFilter",
"[",
"numClasses",
"+",
"1",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"numClasses",
"+",
"1",
";",
"i",
"++",
")",
"{",
"String",
"classificationName",
"=",
"null",
";",
"// The zeroth filter belongs to the default classification, which has a ",
"// null classification name",
"if",
"(",
"i",
">",
"0",
")",
"classificationName",
"=",
"classifications",
".",
"getClassification",
"(",
"i",
")",
";",
"consumerKeyFilter",
"[",
"i",
"]",
"=",
"new",
"LocalQPConsumerKeyFilter",
"(",
"this",
",",
"i",
",",
"classificationName",
")",
";",
"cursor",
"=",
"itemStream",
".",
"newLockingItemCursor",
"(",
"consumerKeyFilter",
"[",
"i",
"]",
",",
"!",
"forwardScanning",
")",
";",
"consumerKeyFilter",
"[",
"i",
"]",
".",
"setLockingCursor",
"(",
"cursor",
")",
";",
"}",
"}",
"else",
"{",
"// No message classification",
"consumerKeyFilter",
"=",
"new",
"LocalQPConsumerKeyFilter",
"[",
"1",
"]",
";",
"consumerKeyFilter",
"[",
"0",
"]",
"=",
"new",
"LocalQPConsumerKeyFilter",
"(",
"this",
",",
"0",
",",
"null",
")",
";",
"cursor",
"=",
"itemStream",
".",
"newLockingItemCursor",
"(",
"consumerKeyFilter",
"[",
"0",
"]",
",",
"!",
"forwardScanning",
")",
";",
"consumerKeyFilter",
"[",
"0",
"]",
".",
"setLockingCursor",
"(",
"cursor",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"createNewFiltersAndCursors\"",
")",
";",
"}"
] | Create the filters and cursors for this Key. If XD has registered a
MessageController we'll need a cursor-filter pair for each classification.
@throws SIResourceException
@throws MessageStoreException | [
"Create",
"the",
"filters",
"and",
"cursors",
"for",
"this",
"Key",
".",
"If",
"XD",
"has",
"registered",
"a",
"MessageController",
"we",
"ll",
"need",
"a",
"cursor",
"-",
"filter",
"pair",
"for",
"each",
"classification",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/LocalQPConsumerKey.java#L972-L1014 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsFactoryFactoryImpl.java | JmsFactoryFactoryImpl.createConnectionFactory | @Override
public JmsConnectionFactory createConnectionFactory() throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "createConnectionFactory");
JmsConnectionFactory jmscf = null;
// get a jca managed connection factory, which is used to construct
// the jms connection factory.
JmsJcaFactory jcaFact = JmsJcaFactory.getInstance();
if (jcaFact == null) {
// This indicates that the jmsra.impl class could not be loaded by their
// static initializer. Nothing we can do about that...
// d238447 FFDC review. FFDC has already been generated by JmsJcaFactory, so
// don't generate one here.
throw (JMSException) JmsErrorUtils.newThrowable(
JMSException.class,
"UNABLE_TO_CREATE_FACTORY_CWSIA0008",
new Object[] { "JmsJcaFactoryImpl", "sib.api.jmsraOutboundImpl.jar" },
tc
);
}
JmsJcaManagedConnectionFactory jcamcf = jcaFact.createManagedConnectionFactory();
// invoke the construction of a jms connection factory - the jca managed
// connection factory will call back into the jms api code by getting a
// JmsRAFactoryFactory, and calling a create jms connection factory
// method on it with jca connection factory and jca managed connection
// factory objects as parameters (the jms cf will keep references to the
// jca cf and jca mcf).
try {
jmscf = (JmsConnectionFactory) jcamcf.createConnectionFactory();
} catch (ResourceException re) {
// No FFDC code needed
// d222942 review - no documentation for when a RE will be thrown, so
// default exception ok. (A quick look at the RA suggests the exception isn't
// ever thrown).
// d238447 FFDC review. From the above comment, generating an FFDC seems ok.
throw (JMSException) JmsErrorUtils.newThrowable(
JMSException.class,
"EXCEPTION_RECEIVED_CWSIA0007",
new Object[] { re, "JmsFactoryFactoryImpl.createConnectionFactory (#2)" },
re,
"JmsFactoryFactoryImpl.createConnectionFactory#2",
this,
tc
);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "createConnectionFactory", jmscf);
return jmscf;
} | java | @Override
public JmsConnectionFactory createConnectionFactory() throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "createConnectionFactory");
JmsConnectionFactory jmscf = null;
// get a jca managed connection factory, which is used to construct
// the jms connection factory.
JmsJcaFactory jcaFact = JmsJcaFactory.getInstance();
if (jcaFact == null) {
// This indicates that the jmsra.impl class could not be loaded by their
// static initializer. Nothing we can do about that...
// d238447 FFDC review. FFDC has already been generated by JmsJcaFactory, so
// don't generate one here.
throw (JMSException) JmsErrorUtils.newThrowable(
JMSException.class,
"UNABLE_TO_CREATE_FACTORY_CWSIA0008",
new Object[] { "JmsJcaFactoryImpl", "sib.api.jmsraOutboundImpl.jar" },
tc
);
}
JmsJcaManagedConnectionFactory jcamcf = jcaFact.createManagedConnectionFactory();
// invoke the construction of a jms connection factory - the jca managed
// connection factory will call back into the jms api code by getting a
// JmsRAFactoryFactory, and calling a create jms connection factory
// method on it with jca connection factory and jca managed connection
// factory objects as parameters (the jms cf will keep references to the
// jca cf and jca mcf).
try {
jmscf = (JmsConnectionFactory) jcamcf.createConnectionFactory();
} catch (ResourceException re) {
// No FFDC code needed
// d222942 review - no documentation for when a RE will be thrown, so
// default exception ok. (A quick look at the RA suggests the exception isn't
// ever thrown).
// d238447 FFDC review. From the above comment, generating an FFDC seems ok.
throw (JMSException) JmsErrorUtils.newThrowable(
JMSException.class,
"EXCEPTION_RECEIVED_CWSIA0007",
new Object[] { re, "JmsFactoryFactoryImpl.createConnectionFactory (#2)" },
re,
"JmsFactoryFactoryImpl.createConnectionFactory#2",
this,
tc
);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "createConnectionFactory", jmscf);
return jmscf;
} | [
"@",
"Override",
"public",
"JmsConnectionFactory",
"createConnectionFactory",
"(",
")",
"throws",
"JMSException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"createConnectionFactory\"",
")",
";",
"JmsConnectionFactory",
"jmscf",
"=",
"null",
";",
"// get a jca managed connection factory, which is used to construct",
"// the jms connection factory.",
"JmsJcaFactory",
"jcaFact",
"=",
"JmsJcaFactory",
".",
"getInstance",
"(",
")",
";",
"if",
"(",
"jcaFact",
"==",
"null",
")",
"{",
"// This indicates that the jmsra.impl class could not be loaded by their",
"// static initializer. Nothing we can do about that...",
"// d238447 FFDC review. FFDC has already been generated by JmsJcaFactory, so",
"// don't generate one here.",
"throw",
"(",
"JMSException",
")",
"JmsErrorUtils",
".",
"newThrowable",
"(",
"JMSException",
".",
"class",
",",
"\"UNABLE_TO_CREATE_FACTORY_CWSIA0008\"",
",",
"new",
"Object",
"[",
"]",
"{",
"\"JmsJcaFactoryImpl\"",
",",
"\"sib.api.jmsraOutboundImpl.jar\"",
"}",
",",
"tc",
")",
";",
"}",
"JmsJcaManagedConnectionFactory",
"jcamcf",
"=",
"jcaFact",
".",
"createManagedConnectionFactory",
"(",
")",
";",
"// invoke the construction of a jms connection factory - the jca managed",
"// connection factory will call back into the jms api code by getting a",
"// JmsRAFactoryFactory, and calling a create jms connection factory",
"// method on it with jca connection factory and jca managed connection",
"// factory objects as parameters (the jms cf will keep references to the",
"// jca cf and jca mcf).",
"try",
"{",
"jmscf",
"=",
"(",
"JmsConnectionFactory",
")",
"jcamcf",
".",
"createConnectionFactory",
"(",
")",
";",
"}",
"catch",
"(",
"ResourceException",
"re",
")",
"{",
"// No FFDC code needed",
"// d222942 review - no documentation for when a RE will be thrown, so",
"// default exception ok. (A quick look at the RA suggests the exception isn't",
"// ever thrown).",
"// d238447 FFDC review. From the above comment, generating an FFDC seems ok.",
"throw",
"(",
"JMSException",
")",
"JmsErrorUtils",
".",
"newThrowable",
"(",
"JMSException",
".",
"class",
",",
"\"EXCEPTION_RECEIVED_CWSIA0007\"",
",",
"new",
"Object",
"[",
"]",
"{",
"re",
",",
"\"JmsFactoryFactoryImpl.createConnectionFactory (#2)\"",
"}",
",",
"re",
",",
"\"JmsFactoryFactoryImpl.createConnectionFactory#2\"",
",",
"this",
",",
"tc",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"createConnectionFactory\"",
",",
"jmscf",
")",
";",
"return",
"jmscf",
";",
"}"
] | This method is called by the application to retrieve its first
ConnectionFactory object. | [
"This",
"method",
"is",
"called",
"by",
"the",
"application",
"to",
"retrieve",
"its",
"first",
"ConnectionFactory",
"object",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsFactoryFactoryImpl.java#L78-L132 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsFactoryFactoryImpl.java | JmsFactoryFactoryImpl.createQueueConnectionFactory | @Override
public JmsQueueConnectionFactory createQueueConnectionFactory() throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "createQueueConnectionFactory");
JmsQueueConnectionFactory jmsqcf = null;
// get a jca managed queue connection factory, which is used to construct
// the jms queue connection factory.
JmsJcaManagedQueueConnectionFactory jcamqcf = JmsJcaFactory.getInstance().createManagedQueueConnectionFactory();
// invoke the construction of a jms queue connection factory - the jca
// managed queue connection factory will call back into the jms api code
// by getting a JmsRAFactoryFactory, and calling a create jms queue
// connection factory method on it with jca connection factory and jca
// managed queue connection factory objects as parameters (the jms qcf
// will keep references to the jca cf and jca mqcf).
try {
jmsqcf = (JmsQueueConnectionFactory) jcamqcf.createConnectionFactory();
} catch (ResourceException re) {
// No FFDC code needed
// d222942 review - no documentation for when a RE will be thrown, so
// default exception ok. (A quick look at the RA suggests the exception isn't
// ever thrown).
// d238447 FFDC review. Comment above suggests an FFDC ok for this case.
throw (JMSException) JmsErrorUtils.newThrowable(
JMSException.class,
"EXCEPTION_RECEIVED_CWSIA0007",
new Object[] { re, "JmsFactoryFactoryImpl.createQueueConnectionFactory (#1)" },
re,
"JmsFactoryFactoryImpl.createQueueConnectionFactory#1",
this,
tc
);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "createQueueConnectionFactory", jmsqcf);
return jmsqcf;
} | java | @Override
public JmsQueueConnectionFactory createQueueConnectionFactory() throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "createQueueConnectionFactory");
JmsQueueConnectionFactory jmsqcf = null;
// get a jca managed queue connection factory, which is used to construct
// the jms queue connection factory.
JmsJcaManagedQueueConnectionFactory jcamqcf = JmsJcaFactory.getInstance().createManagedQueueConnectionFactory();
// invoke the construction of a jms queue connection factory - the jca
// managed queue connection factory will call back into the jms api code
// by getting a JmsRAFactoryFactory, and calling a create jms queue
// connection factory method on it with jca connection factory and jca
// managed queue connection factory objects as parameters (the jms qcf
// will keep references to the jca cf and jca mqcf).
try {
jmsqcf = (JmsQueueConnectionFactory) jcamqcf.createConnectionFactory();
} catch (ResourceException re) {
// No FFDC code needed
// d222942 review - no documentation for when a RE will be thrown, so
// default exception ok. (A quick look at the RA suggests the exception isn't
// ever thrown).
// d238447 FFDC review. Comment above suggests an FFDC ok for this case.
throw (JMSException) JmsErrorUtils.newThrowable(
JMSException.class,
"EXCEPTION_RECEIVED_CWSIA0007",
new Object[] { re, "JmsFactoryFactoryImpl.createQueueConnectionFactory (#1)" },
re,
"JmsFactoryFactoryImpl.createQueueConnectionFactory#1",
this,
tc
);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "createQueueConnectionFactory", jmsqcf);
return jmsqcf;
} | [
"@",
"Override",
"public",
"JmsQueueConnectionFactory",
"createQueueConnectionFactory",
"(",
")",
"throws",
"JMSException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"createQueueConnectionFactory\"",
")",
";",
"JmsQueueConnectionFactory",
"jmsqcf",
"=",
"null",
";",
"// get a jca managed queue connection factory, which is used to construct",
"// the jms queue connection factory.",
"JmsJcaManagedQueueConnectionFactory",
"jcamqcf",
"=",
"JmsJcaFactory",
".",
"getInstance",
"(",
")",
".",
"createManagedQueueConnectionFactory",
"(",
")",
";",
"// invoke the construction of a jms queue connection factory - the jca",
"// managed queue connection factory will call back into the jms api code",
"// by getting a JmsRAFactoryFactory, and calling a create jms queue",
"// connection factory method on it with jca connection factory and jca",
"// managed queue connection factory objects as parameters (the jms qcf",
"// will keep references to the jca cf and jca mqcf).",
"try",
"{",
"jmsqcf",
"=",
"(",
"JmsQueueConnectionFactory",
")",
"jcamqcf",
".",
"createConnectionFactory",
"(",
")",
";",
"}",
"catch",
"(",
"ResourceException",
"re",
")",
"{",
"// No FFDC code needed",
"// d222942 review - no documentation for when a RE will be thrown, so",
"// default exception ok. (A quick look at the RA suggests the exception isn't",
"// ever thrown).",
"// d238447 FFDC review. Comment above suggests an FFDC ok for this case.",
"throw",
"(",
"JMSException",
")",
"JmsErrorUtils",
".",
"newThrowable",
"(",
"JMSException",
".",
"class",
",",
"\"EXCEPTION_RECEIVED_CWSIA0007\"",
",",
"new",
"Object",
"[",
"]",
"{",
"re",
",",
"\"JmsFactoryFactoryImpl.createQueueConnectionFactory (#1)\"",
"}",
",",
"re",
",",
"\"JmsFactoryFactoryImpl.createQueueConnectionFactory#1\"",
",",
"this",
",",
"tc",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"createQueueConnectionFactory\"",
",",
"jmsqcf",
")",
";",
"return",
"jmsqcf",
";",
"}"
] | This method is called by the application to retrieve its first
QueueConnectionFactory object. | [
"This",
"method",
"is",
"called",
"by",
"the",
"application",
"to",
"retrieve",
"its",
"first",
"QueueConnectionFactory",
"object",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsFactoryFactoryImpl.java#L138-L176 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsFactoryFactoryImpl.java | JmsFactoryFactoryImpl.createTopicConnectionFactory | @Override
public JmsTopicConnectionFactory createTopicConnectionFactory() throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "createTopicConnectionFactory");
JmsTopicConnectionFactory jmstcf = null;
// get a jca managed topic connection factory, which is used to construct
// the jms topic connection factory.
JmsJcaManagedTopicConnectionFactory jcamtcf = JmsJcaFactory.getInstance().createManagedTopicConnectionFactory();
// invoke the construction of a jms topic connection factory - the jca
// managed topic connection factory will call back into the jms api code
// by getting a JmsRAFactoryFactory, and calling a create jms topic
// connection factory method on it with jca connection factory and jca
// managed topic connection factory objects as parameters (and the jms
// tcf will keep references to the jca cf and jca mtcf).
try {
jmstcf = (JmsTopicConnectionFactory) jcamtcf.createConnectionFactory();
} catch (ResourceException re) {
// No FFDC code needed
// d222942 review - no documentation for when a RE will be thrown, so
// default exception ok. (A quick look at the RA suggests the exception isn't
// ever thrown).
// d238447 FFDC review. Comment above suggests FFDC ok.
throw (JMSException) JmsErrorUtils.newThrowable(
JMSException.class,
"EXCEPTION_RECEIVED_CWSIA0007",
new Object[] { re, "JmsFactoryFactoryImpl.createTopicConnectionFactory (#1)" },
re,
"JmsFactoryFactoryImpl.createTopicConnectionFactory#1",
this,
tc
);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "createTopicConnectionFactory", jmstcf);
return jmstcf;
} | java | @Override
public JmsTopicConnectionFactory createTopicConnectionFactory() throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "createTopicConnectionFactory");
JmsTopicConnectionFactory jmstcf = null;
// get a jca managed topic connection factory, which is used to construct
// the jms topic connection factory.
JmsJcaManagedTopicConnectionFactory jcamtcf = JmsJcaFactory.getInstance().createManagedTopicConnectionFactory();
// invoke the construction of a jms topic connection factory - the jca
// managed topic connection factory will call back into the jms api code
// by getting a JmsRAFactoryFactory, and calling a create jms topic
// connection factory method on it with jca connection factory and jca
// managed topic connection factory objects as parameters (and the jms
// tcf will keep references to the jca cf and jca mtcf).
try {
jmstcf = (JmsTopicConnectionFactory) jcamtcf.createConnectionFactory();
} catch (ResourceException re) {
// No FFDC code needed
// d222942 review - no documentation for when a RE will be thrown, so
// default exception ok. (A quick look at the RA suggests the exception isn't
// ever thrown).
// d238447 FFDC review. Comment above suggests FFDC ok.
throw (JMSException) JmsErrorUtils.newThrowable(
JMSException.class,
"EXCEPTION_RECEIVED_CWSIA0007",
new Object[] { re, "JmsFactoryFactoryImpl.createTopicConnectionFactory (#1)" },
re,
"JmsFactoryFactoryImpl.createTopicConnectionFactory#1",
this,
tc
);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "createTopicConnectionFactory", jmstcf);
return jmstcf;
} | [
"@",
"Override",
"public",
"JmsTopicConnectionFactory",
"createTopicConnectionFactory",
"(",
")",
"throws",
"JMSException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"createTopicConnectionFactory\"",
")",
";",
"JmsTopicConnectionFactory",
"jmstcf",
"=",
"null",
";",
"// get a jca managed topic connection factory, which is used to construct",
"// the jms topic connection factory.",
"JmsJcaManagedTopicConnectionFactory",
"jcamtcf",
"=",
"JmsJcaFactory",
".",
"getInstance",
"(",
")",
".",
"createManagedTopicConnectionFactory",
"(",
")",
";",
"// invoke the construction of a jms topic connection factory - the jca",
"// managed topic connection factory will call back into the jms api code",
"// by getting a JmsRAFactoryFactory, and calling a create jms topic",
"// connection factory method on it with jca connection factory and jca",
"// managed topic connection factory objects as parameters (and the jms",
"// tcf will keep references to the jca cf and jca mtcf).",
"try",
"{",
"jmstcf",
"=",
"(",
"JmsTopicConnectionFactory",
")",
"jcamtcf",
".",
"createConnectionFactory",
"(",
")",
";",
"}",
"catch",
"(",
"ResourceException",
"re",
")",
"{",
"// No FFDC code needed",
"// d222942 review - no documentation for when a RE will be thrown, so",
"// default exception ok. (A quick look at the RA suggests the exception isn't",
"// ever thrown).",
"// d238447 FFDC review. Comment above suggests FFDC ok.",
"throw",
"(",
"JMSException",
")",
"JmsErrorUtils",
".",
"newThrowable",
"(",
"JMSException",
".",
"class",
",",
"\"EXCEPTION_RECEIVED_CWSIA0007\"",
",",
"new",
"Object",
"[",
"]",
"{",
"re",
",",
"\"JmsFactoryFactoryImpl.createTopicConnectionFactory (#1)\"",
"}",
",",
"re",
",",
"\"JmsFactoryFactoryImpl.createTopicConnectionFactory#1\"",
",",
"this",
",",
"tc",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"createTopicConnectionFactory\"",
",",
"jmstcf",
")",
";",
"return",
"jmstcf",
";",
"}"
] | This method is called by the application to retrieve its first
TopicConnectionFactory object. | [
"This",
"method",
"is",
"called",
"by",
"the",
"application",
"to",
"retrieve",
"its",
"first",
"TopicConnectionFactory",
"object",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsFactoryFactoryImpl.java#L182-L220 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsFactoryFactoryImpl.java | JmsFactoryFactoryImpl.createQueue | @Override
public JmsQueue createQueue(String name) throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "createQueue", name);
JmsQueue queue = null;
// if name string is null, empty or just "queue://", throw exception
if ((name == null) || ("".equals(name)) || (JmsQueueImpl.QUEUE_PREFIX.equals(name))) {
throw (InvalidDestinationException) JmsErrorUtils.newThrowable(
InvalidDestinationException.class,
"INVALID_VALUE_CWSIA0003",
new Object[] { "Queue name", name },
tc
);
}
// if name is "topic://" throw exception
if (name.startsWith(JmsTopicImpl.TOPIC_PREFIX)) {
throw (InvalidDestinationException) JmsErrorUtils.newThrowable(
InvalidDestinationException.class,
"MALFORMED_DESCRIPTOR_CWSIA0047",
new Object[] { "Queue", name },
tc
);
}
name = name.trim();
queue = (JmsQueue) destCreator.createDestinationFromString(name, URIDestinationCreator.DestType.QUEUE);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "createQueue", queue);
return queue;
} | java | @Override
public JmsQueue createQueue(String name) throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "createQueue", name);
JmsQueue queue = null;
// if name string is null, empty or just "queue://", throw exception
if ((name == null) || ("".equals(name)) || (JmsQueueImpl.QUEUE_PREFIX.equals(name))) {
throw (InvalidDestinationException) JmsErrorUtils.newThrowable(
InvalidDestinationException.class,
"INVALID_VALUE_CWSIA0003",
new Object[] { "Queue name", name },
tc
);
}
// if name is "topic://" throw exception
if (name.startsWith(JmsTopicImpl.TOPIC_PREFIX)) {
throw (InvalidDestinationException) JmsErrorUtils.newThrowable(
InvalidDestinationException.class,
"MALFORMED_DESCRIPTOR_CWSIA0047",
new Object[] { "Queue", name },
tc
);
}
name = name.trim();
queue = (JmsQueue) destCreator.createDestinationFromString(name, URIDestinationCreator.DestType.QUEUE);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "createQueue", queue);
return queue;
} | [
"@",
"Override",
"public",
"JmsQueue",
"createQueue",
"(",
"String",
"name",
")",
"throws",
"JMSException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"createQueue\"",
",",
"name",
")",
";",
"JmsQueue",
"queue",
"=",
"null",
";",
"// if name string is null, empty or just \"queue://\", throw exception",
"if",
"(",
"(",
"name",
"==",
"null",
")",
"||",
"(",
"\"\"",
".",
"equals",
"(",
"name",
")",
")",
"||",
"(",
"JmsQueueImpl",
".",
"QUEUE_PREFIX",
".",
"equals",
"(",
"name",
")",
")",
")",
"{",
"throw",
"(",
"InvalidDestinationException",
")",
"JmsErrorUtils",
".",
"newThrowable",
"(",
"InvalidDestinationException",
".",
"class",
",",
"\"INVALID_VALUE_CWSIA0003\"",
",",
"new",
"Object",
"[",
"]",
"{",
"\"Queue name\"",
",",
"name",
"}",
",",
"tc",
")",
";",
"}",
"// if name is \"topic://\" throw exception",
"if",
"(",
"name",
".",
"startsWith",
"(",
"JmsTopicImpl",
".",
"TOPIC_PREFIX",
")",
")",
"{",
"throw",
"(",
"InvalidDestinationException",
")",
"JmsErrorUtils",
".",
"newThrowable",
"(",
"InvalidDestinationException",
".",
"class",
",",
"\"MALFORMED_DESCRIPTOR_CWSIA0047\"",
",",
"new",
"Object",
"[",
"]",
"{",
"\"Queue\"",
",",
"name",
"}",
",",
"tc",
")",
";",
"}",
"name",
"=",
"name",
".",
"trim",
"(",
")",
";",
"queue",
"=",
"(",
"JmsQueue",
")",
"destCreator",
".",
"createDestinationFromString",
"(",
"name",
",",
"URIDestinationCreator",
".",
"DestType",
".",
"QUEUE",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"createQueue\"",
",",
"queue",
")",
";",
"return",
"queue",
";",
"}"
] | This method is called by the application to create a jms administered
queue object. | [
"This",
"method",
"is",
"called",
"by",
"the",
"application",
"to",
"create",
"a",
"jms",
"administered",
"queue",
"object",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsFactoryFactoryImpl.java#L304-L336 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsFactoryFactoryImpl.java | JmsFactoryFactoryImpl.createTopic | @Override
public JmsTopic createTopic(String name) throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "createTopic", name);
JmsTopic topic = null;
// if name string is null throw exception
if (name == null) {
throw (InvalidDestinationException) JmsErrorUtils.newThrowable(
InvalidDestinationException.class,
"INVALID_VALUE_CWSIA0003",
new Object[] { "Topic name", null },
tc
);
}
// if name is "queue://" throw exception
if (name != null && name.startsWith(JmsQueueImpl.QUEUE_PREFIX)) {
throw (InvalidDestinationException) JmsErrorUtils.newThrowable(
InvalidDestinationException.class,
"MALFORMED_DESCRIPTOR_CWSIA0047",
new Object[] { "Topic", name },
tc
);
}
name = name.trim();
topic = (JmsTopic) destCreator.createDestinationFromString(name, URIDestinationCreator.DestType.TOPIC);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "createTopic", topic);
return topic;
} | java | @Override
public JmsTopic createTopic(String name) throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "createTopic", name);
JmsTopic topic = null;
// if name string is null throw exception
if (name == null) {
throw (InvalidDestinationException) JmsErrorUtils.newThrowable(
InvalidDestinationException.class,
"INVALID_VALUE_CWSIA0003",
new Object[] { "Topic name", null },
tc
);
}
// if name is "queue://" throw exception
if (name != null && name.startsWith(JmsQueueImpl.QUEUE_PREFIX)) {
throw (InvalidDestinationException) JmsErrorUtils.newThrowable(
InvalidDestinationException.class,
"MALFORMED_DESCRIPTOR_CWSIA0047",
new Object[] { "Topic", name },
tc
);
}
name = name.trim();
topic = (JmsTopic) destCreator.createDestinationFromString(name, URIDestinationCreator.DestType.TOPIC);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "createTopic", topic);
return topic;
} | [
"@",
"Override",
"public",
"JmsTopic",
"createTopic",
"(",
"String",
"name",
")",
"throws",
"JMSException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"createTopic\"",
",",
"name",
")",
";",
"JmsTopic",
"topic",
"=",
"null",
";",
"// if name string is null throw exception",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"throw",
"(",
"InvalidDestinationException",
")",
"JmsErrorUtils",
".",
"newThrowable",
"(",
"InvalidDestinationException",
".",
"class",
",",
"\"INVALID_VALUE_CWSIA0003\"",
",",
"new",
"Object",
"[",
"]",
"{",
"\"Topic name\"",
",",
"null",
"}",
",",
"tc",
")",
";",
"}",
"// if name is \"queue://\" throw exception",
"if",
"(",
"name",
"!=",
"null",
"&&",
"name",
".",
"startsWith",
"(",
"JmsQueueImpl",
".",
"QUEUE_PREFIX",
")",
")",
"{",
"throw",
"(",
"InvalidDestinationException",
")",
"JmsErrorUtils",
".",
"newThrowable",
"(",
"InvalidDestinationException",
".",
"class",
",",
"\"MALFORMED_DESCRIPTOR_CWSIA0047\"",
",",
"new",
"Object",
"[",
"]",
"{",
"\"Topic\"",
",",
"name",
"}",
",",
"tc",
")",
";",
"}",
"name",
"=",
"name",
".",
"trim",
"(",
")",
";",
"topic",
"=",
"(",
"JmsTopic",
")",
"destCreator",
".",
"createDestinationFromString",
"(",
"name",
",",
"URIDestinationCreator",
".",
"DestType",
".",
"TOPIC",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"createTopic\"",
",",
"topic",
")",
";",
"return",
"topic",
";",
"}"
] | This method is called by the application to create a jms administered
topic object. | [
"This",
"method",
"is",
"called",
"by",
"the",
"application",
"to",
"create",
"a",
"jms",
"administered",
"topic",
"object",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsFactoryFactoryImpl.java#L342-L374 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/impl/EqualityMatcher.java | EqualityMatcher.handlePut | void handlePut(
SimpleTest test,
Conjunction selector,
MatchTarget object,
InternTable subExpr)
throws MatchingException {
if (tc.isEntryEnabled())
tc.entry(this,cclass, "handlePut",
new Object[] {test,selector,object,subExpr} );
Object value = test.getValue();
if (value == null)
throw new IllegalStateException();
handleEqualityPut(value, selector, object, subExpr);
if (tc.isEntryEnabled())
tc.exit(this,cclass, "handlePut");
} | java | void handlePut(
SimpleTest test,
Conjunction selector,
MatchTarget object,
InternTable subExpr)
throws MatchingException {
if (tc.isEntryEnabled())
tc.entry(this,cclass, "handlePut",
new Object[] {test,selector,object,subExpr} );
Object value = test.getValue();
if (value == null)
throw new IllegalStateException();
handleEqualityPut(value, selector, object, subExpr);
if (tc.isEntryEnabled())
tc.exit(this,cclass, "handlePut");
} | [
"void",
"handlePut",
"(",
"SimpleTest",
"test",
",",
"Conjunction",
"selector",
",",
"MatchTarget",
"object",
",",
"InternTable",
"subExpr",
")",
"throws",
"MatchingException",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"tc",
".",
"entry",
"(",
"this",
",",
"cclass",
",",
"\"handlePut\"",
",",
"new",
"Object",
"[",
"]",
"{",
"test",
",",
"selector",
",",
"object",
",",
"subExpr",
"}",
")",
";",
"Object",
"value",
"=",
"test",
".",
"getValue",
"(",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
"throw",
"new",
"IllegalStateException",
"(",
")",
";",
"handleEqualityPut",
"(",
"value",
",",
"selector",
",",
"object",
",",
"subExpr",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"tc",
".",
"exit",
"(",
"this",
",",
"cclass",
",",
"\"handlePut\"",
")",
";",
"}"
] | Implement handlePut. | [
"Implement",
"handlePut",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/impl/EqualityMatcher.java#L62-L77 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/impl/EqualityMatcher.java | EqualityMatcher.handleEqualityPut | void handleEqualityPut(Object value, Conjunction selector,
MatchTarget object, InternTable subExpr) throws MatchingException {
if (tc.isEntryEnabled())
tc.entry(this,cclass, "handleEqualityPut",
new Object[] {value,selector,object,subExpr} );
ContentMatcher next =
(ContentMatcher) ((children == null) ? null : children.get(value));
ContentMatcher newNext = nextMatcher(selector, next);
if (newNext != next)
{
if (children == null)
children = new HashMap(INITIAL_CHILDREN_CAPACITY);
children.put(value, newNext);
}
newNext.put(selector, object, subExpr);
if (tc.isEntryEnabled())
tc.exit(this,cclass, "handleEqualityPut");
} | java | void handleEqualityPut(Object value, Conjunction selector,
MatchTarget object, InternTable subExpr) throws MatchingException {
if (tc.isEntryEnabled())
tc.entry(this,cclass, "handleEqualityPut",
new Object[] {value,selector,object,subExpr} );
ContentMatcher next =
(ContentMatcher) ((children == null) ? null : children.get(value));
ContentMatcher newNext = nextMatcher(selector, next);
if (newNext != next)
{
if (children == null)
children = new HashMap(INITIAL_CHILDREN_CAPACITY);
children.put(value, newNext);
}
newNext.put(selector, object, subExpr);
if (tc.isEntryEnabled())
tc.exit(this,cclass, "handleEqualityPut");
} | [
"void",
"handleEqualityPut",
"(",
"Object",
"value",
",",
"Conjunction",
"selector",
",",
"MatchTarget",
"object",
",",
"InternTable",
"subExpr",
")",
"throws",
"MatchingException",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"tc",
".",
"entry",
"(",
"this",
",",
"cclass",
",",
"\"handleEqualityPut\"",
",",
"new",
"Object",
"[",
"]",
"{",
"value",
",",
"selector",
",",
"object",
",",
"subExpr",
"}",
")",
";",
"ContentMatcher",
"next",
"=",
"(",
"ContentMatcher",
")",
"(",
"(",
"children",
"==",
"null",
")",
"?",
"null",
":",
"children",
".",
"get",
"(",
"value",
")",
")",
";",
"ContentMatcher",
"newNext",
"=",
"nextMatcher",
"(",
"selector",
",",
"next",
")",
";",
"if",
"(",
"newNext",
"!=",
"next",
")",
"{",
"if",
"(",
"children",
"==",
"null",
")",
"children",
"=",
"new",
"HashMap",
"(",
"INITIAL_CHILDREN_CAPACITY",
")",
";",
"children",
".",
"put",
"(",
"value",
",",
"newNext",
")",
";",
"}",
"newNext",
".",
"put",
"(",
"selector",
",",
"object",
",",
"subExpr",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"tc",
".",
"exit",
"(",
"this",
",",
"cclass",
",",
"\"handleEqualityPut\"",
")",
";",
"}"
] | Perform the handlePut function when the test is an equality test
@param value the value of the SimpleTest's comparand, perhaps wrapped
(e.g. by NumericMatcher)
@param selector the Conjunction representing all or part of a selector
@param object the MatchTarget to install
@param subExpr the InternTable used to assign unique ids to subexpressions | [
"Perform",
"the",
"handlePut",
"function",
"when",
"the",
"test",
"is",
"an",
"equality",
"test"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/impl/EqualityMatcher.java#L86-L103 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/impl/EqualityMatcher.java | EqualityMatcher.handleEqualityRemove | void handleEqualityRemove(Object value, Conjunction selector,
MatchTarget object, InternTable subExpr, OrdinalPosition parentId) throws MatchingException {
if (tc.isEntryEnabled())
tc.entry(this,cclass, "handleEqualityRemove",
new Object[] {value,selector,object,subExpr} );
ContentMatcher next = (ContentMatcher) children.get(value);
ContentMatcher newNext =
(ContentMatcher) next.remove(selector, object, subExpr, ordinalPosition);
if (newNext == null)
children.remove(value);
else if (newNext != next)
children.put(value, newNext);
if (tc.isEntryEnabled())
tc.exit(this,cclass, "handleEqualityRemove");
} | java | void handleEqualityRemove(Object value, Conjunction selector,
MatchTarget object, InternTable subExpr, OrdinalPosition parentId) throws MatchingException {
if (tc.isEntryEnabled())
tc.entry(this,cclass, "handleEqualityRemove",
new Object[] {value,selector,object,subExpr} );
ContentMatcher next = (ContentMatcher) children.get(value);
ContentMatcher newNext =
(ContentMatcher) next.remove(selector, object, subExpr, ordinalPosition);
if (newNext == null)
children.remove(value);
else if (newNext != next)
children.put(value, newNext);
if (tc.isEntryEnabled())
tc.exit(this,cclass, "handleEqualityRemove");
} | [
"void",
"handleEqualityRemove",
"(",
"Object",
"value",
",",
"Conjunction",
"selector",
",",
"MatchTarget",
"object",
",",
"InternTable",
"subExpr",
",",
"OrdinalPosition",
"parentId",
")",
"throws",
"MatchingException",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"tc",
".",
"entry",
"(",
"this",
",",
"cclass",
",",
"\"handleEqualityRemove\"",
",",
"new",
"Object",
"[",
"]",
"{",
"value",
",",
"selector",
",",
"object",
",",
"subExpr",
"}",
")",
";",
"ContentMatcher",
"next",
"=",
"(",
"ContentMatcher",
")",
"children",
".",
"get",
"(",
"value",
")",
";",
"ContentMatcher",
"newNext",
"=",
"(",
"ContentMatcher",
")",
"next",
".",
"remove",
"(",
"selector",
",",
"object",
",",
"subExpr",
",",
"ordinalPosition",
")",
";",
"if",
"(",
"newNext",
"==",
"null",
")",
"children",
".",
"remove",
"(",
"value",
")",
";",
"else",
"if",
"(",
"newNext",
"!=",
"next",
")",
"children",
".",
"put",
"(",
"value",
",",
"newNext",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"tc",
".",
"exit",
"(",
"this",
",",
"cclass",
",",
"\"handleEqualityRemove\"",
")",
";",
"}"
] | Perform the handleRemove function when the test is an equality test
@param value the value of the SimpleTest's comparand, perhaps wrapped
(e.g. by NumericMatcher)
@param selector the Conjunction representing all or part of a selector
@param object the MatchTarget to remove
@param subExpr the InternTable used to assign unique ids to subexpressions | [
"Perform",
"the",
"handleRemove",
"function",
"when",
"the",
"test",
"is",
"an",
"equality",
"test"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/impl/EqualityMatcher.java#L171-L185 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/impl/EqualityMatcher.java | EqualityMatcher.isEmpty | boolean isEmpty() {
if (tc.isEntryEnabled())
tc.entry(this,cclass, "isEmpty");
boolean ans = super.isEmpty() && !haveEqualityMatches();
if (tc.isEntryEnabled())
tc.exit(this,cclass, "isEmpty", new Boolean(ans));
return ans;
} | java | boolean isEmpty() {
if (tc.isEntryEnabled())
tc.entry(this,cclass, "isEmpty");
boolean ans = super.isEmpty() && !haveEqualityMatches();
if (tc.isEntryEnabled())
tc.exit(this,cclass, "isEmpty", new Boolean(ans));
return ans;
} | [
"boolean",
"isEmpty",
"(",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"tc",
".",
"entry",
"(",
"this",
",",
"cclass",
",",
"\"isEmpty\"",
")",
";",
"boolean",
"ans",
"=",
"super",
".",
"isEmpty",
"(",
")",
"&&",
"!",
"haveEqualityMatches",
"(",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"tc",
".",
"exit",
"(",
"this",
",",
"cclass",
",",
"\"isEmpty\"",
",",
"new",
"Boolean",
"(",
"ans",
")",
")",
";",
"return",
"ans",
";",
"}"
] | Override isEmpty to check whether children is empty | [
"Override",
"isEmpty",
"to",
"check",
"whether",
"children",
"is",
"empty"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/impl/EqualityMatcher.java#L188-L195 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/impl/EqualityMatcher.java | EqualityMatcher.nextMatcher | ContentMatcher nextMatcher(Conjunction selector, ContentMatcher oldMatcher) {
if (tc.isEntryEnabled())
tc.entry(this,cclass, "nextMatcher", "selector: "+selector+", oldMatcher: "+oldMatcher);
ContentMatcher ans;
if (!cacheing)
ans = super.nextMatcher(selector, oldMatcher);
else if (oldMatcher == null)
ans = new CacheingMatcher(ordinalPosition, super.nextMatcher(selector, null));
else
ans = oldMatcher;
if (tc.isEntryEnabled())
tc.exit(this,cclass, "nextMatcher", ans);
return ans;
} | java | ContentMatcher nextMatcher(Conjunction selector, ContentMatcher oldMatcher) {
if (tc.isEntryEnabled())
tc.entry(this,cclass, "nextMatcher", "selector: "+selector+", oldMatcher: "+oldMatcher);
ContentMatcher ans;
if (!cacheing)
ans = super.nextMatcher(selector, oldMatcher);
else if (oldMatcher == null)
ans = new CacheingMatcher(ordinalPosition, super.nextMatcher(selector, null));
else
ans = oldMatcher;
if (tc.isEntryEnabled())
tc.exit(this,cclass, "nextMatcher", ans);
return ans;
} | [
"ContentMatcher",
"nextMatcher",
"(",
"Conjunction",
"selector",
",",
"ContentMatcher",
"oldMatcher",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"tc",
".",
"entry",
"(",
"this",
",",
"cclass",
",",
"\"nextMatcher\"",
",",
"\"selector: \"",
"+",
"selector",
"+",
"\", oldMatcher: \"",
"+",
"oldMatcher",
")",
";",
"ContentMatcher",
"ans",
";",
"if",
"(",
"!",
"cacheing",
")",
"ans",
"=",
"super",
".",
"nextMatcher",
"(",
"selector",
",",
"oldMatcher",
")",
";",
"else",
"if",
"(",
"oldMatcher",
"==",
"null",
")",
"ans",
"=",
"new",
"CacheingMatcher",
"(",
"ordinalPosition",
",",
"super",
".",
"nextMatcher",
"(",
"selector",
",",
"null",
")",
")",
";",
"else",
"ans",
"=",
"oldMatcher",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"tc",
".",
"exit",
"(",
"this",
",",
"cclass",
",",
"\"nextMatcher\"",
",",
"ans",
")",
";",
"return",
"ans",
";",
"}"
] | Override nextMatcher to handle possibility of cacheing | [
"Override",
"nextMatcher",
"to",
"handle",
"possibility",
"of",
"cacheing"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/impl/EqualityMatcher.java#L210-L223 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ExceptionDestinationHandlerImpl.java | ExceptionDestinationHandlerImpl.setDestination | public void setDestination(DestinationHandler originalDestination)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "setDestination", originalDestination);
_originalDestination = originalDestination;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "setDestination");
} | java | public void setDestination(DestinationHandler originalDestination)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "setDestination", originalDestination);
_originalDestination = originalDestination;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "setDestination");
} | [
"public",
"void",
"setDestination",
"(",
"DestinationHandler",
"originalDestination",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"setDestination\"",
",",
"originalDestination",
")",
";",
"_originalDestination",
"=",
"originalDestination",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"setDestination\"",
")",
";",
"}"
] | Sets the destination that could not be delivered to.
@param destination The destination to set | [
"Sets",
"the",
"destination",
"that",
"could",
"not",
"be",
"delivered",
"to",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ExceptionDestinationHandlerImpl.java#L233-L242 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ExceptionDestinationHandlerImpl.java | ExceptionDestinationHandlerImpl.setDestination | @Override
public void setDestination(SIDestinationAddress destinationAddr)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "setDestination", destinationAddr);
if (destinationAddr != null)
{
try
{
_originalDestination = _messageProcessor.getDestinationManager().getDestination((JsDestinationAddress) destinationAddr, true);
} catch (SIException e)
{
// No FFDC code needed
/* Generate warning but retry with default exception destination */
SibTr.warning(tc, "EXCEPTION_DESTINATION_WARNING_CWSIP0291",
new Object[] { destinationAddr.getDestinationName(), _messageProcessor.getMessagingEngineName(), e });
// Create a handler to the default if provided destination is inaccessible
_originalDestination = null;
}
}
else
_originalDestination = null;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "setDestination", _originalDestination);
} | java | @Override
public void setDestination(SIDestinationAddress destinationAddr)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "setDestination", destinationAddr);
if (destinationAddr != null)
{
try
{
_originalDestination = _messageProcessor.getDestinationManager().getDestination((JsDestinationAddress) destinationAddr, true);
} catch (SIException e)
{
// No FFDC code needed
/* Generate warning but retry with default exception destination */
SibTr.warning(tc, "EXCEPTION_DESTINATION_WARNING_CWSIP0291",
new Object[] { destinationAddr.getDestinationName(), _messageProcessor.getMessagingEngineName(), e });
// Create a handler to the default if provided destination is inaccessible
_originalDestination = null;
}
}
else
_originalDestination = null;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "setDestination", _originalDestination);
} | [
"@",
"Override",
"public",
"void",
"setDestination",
"(",
"SIDestinationAddress",
"destinationAddr",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"setDestination\"",
",",
"destinationAddr",
")",
";",
"if",
"(",
"destinationAddr",
"!=",
"null",
")",
"{",
"try",
"{",
"_originalDestination",
"=",
"_messageProcessor",
".",
"getDestinationManager",
"(",
")",
".",
"getDestination",
"(",
"(",
"JsDestinationAddress",
")",
"destinationAddr",
",",
"true",
")",
";",
"}",
"catch",
"(",
"SIException",
"e",
")",
"{",
"// No FFDC code needed",
"/* Generate warning but retry with default exception destination */",
"SibTr",
".",
"warning",
"(",
"tc",
",",
"\"EXCEPTION_DESTINATION_WARNING_CWSIP0291\"",
",",
"new",
"Object",
"[",
"]",
"{",
"destinationAddr",
".",
"getDestinationName",
"(",
")",
",",
"_messageProcessor",
".",
"getMessagingEngineName",
"(",
")",
",",
"e",
"}",
")",
";",
"// Create a handler to the default if provided destination is inaccessible",
"_originalDestination",
"=",
"null",
";",
"}",
"}",
"else",
"_originalDestination",
"=",
"null",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"setDestination\"",
",",
"_originalDestination",
")",
";",
"}"
] | Sets the destination that could not be delivered to. Looks up the destination
given its name.
@param destinationName - The destination to set | [
"Sets",
"the",
"destination",
"that",
"could",
"not",
"be",
"delivered",
"to",
".",
"Looks",
"up",
"the",
"destination",
"given",
"its",
"name",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ExceptionDestinationHandlerImpl.java#L251-L279 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ExceptionDestinationHandlerImpl.java | ExceptionDestinationHandlerImpl.checkCanExceptionMessage | public int checkCanExceptionMessage()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "checkCanExceptionMessage");
// Return code
int rc = DestinationHandler.OUTPUT_HANDLER_NOT_FOUND;
String newExceptionDestination = null;
boolean usingDefault = false;
if (_originalDestination != null)
{
newExceptionDestination = _originalDestination.getExceptionDestination();
if (newExceptionDestination == null || newExceptionDestination.equals(""))
{
// Simply return with OUTPUT_HANDLER_NOT_FOUND
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkCanExceptionMessage", rc);
return rc;
}
if (newExceptionDestination.equals(JsConstants.DEFAULT_EXCEPTION_DESTINATION))
{
newExceptionDestination = _defaultExceptionDestinationName;
usingDefault = true;
}
}
else
{
newExceptionDestination = _defaultExceptionDestinationName;
usingDefault = true;
}
try
{
DestinationHandler exceptionDestHandler =
_messageProcessor.getDestinationManager().
getDestination(newExceptionDestination, true);
rc = exceptionDestHandler.checkCanAcceptMessage(null, null);
} catch (SIException e)
{
// No FFDC code needed
SibTr.exception(tc, e);
}
// If we havent checked the system default destination, then do that now
if (rc != DestinationHandler.OUTPUT_HANDLER_FOUND && !usingDefault)
{
try
{
DestinationHandler exceptionDestHandler =
_messageProcessor.getDestinationManager().
getDestination(_defaultExceptionDestinationName, true);
rc = exceptionDestHandler.checkCanAcceptMessage(null, null);
} catch (SIException e)
{
// No FFDC code needed
SibTr.exception(tc, e);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkCanExceptionMessage", Integer.valueOf(rc));
return rc;
} | java | public int checkCanExceptionMessage()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "checkCanExceptionMessage");
// Return code
int rc = DestinationHandler.OUTPUT_HANDLER_NOT_FOUND;
String newExceptionDestination = null;
boolean usingDefault = false;
if (_originalDestination != null)
{
newExceptionDestination = _originalDestination.getExceptionDestination();
if (newExceptionDestination == null || newExceptionDestination.equals(""))
{
// Simply return with OUTPUT_HANDLER_NOT_FOUND
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkCanExceptionMessage", rc);
return rc;
}
if (newExceptionDestination.equals(JsConstants.DEFAULT_EXCEPTION_DESTINATION))
{
newExceptionDestination = _defaultExceptionDestinationName;
usingDefault = true;
}
}
else
{
newExceptionDestination = _defaultExceptionDestinationName;
usingDefault = true;
}
try
{
DestinationHandler exceptionDestHandler =
_messageProcessor.getDestinationManager().
getDestination(newExceptionDestination, true);
rc = exceptionDestHandler.checkCanAcceptMessage(null, null);
} catch (SIException e)
{
// No FFDC code needed
SibTr.exception(tc, e);
}
// If we havent checked the system default destination, then do that now
if (rc != DestinationHandler.OUTPUT_HANDLER_FOUND && !usingDefault)
{
try
{
DestinationHandler exceptionDestHandler =
_messageProcessor.getDestinationManager().
getDestination(_defaultExceptionDestinationName, true);
rc = exceptionDestHandler.checkCanAcceptMessage(null, null);
} catch (SIException e)
{
// No FFDC code needed
SibTr.exception(tc, e);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkCanExceptionMessage", Integer.valueOf(rc));
return rc;
} | [
"public",
"int",
"checkCanExceptionMessage",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"checkCanExceptionMessage\"",
")",
";",
"// Return code",
"int",
"rc",
"=",
"DestinationHandler",
".",
"OUTPUT_HANDLER_NOT_FOUND",
";",
"String",
"newExceptionDestination",
"=",
"null",
";",
"boolean",
"usingDefault",
"=",
"false",
";",
"if",
"(",
"_originalDestination",
"!=",
"null",
")",
"{",
"newExceptionDestination",
"=",
"_originalDestination",
".",
"getExceptionDestination",
"(",
")",
";",
"if",
"(",
"newExceptionDestination",
"==",
"null",
"||",
"newExceptionDestination",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",
"// Simply return with OUTPUT_HANDLER_NOT_FOUND",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"checkCanExceptionMessage\"",
",",
"rc",
")",
";",
"return",
"rc",
";",
"}",
"if",
"(",
"newExceptionDestination",
".",
"equals",
"(",
"JsConstants",
".",
"DEFAULT_EXCEPTION_DESTINATION",
")",
")",
"{",
"newExceptionDestination",
"=",
"_defaultExceptionDestinationName",
";",
"usingDefault",
"=",
"true",
";",
"}",
"}",
"else",
"{",
"newExceptionDestination",
"=",
"_defaultExceptionDestinationName",
";",
"usingDefault",
"=",
"true",
";",
"}",
"try",
"{",
"DestinationHandler",
"exceptionDestHandler",
"=",
"_messageProcessor",
".",
"getDestinationManager",
"(",
")",
".",
"getDestination",
"(",
"newExceptionDestination",
",",
"true",
")",
";",
"rc",
"=",
"exceptionDestHandler",
".",
"checkCanAcceptMessage",
"(",
"null",
",",
"null",
")",
";",
"}",
"catch",
"(",
"SIException",
"e",
")",
"{",
"// No FFDC code needed",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"e",
")",
";",
"}",
"// If we havent checked the system default destination, then do that now",
"if",
"(",
"rc",
"!=",
"DestinationHandler",
".",
"OUTPUT_HANDLER_FOUND",
"&&",
"!",
"usingDefault",
")",
"{",
"try",
"{",
"DestinationHandler",
"exceptionDestHandler",
"=",
"_messageProcessor",
".",
"getDestinationManager",
"(",
")",
".",
"getDestination",
"(",
"_defaultExceptionDestinationName",
",",
"true",
")",
";",
"rc",
"=",
"exceptionDestHandler",
".",
"checkCanAcceptMessage",
"(",
"null",
",",
"null",
")",
";",
"}",
"catch",
"(",
"SIException",
"e",
")",
"{",
"// No FFDC code needed",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"e",
")",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"checkCanExceptionMessage\"",
",",
"Integer",
".",
"valueOf",
"(",
"rc",
")",
")",
";",
"return",
"rc",
";",
"}"
] | Check whether it will be possible to place a message on the exception destination.
@return rc reason code | [
"Check",
"whether",
"it",
"will",
"be",
"possible",
"to",
"place",
"a",
"message",
"on",
"the",
"exception",
"destination",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ExceptionDestinationHandlerImpl.java#L286-L356 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ExceptionDestinationHandlerImpl.java | ExceptionDestinationHandlerImpl.handleUndeliverableMessage | @Override
public UndeliverableReturnCode handleUndeliverableMessage(
SIBusMessage msg,
String alternateUser,
TransactionCommon tran,
int exceptionReason,
String[] exceptionStrings)
{
// F001333-14610
// Delegate down onto the new method passing a null
// subscription ID.
return handleUndeliverableMessage(msg, alternateUser, tran, exceptionReason, exceptionStrings, null);
} | java | @Override
public UndeliverableReturnCode handleUndeliverableMessage(
SIBusMessage msg,
String alternateUser,
TransactionCommon tran,
int exceptionReason,
String[] exceptionStrings)
{
// F001333-14610
// Delegate down onto the new method passing a null
// subscription ID.
return handleUndeliverableMessage(msg, alternateUser, tran, exceptionReason, exceptionStrings, null);
} | [
"@",
"Override",
"public",
"UndeliverableReturnCode",
"handleUndeliverableMessage",
"(",
"SIBusMessage",
"msg",
",",
"String",
"alternateUser",
",",
"TransactionCommon",
"tran",
",",
"int",
"exceptionReason",
",",
"String",
"[",
"]",
"exceptionStrings",
")",
"{",
"// F001333-14610",
"// Delegate down onto the new method passing a null",
"// subscription ID.",
"return",
"handleUndeliverableMessage",
"(",
"msg",
",",
"alternateUser",
",",
"tran",
",",
"exceptionReason",
",",
"exceptionStrings",
",",
"null",
")",
";",
"}"
] | Wrapper method for handleUndeliverableMessage. This version will be called
from an external component via the
com.ibm.ws.sib.processor.ExceptionDestinationHandler interface. E.g. we
need to access this routine from the MQLink in the comms component.
@param msg - The undeliverable message
@param tran - The transaction that the message was delivered under
@param exceptionReason - The reason why the message could not be delivered
@param exceptionStrings - A list of inserts to place into an error message
@return A code indicating what we did with the message | [
"Wrapper",
"method",
"for",
"handleUndeliverableMessage",
".",
"This",
"version",
"will",
"be",
"called",
"from",
"an",
"external",
"component",
"via",
"the",
"com",
".",
"ibm",
".",
"ws",
".",
"sib",
".",
"processor",
".",
"ExceptionDestinationHandler",
"interface",
".",
"E",
".",
"g",
".",
"we",
"need",
"to",
"access",
"this",
"routine",
"from",
"the",
"MQLink",
"in",
"the",
"comms",
"component",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ExceptionDestinationHandlerImpl.java#L428-L440 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ExceptionDestinationHandlerImpl.java | ExceptionDestinationHandlerImpl.checkMessage | private UndeliverableReturnCode checkMessage(SIMPMessage message)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "checkMessage", message);
UndeliverableReturnCode rc = UndeliverableReturnCode.OK;
// F001333:E3
// If the message's reliability equals or is less than the configured ExceptionDiscardReliability
// then the message shouldn't be sent on to the exception destination, instead it should simply
// be thrown away (the default setting is BestEffort).
// We'll always chuck away BestEffort messages, but if we have the original destination we'll base
// our decision on its configuration
// (If the _originalDestination is null then we do not have the original destination's config to hand,
// for example, in the case of cleaning up a deleted destination)
Reliability discardReliabilityThreshold = Reliability.BEST_EFFORT_NONPERSISTENT;
if (_originalDestination != null)
discardReliabilityThreshold = _originalDestination.getExceptionDiscardReliability();
if (message.getReliability().compareTo(discardReliabilityThreshold) <= 0)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Message reliability (" + message.getReliability() + ") <= Exception reliability (" +
discardReliabilityThreshold + ")");
rc = UndeliverableReturnCode.DISCARD;
}
// Discard messages from temporary destinations.
else if (_originalDestination != null &&
_originalDestination.isTemporary())
rc = UndeliverableReturnCode.DISCARD;
// If the discardMessage option is set, then we discard the message rather
// than send to the exception destination
else if (Boolean.TRUE.equals(message.getMessage().getReportDiscardMsg()))
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Message discarded at sender's request");
rc = UndeliverableReturnCode.DISCARD;
}
// Decide whether we want to block the message or not.
else if (isBlockRequired(message))
rc = UndeliverableReturnCode.BLOCK;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkMessage", rc);
return rc;
} | java | private UndeliverableReturnCode checkMessage(SIMPMessage message)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "checkMessage", message);
UndeliverableReturnCode rc = UndeliverableReturnCode.OK;
// F001333:E3
// If the message's reliability equals or is less than the configured ExceptionDiscardReliability
// then the message shouldn't be sent on to the exception destination, instead it should simply
// be thrown away (the default setting is BestEffort).
// We'll always chuck away BestEffort messages, but if we have the original destination we'll base
// our decision on its configuration
// (If the _originalDestination is null then we do not have the original destination's config to hand,
// for example, in the case of cleaning up a deleted destination)
Reliability discardReliabilityThreshold = Reliability.BEST_EFFORT_NONPERSISTENT;
if (_originalDestination != null)
discardReliabilityThreshold = _originalDestination.getExceptionDiscardReliability();
if (message.getReliability().compareTo(discardReliabilityThreshold) <= 0)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Message reliability (" + message.getReliability() + ") <= Exception reliability (" +
discardReliabilityThreshold + ")");
rc = UndeliverableReturnCode.DISCARD;
}
// Discard messages from temporary destinations.
else if (_originalDestination != null &&
_originalDestination.isTemporary())
rc = UndeliverableReturnCode.DISCARD;
// If the discardMessage option is set, then we discard the message rather
// than send to the exception destination
else if (Boolean.TRUE.equals(message.getMessage().getReportDiscardMsg()))
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Message discarded at sender's request");
rc = UndeliverableReturnCode.DISCARD;
}
// Decide whether we want to block the message or not.
else if (isBlockRequired(message))
rc = UndeliverableReturnCode.BLOCK;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkMessage", rc);
return rc;
} | [
"private",
"UndeliverableReturnCode",
"checkMessage",
"(",
"SIMPMessage",
"message",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"checkMessage\"",
",",
"message",
")",
";",
"UndeliverableReturnCode",
"rc",
"=",
"UndeliverableReturnCode",
".",
"OK",
";",
"// F001333:E3",
"// If the message's reliability equals or is less than the configured ExceptionDiscardReliability",
"// then the message shouldn't be sent on to the exception destination, instead it should simply",
"// be thrown away (the default setting is BestEffort).",
"// We'll always chuck away BestEffort messages, but if we have the original destination we'll base",
"// our decision on its configuration",
"// (If the _originalDestination is null then we do not have the original destination's config to hand,",
"// for example, in the case of cleaning up a deleted destination)",
"Reliability",
"discardReliabilityThreshold",
"=",
"Reliability",
".",
"BEST_EFFORT_NONPERSISTENT",
";",
"if",
"(",
"_originalDestination",
"!=",
"null",
")",
"discardReliabilityThreshold",
"=",
"_originalDestination",
".",
"getExceptionDiscardReliability",
"(",
")",
";",
"if",
"(",
"message",
".",
"getReliability",
"(",
")",
".",
"compareTo",
"(",
"discardReliabilityThreshold",
")",
"<=",
"0",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"Message reliability (\"",
"+",
"message",
".",
"getReliability",
"(",
")",
"+",
"\") <= Exception reliability (\"",
"+",
"discardReliabilityThreshold",
"+",
"\")\"",
")",
";",
"rc",
"=",
"UndeliverableReturnCode",
".",
"DISCARD",
";",
"}",
"// Discard messages from temporary destinations.",
"else",
"if",
"(",
"_originalDestination",
"!=",
"null",
"&&",
"_originalDestination",
".",
"isTemporary",
"(",
")",
")",
"rc",
"=",
"UndeliverableReturnCode",
".",
"DISCARD",
";",
"// If the discardMessage option is set, then we discard the message rather",
"// than send to the exception destination",
"else",
"if",
"(",
"Boolean",
".",
"TRUE",
".",
"equals",
"(",
"message",
".",
"getMessage",
"(",
")",
".",
"getReportDiscardMsg",
"(",
")",
")",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"Message discarded at sender's request\"",
")",
";",
"rc",
"=",
"UndeliverableReturnCode",
".",
"DISCARD",
";",
"}",
"// Decide whether we want to block the message or not.",
"else",
"if",
"(",
"isBlockRequired",
"(",
"message",
")",
")",
"rc",
"=",
"UndeliverableReturnCode",
".",
"BLOCK",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"checkMessage\"",
",",
"rc",
")",
";",
"return",
"rc",
";",
"}"
] | Checks that a message is valid for delivery to an exception
destination
@param message
@return | [
"Checks",
"that",
"a",
"message",
"is",
"valid",
"for",
"delivery",
"to",
"an",
"exception",
"destination"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ExceptionDestinationHandlerImpl.java#L1763-L1817 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ExceptionDestinationHandlerImpl.java | ExceptionDestinationHandlerImpl.checkExceptionDestinationAccess | private AccessResult checkExceptionDestinationAccess(JsMessage msg,
ConnectionImpl conn,
String alternateUser,
boolean defaultInUse)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "checkExceptionDestinationAccess", new Object[] { msg,
conn,
alternateUser,
Boolean.valueOf(defaultInUse) });
// Will drive the form of sib.security checkDestinationAccess() that
// takes a JsMessage
SecurityContext secContext = new SecurityContext(msg,
alternateUser,
null,
_messageProcessor.getAuthorisationUtils());
boolean allowed = true;
boolean identityAdoptionAllowed = true;
if (defaultInUse)
{
// We're using the default exc destination for the ME, call
// checkDestinationAccess() with the default exc dest prefix
// rather than the fully qualified name
// First we do the alternate user check. If an alternateUser was set then
// (A )We need to determine whether the connected subject has the authority to
// perform alternate user checks. It is assumed that if there is no connection
// associated with this call, then we're privileged anyway.
// (B) We need to do the destination access check with the supplied alternate
// user.
if (conn != null)// conn will be null if we've followed the handleUndeliverableMessage route
// (privileged) rather than the sendToExceptionDestination route
// where the Core SPI has been driven
{
// Careful, we need a sec context for the connection rather than that associated
// with the message.
SecurityContext connSecContext = new SecurityContext(conn.getSecuritySubject(),
alternateUser,
null,
_messageProcessor.getAuthorisationUtils());
// Alternate user check
if (alternateUser != null)
{
if (!_messageProcessor.
getAccessChecker().
checkDestinationAccess(connSecContext,
null, // home bus
SIMPConstants.SYSTEM_DEFAULT_EXCEPTION_DESTINATION_PREFIX,
OperationType.IDENTITY_ADOPTER))
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "checkExceptionDestinationAccess", "not authorized to perform alternate user checks on this destination");
allowed = false;
identityAdoptionAllowed = false;
}
}
// Now check access authority on the destination itself
if (allowed)
{
if (!_messageProcessor.
getAccessChecker().
checkDestinationAccess(connSecContext,
null, // home bus
SIMPConstants.SYSTEM_DEFAULT_EXCEPTION_DESTINATION_PREFIX,
OperationType.SEND))
{
allowed = false;
}
}
}
else // handleUndeliverableMessage route
{
if (!_messageProcessor.
getAccessChecker().
checkDestinationAccess(secContext,
null, // home bus
SIMPConstants.SYSTEM_DEFAULT_EXCEPTION_DESTINATION_PREFIX,
OperationType.SEND))
{
allowed = false;
}
}
}
else
{
// Same style of processing as above
if (conn != null) // conn will be null if we've followed the handleUndeliverableMessage route
// (privileged) rather than the sendToExceptionDestination route
// where the Core SPI has been driven
{
// Careful, we need a sec context for the connection rather than that associated
// with the message.
SecurityContext connSecContext = new SecurityContext(conn.getSecuritySubject(),
alternateUser,
null,
_messageProcessor.getAuthorisationUtils());
// Alternate user check
if (alternateUser != null)
{
if (!_exceptionDestination.
checkDestinationAccess(connSecContext,
OperationType.IDENTITY_ADOPTER))
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "checkExceptionDestinationAccess", "not authorized to perform alternate user checks on this destination");
allowed = false;
identityAdoptionAllowed = false;
}
}
// Now check access authority on the destination itself
if (allowed)
{
if (!_exceptionDestination.
checkDestinationAccess(connSecContext,
OperationType.SEND))
{
allowed = false;
}
}
}
else // handleUndeliverableMessage route
{
// Check authority to produce to destination
if (!_exceptionDestination.
checkDestinationAccess(secContext,
OperationType.SEND))
{
allowed = false;
}
}
}
AccessResult result = new AccessResult(allowed, identityAdoptionAllowed);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc,
"checkExceptionDestinationAccess",
result);
return result;
} | java | private AccessResult checkExceptionDestinationAccess(JsMessage msg,
ConnectionImpl conn,
String alternateUser,
boolean defaultInUse)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "checkExceptionDestinationAccess", new Object[] { msg,
conn,
alternateUser,
Boolean.valueOf(defaultInUse) });
// Will drive the form of sib.security checkDestinationAccess() that
// takes a JsMessage
SecurityContext secContext = new SecurityContext(msg,
alternateUser,
null,
_messageProcessor.getAuthorisationUtils());
boolean allowed = true;
boolean identityAdoptionAllowed = true;
if (defaultInUse)
{
// We're using the default exc destination for the ME, call
// checkDestinationAccess() with the default exc dest prefix
// rather than the fully qualified name
// First we do the alternate user check. If an alternateUser was set then
// (A )We need to determine whether the connected subject has the authority to
// perform alternate user checks. It is assumed that if there is no connection
// associated with this call, then we're privileged anyway.
// (B) We need to do the destination access check with the supplied alternate
// user.
if (conn != null)// conn will be null if we've followed the handleUndeliverableMessage route
// (privileged) rather than the sendToExceptionDestination route
// where the Core SPI has been driven
{
// Careful, we need a sec context for the connection rather than that associated
// with the message.
SecurityContext connSecContext = new SecurityContext(conn.getSecuritySubject(),
alternateUser,
null,
_messageProcessor.getAuthorisationUtils());
// Alternate user check
if (alternateUser != null)
{
if (!_messageProcessor.
getAccessChecker().
checkDestinationAccess(connSecContext,
null, // home bus
SIMPConstants.SYSTEM_DEFAULT_EXCEPTION_DESTINATION_PREFIX,
OperationType.IDENTITY_ADOPTER))
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "checkExceptionDestinationAccess", "not authorized to perform alternate user checks on this destination");
allowed = false;
identityAdoptionAllowed = false;
}
}
// Now check access authority on the destination itself
if (allowed)
{
if (!_messageProcessor.
getAccessChecker().
checkDestinationAccess(connSecContext,
null, // home bus
SIMPConstants.SYSTEM_DEFAULT_EXCEPTION_DESTINATION_PREFIX,
OperationType.SEND))
{
allowed = false;
}
}
}
else // handleUndeliverableMessage route
{
if (!_messageProcessor.
getAccessChecker().
checkDestinationAccess(secContext,
null, // home bus
SIMPConstants.SYSTEM_DEFAULT_EXCEPTION_DESTINATION_PREFIX,
OperationType.SEND))
{
allowed = false;
}
}
}
else
{
// Same style of processing as above
if (conn != null) // conn will be null if we've followed the handleUndeliverableMessage route
// (privileged) rather than the sendToExceptionDestination route
// where the Core SPI has been driven
{
// Careful, we need a sec context for the connection rather than that associated
// with the message.
SecurityContext connSecContext = new SecurityContext(conn.getSecuritySubject(),
alternateUser,
null,
_messageProcessor.getAuthorisationUtils());
// Alternate user check
if (alternateUser != null)
{
if (!_exceptionDestination.
checkDestinationAccess(connSecContext,
OperationType.IDENTITY_ADOPTER))
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "checkExceptionDestinationAccess", "not authorized to perform alternate user checks on this destination");
allowed = false;
identityAdoptionAllowed = false;
}
}
// Now check access authority on the destination itself
if (allowed)
{
if (!_exceptionDestination.
checkDestinationAccess(connSecContext,
OperationType.SEND))
{
allowed = false;
}
}
}
else // handleUndeliverableMessage route
{
// Check authority to produce to destination
if (!_exceptionDestination.
checkDestinationAccess(secContext,
OperationType.SEND))
{
allowed = false;
}
}
}
AccessResult result = new AccessResult(allowed, identityAdoptionAllowed);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc,
"checkExceptionDestinationAccess",
result);
return result;
} | [
"private",
"AccessResult",
"checkExceptionDestinationAccess",
"(",
"JsMessage",
"msg",
",",
"ConnectionImpl",
"conn",
",",
"String",
"alternateUser",
",",
"boolean",
"defaultInUse",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"checkExceptionDestinationAccess\"",
",",
"new",
"Object",
"[",
"]",
"{",
"msg",
",",
"conn",
",",
"alternateUser",
",",
"Boolean",
".",
"valueOf",
"(",
"defaultInUse",
")",
"}",
")",
";",
"// Will drive the form of sib.security checkDestinationAccess() that",
"// takes a JsMessage",
"SecurityContext",
"secContext",
"=",
"new",
"SecurityContext",
"(",
"msg",
",",
"alternateUser",
",",
"null",
",",
"_messageProcessor",
".",
"getAuthorisationUtils",
"(",
")",
")",
";",
"boolean",
"allowed",
"=",
"true",
";",
"boolean",
"identityAdoptionAllowed",
"=",
"true",
";",
"if",
"(",
"defaultInUse",
")",
"{",
"// We're using the default exc destination for the ME, call",
"// checkDestinationAccess() with the default exc dest prefix",
"// rather than the fully qualified name",
"// First we do the alternate user check. If an alternateUser was set then",
"// (A )We need to determine whether the connected subject has the authority to",
"// perform alternate user checks. It is assumed that if there is no connection",
"// associated with this call, then we're privileged anyway.",
"// (B) We need to do the destination access check with the supplied alternate",
"// user.",
"if",
"(",
"conn",
"!=",
"null",
")",
"// conn will be null if we've followed the handleUndeliverableMessage route",
"// (privileged) rather than the sendToExceptionDestination route",
"// where the Core SPI has been driven",
"{",
"// Careful, we need a sec context for the connection rather than that associated",
"// with the message.",
"SecurityContext",
"connSecContext",
"=",
"new",
"SecurityContext",
"(",
"conn",
".",
"getSecuritySubject",
"(",
")",
",",
"alternateUser",
",",
"null",
",",
"_messageProcessor",
".",
"getAuthorisationUtils",
"(",
")",
")",
";",
"// Alternate user check",
"if",
"(",
"alternateUser",
"!=",
"null",
")",
"{",
"if",
"(",
"!",
"_messageProcessor",
".",
"getAccessChecker",
"(",
")",
".",
"checkDestinationAccess",
"(",
"connSecContext",
",",
"null",
",",
"// home bus",
"SIMPConstants",
".",
"SYSTEM_DEFAULT_EXCEPTION_DESTINATION_PREFIX",
",",
"OperationType",
".",
"IDENTITY_ADOPTER",
")",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"checkExceptionDestinationAccess\"",
",",
"\"not authorized to perform alternate user checks on this destination\"",
")",
";",
"allowed",
"=",
"false",
";",
"identityAdoptionAllowed",
"=",
"false",
";",
"}",
"}",
"// Now check access authority on the destination itself",
"if",
"(",
"allowed",
")",
"{",
"if",
"(",
"!",
"_messageProcessor",
".",
"getAccessChecker",
"(",
")",
".",
"checkDestinationAccess",
"(",
"connSecContext",
",",
"null",
",",
"// home bus",
"SIMPConstants",
".",
"SYSTEM_DEFAULT_EXCEPTION_DESTINATION_PREFIX",
",",
"OperationType",
".",
"SEND",
")",
")",
"{",
"allowed",
"=",
"false",
";",
"}",
"}",
"}",
"else",
"// handleUndeliverableMessage route",
"{",
"if",
"(",
"!",
"_messageProcessor",
".",
"getAccessChecker",
"(",
")",
".",
"checkDestinationAccess",
"(",
"secContext",
",",
"null",
",",
"// home bus",
"SIMPConstants",
".",
"SYSTEM_DEFAULT_EXCEPTION_DESTINATION_PREFIX",
",",
"OperationType",
".",
"SEND",
")",
")",
"{",
"allowed",
"=",
"false",
";",
"}",
"}",
"}",
"else",
"{",
"// Same style of processing as above",
"if",
"(",
"conn",
"!=",
"null",
")",
"// conn will be null if we've followed the handleUndeliverableMessage route",
"// (privileged) rather than the sendToExceptionDestination route",
"// where the Core SPI has been driven",
"{",
"// Careful, we need a sec context for the connection rather than that associated",
"// with the message.",
"SecurityContext",
"connSecContext",
"=",
"new",
"SecurityContext",
"(",
"conn",
".",
"getSecuritySubject",
"(",
")",
",",
"alternateUser",
",",
"null",
",",
"_messageProcessor",
".",
"getAuthorisationUtils",
"(",
")",
")",
";",
"// Alternate user check",
"if",
"(",
"alternateUser",
"!=",
"null",
")",
"{",
"if",
"(",
"!",
"_exceptionDestination",
".",
"checkDestinationAccess",
"(",
"connSecContext",
",",
"OperationType",
".",
"IDENTITY_ADOPTER",
")",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"checkExceptionDestinationAccess\"",
",",
"\"not authorized to perform alternate user checks on this destination\"",
")",
";",
"allowed",
"=",
"false",
";",
"identityAdoptionAllowed",
"=",
"false",
";",
"}",
"}",
"// Now check access authority on the destination itself",
"if",
"(",
"allowed",
")",
"{",
"if",
"(",
"!",
"_exceptionDestination",
".",
"checkDestinationAccess",
"(",
"connSecContext",
",",
"OperationType",
".",
"SEND",
")",
")",
"{",
"allowed",
"=",
"false",
";",
"}",
"}",
"}",
"else",
"// handleUndeliverableMessage route",
"{",
"// Check authority to produce to destination",
"if",
"(",
"!",
"_exceptionDestination",
".",
"checkDestinationAccess",
"(",
"secContext",
",",
"OperationType",
".",
"SEND",
")",
")",
"{",
"allowed",
"=",
"false",
";",
"}",
"}",
"}",
"AccessResult",
"result",
"=",
"new",
"AccessResult",
"(",
"allowed",
",",
"identityAdoptionAllowed",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"checkExceptionDestinationAccess\"",
",",
"result",
")",
";",
"return",
"result",
";",
"}"
] | Checks authority to access exception destination.
@param message
@return | [
"Checks",
"authority",
"to",
"access",
"exception",
"destination",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ExceptionDestinationHandlerImpl.java#L1825-L1974 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ExceptionDestinationHandlerImpl.java | ExceptionDestinationHandlerImpl.handleAccessDenied | private void handleAccessDenied(AccessResult result,
JsMessage msg,
String alternateUser)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "handleAccessDenied", new Object[] { result,
msg,
alternateUser });
// Determine the username and operation for messaging
String userName = null;
OperationType operationType = null;
if (result.didIdentityAdoptionFail())
{
userName = msg.getSecurityUserid();
operationType = OperationType.IDENTITY_ADOPTER;
}
else
{
operationType = OperationType.SEND;
if (alternateUser != null)
userName = alternateUser;
else
userName = msg.getSecurityUserid();
}
// Build the message for the Exception and the Notification
String nlsMessage =
nls.getFormattedMessage("USER_NOT_AUTH_EXCEPTION_DEST_ERROR_CWSIP0313",
new Object[] { userName,
_exceptionDestinationName },
null);
// Fire a Notification if Eventing is enabled
_messageProcessor.
getAccessChecker().
fireDestinationAccessNotAuthorizedEvent(_exceptionDestinationName,
userName,
operationType,
nlsMessage);
// Report the not authorized condition to the console
SibTr.warning(tc,
"USER_NOT_AUTH_EXCEPTION_DEST_ERROR_CWSIP0313",
new Object[] { userName,
_exceptionDestinationName }
);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc,
"handleAccessDenied");
} | java | private void handleAccessDenied(AccessResult result,
JsMessage msg,
String alternateUser)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "handleAccessDenied", new Object[] { result,
msg,
alternateUser });
// Determine the username and operation for messaging
String userName = null;
OperationType operationType = null;
if (result.didIdentityAdoptionFail())
{
userName = msg.getSecurityUserid();
operationType = OperationType.IDENTITY_ADOPTER;
}
else
{
operationType = OperationType.SEND;
if (alternateUser != null)
userName = alternateUser;
else
userName = msg.getSecurityUserid();
}
// Build the message for the Exception and the Notification
String nlsMessage =
nls.getFormattedMessage("USER_NOT_AUTH_EXCEPTION_DEST_ERROR_CWSIP0313",
new Object[] { userName,
_exceptionDestinationName },
null);
// Fire a Notification if Eventing is enabled
_messageProcessor.
getAccessChecker().
fireDestinationAccessNotAuthorizedEvent(_exceptionDestinationName,
userName,
operationType,
nlsMessage);
// Report the not authorized condition to the console
SibTr.warning(tc,
"USER_NOT_AUTH_EXCEPTION_DEST_ERROR_CWSIP0313",
new Object[] { userName,
_exceptionDestinationName }
);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc,
"handleAccessDenied");
} | [
"private",
"void",
"handleAccessDenied",
"(",
"AccessResult",
"result",
",",
"JsMessage",
"msg",
",",
"String",
"alternateUser",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"handleAccessDenied\"",
",",
"new",
"Object",
"[",
"]",
"{",
"result",
",",
"msg",
",",
"alternateUser",
"}",
")",
";",
"// Determine the username and operation for messaging",
"String",
"userName",
"=",
"null",
";",
"OperationType",
"operationType",
"=",
"null",
";",
"if",
"(",
"result",
".",
"didIdentityAdoptionFail",
"(",
")",
")",
"{",
"userName",
"=",
"msg",
".",
"getSecurityUserid",
"(",
")",
";",
"operationType",
"=",
"OperationType",
".",
"IDENTITY_ADOPTER",
";",
"}",
"else",
"{",
"operationType",
"=",
"OperationType",
".",
"SEND",
";",
"if",
"(",
"alternateUser",
"!=",
"null",
")",
"userName",
"=",
"alternateUser",
";",
"else",
"userName",
"=",
"msg",
".",
"getSecurityUserid",
"(",
")",
";",
"}",
"// Build the message for the Exception and the Notification",
"String",
"nlsMessage",
"=",
"nls",
".",
"getFormattedMessage",
"(",
"\"USER_NOT_AUTH_EXCEPTION_DEST_ERROR_CWSIP0313\"",
",",
"new",
"Object",
"[",
"]",
"{",
"userName",
",",
"_exceptionDestinationName",
"}",
",",
"null",
")",
";",
"// Fire a Notification if Eventing is enabled",
"_messageProcessor",
".",
"getAccessChecker",
"(",
")",
".",
"fireDestinationAccessNotAuthorizedEvent",
"(",
"_exceptionDestinationName",
",",
"userName",
",",
"operationType",
",",
"nlsMessage",
")",
";",
"// Report the not authorized condition to the console",
"SibTr",
".",
"warning",
"(",
"tc",
",",
"\"USER_NOT_AUTH_EXCEPTION_DEST_ERROR_CWSIP0313\"",
",",
"new",
"Object",
"[",
"]",
"{",
"userName",
",",
"_exceptionDestinationName",
"}",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"handleAccessDenied\"",
")",
";",
"}"
] | Fire an event if eventing is enabled and write an audit record.
@param result
@param msg
@param alternateUser | [
"Fire",
"an",
"event",
"if",
"eventing",
"is",
"enabled",
"and",
"write",
"an",
"audit",
"record",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ExceptionDestinationHandlerImpl.java#L1983-L2036 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ExceptionDestinationHandlerImpl.java | ExceptionDestinationHandlerImpl.fireMessageExceptionedEvent | private void fireMessageExceptionedEvent(String apiMsgId,
SIMPMessage message,
int exceptionReason)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc,
"fireMessageExceptionedEvent",
new Object[] { apiMsgId,
message,
Integer.valueOf(exceptionReason) });
JsMessagingEngine me = _messageProcessor.getMessagingEngine();
RuntimeEventListener listener = _messageProcessor.getRuntimeEventListener();
String systemMessageId = message.getMessage().getSystemMessageId();
// Check that we have a RuntimeEventListener
if (listener != null)
{
// Build the message for the Notification
String nlsMessage =
nls_mt.getFormattedMessage(
"MESSAGE_EXCEPTION_DESTINATIONED_CWSJU0012",
new Object[] {
apiMsgId,
systemMessageId,
_exceptionDestinationName,
Integer.valueOf(exceptionReason),
message.getMessage().getExceptionMessage() },
null);
// Build the properties for the Notification
Properties props = new Properties();
// Set values for the intended destination
String intendedDestinationName = "";
String intendedDestinationUuid = SIBUuid12.toZeroString();
if (_originalDestination != null)
{
intendedDestinationName = _originalDestination.getName();
intendedDestinationUuid = _originalDestination.getUuid().toString();
}
props.put(SibNotificationConstants.KEY_INTENDED_DESTINATION_NAME,
intendedDestinationName);
props.put(SibNotificationConstants.KEY_INTENDED_DESTINATION_UUID,
intendedDestinationUuid);
// Set values for the exception destination
props.put(SibNotificationConstants.KEY_EXCEPTION_DESTINATION_NAME,
_exceptionDestination.getName());
props.put(SibNotificationConstants.KEY_EXCEPTION_DESTINATION_UUID,
_exceptionDestination.getUuid().toString());
props.put(SibNotificationConstants.KEY_SYSTEM_MESSAGE_IDENTIFIER,
(systemMessageId == null) ? "" : systemMessageId);
props.put(SibNotificationConstants.KEY_MESSAGE_EXCEPTION_REASON,
String.valueOf(exceptionReason));
// Fire the event
listener.runtimeEventOccurred(me,
SibNotificationConstants.TYPE_SIB_MESSAGE_EXCEPTIONED,
nlsMessage,
props);
}
else
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Null RuntimeEventListener, cannot fire event");
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "fireMessageExceptionedEvent");
} | java | private void fireMessageExceptionedEvent(String apiMsgId,
SIMPMessage message,
int exceptionReason)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc,
"fireMessageExceptionedEvent",
new Object[] { apiMsgId,
message,
Integer.valueOf(exceptionReason) });
JsMessagingEngine me = _messageProcessor.getMessagingEngine();
RuntimeEventListener listener = _messageProcessor.getRuntimeEventListener();
String systemMessageId = message.getMessage().getSystemMessageId();
// Check that we have a RuntimeEventListener
if (listener != null)
{
// Build the message for the Notification
String nlsMessage =
nls_mt.getFormattedMessage(
"MESSAGE_EXCEPTION_DESTINATIONED_CWSJU0012",
new Object[] {
apiMsgId,
systemMessageId,
_exceptionDestinationName,
Integer.valueOf(exceptionReason),
message.getMessage().getExceptionMessage() },
null);
// Build the properties for the Notification
Properties props = new Properties();
// Set values for the intended destination
String intendedDestinationName = "";
String intendedDestinationUuid = SIBUuid12.toZeroString();
if (_originalDestination != null)
{
intendedDestinationName = _originalDestination.getName();
intendedDestinationUuid = _originalDestination.getUuid().toString();
}
props.put(SibNotificationConstants.KEY_INTENDED_DESTINATION_NAME,
intendedDestinationName);
props.put(SibNotificationConstants.KEY_INTENDED_DESTINATION_UUID,
intendedDestinationUuid);
// Set values for the exception destination
props.put(SibNotificationConstants.KEY_EXCEPTION_DESTINATION_NAME,
_exceptionDestination.getName());
props.put(SibNotificationConstants.KEY_EXCEPTION_DESTINATION_UUID,
_exceptionDestination.getUuid().toString());
props.put(SibNotificationConstants.KEY_SYSTEM_MESSAGE_IDENTIFIER,
(systemMessageId == null) ? "" : systemMessageId);
props.put(SibNotificationConstants.KEY_MESSAGE_EXCEPTION_REASON,
String.valueOf(exceptionReason));
// Fire the event
listener.runtimeEventOccurred(me,
SibNotificationConstants.TYPE_SIB_MESSAGE_EXCEPTIONED,
nlsMessage,
props);
}
else
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Null RuntimeEventListener, cannot fire event");
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "fireMessageExceptionedEvent");
} | [
"private",
"void",
"fireMessageExceptionedEvent",
"(",
"String",
"apiMsgId",
",",
"SIMPMessage",
"message",
",",
"int",
"exceptionReason",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"fireMessageExceptionedEvent\"",
",",
"new",
"Object",
"[",
"]",
"{",
"apiMsgId",
",",
"message",
",",
"Integer",
".",
"valueOf",
"(",
"exceptionReason",
")",
"}",
")",
";",
"JsMessagingEngine",
"me",
"=",
"_messageProcessor",
".",
"getMessagingEngine",
"(",
")",
";",
"RuntimeEventListener",
"listener",
"=",
"_messageProcessor",
".",
"getRuntimeEventListener",
"(",
")",
";",
"String",
"systemMessageId",
"=",
"message",
".",
"getMessage",
"(",
")",
".",
"getSystemMessageId",
"(",
")",
";",
"// Check that we have a RuntimeEventListener",
"if",
"(",
"listener",
"!=",
"null",
")",
"{",
"// Build the message for the Notification",
"String",
"nlsMessage",
"=",
"nls_mt",
".",
"getFormattedMessage",
"(",
"\"MESSAGE_EXCEPTION_DESTINATIONED_CWSJU0012\"",
",",
"new",
"Object",
"[",
"]",
"{",
"apiMsgId",
",",
"systemMessageId",
",",
"_exceptionDestinationName",
",",
"Integer",
".",
"valueOf",
"(",
"exceptionReason",
")",
",",
"message",
".",
"getMessage",
"(",
")",
".",
"getExceptionMessage",
"(",
")",
"}",
",",
"null",
")",
";",
"// Build the properties for the Notification",
"Properties",
"props",
"=",
"new",
"Properties",
"(",
")",
";",
"// Set values for the intended destination",
"String",
"intendedDestinationName",
"=",
"\"\"",
";",
"String",
"intendedDestinationUuid",
"=",
"SIBUuid12",
".",
"toZeroString",
"(",
")",
";",
"if",
"(",
"_originalDestination",
"!=",
"null",
")",
"{",
"intendedDestinationName",
"=",
"_originalDestination",
".",
"getName",
"(",
")",
";",
"intendedDestinationUuid",
"=",
"_originalDestination",
".",
"getUuid",
"(",
")",
".",
"toString",
"(",
")",
";",
"}",
"props",
".",
"put",
"(",
"SibNotificationConstants",
".",
"KEY_INTENDED_DESTINATION_NAME",
",",
"intendedDestinationName",
")",
";",
"props",
".",
"put",
"(",
"SibNotificationConstants",
".",
"KEY_INTENDED_DESTINATION_UUID",
",",
"intendedDestinationUuid",
")",
";",
"// Set values for the exception destination",
"props",
".",
"put",
"(",
"SibNotificationConstants",
".",
"KEY_EXCEPTION_DESTINATION_NAME",
",",
"_exceptionDestination",
".",
"getName",
"(",
")",
")",
";",
"props",
".",
"put",
"(",
"SibNotificationConstants",
".",
"KEY_EXCEPTION_DESTINATION_UUID",
",",
"_exceptionDestination",
".",
"getUuid",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"props",
".",
"put",
"(",
"SibNotificationConstants",
".",
"KEY_SYSTEM_MESSAGE_IDENTIFIER",
",",
"(",
"systemMessageId",
"==",
"null",
")",
"?",
"\"\"",
":",
"systemMessageId",
")",
";",
"props",
".",
"put",
"(",
"SibNotificationConstants",
".",
"KEY_MESSAGE_EXCEPTION_REASON",
",",
"String",
".",
"valueOf",
"(",
"exceptionReason",
")",
")",
";",
"// Fire the event",
"listener",
".",
"runtimeEventOccurred",
"(",
"me",
",",
"SibNotificationConstants",
".",
"TYPE_SIB_MESSAGE_EXCEPTIONED",
",",
"nlsMessage",
",",
"props",
")",
";",
"}",
"else",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"Null RuntimeEventListener, cannot fire event\"",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"fireMessageExceptionedEvent\"",
")",
";",
"}"
] | Fire an event notification of type TYPE_SIB_MESSAGE_EXCEPTIONED
@param newState | [
"Fire",
"an",
"event",
"notification",
"of",
"type",
"TYPE_SIB_MESSAGE_EXCEPTIONED"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ExceptionDestinationHandlerImpl.java#L2093-L2168 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/webapp/WebGroup.java | WebGroup.decodeUri | public static String decodeUri(String url)
{
int index1 = url.indexOf(sessUrlRewritePrefix);
int index2 = url.indexOf(qMark);
String tmp = null;
if (index2 != -1 && index2 > index1)
{
tmp = url.substring(index2);
}
if (index1 != -1)
{
url = url.substring(0, index1);
if (tmp != null)
{
url = url + tmp;
}
}
return url;
} | java | public static String decodeUri(String url)
{
int index1 = url.indexOf(sessUrlRewritePrefix);
int index2 = url.indexOf(qMark);
String tmp = null;
if (index2 != -1 && index2 > index1)
{
tmp = url.substring(index2);
}
if (index1 != -1)
{
url = url.substring(0, index1);
if (tmp != null)
{
url = url + tmp;
}
}
return url;
} | [
"public",
"static",
"String",
"decodeUri",
"(",
"String",
"url",
")",
"{",
"int",
"index1",
"=",
"url",
".",
"indexOf",
"(",
"sessUrlRewritePrefix",
")",
";",
"int",
"index2",
"=",
"url",
".",
"indexOf",
"(",
"qMark",
")",
";",
"String",
"tmp",
"=",
"null",
";",
"if",
"(",
"index2",
"!=",
"-",
"1",
"&&",
"index2",
">",
"index1",
")",
"{",
"tmp",
"=",
"url",
".",
"substring",
"(",
"index2",
")",
";",
"}",
"if",
"(",
"index1",
"!=",
"-",
"1",
")",
"{",
"url",
"=",
"url",
".",
"substring",
"(",
"0",
",",
"index1",
")",
";",
"if",
"(",
"tmp",
"!=",
"null",
")",
"{",
"url",
"=",
"url",
"+",
"tmp",
";",
"}",
"}",
"return",
"url",
";",
"}"
] | Strips out the sessionId only form the URI
@param url
@return | [
"Strips",
"out",
"the",
"sessionId",
"only",
"form",
"the",
"URI"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/webapp/WebGroup.java#L395-L414 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/FaceletFactory.java | FaceletFactory.setInstance | public static final void setInstance(FaceletFactory factory)
{
if (factory == null)
{
instance.remove();
}
else
{
instance.set(factory);
}
} | java | public static final void setInstance(FaceletFactory factory)
{
if (factory == null)
{
instance.remove();
}
else
{
instance.set(factory);
}
} | [
"public",
"static",
"final",
"void",
"setInstance",
"(",
"FaceletFactory",
"factory",
")",
"{",
"if",
"(",
"factory",
"==",
"null",
")",
"{",
"instance",
".",
"remove",
"(",
")",
";",
"}",
"else",
"{",
"instance",
".",
"set",
"(",
"factory",
")",
";",
"}",
"}"
] | Set the static instance
@param factory | [
"Set",
"the",
"static",
"instance"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/FaceletFactory.java#L165-L175 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.