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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
alibaba/java-dns-cache-manipulator | library/src/main/java/com/alibaba/dcm/DnsCacheManipulator.java | DnsCacheManipulator.setDnsCache | public static void setDnsCache(Properties properties) {
for (Map.Entry<Object, Object> entry : properties.entrySet()) {
final String host = (String) entry.getKey();
String ipList = (String) entry.getValue();
ipList = ipList.trim();
if (ipList.isEmpty()) continue;
final String[] ips = COMMA_SEPARATOR.split(ipList);
setDnsCache(host, ips);
}
} | java | public static void setDnsCache(Properties properties) {
for (Map.Entry<Object, Object> entry : properties.entrySet()) {
final String host = (String) entry.getKey();
String ipList = (String) entry.getValue();
ipList = ipList.trim();
if (ipList.isEmpty()) continue;
final String[] ips = COMMA_SEPARATOR.split(ipList);
setDnsCache(host, ips);
}
} | [
"public",
"static",
"void",
"setDnsCache",
"(",
"Properties",
"properties",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"Object",
",",
"Object",
">",
"entry",
":",
"properties",
".",
"entrySet",
"(",
")",
")",
"{",
"final",
"String",
"host",
"=",
"(",
"String",
")",
"entry",
".",
"getKey",
"(",
")",
";",
"String",
"ipList",
"=",
"(",
"String",
")",
"entry",
".",
"getValue",
"(",
")",
";",
"ipList",
"=",
"ipList",
".",
"trim",
"(",
")",
";",
"if",
"(",
"ipList",
".",
"isEmpty",
"(",
")",
")",
"continue",
";",
"final",
"String",
"[",
"]",
"ips",
"=",
"COMMA_SEPARATOR",
".",
"split",
"(",
"ipList",
")",
";",
"setDnsCache",
"(",
"host",
",",
"ips",
")",
";",
"}",
"}"
] | Set dns cache entries by properties
@param properties input properties. eg. {@code www.example.com=42.42.42.42}, or {@code www.example.com=42.42.42.42,43.43.43.43}
@throws DnsCacheManipulatorException Operation fail | [
"Set",
"dns",
"cache",
"entries",
"by",
"properties"
] | eab50ee5c27671f9159b55458301f9429b2fcc47 | https://github.com/alibaba/java-dns-cache-manipulator/blob/eab50ee5c27671f9159b55458301f9429b2fcc47/library/src/main/java/com/alibaba/dcm/DnsCacheManipulator.java#L71-L82 | train |
alibaba/java-dns-cache-manipulator | library/src/main/java/com/alibaba/dcm/DnsCacheManipulator.java | DnsCacheManipulator.loadDnsCacheConfig | public static void loadDnsCacheConfig(String propertiesFileName) {
InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(propertiesFileName);
if (inputStream == null) {
inputStream = DnsCacheManipulator.class.getClassLoader().getResourceAsStream(propertiesFileName);
}
if (inputStream == null) {
throw new DnsCacheManipulatorException("Fail to find " + propertiesFileName + " on classpath!");
}
try {
Properties properties = new Properties();
properties.load(inputStream);
inputStream.close();
setDnsCache(properties);
} catch (Exception e) {
final String message = String.format("Fail to loadDnsCacheConfig from %s, cause: %s",
propertiesFileName, e.toString());
throw new DnsCacheManipulatorException(message, e);
}
} | java | public static void loadDnsCacheConfig(String propertiesFileName) {
InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(propertiesFileName);
if (inputStream == null) {
inputStream = DnsCacheManipulator.class.getClassLoader().getResourceAsStream(propertiesFileName);
}
if (inputStream == null) {
throw new DnsCacheManipulatorException("Fail to find " + propertiesFileName + " on classpath!");
}
try {
Properties properties = new Properties();
properties.load(inputStream);
inputStream.close();
setDnsCache(properties);
} catch (Exception e) {
final String message = String.format("Fail to loadDnsCacheConfig from %s, cause: %s",
propertiesFileName, e.toString());
throw new DnsCacheManipulatorException(message, e);
}
} | [
"public",
"static",
"void",
"loadDnsCacheConfig",
"(",
"String",
"propertiesFileName",
")",
"{",
"InputStream",
"inputStream",
"=",
"Thread",
".",
"currentThread",
"(",
")",
".",
"getContextClassLoader",
"(",
")",
".",
"getResourceAsStream",
"(",
"propertiesFileName",
")",
";",
"if",
"(",
"inputStream",
"==",
"null",
")",
"{",
"inputStream",
"=",
"DnsCacheManipulator",
".",
"class",
".",
"getClassLoader",
"(",
")",
".",
"getResourceAsStream",
"(",
"propertiesFileName",
")",
";",
"}",
"if",
"(",
"inputStream",
"==",
"null",
")",
"{",
"throw",
"new",
"DnsCacheManipulatorException",
"(",
"\"Fail to find \"",
"+",
"propertiesFileName",
"+",
"\" on classpath!\"",
")",
";",
"}",
"try",
"{",
"Properties",
"properties",
"=",
"new",
"Properties",
"(",
")",
";",
"properties",
".",
"load",
"(",
"inputStream",
")",
";",
"inputStream",
".",
"close",
"(",
")",
";",
"setDnsCache",
"(",
"properties",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"final",
"String",
"message",
"=",
"String",
".",
"format",
"(",
"\"Fail to loadDnsCacheConfig from %s, cause: %s\"",
",",
"propertiesFileName",
",",
"e",
".",
"toString",
"(",
")",
")",
";",
"throw",
"new",
"DnsCacheManipulatorException",
"(",
"message",
",",
"e",
")",
";",
"}",
"}"
] | Load dns config from the specified properties file on classpath, then set dns cache.
@param propertiesFileName specified properties file name on classpath.
@throws DnsCacheManipulatorException Operation fail
@see DnsCacheManipulator#setDnsCache(java.util.Properties) | [
"Load",
"dns",
"config",
"from",
"the",
"specified",
"properties",
"file",
"on",
"classpath",
"then",
"set",
"dns",
"cache",
"."
] | eab50ee5c27671f9159b55458301f9429b2fcc47 | https://github.com/alibaba/java-dns-cache-manipulator/blob/eab50ee5c27671f9159b55458301f9429b2fcc47/library/src/main/java/com/alibaba/dcm/DnsCacheManipulator.java#L106-L125 | train |
alibaba/java-dns-cache-manipulator | library/src/main/java/com/alibaba/dcm/DnsCacheManipulator.java | DnsCacheManipulator.getDnsCache | @Nullable
public static DnsCacheEntry getDnsCache(String host) {
try {
return InetAddressCacheUtil.getInetAddressCache(host);
} catch (Exception e) {
throw new DnsCacheManipulatorException("Fail to getDnsCache, cause: " + e.toString(), e);
}
} | java | @Nullable
public static DnsCacheEntry getDnsCache(String host) {
try {
return InetAddressCacheUtil.getInetAddressCache(host);
} catch (Exception e) {
throw new DnsCacheManipulatorException("Fail to getDnsCache, cause: " + e.toString(), e);
}
} | [
"@",
"Nullable",
"public",
"static",
"DnsCacheEntry",
"getDnsCache",
"(",
"String",
"host",
")",
"{",
"try",
"{",
"return",
"InetAddressCacheUtil",
".",
"getInetAddressCache",
"(",
"host",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"DnsCacheManipulatorException",
"(",
"\"Fail to getDnsCache, cause: \"",
"+",
"e",
".",
"toString",
"(",
")",
",",
"e",
")",
";",
"}",
"}"
] | Get dns cache.
@return dns cache. return {@code null} if no entry for host or dns cache is expired.
@throws DnsCacheManipulatorException Operation fail | [
"Get",
"dns",
"cache",
"."
] | eab50ee5c27671f9159b55458301f9429b2fcc47 | https://github.com/alibaba/java-dns-cache-manipulator/blob/eab50ee5c27671f9159b55458301f9429b2fcc47/library/src/main/java/com/alibaba/dcm/DnsCacheManipulator.java#L133-L140 | train |
alibaba/java-dns-cache-manipulator | library/src/main/java/com/alibaba/dcm/DnsCacheManipulator.java | DnsCacheManipulator.listDnsCache | public static List<DnsCacheEntry> listDnsCache() {
try {
return InetAddressCacheUtil.listInetAddressCache().getCache();
} catch (Exception e) {
throw new DnsCacheManipulatorException("Fail to listDnsCache, cause: " + e.toString(), e);
}
} | java | public static List<DnsCacheEntry> listDnsCache() {
try {
return InetAddressCacheUtil.listInetAddressCache().getCache();
} catch (Exception e) {
throw new DnsCacheManipulatorException("Fail to listDnsCache, cause: " + e.toString(), e);
}
} | [
"public",
"static",
"List",
"<",
"DnsCacheEntry",
">",
"listDnsCache",
"(",
")",
"{",
"try",
"{",
"return",
"InetAddressCacheUtil",
".",
"listInetAddressCache",
"(",
")",
".",
"getCache",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"DnsCacheManipulatorException",
"(",
"\"Fail to listDnsCache, cause: \"",
"+",
"e",
".",
"toString",
"(",
")",
",",
"e",
")",
";",
"}",
"}"
] | Get all dns cache entries.
@return dns cache entries
@throws DnsCacheManipulatorException Operation fail
@see #getWholeDnsCache()
@since 1.2.0 | [
"Get",
"all",
"dns",
"cache",
"entries",
"."
] | eab50ee5c27671f9159b55458301f9429b2fcc47 | https://github.com/alibaba/java-dns-cache-manipulator/blob/eab50ee5c27671f9159b55458301f9429b2fcc47/library/src/main/java/com/alibaba/dcm/DnsCacheManipulator.java#L162-L168 | train |
alibaba/java-dns-cache-manipulator | library/src/main/java/com/alibaba/dcm/DnsCacheManipulator.java | DnsCacheManipulator.getWholeDnsCache | public static DnsCache getWholeDnsCache() {
try {
return InetAddressCacheUtil.listInetAddressCache();
} catch (Exception e) {
throw new DnsCacheManipulatorException("Fail to getWholeDnsCache, cause: " + e.toString(), e);
}
} | java | public static DnsCache getWholeDnsCache() {
try {
return InetAddressCacheUtil.listInetAddressCache();
} catch (Exception e) {
throw new DnsCacheManipulatorException("Fail to getWholeDnsCache, cause: " + e.toString(), e);
}
} | [
"public",
"static",
"DnsCache",
"getWholeDnsCache",
"(",
")",
"{",
"try",
"{",
"return",
"InetAddressCacheUtil",
".",
"listInetAddressCache",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"DnsCacheManipulatorException",
"(",
"\"Fail to getWholeDnsCache, cause: \"",
"+",
"e",
".",
"toString",
"(",
")",
",",
"e",
")",
";",
"}",
"}"
] | Get whole dns cache info.
@return dns cache entries
@throws DnsCacheManipulatorException Operation fail
@since 1.2.0 | [
"Get",
"whole",
"dns",
"cache",
"info",
"."
] | eab50ee5c27671f9159b55458301f9429b2fcc47 | https://github.com/alibaba/java-dns-cache-manipulator/blob/eab50ee5c27671f9159b55458301f9429b2fcc47/library/src/main/java/com/alibaba/dcm/DnsCacheManipulator.java#L177-L183 | train |
alibaba/java-dns-cache-manipulator | library/src/main/java/com/alibaba/dcm/DnsCacheManipulator.java | DnsCacheManipulator.removeDnsCache | public static void removeDnsCache(String host) {
try {
InetAddressCacheUtil.removeInetAddressCache(host);
} catch (Exception e) {
final String message = String.format("Fail to removeDnsCache for host %s, cause: %s", host, e.toString());
throw new DnsCacheManipulatorException(message, e);
}
} | java | public static void removeDnsCache(String host) {
try {
InetAddressCacheUtil.removeInetAddressCache(host);
} catch (Exception e) {
final String message = String.format("Fail to removeDnsCache for host %s, cause: %s", host, e.toString());
throw new DnsCacheManipulatorException(message, e);
}
} | [
"public",
"static",
"void",
"removeDnsCache",
"(",
"String",
"host",
")",
"{",
"try",
"{",
"InetAddressCacheUtil",
".",
"removeInetAddressCache",
"(",
"host",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"final",
"String",
"message",
"=",
"String",
".",
"format",
"(",
"\"Fail to removeDnsCache for host %s, cause: %s\"",
",",
"host",
",",
"e",
".",
"toString",
"(",
")",
")",
";",
"throw",
"new",
"DnsCacheManipulatorException",
"(",
"message",
",",
"e",
")",
";",
"}",
"}"
] | Remove dns cache entry, cause lookup dns server for host after.
@param host host
@throws DnsCacheManipulatorException Operation fail
@see DnsCacheManipulator#clearDnsCache | [
"Remove",
"dns",
"cache",
"entry",
"cause",
"lookup",
"dns",
"server",
"for",
"host",
"after",
"."
] | eab50ee5c27671f9159b55458301f9429b2fcc47 | https://github.com/alibaba/java-dns-cache-manipulator/blob/eab50ee5c27671f9159b55458301f9429b2fcc47/library/src/main/java/com/alibaba/dcm/DnsCacheManipulator.java#L192-L199 | train |
alibaba/java-dns-cache-manipulator | library/src/main/java/com/alibaba/dcm/DnsCacheManipulator.java | DnsCacheManipulator.setDnsNegativeCachePolicy | public static void setDnsNegativeCachePolicy(int negativeCacheSeconds) {
try {
InetAddressCacheUtil.setDnsNegativeCachePolicy(negativeCacheSeconds);
} catch (Exception e) {
throw new DnsCacheManipulatorException("Fail to setDnsNegativeCachePolicy, cause: " + e.toString(), e);
}
} | java | public static void setDnsNegativeCachePolicy(int negativeCacheSeconds) {
try {
InetAddressCacheUtil.setDnsNegativeCachePolicy(negativeCacheSeconds);
} catch (Exception e) {
throw new DnsCacheManipulatorException("Fail to setDnsNegativeCachePolicy, cause: " + e.toString(), e);
}
} | [
"public",
"static",
"void",
"setDnsNegativeCachePolicy",
"(",
"int",
"negativeCacheSeconds",
")",
"{",
"try",
"{",
"InetAddressCacheUtil",
".",
"setDnsNegativeCachePolicy",
"(",
"negativeCacheSeconds",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"DnsCacheManipulatorException",
"(",
"\"Fail to setDnsNegativeCachePolicy, cause: \"",
"+",
"e",
".",
"toString",
"(",
")",
",",
"e",
")",
";",
"}",
"}"
] | Set JVM DNS negative cache policy
@param negativeCacheSeconds set default dns cache time. Special input case:
<ul>
<li> {@code -1} means never expired.(In effect, all negative value)</li>
<li> {@code 0} never cached.</li>
</ul>
@throws DnsCacheManipulatorException Operation fail
@since 1.3.0 | [
"Set",
"JVM",
"DNS",
"negative",
"cache",
"policy"
] | eab50ee5c27671f9159b55458301f9429b2fcc47 | https://github.com/alibaba/java-dns-cache-manipulator/blob/eab50ee5c27671f9159b55458301f9429b2fcc47/library/src/main/java/com/alibaba/dcm/DnsCacheManipulator.java#L286-L292 | train |
DreaminginCodeZH/MaterialProgressBar | library/src/main/java/me/zhanghai/android/materialprogressbar/internal/DrawableContainerCompat.java | DrawableContainerCompat.initializeDrawableForDisplay | private void initializeDrawableForDisplay(Drawable d) {
if (mBlockInvalidateCallback == null) {
mBlockInvalidateCallback = new BlockInvalidateCallback();
}
// Temporary fix for suspending callbacks during initialization. We
// don't want any of these setters causing an invalidate() since that
// may call back into DrawableContainer.
d.setCallback(mBlockInvalidateCallback.wrap(d.getCallback()));
try {
if (mDrawableContainerState.mEnterFadeDuration <= 0 && mHasAlpha) {
d.setAlpha(mAlpha);
}
if (mDrawableContainerState.mHasColorFilter) {
// Color filter always overrides tint.
d.setColorFilter(mDrawableContainerState.mColorFilter);
} else {
if (mDrawableContainerState.mHasTintList) {
DrawableCompat.setTintList(d, mDrawableContainerState.mTintList);
}
if (mDrawableContainerState.mHasTintMode) {
DrawableCompat.setTintMode(d, mDrawableContainerState.mTintMode);
}
}
d.setVisible(isVisible(), true);
d.setDither(mDrawableContainerState.mDither);
d.setState(getState());
d.setLevel(getLevel());
d.setBounds(getBounds());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
d.setLayoutDirection(getLayoutDirection());
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
d.setAutoMirrored(mDrawableContainerState.mAutoMirrored);
}
final Rect hotspotBounds = mHotspotBounds;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && hotspotBounds != null) {
d.setHotspotBounds(hotspotBounds.left, hotspotBounds.top,
hotspotBounds.right, hotspotBounds.bottom);
}
} finally {
d.setCallback(mBlockInvalidateCallback.unwrap());
}
} | java | private void initializeDrawableForDisplay(Drawable d) {
if (mBlockInvalidateCallback == null) {
mBlockInvalidateCallback = new BlockInvalidateCallback();
}
// Temporary fix for suspending callbacks during initialization. We
// don't want any of these setters causing an invalidate() since that
// may call back into DrawableContainer.
d.setCallback(mBlockInvalidateCallback.wrap(d.getCallback()));
try {
if (mDrawableContainerState.mEnterFadeDuration <= 0 && mHasAlpha) {
d.setAlpha(mAlpha);
}
if (mDrawableContainerState.mHasColorFilter) {
// Color filter always overrides tint.
d.setColorFilter(mDrawableContainerState.mColorFilter);
} else {
if (mDrawableContainerState.mHasTintList) {
DrawableCompat.setTintList(d, mDrawableContainerState.mTintList);
}
if (mDrawableContainerState.mHasTintMode) {
DrawableCompat.setTintMode(d, mDrawableContainerState.mTintMode);
}
}
d.setVisible(isVisible(), true);
d.setDither(mDrawableContainerState.mDither);
d.setState(getState());
d.setLevel(getLevel());
d.setBounds(getBounds());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
d.setLayoutDirection(getLayoutDirection());
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
d.setAutoMirrored(mDrawableContainerState.mAutoMirrored);
}
final Rect hotspotBounds = mHotspotBounds;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && hotspotBounds != null) {
d.setHotspotBounds(hotspotBounds.left, hotspotBounds.top,
hotspotBounds.right, hotspotBounds.bottom);
}
} finally {
d.setCallback(mBlockInvalidateCallback.unwrap());
}
} | [
"private",
"void",
"initializeDrawableForDisplay",
"(",
"Drawable",
"d",
")",
"{",
"if",
"(",
"mBlockInvalidateCallback",
"==",
"null",
")",
"{",
"mBlockInvalidateCallback",
"=",
"new",
"BlockInvalidateCallback",
"(",
")",
";",
"}",
"// Temporary fix for suspending callbacks during initialization. We",
"// don't want any of these setters causing an invalidate() since that",
"// may call back into DrawableContainer.",
"d",
".",
"setCallback",
"(",
"mBlockInvalidateCallback",
".",
"wrap",
"(",
"d",
".",
"getCallback",
"(",
")",
")",
")",
";",
"try",
"{",
"if",
"(",
"mDrawableContainerState",
".",
"mEnterFadeDuration",
"<=",
"0",
"&&",
"mHasAlpha",
")",
"{",
"d",
".",
"setAlpha",
"(",
"mAlpha",
")",
";",
"}",
"if",
"(",
"mDrawableContainerState",
".",
"mHasColorFilter",
")",
"{",
"// Color filter always overrides tint.",
"d",
".",
"setColorFilter",
"(",
"mDrawableContainerState",
".",
"mColorFilter",
")",
";",
"}",
"else",
"{",
"if",
"(",
"mDrawableContainerState",
".",
"mHasTintList",
")",
"{",
"DrawableCompat",
".",
"setTintList",
"(",
"d",
",",
"mDrawableContainerState",
".",
"mTintList",
")",
";",
"}",
"if",
"(",
"mDrawableContainerState",
".",
"mHasTintMode",
")",
"{",
"DrawableCompat",
".",
"setTintMode",
"(",
"d",
",",
"mDrawableContainerState",
".",
"mTintMode",
")",
";",
"}",
"}",
"d",
".",
"setVisible",
"(",
"isVisible",
"(",
")",
",",
"true",
")",
";",
"d",
".",
"setDither",
"(",
"mDrawableContainerState",
".",
"mDither",
")",
";",
"d",
".",
"setState",
"(",
"getState",
"(",
")",
")",
";",
"d",
".",
"setLevel",
"(",
"getLevel",
"(",
")",
")",
";",
"d",
".",
"setBounds",
"(",
"getBounds",
"(",
")",
")",
";",
"if",
"(",
"Build",
".",
"VERSION",
".",
"SDK_INT",
">=",
"Build",
".",
"VERSION_CODES",
".",
"M",
")",
"{",
"d",
".",
"setLayoutDirection",
"(",
"getLayoutDirection",
"(",
")",
")",
";",
"}",
"if",
"(",
"Build",
".",
"VERSION",
".",
"SDK_INT",
">=",
"Build",
".",
"VERSION_CODES",
".",
"KITKAT",
")",
"{",
"d",
".",
"setAutoMirrored",
"(",
"mDrawableContainerState",
".",
"mAutoMirrored",
")",
";",
"}",
"final",
"Rect",
"hotspotBounds",
"=",
"mHotspotBounds",
";",
"if",
"(",
"Build",
".",
"VERSION",
".",
"SDK_INT",
">=",
"Build",
".",
"VERSION_CODES",
".",
"LOLLIPOP",
"&&",
"hotspotBounds",
"!=",
"null",
")",
"{",
"d",
".",
"setHotspotBounds",
"(",
"hotspotBounds",
".",
"left",
",",
"hotspotBounds",
".",
"top",
",",
"hotspotBounds",
".",
"right",
",",
"hotspotBounds",
".",
"bottom",
")",
";",
"}",
"}",
"finally",
"{",
"d",
".",
"setCallback",
"(",
"mBlockInvalidateCallback",
".",
"unwrap",
"(",
")",
")",
";",
"}",
"}"
] | Initializes a drawable for display in this container.
@param d The drawable to initialize. | [
"Initializes",
"a",
"drawable",
"for",
"display",
"in",
"this",
"container",
"."
] | 7450ac880c8c9edf5d836cc0470fca01592d093e | https://github.com/DreaminginCodeZH/MaterialProgressBar/blob/7450ac880c8c9edf5d836cc0470fca01592d093e/library/src/main/java/me/zhanghai/android/materialprogressbar/internal/DrawableContainerCompat.java#L483-L525 | train |
DreaminginCodeZH/MaterialProgressBar | library/src/main/java/me/zhanghai/android/materialprogressbar/internal/AnimationScaleListDrawableCompat.java | AnimationScaleListDrawableCompat.onStateChange | @Override
protected boolean onStateChange(int[] stateSet) {
final boolean changed = super.onStateChange(stateSet);
int idx = mAnimationScaleListState.getCurrentDrawableIndexBasedOnScale();
return selectDrawable(idx) || changed;
} | java | @Override
protected boolean onStateChange(int[] stateSet) {
final boolean changed = super.onStateChange(stateSet);
int idx = mAnimationScaleListState.getCurrentDrawableIndexBasedOnScale();
return selectDrawable(idx) || changed;
} | [
"@",
"Override",
"protected",
"boolean",
"onStateChange",
"(",
"int",
"[",
"]",
"stateSet",
")",
"{",
"final",
"boolean",
"changed",
"=",
"super",
".",
"onStateChange",
"(",
"stateSet",
")",
";",
"int",
"idx",
"=",
"mAnimationScaleListState",
".",
"getCurrentDrawableIndexBasedOnScale",
"(",
")",
";",
"return",
"selectDrawable",
"(",
"idx",
")",
"||",
"changed",
";",
"}"
] | Set the current drawable according to the animation scale. If scale is 0, then pick the
static drawable, otherwise, pick the animatable drawable. | [
"Set",
"the",
"current",
"drawable",
"according",
"to",
"the",
"animation",
"scale",
".",
"If",
"scale",
"is",
"0",
"then",
"pick",
"the",
"static",
"drawable",
"otherwise",
"pick",
"the",
"animatable",
"drawable",
"."
] | 7450ac880c8c9edf5d836cc0470fca01592d093e | https://github.com/DreaminginCodeZH/MaterialProgressBar/blob/7450ac880c8c9edf5d836cc0470fca01592d093e/library/src/main/java/me/zhanghai/android/materialprogressbar/internal/AnimationScaleListDrawableCompat.java#L57-L62 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.wsoc/src/com/ibm/ws/wsoc/util/Utils.java | Utils.longToInt | public static int longToInt(long inLong) {
if (inLong < Integer.MIN_VALUE) {
return Integer.MIN_VALUE;
}
if (inLong > Integer.MAX_VALUE) {
return Integer.MAX_VALUE;
}
return (int) inLong;
} | java | public static int longToInt(long inLong) {
if (inLong < Integer.MIN_VALUE) {
return Integer.MIN_VALUE;
}
if (inLong > Integer.MAX_VALUE) {
return Integer.MAX_VALUE;
}
return (int) inLong;
} | [
"public",
"static",
"int",
"longToInt",
"(",
"long",
"inLong",
")",
"{",
"if",
"(",
"inLong",
"<",
"Integer",
".",
"MIN_VALUE",
")",
"{",
"return",
"Integer",
".",
"MIN_VALUE",
";",
"}",
"if",
"(",
"inLong",
">",
"Integer",
".",
"MAX_VALUE",
")",
"{",
"return",
"Integer",
".",
"MAX_VALUE",
";",
"}",
"return",
"(",
"int",
")",
"inLong",
";",
"}"
] | convert unsigned long to signed int. | [
"convert",
"unsigned",
"long",
"to",
"signed",
"int",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.wsoc/src/com/ibm/ws/wsoc/util/Utils.java#L46-L57 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.wsoc/src/com/ibm/ws/wsoc/util/Utils.java | Utils.getAllInterfaces | public static void getAllInterfaces(Class<?> classObject, ArrayList<Type> interfaces) {
Type[] superInterfaces = classObject.getGenericInterfaces();
interfaces.addAll((Arrays.asList(superInterfaces)));
// for cases where the extended class is defined with a Generic.
Type tgs = classObject.getGenericSuperclass();
if (tgs != null) {
if ((tgs) instanceof ParameterizedType) {
interfaces.add(tgs);
}
}
if (tc.isDebugEnabled()) {
Tr.debug(tc, "updated interfaces to: " + interfaces);
}
Class<?> superClass = classObject.getSuperclass();
if (superClass != null) {
getAllInterfaces(superClass, interfaces);
}
} | java | public static void getAllInterfaces(Class<?> classObject, ArrayList<Type> interfaces) {
Type[] superInterfaces = classObject.getGenericInterfaces();
interfaces.addAll((Arrays.asList(superInterfaces)));
// for cases where the extended class is defined with a Generic.
Type tgs = classObject.getGenericSuperclass();
if (tgs != null) {
if ((tgs) instanceof ParameterizedType) {
interfaces.add(tgs);
}
}
if (tc.isDebugEnabled()) {
Tr.debug(tc, "updated interfaces to: " + interfaces);
}
Class<?> superClass = classObject.getSuperclass();
if (superClass != null) {
getAllInterfaces(superClass, interfaces);
}
} | [
"public",
"static",
"void",
"getAllInterfaces",
"(",
"Class",
"<",
"?",
">",
"classObject",
",",
"ArrayList",
"<",
"Type",
">",
"interfaces",
")",
"{",
"Type",
"[",
"]",
"superInterfaces",
"=",
"classObject",
".",
"getGenericInterfaces",
"(",
")",
";",
"interfaces",
".",
"addAll",
"(",
"(",
"Arrays",
".",
"asList",
"(",
"superInterfaces",
")",
")",
")",
";",
"// for cases where the extended class is defined with a Generic.",
"Type",
"tgs",
"=",
"classObject",
".",
"getGenericSuperclass",
"(",
")",
";",
"if",
"(",
"tgs",
"!=",
"null",
")",
"{",
"if",
"(",
"(",
"tgs",
")",
"instanceof",
"ParameterizedType",
")",
"{",
"interfaces",
".",
"add",
"(",
"tgs",
")",
";",
"}",
"}",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"updated interfaces to: \"",
"+",
"interfaces",
")",
";",
"}",
"Class",
"<",
"?",
">",
"superClass",
"=",
"classObject",
".",
"getSuperclass",
"(",
")",
";",
"if",
"(",
"superClass",
"!=",
"null",
")",
"{",
"getAllInterfaces",
"(",
"superClass",
",",
"interfaces",
")",
";",
"}",
"}"
] | recursively gets all interfaces | [
"recursively",
"gets",
"all",
"interfaces"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.wsoc/src/com/ibm/ws/wsoc/util/Utils.java#L309-L329 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.wsoc/src/com/ibm/ws/wsoc/util/Utils.java | Utils.truncateCloseReason | public static String truncateCloseReason(String reasonPhrase) {
if (reasonPhrase != null) {
byte[] reasonBytes = reasonPhrase.getBytes(Utils.UTF8_CHARSET);
int len = reasonBytes.length;
// Why 120? UTF-8 can take 4 bytes per character, so we either hit the boundary, or are off by 1-3 bytes.
// Subtract 3 from 123 and we'll try to cut only if it is greater than that.
if (len > 120) {
String updatedPhrase = cutStringByByteSize(reasonPhrase, 120);
reasonPhrase = updatedPhrase;
}
}
return reasonPhrase;
} | java | public static String truncateCloseReason(String reasonPhrase) {
if (reasonPhrase != null) {
byte[] reasonBytes = reasonPhrase.getBytes(Utils.UTF8_CHARSET);
int len = reasonBytes.length;
// Why 120? UTF-8 can take 4 bytes per character, so we either hit the boundary, or are off by 1-3 bytes.
// Subtract 3 from 123 and we'll try to cut only if it is greater than that.
if (len > 120) {
String updatedPhrase = cutStringByByteSize(reasonPhrase, 120);
reasonPhrase = updatedPhrase;
}
}
return reasonPhrase;
} | [
"public",
"static",
"String",
"truncateCloseReason",
"(",
"String",
"reasonPhrase",
")",
"{",
"if",
"(",
"reasonPhrase",
"!=",
"null",
")",
"{",
"byte",
"[",
"]",
"reasonBytes",
"=",
"reasonPhrase",
".",
"getBytes",
"(",
"Utils",
".",
"UTF8_CHARSET",
")",
";",
"int",
"len",
"=",
"reasonBytes",
".",
"length",
";",
"// Why 120? UTF-8 can take 4 bytes per character, so we either hit the boundary, or are off by 1-3 bytes.",
"// Subtract 3 from 123 and we'll try to cut only if it is greater than that.",
"if",
"(",
"len",
">",
"120",
")",
"{",
"String",
"updatedPhrase",
"=",
"cutStringByByteSize",
"(",
"reasonPhrase",
",",
"120",
")",
";",
"reasonPhrase",
"=",
"updatedPhrase",
";",
"}",
"}",
"return",
"reasonPhrase",
";",
"}"
] | close reason needs to be truncated to 123 UTF-8 encoded bytes | [
"close",
"reason",
"needs",
"to",
"be",
"truncated",
"to",
"123",
"UTF",
"-",
"8",
"encoded",
"bytes"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.wsoc/src/com/ibm/ws/wsoc/util/Utils.java#L488-L502 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/html/HtmlMenuRendererBase.java | HtmlMenuRendererBase.getConverter | protected Converter getConverter(FacesContext facesContext,
UIComponent component)
{
if (component instanceof UISelectMany)
{
return HtmlRendererUtils.findUISelectManyConverterFailsafe(facesContext,
(UISelectMany) component);
}
else if (component instanceof UISelectOne)
{
return HtmlRendererUtils.findUIOutputConverterFailSafe(facesContext, component);
}
return null;
} | java | protected Converter getConverter(FacesContext facesContext,
UIComponent component)
{
if (component instanceof UISelectMany)
{
return HtmlRendererUtils.findUISelectManyConverterFailsafe(facesContext,
(UISelectMany) component);
}
else if (component instanceof UISelectOne)
{
return HtmlRendererUtils.findUIOutputConverterFailSafe(facesContext, component);
}
return null;
} | [
"protected",
"Converter",
"getConverter",
"(",
"FacesContext",
"facesContext",
",",
"UIComponent",
"component",
")",
"{",
"if",
"(",
"component",
"instanceof",
"UISelectMany",
")",
"{",
"return",
"HtmlRendererUtils",
".",
"findUISelectManyConverterFailsafe",
"(",
"facesContext",
",",
"(",
"UISelectMany",
")",
"component",
")",
";",
"}",
"else",
"if",
"(",
"component",
"instanceof",
"UISelectOne",
")",
"{",
"return",
"HtmlRendererUtils",
".",
"findUIOutputConverterFailSafe",
"(",
"facesContext",
",",
"component",
")",
";",
"}",
"return",
"null",
";",
"}"
] | Gets the converter for the given component rendered by this renderer.
@param facesContext
@param component
@return | [
"Gets",
"the",
"converter",
"for",
"the",
"given",
"component",
"rendered",
"by",
"this",
"renderer",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/html/HtmlMenuRendererBase.java#L169-L182 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/BaseMessagingEngineImpl.java | BaseMessagingEngineImpl.startConditional | public void startConditional() throws Exception {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "startConditional", this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Activating MBean for ME " + getName());
setState(STATE_STARTING);
start(JsConstants.ME_START_DEFAULT);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "startConditional");
} | java | public void startConditional() throws Exception {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "startConditional", this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Activating MBean for ME " + getName());
setState(STATE_STARTING);
start(JsConstants.ME_START_DEFAULT);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "startConditional");
} | [
"public",
"void",
"startConditional",
"(",
")",
"throws",
"Exception",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"startConditional\"",
",",
"this",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"Activating MBean for ME \"",
"+",
"getName",
"(",
")",
")",
";",
"setState",
"(",
"STATE_STARTING",
")",
";",
"start",
"(",
"JsConstants",
".",
"ME_START_DEFAULT",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"startConditional\"",
")",
";",
"}"
] | Start the Messaging Engine if it is enabled
@throws Exception | [
"Start",
"the",
"Messaging",
"Engine",
"if",
"it",
"is",
"enabled"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/BaseMessagingEngineImpl.java#L333-L343 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/BaseMessagingEngineImpl.java | BaseMessagingEngineImpl.okayToSendServerStarted | private boolean okayToSendServerStarted() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "okayToSendServerStarted", this);
synchronized (lockObject) {
if (!_sentServerStarted) {
if ((_state == STATE_STARTED) && _mainImpl.isServerStarted()) {
_sentServerStarted = true;
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "okayToSendServerStarted", new Boolean(_sentServerStarted));
return _sentServerStarted;
} | java | private boolean okayToSendServerStarted() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "okayToSendServerStarted", this);
synchronized (lockObject) {
if (!_sentServerStarted) {
if ((_state == STATE_STARTED) && _mainImpl.isServerStarted()) {
_sentServerStarted = true;
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "okayToSendServerStarted", new Boolean(_sentServerStarted));
return _sentServerStarted;
} | [
"private",
"boolean",
"okayToSendServerStarted",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"okayToSendServerStarted\"",
",",
"this",
")",
";",
"synchronized",
"(",
"lockObject",
")",
"{",
"if",
"(",
"!",
"_sentServerStarted",
")",
"{",
"if",
"(",
"(",
"_state",
"==",
"STATE_STARTED",
")",
"&&",
"_mainImpl",
".",
"isServerStarted",
"(",
")",
")",
"{",
"_sentServerStarted",
"=",
"true",
";",
"}",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"okayToSendServerStarted\"",
",",
"new",
"Boolean",
"(",
"_sentServerStarted",
")",
")",
";",
"return",
"_sentServerStarted",
";",
"}"
] | Determine whether the conditions permitting a "server started" notification
to be sent are met.
@return boolean a value indicating whether the notification can be sent | [
"Determine",
"whether",
"the",
"conditions",
"permitting",
"a",
"server",
"started",
"notification",
"to",
"be",
"sent",
"are",
"met",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/BaseMessagingEngineImpl.java#L375-L389 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/BaseMessagingEngineImpl.java | BaseMessagingEngineImpl.okayToSendServerStopping | private boolean okayToSendServerStopping() {
// Removed the synchronized modifier of this method, as its only setting one private variable _sentServerStopping,
// If its synchronized, then notification thread gets blocked here until JsActivationThread returns and so it doesnot set _sentServerStopping to true
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())// To enable the JsActivationThread to check for serverStopping notification while its still running, this method should not be synchronized.
SibTr.entry(tc, "okayToSendServerStopping", this);
synchronized (lockObject) { // This should be run in a synchronized context
if (!_sentServerStopping) {
if ((_state == STATE_STARTED || _state == STATE_AUTOSTARTING || _state == STATE_STARTING) && _mainImpl.isServerStopping()) { // Adding additional ME states( STARTING and AUTOSTARTING) , so that sever stopping notification is also sent when ME is in those states.
_sentServerStopping = true;
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "okayToSendServerStopping", new Boolean(
_sentServerStopping));
return _sentServerStopping;
} | java | private boolean okayToSendServerStopping() {
// Removed the synchronized modifier of this method, as its only setting one private variable _sentServerStopping,
// If its synchronized, then notification thread gets blocked here until JsActivationThread returns and so it doesnot set _sentServerStopping to true
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())// To enable the JsActivationThread to check for serverStopping notification while its still running, this method should not be synchronized.
SibTr.entry(tc, "okayToSendServerStopping", this);
synchronized (lockObject) { // This should be run in a synchronized context
if (!_sentServerStopping) {
if ((_state == STATE_STARTED || _state == STATE_AUTOSTARTING || _state == STATE_STARTING) && _mainImpl.isServerStopping()) { // Adding additional ME states( STARTING and AUTOSTARTING) , so that sever stopping notification is also sent when ME is in those states.
_sentServerStopping = true;
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "okayToSendServerStopping", new Boolean(
_sentServerStopping));
return _sentServerStopping;
} | [
"private",
"boolean",
"okayToSendServerStopping",
"(",
")",
"{",
"// Removed the synchronized modifier of this method, as its only setting one private variable _sentServerStopping,",
"// If its synchronized, then notification thread gets blocked here until JsActivationThread returns and so it doesnot set _sentServerStopping to true",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"// To enable the JsActivationThread to check for serverStopping notification while its still running, this method should not be synchronized.",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"okayToSendServerStopping\"",
",",
"this",
")",
";",
"synchronized",
"(",
"lockObject",
")",
"{",
"// This should be run in a synchronized context ",
"if",
"(",
"!",
"_sentServerStopping",
")",
"{",
"if",
"(",
"(",
"_state",
"==",
"STATE_STARTED",
"||",
"_state",
"==",
"STATE_AUTOSTARTING",
"||",
"_state",
"==",
"STATE_STARTING",
")",
"&&",
"_mainImpl",
".",
"isServerStopping",
"(",
")",
")",
"{",
"// Adding additional ME states( STARTING and AUTOSTARTING) , so that sever stopping notification is also sent when ME is in those states.",
"_sentServerStopping",
"=",
"true",
";",
"}",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"okayToSendServerStopping\"",
",",
"new",
"Boolean",
"(",
"_sentServerStopping",
")",
")",
";",
"return",
"_sentServerStopping",
";",
"}"
] | Determine whether the conditions permitting a "server stopping"
notification to be sent are met.
The ME state can be STARTED ,AUTOSTARTING or in STARTING state , to receive "server stopping" notification
@return boolean a value indicating whether the notification can be sent | [
"Determine",
"whether",
"the",
"conditions",
"permitting",
"a",
"server",
"stopping",
"notification",
"to",
"be",
"sent",
"are",
"met",
".",
"The",
"ME",
"state",
"can",
"be",
"STARTED",
"AUTOSTARTING",
"or",
"in",
"STARTING",
"state",
"to",
"receive",
"server",
"stopping",
"notification"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/BaseMessagingEngineImpl.java#L398-L415 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/BaseMessagingEngineImpl.java | BaseMessagingEngineImpl.getEngineComponent | @SuppressWarnings("unchecked")
public <EngineComponent> EngineComponent getEngineComponent(Class<EngineComponent> clazz) {
String thisMethodName = "getEngineComponent";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, clazz);
}
JsEngineComponent foundEngineComponent = null;
// No need to synchronize on jmeComponents to prevent concurrent
// modification from dynamic config and runtime callbacks, because
// jmeComponents is now a CopyOnWriteArrayList.
Iterator<ComponentList> vIter = jmeComponents.iterator();
while (vIter.hasNext() && foundEngineComponent == null) {
ComponentList c = vIter.next();
if (clazz.isInstance(c.getRef())) {
foundEngineComponent = c.getRef();
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, thisMethodName, foundEngineComponent);
}
return (EngineComponent) foundEngineComponent;
} | java | @SuppressWarnings("unchecked")
public <EngineComponent> EngineComponent getEngineComponent(Class<EngineComponent> clazz) {
String thisMethodName = "getEngineComponent";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, clazz);
}
JsEngineComponent foundEngineComponent = null;
// No need to synchronize on jmeComponents to prevent concurrent
// modification from dynamic config and runtime callbacks, because
// jmeComponents is now a CopyOnWriteArrayList.
Iterator<ComponentList> vIter = jmeComponents.iterator();
while (vIter.hasNext() && foundEngineComponent == null) {
ComponentList c = vIter.next();
if (clazz.isInstance(c.getRef())) {
foundEngineComponent = c.getRef();
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, thisMethodName, foundEngineComponent);
}
return (EngineComponent) foundEngineComponent;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"EngineComponent",
">",
"EngineComponent",
"getEngineComponent",
"(",
"Class",
"<",
"EngineComponent",
">",
"clazz",
")",
"{",
"String",
"thisMethodName",
"=",
"\"getEngineComponent\"",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"thisMethodName",
",",
"clazz",
")",
";",
"}",
"JsEngineComponent",
"foundEngineComponent",
"=",
"null",
";",
"// No need to synchronize on jmeComponents to prevent concurrent",
"// modification from dynamic config and runtime callbacks, because",
"// jmeComponents is now a CopyOnWriteArrayList.",
"Iterator",
"<",
"ComponentList",
">",
"vIter",
"=",
"jmeComponents",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"vIter",
".",
"hasNext",
"(",
")",
"&&",
"foundEngineComponent",
"==",
"null",
")",
"{",
"ComponentList",
"c",
"=",
"vIter",
".",
"next",
"(",
")",
";",
"if",
"(",
"clazz",
".",
"isInstance",
"(",
"c",
".",
"getRef",
"(",
")",
")",
")",
"{",
"foundEngineComponent",
"=",
"c",
".",
"getRef",
"(",
")",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"thisMethodName",
",",
"foundEngineComponent",
")",
";",
"}",
"return",
"(",
"EngineComponent",
")",
"foundEngineComponent",
";",
"}"
] | The purpose of this method is to get an engine component that can be cast using the
specified class. The EngineComponent is not a class name, but represents the classes
real type.
@param <EngineComponent> The generic type of the desired engine component.
@param clazz The class representing the engine component interface.
@return The desired engine component. | [
"The",
"purpose",
"of",
"this",
"method",
"is",
"to",
"get",
"an",
"engine",
"component",
"that",
"can",
"be",
"cast",
"using",
"the",
"specified",
"class",
".",
"The",
"EngineComponent",
"is",
"not",
"a",
"class",
"name",
"but",
"represents",
"the",
"classes",
"real",
"type",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/BaseMessagingEngineImpl.java#L693-L720 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/BaseMessagingEngineImpl.java | BaseMessagingEngineImpl.getEngineComponents | @SuppressWarnings("unchecked")
public <EngineComponent> EngineComponent[] getEngineComponents(Class<EngineComponent> clazz) {
String thisMethodName = "getEngineComponents";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, clazz);
}
List<EngineComponent> foundComponents = new ArrayList<EngineComponent>();
// No need to synchronize on jmeComponents to prevent concurrent
// modification from dynamic config and runtime callbacks, because
// jmeComponents is now a CopyOnWriteArrayList.
Iterator<ComponentList> vIter = jmeComponents.iterator();
while (vIter.hasNext()) {
JsEngineComponent ec = vIter.next().getRef();
if (clazz.isInstance(ec)) {
foundComponents.add((EngineComponent) ec);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, thisMethodName, foundComponents);
}
// this code is required to get an array of the EngineComponent type.
return foundComponents.toArray((EngineComponent[]) Array.newInstance(clazz, 0));
} | java | @SuppressWarnings("unchecked")
public <EngineComponent> EngineComponent[] getEngineComponents(Class<EngineComponent> clazz) {
String thisMethodName = "getEngineComponents";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, clazz);
}
List<EngineComponent> foundComponents = new ArrayList<EngineComponent>();
// No need to synchronize on jmeComponents to prevent concurrent
// modification from dynamic config and runtime callbacks, because
// jmeComponents is now a CopyOnWriteArrayList.
Iterator<ComponentList> vIter = jmeComponents.iterator();
while (vIter.hasNext()) {
JsEngineComponent ec = vIter.next().getRef();
if (clazz.isInstance(ec)) {
foundComponents.add((EngineComponent) ec);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, thisMethodName, foundComponents);
}
// this code is required to get an array of the EngineComponent type.
return foundComponents.toArray((EngineComponent[]) Array.newInstance(clazz, 0));
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"EngineComponent",
">",
"EngineComponent",
"[",
"]",
"getEngineComponents",
"(",
"Class",
"<",
"EngineComponent",
">",
"clazz",
")",
"{",
"String",
"thisMethodName",
"=",
"\"getEngineComponents\"",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"thisMethodName",
",",
"clazz",
")",
";",
"}",
"List",
"<",
"EngineComponent",
">",
"foundComponents",
"=",
"new",
"ArrayList",
"<",
"EngineComponent",
">",
"(",
")",
";",
"// No need to synchronize on jmeComponents to prevent concurrent",
"// modification from dynamic config and runtime callbacks, because",
"// jmeComponents is now a CopyOnWriteArrayList.",
"Iterator",
"<",
"ComponentList",
">",
"vIter",
"=",
"jmeComponents",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"vIter",
".",
"hasNext",
"(",
")",
")",
"{",
"JsEngineComponent",
"ec",
"=",
"vIter",
".",
"next",
"(",
")",
".",
"getRef",
"(",
")",
";",
"if",
"(",
"clazz",
".",
"isInstance",
"(",
"ec",
")",
")",
"{",
"foundComponents",
".",
"add",
"(",
"(",
"EngineComponent",
")",
"ec",
")",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"thisMethodName",
",",
"foundComponents",
")",
";",
"}",
"// this code is required to get an array of the EngineComponent type.",
"return",
"foundComponents",
".",
"toArray",
"(",
"(",
"EngineComponent",
"[",
"]",
")",
"Array",
".",
"newInstance",
"(",
"clazz",
",",
"0",
")",
")",
";",
"}"
] | The purpose of this method is to get an engine component that can be cast using the
specified class. The EngineComponent is not a class name, but represents the classes
real type. It is not possible to create an Array of a generic type without using
reflection.
@param <EngineComponent> The generic type of the desired engine component.
@param clazz The class representing the engine component interface.
@return An array of engine components that match the desired
engine component type. | [
"The",
"purpose",
"of",
"this",
"method",
"is",
"to",
"get",
"an",
"engine",
"component",
"that",
"can",
"be",
"cast",
"using",
"the",
"specified",
"class",
".",
"The",
"EngineComponent",
"is",
"not",
"a",
"class",
"name",
"but",
"represents",
"the",
"classes",
"real",
"type",
".",
"It",
"is",
"not",
"possible",
"to",
"create",
"an",
"Array",
"of",
"a",
"generic",
"type",
"without",
"using",
"reflection",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/BaseMessagingEngineImpl.java#L738-L766 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/BaseMessagingEngineImpl.java | BaseMessagingEngineImpl.getMeConfig | public final JsMEConfig getMeConfig() {
String thisMethodName = "getMeConfig";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, this);
SibTr.exit(tc, thisMethodName, _me);
}
return _me;
} | java | public final JsMEConfig getMeConfig() {
String thisMethodName = "getMeConfig";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, this);
SibTr.exit(tc, thisMethodName, _me);
}
return _me;
} | [
"public",
"final",
"JsMEConfig",
"getMeConfig",
"(",
")",
"{",
"String",
"thisMethodName",
"=",
"\"getMeConfig\"",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"thisMethodName",
",",
"this",
")",
";",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"thisMethodName",
",",
"_me",
")",
";",
"}",
"return",
"_me",
";",
"}"
] | Returns a reference to this messaging engine's configuration.
@return a reference to this messaging engine's configuration. | [
"Returns",
"a",
"reference",
"to",
"this",
"messaging",
"engine",
"s",
"configuration",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/BaseMessagingEngineImpl.java#L809-L819 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/BaseMessagingEngineImpl.java | BaseMessagingEngineImpl.getMessageProcessor | @Deprecated
public JsEngineComponent getMessageProcessor(String name) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, "getMessageProcessor", this);
SibTr.exit(tc, "getMessageProcessor", _messageProcessor);
}
return _messageProcessor;
} | java | @Deprecated
public JsEngineComponent getMessageProcessor(String name) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, "getMessageProcessor", this);
SibTr.exit(tc, "getMessageProcessor", _messageProcessor);
}
return _messageProcessor;
} | [
"@",
"Deprecated",
"public",
"JsEngineComponent",
"getMessageProcessor",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"getMessageProcessor\"",
",",
"this",
")",
";",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"getMessageProcessor\"",
",",
"_messageProcessor",
")",
";",
"}",
"return",
"_messageProcessor",
";",
"}"
] | Gets the instance of the MP associated with this ME
@deprecated
@param name
@return JsEngineComponent | [
"Gets",
"the",
"instance",
"of",
"the",
"MP",
"associated",
"with",
"this",
"ME"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/BaseMessagingEngineImpl.java#L852-L861 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/BaseMessagingEngineImpl.java | BaseMessagingEngineImpl.resolveExceptionDestination | private void resolveExceptionDestination(BaseDestinationDefinition dd) {
String thisMethodName = "resolveExceptionDestination";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, dd.getName());
}
// If variable substitution string detected, then override ED name
if (dd.isLocal()) {
String ed = ((DestinationDefinition) dd).getExceptionDestination();
if ((ed != null) && (ed.equals(JsConstants.DEFAULT_EXCEPTION_DESTINATION))) {
((DestinationDefinition) dd).setExceptionDestination(JsConstants.EXCEPTION_DESTINATION_PREFIX + this.getName());
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, thisMethodName);
}
} | java | private void resolveExceptionDestination(BaseDestinationDefinition dd) {
String thisMethodName = "resolveExceptionDestination";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, dd.getName());
}
// If variable substitution string detected, then override ED name
if (dd.isLocal()) {
String ed = ((DestinationDefinition) dd).getExceptionDestination();
if ((ed != null) && (ed.equals(JsConstants.DEFAULT_EXCEPTION_DESTINATION))) {
((DestinationDefinition) dd).setExceptionDestination(JsConstants.EXCEPTION_DESTINATION_PREFIX + this.getName());
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, thisMethodName);
}
} | [
"private",
"void",
"resolveExceptionDestination",
"(",
"BaseDestinationDefinition",
"dd",
")",
"{",
"String",
"thisMethodName",
"=",
"\"resolveExceptionDestination\"",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"thisMethodName",
",",
"dd",
".",
"getName",
"(",
")",
")",
";",
"}",
"// If variable substitution string detected, then override ED name",
"if",
"(",
"dd",
".",
"isLocal",
"(",
")",
")",
"{",
"String",
"ed",
"=",
"(",
"(",
"DestinationDefinition",
")",
"dd",
")",
".",
"getExceptionDestination",
"(",
")",
";",
"if",
"(",
"(",
"ed",
"!=",
"null",
")",
"&&",
"(",
"ed",
".",
"equals",
"(",
"JsConstants",
".",
"DEFAULT_EXCEPTION_DESTINATION",
")",
")",
")",
"{",
"(",
"(",
"DestinationDefinition",
")",
"dd",
")",
".",
"setExceptionDestination",
"(",
"JsConstants",
".",
"EXCEPTION_DESTINATION_PREFIX",
"+",
"this",
".",
"getName",
"(",
")",
")",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"thisMethodName",
")",
";",
"}",
"}"
] | Resolve, if necessary, a variable Exception Destination name in the
specified DD to it's runtime value.
@param dd
the DestinationDefinition to be checked, and modified | [
"Resolve",
"if",
"necessary",
"a",
"variable",
"Exception",
"Destination",
"name",
"in",
"the",
"specified",
"DD",
"to",
"it",
"s",
"runtime",
"value",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/BaseMessagingEngineImpl.java#L1022-L1041 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/BaseMessagingEngineImpl.java | BaseMessagingEngineImpl.getSIBDestinationByUuid | BaseDestinationDefinition getSIBDestinationByUuid(String bus, String key, boolean newCache) throws SIBExceptionDestinationNotFound, SIBExceptionBase {
String thisMethodName = "getSIBDestinationByUuid";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, new Object[] { bus, key, new Boolean(newCache) });
}
BaseDestinationDefinition bdd = null;
if (oldDestCache == null || newCache) {
bdd = (BaseDestinationDefinition) _bus.getDestinationCache().getSIBDestinationByUuid(bus, key).clone();
} else {
bdd = (BaseDestinationDefinition) oldDestCache.getSIBDestinationByUuid(bus, key).clone();
}
// Resolve Exception Destination if necessary
resolveExceptionDestination(bdd);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, thisMethodName, bdd);
}
return bdd;
} | java | BaseDestinationDefinition getSIBDestinationByUuid(String bus, String key, boolean newCache) throws SIBExceptionDestinationNotFound, SIBExceptionBase {
String thisMethodName = "getSIBDestinationByUuid";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, new Object[] { bus, key, new Boolean(newCache) });
}
BaseDestinationDefinition bdd = null;
if (oldDestCache == null || newCache) {
bdd = (BaseDestinationDefinition) _bus.getDestinationCache().getSIBDestinationByUuid(bus, key).clone();
} else {
bdd = (BaseDestinationDefinition) oldDestCache.getSIBDestinationByUuid(bus, key).clone();
}
// Resolve Exception Destination if necessary
resolveExceptionDestination(bdd);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, thisMethodName, bdd);
}
return bdd;
} | [
"BaseDestinationDefinition",
"getSIBDestinationByUuid",
"(",
"String",
"bus",
",",
"String",
"key",
",",
"boolean",
"newCache",
")",
"throws",
"SIBExceptionDestinationNotFound",
",",
"SIBExceptionBase",
"{",
"String",
"thisMethodName",
"=",
"\"getSIBDestinationByUuid\"",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"thisMethodName",
",",
"new",
"Object",
"[",
"]",
"{",
"bus",
",",
"key",
",",
"new",
"Boolean",
"(",
"newCache",
")",
"}",
")",
";",
"}",
"BaseDestinationDefinition",
"bdd",
"=",
"null",
";",
"if",
"(",
"oldDestCache",
"==",
"null",
"||",
"newCache",
")",
"{",
"bdd",
"=",
"(",
"BaseDestinationDefinition",
")",
"_bus",
".",
"getDestinationCache",
"(",
")",
".",
"getSIBDestinationByUuid",
"(",
"bus",
",",
"key",
")",
".",
"clone",
"(",
")",
";",
"}",
"else",
"{",
"bdd",
"=",
"(",
"BaseDestinationDefinition",
")",
"oldDestCache",
".",
"getSIBDestinationByUuid",
"(",
"bus",
",",
"key",
")",
".",
"clone",
"(",
")",
";",
"}",
"// Resolve Exception Destination if necessary",
"resolveExceptionDestination",
"(",
"bdd",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"thisMethodName",
",",
"bdd",
")",
";",
"}",
"return",
"bdd",
";",
"}"
] | Accessor method to return a destination definition.
@param bus
@param key
@param newCache
@return the destination cache | [
"Accessor",
"method",
"to",
"return",
"a",
"destination",
"definition",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/BaseMessagingEngineImpl.java#L1133-L1157 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/BaseMessagingEngineImpl.java | BaseMessagingEngineImpl.getState | public final String getState() {
String thisMethodName = "getState";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, this);
SibTr.exit(tc, thisMethodName, states[_state]);
}
return states[_state];
} | java | public final String getState() {
String thisMethodName = "getState";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, this);
SibTr.exit(tc, thisMethodName, states[_state]);
}
return states[_state];
} | [
"public",
"final",
"String",
"getState",
"(",
")",
"{",
"String",
"thisMethodName",
"=",
"\"getState\"",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"thisMethodName",
",",
"this",
")",
";",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"thisMethodName",
",",
"states",
"[",
"_state",
"]",
")",
";",
"}",
"return",
"states",
"[",
"_state",
"]",
";",
"}"
] | Get the state of this ME
@return String | [
"Get",
"the",
"state",
"of",
"this",
"ME"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/BaseMessagingEngineImpl.java#L1228-L1238 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/BaseMessagingEngineImpl.java | BaseMessagingEngineImpl.isStarted | public final boolean isStarted() {
String thisMethodName = "isStarted";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, this);
}
boolean retVal = (_state == STATE_STARTED);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, thisMethodName, Boolean.toString(retVal));
}
return retVal;
} | java | public final boolean isStarted() {
String thisMethodName = "isStarted";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, this);
}
boolean retVal = (_state == STATE_STARTED);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, thisMethodName, Boolean.toString(retVal));
}
return retVal;
} | [
"public",
"final",
"boolean",
"isStarted",
"(",
")",
"{",
"String",
"thisMethodName",
"=",
"\"isStarted\"",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"thisMethodName",
",",
"this",
")",
";",
"}",
"boolean",
"retVal",
"=",
"(",
"_state",
"==",
"STATE_STARTED",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"thisMethodName",
",",
"Boolean",
".",
"toString",
"(",
"retVal",
")",
")",
";",
"}",
"return",
"retVal",
";",
"}"
] | Returns an indication of whether this ME is started or not
@return true if this messaging egine is started; else false. | [
"Returns",
"an",
"indication",
"of",
"whether",
"this",
"ME",
"is",
"started",
"or",
"not"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/BaseMessagingEngineImpl.java#L1294-L1309 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/BaseMessagingEngineImpl.java | BaseMessagingEngineImpl.addLocalizationPoint | final boolean addLocalizationPoint(LWMConfig lp, DestinationDefinition dd) {
String thisMethodName = "addLocalizationPoint";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, lp);
}
boolean success = _localizer.addLocalizationPoint(lp, dd);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, thisMethodName, Boolean.valueOf(success));
}
return success;
} | java | final boolean addLocalizationPoint(LWMConfig lp, DestinationDefinition dd) {
String thisMethodName = "addLocalizationPoint";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, lp);
}
boolean success = _localizer.addLocalizationPoint(lp, dd);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, thisMethodName, Boolean.valueOf(success));
}
return success;
} | [
"final",
"boolean",
"addLocalizationPoint",
"(",
"LWMConfig",
"lp",
",",
"DestinationDefinition",
"dd",
")",
"{",
"String",
"thisMethodName",
"=",
"\"addLocalizationPoint\"",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"thisMethodName",
",",
"lp",
")",
";",
"}",
"boolean",
"success",
"=",
"_localizer",
".",
"addLocalizationPoint",
"(",
"lp",
",",
"dd",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"thisMethodName",
",",
"Boolean",
".",
"valueOf",
"(",
"success",
")",
")",
";",
"}",
"return",
"success",
";",
"}"
] | Pass the request to add a new localization point onto the localizer object.
@param lp localization point definition
@return boolean success Whether the LP was successfully added | [
"Pass",
"the",
"request",
"to",
"add",
"a",
"new",
"localization",
"point",
"onto",
"the",
"localizer",
"object",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/BaseMessagingEngineImpl.java#L1473-L1487 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/BaseMessagingEngineImpl.java | BaseMessagingEngineImpl.alterLocalizationPoint | final void alterLocalizationPoint(BaseDestination dest,LWMConfig lp) {
String thisMethodName = "alterLocalizationPoint";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, lp);
}
try {
_localizer.alterLocalizationPoint(dest,lp);
} catch (Exception e) {
SibTr.exception(tc, e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, thisMethodName);
}
} | java | final void alterLocalizationPoint(BaseDestination dest,LWMConfig lp) {
String thisMethodName = "alterLocalizationPoint";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, lp);
}
try {
_localizer.alterLocalizationPoint(dest,lp);
} catch (Exception e) {
SibTr.exception(tc, e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, thisMethodName);
}
} | [
"final",
"void",
"alterLocalizationPoint",
"(",
"BaseDestination",
"dest",
",",
"LWMConfig",
"lp",
")",
"{",
"String",
"thisMethodName",
"=",
"\"alterLocalizationPoint\"",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"thisMethodName",
",",
"lp",
")",
";",
"}",
"try",
"{",
"_localizer",
".",
"alterLocalizationPoint",
"(",
"dest",
",",
"lp",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"e",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"thisMethodName",
")",
";",
"}",
"}"
] | Pass the request to alter a localization point onto the localizer object.
@param lp
localization point definition | [
"Pass",
"the",
"request",
"to",
"alter",
"a",
"localization",
"point",
"onto",
"the",
"localizer",
"object",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/BaseMessagingEngineImpl.java#L1495-L1512 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/BaseMessagingEngineImpl.java | BaseMessagingEngineImpl.deleteLocalizationPoint | final void deleteLocalizationPoint(JsBus bus, LWMConfig dest) {
String thisMethodName = "deleteLocalizationPoint";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, dest);
}
try {
_localizer.deleteLocalizationPoint(bus, dest);
} catch (SIBExceptionBase ex) {
SibTr.exception(tc, ex);
} catch (SIException e) {
SibTr.exception(tc, e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, thisMethodName);
}
} | java | final void deleteLocalizationPoint(JsBus bus, LWMConfig dest) {
String thisMethodName = "deleteLocalizationPoint";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, dest);
}
try {
_localizer.deleteLocalizationPoint(bus, dest);
} catch (SIBExceptionBase ex) {
SibTr.exception(tc, ex);
} catch (SIException e) {
SibTr.exception(tc, e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, thisMethodName);
}
} | [
"final",
"void",
"deleteLocalizationPoint",
"(",
"JsBus",
"bus",
",",
"LWMConfig",
"dest",
")",
"{",
"String",
"thisMethodName",
"=",
"\"deleteLocalizationPoint\"",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"thisMethodName",
",",
"dest",
")",
";",
"}",
"try",
"{",
"_localizer",
".",
"deleteLocalizationPoint",
"(",
"bus",
",",
"dest",
")",
";",
"}",
"catch",
"(",
"SIBExceptionBase",
"ex",
")",
"{",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"ex",
")",
";",
"}",
"catch",
"(",
"SIException",
"e",
")",
"{",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"e",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"thisMethodName",
")",
";",
"}",
"}"
] | Pass the request to delete a localization point onto the localizer object.
@param lp localization point definition | [
"Pass",
"the",
"request",
"to",
"delete",
"a",
"localization",
"point",
"onto",
"the",
"localizer",
"object",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/BaseMessagingEngineImpl.java#L1519-L1540 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/BaseMessagingEngineImpl.java | BaseMessagingEngineImpl.setLPConfigObjects | final void setLPConfigObjects(List config) {
String thisMethodName = "setLPConfigObjects";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, "Number of LPs =" + config.size());
}
_lpConfig.clear();
_lpConfig.addAll(config);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, thisMethodName);
}
} | java | final void setLPConfigObjects(List config) {
String thisMethodName = "setLPConfigObjects";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, "Number of LPs =" + config.size());
}
_lpConfig.clear();
_lpConfig.addAll(config);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, thisMethodName);
}
} | [
"final",
"void",
"setLPConfigObjects",
"(",
"List",
"config",
")",
"{",
"String",
"thisMethodName",
"=",
"\"setLPConfigObjects\"",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"thisMethodName",
",",
"\"Number of LPs =\"",
"+",
"config",
".",
"size",
"(",
")",
")",
";",
"}",
"_lpConfig",
".",
"clear",
"(",
")",
";",
"_lpConfig",
".",
"addAll",
"(",
"config",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"thisMethodName",
")",
";",
"}",
"}"
] | Update the cache of localization point config objects. This method is used
by dynamic config to refresh the cache.
@param config The _lpConfig to set. | [
"Update",
"the",
"cache",
"of",
"localization",
"point",
"config",
"objects",
".",
"This",
"method",
"is",
"used",
"by",
"dynamic",
"config",
"to",
"refresh",
"the",
"cache",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/BaseMessagingEngineImpl.java#L1565-L1579 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/BaseMessagingEngineImpl.java | BaseMessagingEngineImpl.isEventNotificationPropertySet | public boolean isEventNotificationPropertySet() {
String thisMethodName = "isEventNotificationPropertySet";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, this);
}
boolean enabled = true;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, thisMethodName, Boolean.toString(enabled));
}
return enabled;
} | java | public boolean isEventNotificationPropertySet() {
String thisMethodName = "isEventNotificationPropertySet";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, this);
}
boolean enabled = true;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, thisMethodName, Boolean.toString(enabled));
}
return enabled;
} | [
"public",
"boolean",
"isEventNotificationPropertySet",
"(",
")",
"{",
"String",
"thisMethodName",
"=",
"\"isEventNotificationPropertySet\"",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"thisMethodName",
",",
"this",
")",
";",
"}",
"boolean",
"enabled",
"=",
"true",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"thisMethodName",
",",
"Boolean",
".",
"toString",
"(",
"enabled",
")",
")",
";",
"}",
"return",
"enabled",
";",
"}"
] | Test whether the Event Notification property has been set. This method
resolves the setting for the specific ME and the setting for the bus. | [
"Test",
"whether",
"the",
"Event",
"Notification",
"property",
"has",
"been",
"set",
".",
"This",
"method",
"resolves",
"the",
"setting",
"for",
"the",
"specific",
"ME",
"and",
"the",
"setting",
"for",
"the",
"bus",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/BaseMessagingEngineImpl.java#L1585-L1600 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/BaseMessagingEngineImpl.java | BaseMessagingEngineImpl.getMainImpl | public JsMainImpl getMainImpl() {
String thisMethodName = "getMainImpl";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, this);
SibTr.exit(tc, thisMethodName, _mainImpl);
}
return _mainImpl;
} | java | public JsMainImpl getMainImpl() {
String thisMethodName = "getMainImpl";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, this);
SibTr.exit(tc, thisMethodName, _mainImpl);
}
return _mainImpl;
} | [
"public",
"JsMainImpl",
"getMainImpl",
"(",
")",
"{",
"String",
"thisMethodName",
"=",
"\"getMainImpl\"",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"thisMethodName",
",",
"this",
")",
";",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"thisMethodName",
",",
"_mainImpl",
")",
";",
"}",
"return",
"_mainImpl",
";",
"}"
] | Returns a reference to the repository service. This is used in conjunction
with ConfigRoot to access EMF configuration documents.
@return Reference to the repository service. | [
"Returns",
"a",
"reference",
"to",
"the",
"repository",
"service",
".",
"This",
"is",
"used",
"in",
"conjunction",
"with",
"ConfigRoot",
"to",
"access",
"EMF",
"configuration",
"documents",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/BaseMessagingEngineImpl.java#L1608-L1618 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/BaseMessagingEngineImpl.java | BaseMessagingEngineImpl.loadClass | protected final JsEngineComponent loadClass(String className, int stopSeq, boolean reportError) {
String thisMethodName = "loadClass";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, new Object[] { className, Integer.toString(stopSeq), Boolean.toString(reportError) });
}
Class myClass = null;
JsEngineComponent retValue = null;
int _seq = stopSeq;
if (_seq < 0 || _seq > NUM_STOP_PHASES) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "loadClass: stopSeq is out of bounds " + stopSeq);
} else {
try {
myClass = Class.forName(className);
retValue = (JsEngineComponent) myClass.newInstance();
ComponentList compList = new ComponentList(className, retValue);
// No need to synchronize on jmeComponents to prevent concurrent
// modification from dynamic config and runtime callbacks, because
// jmeComponents is now a CopyOnWriteArrayList.
jmeComponents.add(compList);
stopSequence[_seq].addElement(compList);
} catch (ClassNotFoundException e) {
// No FFDC code needed
if (reportError == true) {
com.ibm.ws.ffdc.FFDCFilter.processException(e, CLASS_NAME + ".loadClass", "3", this);
SibTr.error(tc, "CLASS_LOAD_FAILURE_SIAS0013", className);
SibTr.exception(tc, e);
}
} catch (InstantiationException e) {
com.ibm.ws.ffdc.FFDCFilter.processException(e, CLASS_NAME + ".loadClass", "1", this);
if (reportError == true) {
SibTr.error(tc, "CLASS_LOAD_FAILURE_SIAS0013", className);
SibTr.exception(tc, e);
}
} catch (Throwable e) {
com.ibm.ws.ffdc.FFDCFilter.processException(e, CLASS_NAME + ".loadClass", "2", this);
if (reportError == true) {
SibTr.error(tc, "CLASS_LOAD_FAILURE_SIAS0013", className);
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
if (retValue == null)
SibTr.debug(tc, "loadClass: failed");
else
SibTr.debug(tc, "loadClass: OK");
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, thisMethodName, retValue);
}
return retValue;
} | java | protected final JsEngineComponent loadClass(String className, int stopSeq, boolean reportError) {
String thisMethodName = "loadClass";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, new Object[] { className, Integer.toString(stopSeq), Boolean.toString(reportError) });
}
Class myClass = null;
JsEngineComponent retValue = null;
int _seq = stopSeq;
if (_seq < 0 || _seq > NUM_STOP_PHASES) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "loadClass: stopSeq is out of bounds " + stopSeq);
} else {
try {
myClass = Class.forName(className);
retValue = (JsEngineComponent) myClass.newInstance();
ComponentList compList = new ComponentList(className, retValue);
// No need to synchronize on jmeComponents to prevent concurrent
// modification from dynamic config and runtime callbacks, because
// jmeComponents is now a CopyOnWriteArrayList.
jmeComponents.add(compList);
stopSequence[_seq].addElement(compList);
} catch (ClassNotFoundException e) {
// No FFDC code needed
if (reportError == true) {
com.ibm.ws.ffdc.FFDCFilter.processException(e, CLASS_NAME + ".loadClass", "3", this);
SibTr.error(tc, "CLASS_LOAD_FAILURE_SIAS0013", className);
SibTr.exception(tc, e);
}
} catch (InstantiationException e) {
com.ibm.ws.ffdc.FFDCFilter.processException(e, CLASS_NAME + ".loadClass", "1", this);
if (reportError == true) {
SibTr.error(tc, "CLASS_LOAD_FAILURE_SIAS0013", className);
SibTr.exception(tc, e);
}
} catch (Throwable e) {
com.ibm.ws.ffdc.FFDCFilter.processException(e, CLASS_NAME + ".loadClass", "2", this);
if (reportError == true) {
SibTr.error(tc, "CLASS_LOAD_FAILURE_SIAS0013", className);
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
if (retValue == null)
SibTr.debug(tc, "loadClass: failed");
else
SibTr.debug(tc, "loadClass: OK");
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, thisMethodName, retValue);
}
return retValue;
} | [
"protected",
"final",
"JsEngineComponent",
"loadClass",
"(",
"String",
"className",
",",
"int",
"stopSeq",
",",
"boolean",
"reportError",
")",
"{",
"String",
"thisMethodName",
"=",
"\"loadClass\"",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"thisMethodName",
",",
"new",
"Object",
"[",
"]",
"{",
"className",
",",
"Integer",
".",
"toString",
"(",
"stopSeq",
")",
",",
"Boolean",
".",
"toString",
"(",
"reportError",
")",
"}",
")",
";",
"}",
"Class",
"myClass",
"=",
"null",
";",
"JsEngineComponent",
"retValue",
"=",
"null",
";",
"int",
"_seq",
"=",
"stopSeq",
";",
"if",
"(",
"_seq",
"<",
"0",
"||",
"_seq",
">",
"NUM_STOP_PHASES",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"loadClass: stopSeq is out of bounds \"",
"+",
"stopSeq",
")",
";",
"}",
"else",
"{",
"try",
"{",
"myClass",
"=",
"Class",
".",
"forName",
"(",
"className",
")",
";",
"retValue",
"=",
"(",
"JsEngineComponent",
")",
"myClass",
".",
"newInstance",
"(",
")",
";",
"ComponentList",
"compList",
"=",
"new",
"ComponentList",
"(",
"className",
",",
"retValue",
")",
";",
"// No need to synchronize on jmeComponents to prevent concurrent",
"// modification from dynamic config and runtime callbacks, because",
"// jmeComponents is now a CopyOnWriteArrayList.",
"jmeComponents",
".",
"add",
"(",
"compList",
")",
";",
"stopSequence",
"[",
"_seq",
"]",
".",
"addElement",
"(",
"compList",
")",
";",
"}",
"catch",
"(",
"ClassNotFoundException",
"e",
")",
"{",
"// No FFDC code needed",
"if",
"(",
"reportError",
"==",
"true",
")",
"{",
"com",
".",
"ibm",
".",
"ws",
".",
"ffdc",
".",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"CLASS_NAME",
"+",
"\".loadClass\"",
",",
"\"3\"",
",",
"this",
")",
";",
"SibTr",
".",
"error",
"(",
"tc",
",",
"\"CLASS_LOAD_FAILURE_SIAS0013\"",
",",
"className",
")",
";",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"e",
")",
";",
"}",
"}",
"catch",
"(",
"InstantiationException",
"e",
")",
"{",
"com",
".",
"ibm",
".",
"ws",
".",
"ffdc",
".",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"CLASS_NAME",
"+",
"\".loadClass\"",
",",
"\"1\"",
",",
"this",
")",
";",
"if",
"(",
"reportError",
"==",
"true",
")",
"{",
"SibTr",
".",
"error",
"(",
"tc",
",",
"\"CLASS_LOAD_FAILURE_SIAS0013\"",
",",
"className",
")",
";",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"e",
")",
";",
"}",
"}",
"catch",
"(",
"Throwable",
"e",
")",
"{",
"com",
".",
"ibm",
".",
"ws",
".",
"ffdc",
".",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"CLASS_NAME",
"+",
"\".loadClass\"",
",",
"\"2\"",
",",
"this",
")",
";",
"if",
"(",
"reportError",
"==",
"true",
")",
"{",
"SibTr",
".",
"error",
"(",
"tc",
",",
"\"CLASS_LOAD_FAILURE_SIAS0013\"",
",",
"className",
")",
";",
"}",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"if",
"(",
"retValue",
"==",
"null",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"loadClass: failed\"",
")",
";",
"else",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"loadClass: OK\"",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"thisMethodName",
",",
"retValue",
")",
";",
"}",
"return",
"retValue",
";",
"}"
] | Load the named class and add it to the list of engine components.
@param className
Fully qualified class name of class to load.
@param stopSeq
@param reportError
Set to false for classes we don't care about.
@return | [
"Load",
"the",
"named",
"class",
"and",
"add",
"it",
"to",
"the",
"list",
"of",
"engine",
"components",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/BaseMessagingEngineImpl.java#L1695-L1755 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/RemoteQPConsumerKeyGroup.java | RemoteQPConsumerKeyGroup.addMember | public void addMember(JSConsumerKey key) throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "addMember", key);
super.addMember(key); // superclass method does most of the work
synchronized (criteriaLock)
{
if (allCriterias != null)
{
SelectionCriteria[] newCriterias = new SelectionCriteria[allCriterias.length + 1];
System.arraycopy(allCriterias, 0, newCriterias, 0, allCriterias.length);
allCriterias = newCriterias;
}
else
{
allCriterias = new SelectionCriteria[1];
}
allCriterias[allCriterias.length - 1] = ((RemoteQPConsumerKey) key).getSelectionCriteria()[0];
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "addMember");
} | java | public void addMember(JSConsumerKey key) throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "addMember", key);
super.addMember(key); // superclass method does most of the work
synchronized (criteriaLock)
{
if (allCriterias != null)
{
SelectionCriteria[] newCriterias = new SelectionCriteria[allCriterias.length + 1];
System.arraycopy(allCriterias, 0, newCriterias, 0, allCriterias.length);
allCriterias = newCriterias;
}
else
{
allCriterias = new SelectionCriteria[1];
}
allCriterias[allCriterias.length - 1] = ((RemoteQPConsumerKey) key).getSelectionCriteria()[0];
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "addMember");
} | [
"public",
"void",
"addMember",
"(",
"JSConsumerKey",
"key",
")",
"throws",
"SIResourceException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"addMember\"",
",",
"key",
")",
";",
"super",
".",
"addMember",
"(",
"key",
")",
";",
"// superclass method does most of the work",
"synchronized",
"(",
"criteriaLock",
")",
"{",
"if",
"(",
"allCriterias",
"!=",
"null",
")",
"{",
"SelectionCriteria",
"[",
"]",
"newCriterias",
"=",
"new",
"SelectionCriteria",
"[",
"allCriterias",
".",
"length",
"+",
"1",
"]",
";",
"System",
".",
"arraycopy",
"(",
"allCriterias",
",",
"0",
",",
"newCriterias",
",",
"0",
",",
"allCriterias",
".",
"length",
")",
";",
"allCriterias",
"=",
"newCriterias",
";",
"}",
"else",
"{",
"allCriterias",
"=",
"new",
"SelectionCriteria",
"[",
"1",
"]",
";",
"}",
"allCriterias",
"[",
"allCriterias",
".",
"length",
"-",
"1",
"]",
"=",
"(",
"(",
"RemoteQPConsumerKey",
")",
"key",
")",
".",
"getSelectionCriteria",
"(",
")",
"[",
"0",
"]",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"addMember\"",
")",
";",
"}"
] | overriding superclass method | [
"overriding",
"superclass",
"method"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/RemoteQPConsumerKeyGroup.java#L75-L100 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer.servlet.3.1/src/com/ibm/wsspi/webcontainer31/WCCustomProperties31.java | WCCustomProperties31.setCustomPropertyVariables | public static void setCustomPropertyVariables() {
UPGRADE_READ_TIMEOUT = Integer.valueOf(customProps.getProperty("upgradereadtimeout", Integer.toString(TCPReadRequestContext.NO_TIMEOUT))).intValue();
UPGRADE_WRITE_TIMEOUT = Integer.valueOf(customProps.getProperty("upgradewritetimeout", Integer.toString(TCPReadRequestContext.NO_TIMEOUT))).intValue();
} | java | public static void setCustomPropertyVariables() {
UPGRADE_READ_TIMEOUT = Integer.valueOf(customProps.getProperty("upgradereadtimeout", Integer.toString(TCPReadRequestContext.NO_TIMEOUT))).intValue();
UPGRADE_WRITE_TIMEOUT = Integer.valueOf(customProps.getProperty("upgradewritetimeout", Integer.toString(TCPReadRequestContext.NO_TIMEOUT))).intValue();
} | [
"public",
"static",
"void",
"setCustomPropertyVariables",
"(",
")",
"{",
"UPGRADE_READ_TIMEOUT",
"=",
"Integer",
".",
"valueOf",
"(",
"customProps",
".",
"getProperty",
"(",
"\"upgradereadtimeout\"",
",",
"Integer",
".",
"toString",
"(",
"TCPReadRequestContext",
".",
"NO_TIMEOUT",
")",
")",
")",
".",
"intValue",
"(",
")",
";",
"UPGRADE_WRITE_TIMEOUT",
"=",
"Integer",
".",
"valueOf",
"(",
"customProps",
".",
"getProperty",
"(",
"\"upgradewritetimeout\"",
",",
"Integer",
".",
"toString",
"(",
"TCPReadRequestContext",
".",
"NO_TIMEOUT",
")",
")",
")",
".",
"intValue",
"(",
")",
";",
"}"
] | The timeout to use when the request has been upgraded and a write is happening | [
"The",
"timeout",
"to",
"use",
"when",
"the",
"request",
"has",
"been",
"upgraded",
"and",
"a",
"write",
"is",
"happening"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.servlet.3.1/src/com/ibm/wsspi/webcontainer31/WCCustomProperties31.java#L29-L33 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/InvalidationAuditDaemon.java | InvalidationAuditDaemon.registerInvalidations | public void registerInvalidations(String cacheName, Iterator invalidations) {
InvalidationTableList invalidationTableList = getInvalidationTableList(cacheName);
if (invalidationTableList != null) {
try {
invalidationTableList.readWriteLock.writeLock().lock();
while (invalidations.hasNext()) {
try {
Object invalidation = invalidations.next();
if (invalidation instanceof InvalidateByIdEvent) {
InvalidateByIdEvent idEvent = (InvalidateByIdEvent) invalidation;
Object id = idEvent.getId();
InvalidateByIdEvent oldIdEvent = (InvalidateByIdEvent) invalidationTableList.presentIdSet.get(id);
long timeStamp = idEvent.getTimeStamp();
if ((oldIdEvent != null) && (oldIdEvent.getTimeStamp() >= timeStamp)) {
continue;
}
invalidationTableList.presentIdSet.put(id, idEvent);
continue;
}
InvalidateByTemplateEvent templateEvent = (InvalidateByTemplateEvent) invalidation;
String template = templateEvent.getTemplate();
InvalidateByTemplateEvent oldTemplateEvent = (InvalidateByTemplateEvent) invalidationTableList.presentTemplateSet.get(template);
long timeStamp = templateEvent.getTimeStamp();
if ((oldTemplateEvent != null) && (oldTemplateEvent.getTimeStamp() >= timeStamp)) {
continue;
}
invalidationTableList.presentTemplateSet.put(template, templateEvent);
} catch (Exception ex) {
com.ibm.ws.ffdc.FFDCFilter.processException(ex, "com.ibm.ws.cache.InvalidationAuditDaemon.registerInvalidations", "126", this);
}
}
} finally {
invalidationTableList.readWriteLock.writeLock().unlock();
}
}
} | java | public void registerInvalidations(String cacheName, Iterator invalidations) {
InvalidationTableList invalidationTableList = getInvalidationTableList(cacheName);
if (invalidationTableList != null) {
try {
invalidationTableList.readWriteLock.writeLock().lock();
while (invalidations.hasNext()) {
try {
Object invalidation = invalidations.next();
if (invalidation instanceof InvalidateByIdEvent) {
InvalidateByIdEvent idEvent = (InvalidateByIdEvent) invalidation;
Object id = idEvent.getId();
InvalidateByIdEvent oldIdEvent = (InvalidateByIdEvent) invalidationTableList.presentIdSet.get(id);
long timeStamp = idEvent.getTimeStamp();
if ((oldIdEvent != null) && (oldIdEvent.getTimeStamp() >= timeStamp)) {
continue;
}
invalidationTableList.presentIdSet.put(id, idEvent);
continue;
}
InvalidateByTemplateEvent templateEvent = (InvalidateByTemplateEvent) invalidation;
String template = templateEvent.getTemplate();
InvalidateByTemplateEvent oldTemplateEvent = (InvalidateByTemplateEvent) invalidationTableList.presentTemplateSet.get(template);
long timeStamp = templateEvent.getTimeStamp();
if ((oldTemplateEvent != null) && (oldTemplateEvent.getTimeStamp() >= timeStamp)) {
continue;
}
invalidationTableList.presentTemplateSet.put(template, templateEvent);
} catch (Exception ex) {
com.ibm.ws.ffdc.FFDCFilter.processException(ex, "com.ibm.ws.cache.InvalidationAuditDaemon.registerInvalidations", "126", this);
}
}
} finally {
invalidationTableList.readWriteLock.writeLock().unlock();
}
}
} | [
"public",
"void",
"registerInvalidations",
"(",
"String",
"cacheName",
",",
"Iterator",
"invalidations",
")",
"{",
"InvalidationTableList",
"invalidationTableList",
"=",
"getInvalidationTableList",
"(",
"cacheName",
")",
";",
"if",
"(",
"invalidationTableList",
"!=",
"null",
")",
"{",
"try",
"{",
"invalidationTableList",
".",
"readWriteLock",
".",
"writeLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"while",
"(",
"invalidations",
".",
"hasNext",
"(",
")",
")",
"{",
"try",
"{",
"Object",
"invalidation",
"=",
"invalidations",
".",
"next",
"(",
")",
";",
"if",
"(",
"invalidation",
"instanceof",
"InvalidateByIdEvent",
")",
"{",
"InvalidateByIdEvent",
"idEvent",
"=",
"(",
"InvalidateByIdEvent",
")",
"invalidation",
";",
"Object",
"id",
"=",
"idEvent",
".",
"getId",
"(",
")",
";",
"InvalidateByIdEvent",
"oldIdEvent",
"=",
"(",
"InvalidateByIdEvent",
")",
"invalidationTableList",
".",
"presentIdSet",
".",
"get",
"(",
"id",
")",
";",
"long",
"timeStamp",
"=",
"idEvent",
".",
"getTimeStamp",
"(",
")",
";",
"if",
"(",
"(",
"oldIdEvent",
"!=",
"null",
")",
"&&",
"(",
"oldIdEvent",
".",
"getTimeStamp",
"(",
")",
">=",
"timeStamp",
")",
")",
"{",
"continue",
";",
"}",
"invalidationTableList",
".",
"presentIdSet",
".",
"put",
"(",
"id",
",",
"idEvent",
")",
";",
"continue",
";",
"}",
"InvalidateByTemplateEvent",
"templateEvent",
"=",
"(",
"InvalidateByTemplateEvent",
")",
"invalidation",
";",
"String",
"template",
"=",
"templateEvent",
".",
"getTemplate",
"(",
")",
";",
"InvalidateByTemplateEvent",
"oldTemplateEvent",
"=",
"(",
"InvalidateByTemplateEvent",
")",
"invalidationTableList",
".",
"presentTemplateSet",
".",
"get",
"(",
"template",
")",
";",
"long",
"timeStamp",
"=",
"templateEvent",
".",
"getTimeStamp",
"(",
")",
";",
"if",
"(",
"(",
"oldTemplateEvent",
"!=",
"null",
")",
"&&",
"(",
"oldTemplateEvent",
".",
"getTimeStamp",
"(",
")",
">=",
"timeStamp",
")",
")",
"{",
"continue",
";",
"}",
"invalidationTableList",
".",
"presentTemplateSet",
".",
"put",
"(",
"template",
",",
"templateEvent",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"com",
".",
"ibm",
".",
"ws",
".",
"ffdc",
".",
"FFDCFilter",
".",
"processException",
"(",
"ex",
",",
"\"com.ibm.ws.cache.InvalidationAuditDaemon.registerInvalidations\"",
",",
"\"126\"",
",",
"this",
")",
";",
"}",
"}",
"}",
"finally",
"{",
"invalidationTableList",
".",
"readWriteLock",
".",
"writeLock",
"(",
")",
".",
"unlock",
"(",
")",
";",
"}",
"}",
"}"
] | This adds id and template invalidations.
@param invalidations
The list of invalidations. This is a Vector of either
InvalidateByIdEvent or InvalidateByTemplateEvent. | [
"This",
"adds",
"id",
"and",
"template",
"invalidations",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/InvalidationAuditDaemon.java#L102-L145 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/InvalidationAuditDaemon.java | InvalidationAuditDaemon.filterEntry | public CacheEntry filterEntry(String cacheName, CacheEntry cacheEntry) {
InvalidationTableList invalidationTableList = getInvalidationTableList(cacheName);
try {
invalidationTableList.readWriteLock.readLock().lock();
return internalFilterEntry(cacheName, invalidationTableList, cacheEntry);
} finally {
invalidationTableList.readWriteLock.readLock().unlock();
}
} | java | public CacheEntry filterEntry(String cacheName, CacheEntry cacheEntry) {
InvalidationTableList invalidationTableList = getInvalidationTableList(cacheName);
try {
invalidationTableList.readWriteLock.readLock().lock();
return internalFilterEntry(cacheName, invalidationTableList, cacheEntry);
} finally {
invalidationTableList.readWriteLock.readLock().unlock();
}
} | [
"public",
"CacheEntry",
"filterEntry",
"(",
"String",
"cacheName",
",",
"CacheEntry",
"cacheEntry",
")",
"{",
"InvalidationTableList",
"invalidationTableList",
"=",
"getInvalidationTableList",
"(",
"cacheName",
")",
";",
"try",
"{",
"invalidationTableList",
".",
"readWriteLock",
".",
"readLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"return",
"internalFilterEntry",
"(",
"cacheName",
",",
"invalidationTableList",
",",
"cacheEntry",
")",
";",
"}",
"finally",
"{",
"invalidationTableList",
".",
"readWriteLock",
".",
"readLock",
"(",
")",
".",
"unlock",
"(",
")",
";",
"}",
"}"
] | This ensures the specified CacheEntrys have not been invalidated.
@param cacheEntry The unfiltered CacheEntry.
@return The filtered CacheEntry. | [
"This",
"ensures",
"the",
"specified",
"CacheEntrys",
"have",
"not",
"been",
"invalidated",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/InvalidationAuditDaemon.java#L153-L162 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/InvalidationAuditDaemon.java | InvalidationAuditDaemon.filterEntryList | public ArrayList filterEntryList(String cacheName, ArrayList incomingList) {
InvalidationTableList invalidationTableList = getInvalidationTableList(cacheName);
try {
invalidationTableList.readWriteLock.readLock().lock();
Iterator it = incomingList.iterator();
while (it.hasNext()) {
Object obj = it.next();
if (obj instanceof CacheEntry) {// ignore any "push-pull" String id's in DRS case
CacheEntry cacheEntry = (CacheEntry) obj;
if (internalFilterEntry(cacheName, invalidationTableList, cacheEntry) == null) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "filterEntryList(): Filtered OUT cacheName=" + cacheName + " id=" + cacheEntry.id);
}
it.remove();
}
}
}
return incomingList;
} finally {
invalidationTableList.readWriteLock.readLock().unlock();
}
} | java | public ArrayList filterEntryList(String cacheName, ArrayList incomingList) {
InvalidationTableList invalidationTableList = getInvalidationTableList(cacheName);
try {
invalidationTableList.readWriteLock.readLock().lock();
Iterator it = incomingList.iterator();
while (it.hasNext()) {
Object obj = it.next();
if (obj instanceof CacheEntry) {// ignore any "push-pull" String id's in DRS case
CacheEntry cacheEntry = (CacheEntry) obj;
if (internalFilterEntry(cacheName, invalidationTableList, cacheEntry) == null) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "filterEntryList(): Filtered OUT cacheName=" + cacheName + " id=" + cacheEntry.id);
}
it.remove();
}
}
}
return incomingList;
} finally {
invalidationTableList.readWriteLock.readLock().unlock();
}
} | [
"public",
"ArrayList",
"filterEntryList",
"(",
"String",
"cacheName",
",",
"ArrayList",
"incomingList",
")",
"{",
"InvalidationTableList",
"invalidationTableList",
"=",
"getInvalidationTableList",
"(",
"cacheName",
")",
";",
"try",
"{",
"invalidationTableList",
".",
"readWriteLock",
".",
"readLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"Iterator",
"it",
"=",
"incomingList",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"it",
".",
"hasNext",
"(",
")",
")",
"{",
"Object",
"obj",
"=",
"it",
".",
"next",
"(",
")",
";",
"if",
"(",
"obj",
"instanceof",
"CacheEntry",
")",
"{",
"// ignore any \"push-pull\" String id's in DRS case",
"CacheEntry",
"cacheEntry",
"=",
"(",
"CacheEntry",
")",
"obj",
";",
"if",
"(",
"internalFilterEntry",
"(",
"cacheName",
",",
"invalidationTableList",
",",
"cacheEntry",
")",
"==",
"null",
")",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"filterEntryList(): Filtered OUT cacheName=\"",
"+",
"cacheName",
"+",
"\" id=\"",
"+",
"cacheEntry",
".",
"id",
")",
";",
"}",
"it",
".",
"remove",
"(",
")",
";",
"}",
"}",
"}",
"return",
"incomingList",
";",
"}",
"finally",
"{",
"invalidationTableList",
".",
"readWriteLock",
".",
"readLock",
"(",
")",
".",
"unlock",
"(",
")",
";",
"}",
"}"
] | This ensures all incoming CacheEntrys have not been invalidated.
@param incomingList The unfiltered list of CacheEntrys.
@return The filtered list of CacheEntrys. | [
"This",
"ensures",
"all",
"incoming",
"CacheEntrys",
"have",
"not",
"been",
"invalidated",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/InvalidationAuditDaemon.java#L170-L192 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/InvalidationAuditDaemon.java | InvalidationAuditDaemon.internalFilterEntry | private final CacheEntry internalFilterEntry(String cacheName, InvalidationTableList invalidationTableList, CacheEntry cacheEntry) {
InvalidateByIdEvent idEvent = null;
if (cacheEntry == null) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "internalFilterEntry(): Filtered cacheName=" + cacheName + " CE == NULL");
}
return null;
} else if (cacheEntry.id == null) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "internalFilterEntry(): Filtered cacheName=" + cacheName + " id == NULL");
}
return null;
}
long timeStamp = cacheEntry.getTimeStamp();
idEvent = (InvalidateByIdEvent) invalidationTableList.presentIdSet.get(cacheEntry.id);
if ((idEvent != null) && (idEvent.getTimeStamp() > timeStamp)) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "internalFilterEntry(): Filtered Found a more recent InvalidateByIdEvent for the cacheEntry in presentIdSet. cacheName=" + cacheName + " id=" + cacheEntry.id);
}
return null;
}
if (collision(invalidationTableList.presentTemplateSet, cacheEntry.getTemplates(), timeStamp) || collision(invalidationTableList.presentIdSet, cacheEntry.getDataIds(), timeStamp)) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "internalFilterEntry(): Filtered due to preexisting invalidations due to dependencies and templates in present template and IdSet. cacheName=" + cacheName + " id=" + cacheEntry.id);
}
return null;
}
if (timeStamp > lastTimeCleared) {
return cacheEntry;
}
//else check past values as well
idEvent = (InvalidateByIdEvent) invalidationTableList.pastIdSet.get(cacheEntry.id);
if ((idEvent != null) && (idEvent.getTimeStamp() > timeStamp)) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "internalFilterEntry(): Filtered Found a more recent InvalidateByIdEvent for the cacheEntry in pastIdSet. cacheName=" + cacheName + " id=" + cacheEntry.id);
}
return null;
}
if (collision(invalidationTableList.pastTemplateSet, cacheEntry.getTemplates(), timeStamp) || collision(invalidationTableList.pastIdSet, cacheEntry.getDataIds(), timeStamp)) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "internalFilterEntry(): Filtered due to preexisting invalidations due to dependencies and templates in past template and IdSet. cacheName=" + cacheName + " id=" + cacheEntry.id);
}
return null;
}
return cacheEntry;
} | java | private final CacheEntry internalFilterEntry(String cacheName, InvalidationTableList invalidationTableList, CacheEntry cacheEntry) {
InvalidateByIdEvent idEvent = null;
if (cacheEntry == null) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "internalFilterEntry(): Filtered cacheName=" + cacheName + " CE == NULL");
}
return null;
} else if (cacheEntry.id == null) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "internalFilterEntry(): Filtered cacheName=" + cacheName + " id == NULL");
}
return null;
}
long timeStamp = cacheEntry.getTimeStamp();
idEvent = (InvalidateByIdEvent) invalidationTableList.presentIdSet.get(cacheEntry.id);
if ((idEvent != null) && (idEvent.getTimeStamp() > timeStamp)) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "internalFilterEntry(): Filtered Found a more recent InvalidateByIdEvent for the cacheEntry in presentIdSet. cacheName=" + cacheName + " id=" + cacheEntry.id);
}
return null;
}
if (collision(invalidationTableList.presentTemplateSet, cacheEntry.getTemplates(), timeStamp) || collision(invalidationTableList.presentIdSet, cacheEntry.getDataIds(), timeStamp)) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "internalFilterEntry(): Filtered due to preexisting invalidations due to dependencies and templates in present template and IdSet. cacheName=" + cacheName + " id=" + cacheEntry.id);
}
return null;
}
if (timeStamp > lastTimeCleared) {
return cacheEntry;
}
//else check past values as well
idEvent = (InvalidateByIdEvent) invalidationTableList.pastIdSet.get(cacheEntry.id);
if ((idEvent != null) && (idEvent.getTimeStamp() > timeStamp)) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "internalFilterEntry(): Filtered Found a more recent InvalidateByIdEvent for the cacheEntry in pastIdSet. cacheName=" + cacheName + " id=" + cacheEntry.id);
}
return null;
}
if (collision(invalidationTableList.pastTemplateSet, cacheEntry.getTemplates(), timeStamp) || collision(invalidationTableList.pastIdSet, cacheEntry.getDataIds(), timeStamp)) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "internalFilterEntry(): Filtered due to preexisting invalidations due to dependencies and templates in past template and IdSet. cacheName=" + cacheName + " id=" + cacheEntry.id);
}
return null;
}
return cacheEntry;
} | [
"private",
"final",
"CacheEntry",
"internalFilterEntry",
"(",
"String",
"cacheName",
",",
"InvalidationTableList",
"invalidationTableList",
",",
"CacheEntry",
"cacheEntry",
")",
"{",
"InvalidateByIdEvent",
"idEvent",
"=",
"null",
";",
"if",
"(",
"cacheEntry",
"==",
"null",
")",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"internalFilterEntry(): Filtered cacheName=\"",
"+",
"cacheName",
"+",
"\" CE == NULL\"",
")",
";",
"}",
"return",
"null",
";",
"}",
"else",
"if",
"(",
"cacheEntry",
".",
"id",
"==",
"null",
")",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"internalFilterEntry(): Filtered cacheName=\"",
"+",
"cacheName",
"+",
"\" id == NULL\"",
")",
";",
"}",
"return",
"null",
";",
"}",
"long",
"timeStamp",
"=",
"cacheEntry",
".",
"getTimeStamp",
"(",
")",
";",
"idEvent",
"=",
"(",
"InvalidateByIdEvent",
")",
"invalidationTableList",
".",
"presentIdSet",
".",
"get",
"(",
"cacheEntry",
".",
"id",
")",
";",
"if",
"(",
"(",
"idEvent",
"!=",
"null",
")",
"&&",
"(",
"idEvent",
".",
"getTimeStamp",
"(",
")",
">",
"timeStamp",
")",
")",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"internalFilterEntry(): Filtered Found a more recent InvalidateByIdEvent for the cacheEntry in presentIdSet. cacheName=\"",
"+",
"cacheName",
"+",
"\" id=\"",
"+",
"cacheEntry",
".",
"id",
")",
";",
"}",
"return",
"null",
";",
"}",
"if",
"(",
"collision",
"(",
"invalidationTableList",
".",
"presentTemplateSet",
",",
"cacheEntry",
".",
"getTemplates",
"(",
")",
",",
"timeStamp",
")",
"||",
"collision",
"(",
"invalidationTableList",
".",
"presentIdSet",
",",
"cacheEntry",
".",
"getDataIds",
"(",
")",
",",
"timeStamp",
")",
")",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"internalFilterEntry(): Filtered due to preexisting invalidations due to dependencies and templates in present template and IdSet. cacheName=\"",
"+",
"cacheName",
"+",
"\" id=\"",
"+",
"cacheEntry",
".",
"id",
")",
";",
"}",
"return",
"null",
";",
"}",
"if",
"(",
"timeStamp",
">",
"lastTimeCleared",
")",
"{",
"return",
"cacheEntry",
";",
"}",
"//else check past values as well",
"idEvent",
"=",
"(",
"InvalidateByIdEvent",
")",
"invalidationTableList",
".",
"pastIdSet",
".",
"get",
"(",
"cacheEntry",
".",
"id",
")",
";",
"if",
"(",
"(",
"idEvent",
"!=",
"null",
")",
"&&",
"(",
"idEvent",
".",
"getTimeStamp",
"(",
")",
">",
"timeStamp",
")",
")",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"internalFilterEntry(): Filtered Found a more recent InvalidateByIdEvent for the cacheEntry in pastIdSet. cacheName=\"",
"+",
"cacheName",
"+",
"\" id=\"",
"+",
"cacheEntry",
".",
"id",
")",
";",
"}",
"return",
"null",
";",
"}",
"if",
"(",
"collision",
"(",
"invalidationTableList",
".",
"pastTemplateSet",
",",
"cacheEntry",
".",
"getTemplates",
"(",
")",
",",
"timeStamp",
")",
"||",
"collision",
"(",
"invalidationTableList",
".",
"pastIdSet",
",",
"cacheEntry",
".",
"getDataIds",
"(",
")",
",",
"timeStamp",
")",
")",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"internalFilterEntry(): Filtered due to preexisting invalidations due to dependencies and templates in past template and IdSet. cacheName=\"",
"+",
"cacheName",
"+",
"\" id=\"",
"+",
"cacheEntry",
".",
"id",
")",
";",
"}",
"return",
"null",
";",
"}",
"return",
"cacheEntry",
";",
"}"
] | This is a helper method that filters a single CacheEntry.
It is called by the filterEntry and filterEntryList methods.
@param cacheEntry The unfiltered CacheEntry.
@return The filtered CacheEntry. | [
"This",
"is",
"a",
"helper",
"method",
"that",
"filters",
"a",
"single",
"CacheEntry",
".",
"It",
"is",
"called",
"by",
"the",
"filterEntry",
"and",
"filterEntryList",
"methods",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/InvalidationAuditDaemon.java#L201-L248 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/InvalidationAuditDaemon.java | InvalidationAuditDaemon.filterExternalCacheFragment | public ExternalInvalidation filterExternalCacheFragment(String cacheName, ExternalInvalidation externalCacheFragment) {
InvalidationTableList invalidationTableList = getInvalidationTableList(cacheName);
try {
invalidationTableList.readWriteLock.readLock().lock();
return internalFilterExternalCacheFragment(cacheName, invalidationTableList, externalCacheFragment);
} finally {
invalidationTableList.readWriteLock.readLock().unlock();
}
} | java | public ExternalInvalidation filterExternalCacheFragment(String cacheName, ExternalInvalidation externalCacheFragment) {
InvalidationTableList invalidationTableList = getInvalidationTableList(cacheName);
try {
invalidationTableList.readWriteLock.readLock().lock();
return internalFilterExternalCacheFragment(cacheName, invalidationTableList, externalCacheFragment);
} finally {
invalidationTableList.readWriteLock.readLock().unlock();
}
} | [
"public",
"ExternalInvalidation",
"filterExternalCacheFragment",
"(",
"String",
"cacheName",
",",
"ExternalInvalidation",
"externalCacheFragment",
")",
"{",
"InvalidationTableList",
"invalidationTableList",
"=",
"getInvalidationTableList",
"(",
"cacheName",
")",
";",
"try",
"{",
"invalidationTableList",
".",
"readWriteLock",
".",
"readLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"return",
"internalFilterExternalCacheFragment",
"(",
"cacheName",
",",
"invalidationTableList",
",",
"externalCacheFragment",
")",
";",
"}",
"finally",
"{",
"invalidationTableList",
".",
"readWriteLock",
".",
"readLock",
"(",
")",
".",
"unlock",
"(",
")",
";",
"}",
"}"
] | This ensures that the specified ExternalCacheFragment has not
been invalidated.
@param externalCacheFragment The unfiltered ExternalCacheFragment.
@return The filtered ExternalCacheFragment. | [
"This",
"ensures",
"that",
"the",
"specified",
"ExternalCacheFragment",
"has",
"not",
"been",
"invalidated",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/InvalidationAuditDaemon.java#L256-L264 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/InvalidationAuditDaemon.java | InvalidationAuditDaemon.filterExternalCacheFragmentList | public ArrayList filterExternalCacheFragmentList(String cacheName, ArrayList incomingList) {
InvalidationTableList invalidationTableList = getInvalidationTableList(cacheName);
try {
invalidationTableList.readWriteLock.readLock().lock();
Iterator it = incomingList.iterator();
while (it.hasNext()) {
ExternalInvalidation externalCacheFragment = (ExternalInvalidation) it.next();
if (null == internalFilterExternalCacheFragment(cacheName, invalidationTableList, externalCacheFragment)) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "filterExternalCacheFragmentList(): Filtered OUT cacheName=" + cacheName + " uri=" + externalCacheFragment.getUri());
}
it.remove();
}
}
return incomingList;
} finally {
invalidationTableList.readWriteLock.readLock().unlock();
}
} | java | public ArrayList filterExternalCacheFragmentList(String cacheName, ArrayList incomingList) {
InvalidationTableList invalidationTableList = getInvalidationTableList(cacheName);
try {
invalidationTableList.readWriteLock.readLock().lock();
Iterator it = incomingList.iterator();
while (it.hasNext()) {
ExternalInvalidation externalCacheFragment = (ExternalInvalidation) it.next();
if (null == internalFilterExternalCacheFragment(cacheName, invalidationTableList, externalCacheFragment)) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "filterExternalCacheFragmentList(): Filtered OUT cacheName=" + cacheName + " uri=" + externalCacheFragment.getUri());
}
it.remove();
}
}
return incomingList;
} finally {
invalidationTableList.readWriteLock.readLock().unlock();
}
} | [
"public",
"ArrayList",
"filterExternalCacheFragmentList",
"(",
"String",
"cacheName",
",",
"ArrayList",
"incomingList",
")",
"{",
"InvalidationTableList",
"invalidationTableList",
"=",
"getInvalidationTableList",
"(",
"cacheName",
")",
";",
"try",
"{",
"invalidationTableList",
".",
"readWriteLock",
".",
"readLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"Iterator",
"it",
"=",
"incomingList",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"it",
".",
"hasNext",
"(",
")",
")",
"{",
"ExternalInvalidation",
"externalCacheFragment",
"=",
"(",
"ExternalInvalidation",
")",
"it",
".",
"next",
"(",
")",
";",
"if",
"(",
"null",
"==",
"internalFilterExternalCacheFragment",
"(",
"cacheName",
",",
"invalidationTableList",
",",
"externalCacheFragment",
")",
")",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"filterExternalCacheFragmentList(): Filtered OUT cacheName=\"",
"+",
"cacheName",
"+",
"\" uri=\"",
"+",
"externalCacheFragment",
".",
"getUri",
"(",
")",
")",
";",
"}",
"it",
".",
"remove",
"(",
")",
";",
"}",
"}",
"return",
"incomingList",
";",
"}",
"finally",
"{",
"invalidationTableList",
".",
"readWriteLock",
".",
"readLock",
"(",
")",
".",
"unlock",
"(",
")",
";",
"}",
"}"
] | This ensures all incoming ExternalCacheFragments have not been
invalidated.
@param incomingList The unfiltered list of ExternalCacheFragments.
@return The filtered list of ExternalCacheFragments. | [
"This",
"ensures",
"all",
"incoming",
"ExternalCacheFragments",
"have",
"not",
"been",
"invalidated",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/InvalidationAuditDaemon.java#L273-L293 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/InvalidationAuditDaemon.java | InvalidationAuditDaemon.internalFilterExternalCacheFragment | private final ExternalInvalidation internalFilterExternalCacheFragment(String cacheName, InvalidationTableList invalidationTableList, ExternalInvalidation externalCacheFragment) {
if (externalCacheFragment == null) {
return null;
}
long timeStamp = externalCacheFragment.getTimeStamp();
if (collision(invalidationTableList.presentTemplateSet, externalCacheFragment.getInvalidationIds(), timeStamp) || collision(invalidationTableList.presentIdSet, externalCacheFragment.getTemplates(), timeStamp)) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "internalFilterExternalCacheFragment(): Filtered due to preexisting invalidations due to dependencies and templates in present template and IdSet. cacheName=" + cacheName + " url=" + externalCacheFragment.getUri());
}
return null;
}
if (timeStamp > lastTimeCleared) {
return externalCacheFragment;
}
//else check past values as well
if (collision(invalidationTableList.pastTemplateSet, externalCacheFragment.getInvalidationIds(), timeStamp) || collision(invalidationTableList.pastIdSet, externalCacheFragment.getTemplates(), timeStamp)) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "internalFilterExternalCacheFragment(): Filtered due to preexisting invalidations due to dependencies and templates in past template and IdSet. cacheName=" + cacheName + " url=" + externalCacheFragment.getUri());
}
return null;
}
return externalCacheFragment;
} | java | private final ExternalInvalidation internalFilterExternalCacheFragment(String cacheName, InvalidationTableList invalidationTableList, ExternalInvalidation externalCacheFragment) {
if (externalCacheFragment == null) {
return null;
}
long timeStamp = externalCacheFragment.getTimeStamp();
if (collision(invalidationTableList.presentTemplateSet, externalCacheFragment.getInvalidationIds(), timeStamp) || collision(invalidationTableList.presentIdSet, externalCacheFragment.getTemplates(), timeStamp)) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "internalFilterExternalCacheFragment(): Filtered due to preexisting invalidations due to dependencies and templates in present template and IdSet. cacheName=" + cacheName + " url=" + externalCacheFragment.getUri());
}
return null;
}
if (timeStamp > lastTimeCleared) {
return externalCacheFragment;
}
//else check past values as well
if (collision(invalidationTableList.pastTemplateSet, externalCacheFragment.getInvalidationIds(), timeStamp) || collision(invalidationTableList.pastIdSet, externalCacheFragment.getTemplates(), timeStamp)) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "internalFilterExternalCacheFragment(): Filtered due to preexisting invalidations due to dependencies and templates in past template and IdSet. cacheName=" + cacheName + " url=" + externalCacheFragment.getUri());
}
return null;
}
return externalCacheFragment;
} | [
"private",
"final",
"ExternalInvalidation",
"internalFilterExternalCacheFragment",
"(",
"String",
"cacheName",
",",
"InvalidationTableList",
"invalidationTableList",
",",
"ExternalInvalidation",
"externalCacheFragment",
")",
"{",
"if",
"(",
"externalCacheFragment",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"long",
"timeStamp",
"=",
"externalCacheFragment",
".",
"getTimeStamp",
"(",
")",
";",
"if",
"(",
"collision",
"(",
"invalidationTableList",
".",
"presentTemplateSet",
",",
"externalCacheFragment",
".",
"getInvalidationIds",
"(",
")",
",",
"timeStamp",
")",
"||",
"collision",
"(",
"invalidationTableList",
".",
"presentIdSet",
",",
"externalCacheFragment",
".",
"getTemplates",
"(",
")",
",",
"timeStamp",
")",
")",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"internalFilterExternalCacheFragment(): Filtered due to preexisting invalidations due to dependencies and templates in present template and IdSet. cacheName=\"",
"+",
"cacheName",
"+",
"\" url=\"",
"+",
"externalCacheFragment",
".",
"getUri",
"(",
")",
")",
";",
"}",
"return",
"null",
";",
"}",
"if",
"(",
"timeStamp",
">",
"lastTimeCleared",
")",
"{",
"return",
"externalCacheFragment",
";",
"}",
"//else check past values as well",
"if",
"(",
"collision",
"(",
"invalidationTableList",
".",
"pastTemplateSet",
",",
"externalCacheFragment",
".",
"getInvalidationIds",
"(",
")",
",",
"timeStamp",
")",
"||",
"collision",
"(",
"invalidationTableList",
".",
"pastIdSet",
",",
"externalCacheFragment",
".",
"getTemplates",
"(",
")",
",",
"timeStamp",
")",
")",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"internalFilterExternalCacheFragment(): Filtered due to preexisting invalidations due to dependencies and templates in past template and IdSet. cacheName=\"",
"+",
"cacheName",
"+",
"\" url=\"",
"+",
"externalCacheFragment",
".",
"getUri",
"(",
")",
")",
";",
"}",
"return",
"null",
";",
"}",
"return",
"externalCacheFragment",
";",
"}"
] | This is a helper method that filters a single ExternalCacheFragment.
It is called by the filterExternalCacheFragment and
filterExternalCacheFragmentList methods.
@param externalCacheFragment The unfiltered ExternalCacheFragment.
@return The filtered ExternalCacheFragment. | [
"This",
"is",
"a",
"helper",
"method",
"that",
"filters",
"a",
"single",
"ExternalCacheFragment",
".",
"It",
"is",
"called",
"by",
"the",
"filterExternalCacheFragment",
"and",
"filterExternalCacheFragmentList",
"methods",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/InvalidationAuditDaemon.java#L303-L325 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/InvalidationAuditDaemon.java | InvalidationAuditDaemon.collision | private final boolean collision(Map<Object, InvalidationEvent> hashtable, Enumeration enumeration, long timeStamp) {
while (enumeration.hasMoreElements()) {
Object key = enumeration.nextElement();
InvalidationEvent invalidationEvent = (InvalidationEvent) hashtable.get(key);
if ((invalidationEvent != null) && (invalidationEvent.getTimeStamp() > timeStamp)) {
return true;
}
}
return false;
} | java | private final boolean collision(Map<Object, InvalidationEvent> hashtable, Enumeration enumeration, long timeStamp) {
while (enumeration.hasMoreElements()) {
Object key = enumeration.nextElement();
InvalidationEvent invalidationEvent = (InvalidationEvent) hashtable.get(key);
if ((invalidationEvent != null) && (invalidationEvent.getTimeStamp() > timeStamp)) {
return true;
}
}
return false;
} | [
"private",
"final",
"boolean",
"collision",
"(",
"Map",
"<",
"Object",
",",
"InvalidationEvent",
">",
"hashtable",
",",
"Enumeration",
"enumeration",
",",
"long",
"timeStamp",
")",
"{",
"while",
"(",
"enumeration",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"Object",
"key",
"=",
"enumeration",
".",
"nextElement",
"(",
")",
";",
"InvalidationEvent",
"invalidationEvent",
"=",
"(",
"InvalidationEvent",
")",
"hashtable",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"(",
"invalidationEvent",
"!=",
"null",
")",
"&&",
"(",
"invalidationEvent",
".",
"getTimeStamp",
"(",
")",
">",
"timeStamp",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
] | This is a helper method that checks for a collision.
@param hashtable A Hashtable of invalidation events.
@param enumeration An Enumeration of
@return True if there is an item in the enumeration
that is specified in the hashtable such that
the hashtable entry is newer than the timeStamp. | [
"This",
"is",
"a",
"helper",
"method",
"that",
"checks",
"for",
"a",
"collision",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/InvalidationAuditDaemon.java#L336-L345 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/InvalidationAuditDaemon.java | InvalidationAuditDaemon.getInvalidationTableList | private InvalidationTableList getInvalidationTableList(String cacheName) {
InvalidationTableList invalidationTableList = cacheinvalidationTables.get(cacheName);
if (invalidationTableList == null) {
synchronized (this) {
invalidationTableList = new InvalidationTableList();
cacheinvalidationTables.put(cacheName, invalidationTableList);
}
}
return invalidationTableList;
} | java | private InvalidationTableList getInvalidationTableList(String cacheName) {
InvalidationTableList invalidationTableList = cacheinvalidationTables.get(cacheName);
if (invalidationTableList == null) {
synchronized (this) {
invalidationTableList = new InvalidationTableList();
cacheinvalidationTables.put(cacheName, invalidationTableList);
}
}
return invalidationTableList;
} | [
"private",
"InvalidationTableList",
"getInvalidationTableList",
"(",
"String",
"cacheName",
")",
"{",
"InvalidationTableList",
"invalidationTableList",
"=",
"cacheinvalidationTables",
".",
"get",
"(",
"cacheName",
")",
";",
"if",
"(",
"invalidationTableList",
"==",
"null",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"invalidationTableList",
"=",
"new",
"InvalidationTableList",
"(",
")",
";",
"cacheinvalidationTables",
".",
"put",
"(",
"cacheName",
",",
"invalidationTableList",
")",
";",
"}",
"}",
"return",
"invalidationTableList",
";",
"}"
] | Retrieve the InvalidationTableList by the specified cacheName. | [
"Retrieve",
"the",
"InvalidationTableList",
"by",
"the",
"specified",
"cacheName",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/InvalidationAuditDaemon.java#L350-L359 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/KernelUtils.java | KernelUtils.getBootstrapJar | public static File getBootstrapJar() {
if (launchHome == null) {
if (launchURL == null) {
// How were we launched?
launchURL = getLocationFromClass(KernelUtils.class);
}
launchHome = FileUtils.getFile(launchURL);
}
return launchHome;
} | java | public static File getBootstrapJar() {
if (launchHome == null) {
if (launchURL == null) {
// How were we launched?
launchURL = getLocationFromClass(KernelUtils.class);
}
launchHome = FileUtils.getFile(launchURL);
}
return launchHome;
} | [
"public",
"static",
"File",
"getBootstrapJar",
"(",
")",
"{",
"if",
"(",
"launchHome",
"==",
"null",
")",
"{",
"if",
"(",
"launchURL",
"==",
"null",
")",
"{",
"// How were we launched?",
"launchURL",
"=",
"getLocationFromClass",
"(",
"KernelUtils",
".",
"class",
")",
";",
"}",
"launchHome",
"=",
"FileUtils",
".",
"getFile",
"(",
"launchURL",
")",
";",
"}",
"return",
"launchHome",
";",
"}"
] | The location of the launch jar is only obtained once.
@return a File representing the location of the launching jar | [
"The",
"location",
"of",
"the",
"launch",
"jar",
"is",
"only",
"obtained",
"once",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/KernelUtils.java#L62-L72 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/KernelUtils.java | KernelUtils.getBootstrapLibDir | public static File getBootstrapLibDir() {
if (libDir.get() == null) {
libDir = StaticValue.mutateStaticValue(libDir, new Utils.FileInitializer(getBootstrapJar().getParentFile()));
}
return libDir.get();
} | java | public static File getBootstrapLibDir() {
if (libDir.get() == null) {
libDir = StaticValue.mutateStaticValue(libDir, new Utils.FileInitializer(getBootstrapJar().getParentFile()));
}
return libDir.get();
} | [
"public",
"static",
"File",
"getBootstrapLibDir",
"(",
")",
"{",
"if",
"(",
"libDir",
".",
"get",
"(",
")",
"==",
"null",
")",
"{",
"libDir",
"=",
"StaticValue",
".",
"mutateStaticValue",
"(",
"libDir",
",",
"new",
"Utils",
".",
"FileInitializer",
"(",
"getBootstrapJar",
"(",
")",
".",
"getParentFile",
"(",
")",
")",
")",
";",
"}",
"return",
"libDir",
".",
"get",
"(",
")",
";",
"}"
] | The lib dir is the parent of the bootstrap jar
@return a File representing the location of the launching jar | [
"The",
"lib",
"dir",
"is",
"the",
"parent",
"of",
"the",
"bootstrap",
"jar"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/KernelUtils.java#L102-L107 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/KernelUtils.java | KernelUtils.getProperties | public static Properties getProperties(final InputStream is) throws IOException {
Properties p = new Properties();
try {
if (is != null) {
p.load(is);
// Look for "values" and strip the quotes to values
for (Entry<Object, Object> entry : p.entrySet()) {
String s = ((String) entry.getValue()).trim();
// If first and last characters are ", strip them off..
if (s.length() > 1 && s.startsWith("\"") && s.endsWith("\"")) {
entry.setValue(s.substring(1, s.length() - 1));
}
}
}
} finally {
Utils.tryToClose(is);
}
return p;
} | java | public static Properties getProperties(final InputStream is) throws IOException {
Properties p = new Properties();
try {
if (is != null) {
p.load(is);
// Look for "values" and strip the quotes to values
for (Entry<Object, Object> entry : p.entrySet()) {
String s = ((String) entry.getValue()).trim();
// If first and last characters are ", strip them off..
if (s.length() > 1 && s.startsWith("\"") && s.endsWith("\"")) {
entry.setValue(s.substring(1, s.length() - 1));
}
}
}
} finally {
Utils.tryToClose(is);
}
return p;
} | [
"public",
"static",
"Properties",
"getProperties",
"(",
"final",
"InputStream",
"is",
")",
"throws",
"IOException",
"{",
"Properties",
"p",
"=",
"new",
"Properties",
"(",
")",
";",
"try",
"{",
"if",
"(",
"is",
"!=",
"null",
")",
"{",
"p",
".",
"load",
"(",
"is",
")",
";",
"// Look for \"values\" and strip the quotes to values",
"for",
"(",
"Entry",
"<",
"Object",
",",
"Object",
">",
"entry",
":",
"p",
".",
"entrySet",
"(",
")",
")",
"{",
"String",
"s",
"=",
"(",
"(",
"String",
")",
"entry",
".",
"getValue",
"(",
")",
")",
".",
"trim",
"(",
")",
";",
"// If first and last characters are \", strip them off..",
"if",
"(",
"s",
".",
"length",
"(",
")",
">",
"1",
"&&",
"s",
".",
"startsWith",
"(",
"\"\\\"\"",
")",
"&&",
"s",
".",
"endsWith",
"(",
"\"\\\"\"",
")",
")",
"{",
"entry",
".",
"setValue",
"(",
"s",
".",
"substring",
"(",
"1",
",",
"s",
".",
"length",
"(",
")",
"-",
"1",
")",
")",
";",
"}",
"}",
"}",
"}",
"finally",
"{",
"Utils",
".",
"tryToClose",
"(",
"is",
")",
";",
"}",
"return",
"p",
";",
"}"
] | Read properties from input stream. Will close the input stream before
returning.
@param is
InputStream to read properties from
@return Properties object; will be empty if InputStream is null or empty.
@throws LaunchException | [
"Read",
"properties",
"from",
"input",
"stream",
".",
"Will",
"close",
"the",
"input",
"stream",
"before",
"returning",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/KernelUtils.java#L128-L149 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/KernelUtils.java | KernelUtils.getClassFromLine | private static String getClassFromLine(String line) {
line = line.trim();
// Skip commented lines
if (line.length() == 0 || line.startsWith("#"))
return null;
// lop off spaces/tabs/end-of-line-comments
String[] className = line.split("[\\s#]");
if (className.length >= 1)
return className[0];
return null;
} | java | private static String getClassFromLine(String line) {
line = line.trim();
// Skip commented lines
if (line.length() == 0 || line.startsWith("#"))
return null;
// lop off spaces/tabs/end-of-line-comments
String[] className = line.split("[\\s#]");
if (className.length >= 1)
return className[0];
return null;
} | [
"private",
"static",
"String",
"getClassFromLine",
"(",
"String",
"line",
")",
"{",
"line",
"=",
"line",
".",
"trim",
"(",
")",
";",
"// Skip commented lines",
"if",
"(",
"line",
".",
"length",
"(",
")",
"==",
"0",
"||",
"line",
".",
"startsWith",
"(",
"\"#\"",
")",
")",
"return",
"null",
";",
"// lop off spaces/tabs/end-of-line-comments",
"String",
"[",
"]",
"className",
"=",
"line",
".",
"split",
"(",
"\"[\\\\s#]\"",
")",
";",
"if",
"(",
"className",
".",
"length",
">=",
"1",
")",
"return",
"className",
"[",
"0",
"]",
";",
"return",
"null",
";",
"}"
] | Read a service class from the given line. Must ignore whitespace, and
skip comment lines, or end of line comments.
@param line
@return class name (first text on a line not starting with #) or null for
empty/comment lines | [
"Read",
"a",
"service",
"class",
"from",
"the",
"given",
"line",
".",
"Must",
"ignore",
"whitespace",
"and",
"skip",
"comment",
"lines",
"or",
"end",
"of",
"line",
"comments",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/KernelUtils.java#L180-L194 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/cache/statemodel/ListStatistics.java | ListStatistics.checkSpillLimits | public final void checkSpillLimits()
{
long currentTotal;
long currentSize;
synchronized(this)
{
currentTotal = _countTotal;
currentSize = _countTotalBytes;
}
if (!_spilling)
{
// We are not currently spilling so we need to calculate the moving average
// for the number of items on our stream and then check the moving average
// and the total size of the items on the stream against our configured limits.
// moving total is accumulated value over last 20 calculations minus the
// immediately previous value. This saves both a division and storing the
// last average. To get the current running total we add the current total
// to the _movingTotal
_movingTotal = _movingTotal + currentTotal;
// we calculate the moving average by dividing moving total by number of
// cycles in the moving window.
long movingAverage = _movingTotal / MOVING_AVERAGE_LENGTH;
// we then diminish the moving total by the moving average leaving it free for next time.
_movingTotal = _movingTotal - movingAverage;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Stream is NOT SPILLING");
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Current size :" + currentSize);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Current total :" + currentTotal);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Moving average:" + movingAverage);
if (movingAverage >= _movingAverageHighLimit || // There are too many items on the stream
currentSize >= _totalSizeHighLimit) // The size of items on the stream is too large
{
_spilling = true;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Stream has STARTED SPILLING");
}
}
else
{
// We are spilling so we just need to check against our configured limits and
// if we are below them for both number of items and total size of items then
// we can stop spilling. If we do stop spilling we also need to reset our moving
// average counter.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Stream is SPILLING");
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Current size :" + currentSize);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Current total :" + currentTotal);
if (currentTotal <= _movingAverageLowLimit && // There are only a few items on the stream
currentSize <= _totalSizeLowLimit) // AND The items on the stream are small
{
_spilling = false;
_movingTotal = _movingAverageLowLimit * (MOVING_AVERAGE_LENGTH - 1);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Stream has STOPPED SPILLING");
}
}
} | java | public final void checkSpillLimits()
{
long currentTotal;
long currentSize;
synchronized(this)
{
currentTotal = _countTotal;
currentSize = _countTotalBytes;
}
if (!_spilling)
{
// We are not currently spilling so we need to calculate the moving average
// for the number of items on our stream and then check the moving average
// and the total size of the items on the stream against our configured limits.
// moving total is accumulated value over last 20 calculations minus the
// immediately previous value. This saves both a division and storing the
// last average. To get the current running total we add the current total
// to the _movingTotal
_movingTotal = _movingTotal + currentTotal;
// we calculate the moving average by dividing moving total by number of
// cycles in the moving window.
long movingAverage = _movingTotal / MOVING_AVERAGE_LENGTH;
// we then diminish the moving total by the moving average leaving it free for next time.
_movingTotal = _movingTotal - movingAverage;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Stream is NOT SPILLING");
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Current size :" + currentSize);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Current total :" + currentTotal);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Moving average:" + movingAverage);
if (movingAverage >= _movingAverageHighLimit || // There are too many items on the stream
currentSize >= _totalSizeHighLimit) // The size of items on the stream is too large
{
_spilling = true;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Stream has STARTED SPILLING");
}
}
else
{
// We are spilling so we just need to check against our configured limits and
// if we are below them for both number of items and total size of items then
// we can stop spilling. If we do stop spilling we also need to reset our moving
// average counter.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Stream is SPILLING");
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Current size :" + currentSize);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Current total :" + currentTotal);
if (currentTotal <= _movingAverageLowLimit && // There are only a few items on the stream
currentSize <= _totalSizeLowLimit) // AND The items on the stream are small
{
_spilling = false;
_movingTotal = _movingAverageLowLimit * (MOVING_AVERAGE_LENGTH - 1);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Stream has STOPPED SPILLING");
}
}
} | [
"public",
"final",
"void",
"checkSpillLimits",
"(",
")",
"{",
"long",
"currentTotal",
";",
"long",
"currentSize",
";",
"synchronized",
"(",
"this",
")",
"{",
"currentTotal",
"=",
"_countTotal",
";",
"currentSize",
"=",
"_countTotalBytes",
";",
"}",
"if",
"(",
"!",
"_spilling",
")",
"{",
"// We are not currently spilling so we need to calculate the moving average ",
"// for the number of items on our stream and then check the moving average ",
"// and the total size of the items on the stream against our configured limits.",
"// moving total is accumulated value over last 20 calculations minus the",
"// immediately previous value. This saves both a division and storing the ",
"// last average. To get the current running total we add the current total",
"// to the _movingTotal",
"_movingTotal",
"=",
"_movingTotal",
"+",
"currentTotal",
";",
"// we calculate the moving average by dividing moving total by number of",
"// cycles in the moving window.",
"long",
"movingAverage",
"=",
"_movingTotal",
"/",
"MOVING_AVERAGE_LENGTH",
";",
"// we then diminish the moving total by the moving average leaving it free for next time.",
"_movingTotal",
"=",
"_movingTotal",
"-",
"movingAverage",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Stream is NOT SPILLING\"",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Current size :\"",
"+",
"currentSize",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Current total :\"",
"+",
"currentTotal",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Moving average:\"",
"+",
"movingAverage",
")",
";",
"if",
"(",
"movingAverage",
">=",
"_movingAverageHighLimit",
"||",
"// There are too many items on the stream",
"currentSize",
">=",
"_totalSizeHighLimit",
")",
"// The size of items on the stream is too large",
"{",
"_spilling",
"=",
"true",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Stream has STARTED SPILLING\"",
")",
";",
"}",
"}",
"else",
"{",
"// We are spilling so we just need to check against our configured limits and ",
"// if we are below them for both number of items and total size of items then",
"// we can stop spilling. If we do stop spilling we also need to reset our moving ",
"// average counter.",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Stream is SPILLING\"",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Current size :\"",
"+",
"currentSize",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Current total :\"",
"+",
"currentTotal",
")",
";",
"if",
"(",
"currentTotal",
"<=",
"_movingAverageLowLimit",
"&&",
"// There are only a few items on the stream",
"currentSize",
"<=",
"_totalSizeLowLimit",
")",
"// AND The items on the stream are small",
"{",
"_spilling",
"=",
"false",
";",
"_movingTotal",
"=",
"_movingAverageLowLimit",
"*",
"(",
"MOVING_AVERAGE_LENGTH",
"-",
"1",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Stream has STOPPED SPILLING\"",
")",
";",
"}",
"}",
"}"
] | Instead of just triggering spilling when we have a certain number of
Items on a stream we now have the ability to trigger spilling if the
total size of the Items on a stream goes over a pre-defined limit.
This should allow us to control the memory usage of a stream in a
more intuitive fashion.
For the count limit we use a moving average as this allows us to
flatten out and short term spikes in the number of items on the
stream. This allows us to pop over the item count for a short while
without triggering spilling and slowing item consumption even more.
For the size limit we do not use a moving average as this would
flatten off any spikes in the memory usage of the queue. In the
size case we need to pay attention to any spikes as they could
quickly blow the heap if allowed to build up.
i.e. a moving average of 20
19 x 1k message + 1 x 100MB message = 20 messages
Moving average totals | Moving average
------------------------------------------------
1K |
1K + 2k |
1K + 2K + 3K |
. |
. |
1K + 2K + .... + 19K + 100MB | 105,052,160 / 20 = 5,252,608
So a queue with over 100MB of message data on it would only produce
an average of just over 5MB. This inconsistency makes it difficult
to control the actual amount of memory being used and also for the
user to judge the correct values for the limits. | [
"Instead",
"of",
"just",
"triggering",
"spilling",
"when",
"we",
"have",
"a",
"certain",
"number",
"of",
"Items",
"on",
"a",
"stream",
"we",
"now",
"have",
"the",
"ability",
"to",
"trigger",
"spilling",
"if",
"the",
"total",
"size",
"of",
"the",
"Items",
"on",
"a",
"stream",
"goes",
"over",
"a",
"pre",
"-",
"defined",
"limit",
".",
"This",
"should",
"allow",
"us",
"to",
"control",
"the",
"memory",
"usage",
"of",
"a",
"stream",
"in",
"a",
"more",
"intuitive",
"fashion",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/cache/statemodel/ListStatistics.java#L121-L181 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/cache/statemodel/ListStatistics.java | ListStatistics.updateTotal | public final void updateTotal(int oldSizeInBytes, int newSizeInBytes) throws SevereMessageStoreException
{
boolean doCallback = false;
synchronized(this)
{
// We're only replacing an old size estimation
// with a new one so we do not need to change
// or inspect the count total and watermark
// Check whether we were between our limits before
// before this update.
boolean wasBelowHighLimit = (_countTotalBytes < _watermarkBytesHigh);
boolean wasAboveLowLimit = (_countTotalBytes >= _watermarkBytesLow);
// Update our count to the new value by adding the
// difference between the old and new sizes
_countTotalBytes = _countTotalBytes + (newSizeInBytes - oldSizeInBytes);
if ((wasBelowHighLimit && _countTotalBytes >= _watermarkBytesHigh) // Was below the HIGH watermark but now isn't
|| (wasAboveLowLimit && _countTotalBytes < _watermarkBytesLow)) // OR was above LOW watermark but now isn't
{
doCallback = true;
}
}
if (doCallback)
{
_owningStreamLink.eventWatermarkBreached();
}
} | java | public final void updateTotal(int oldSizeInBytes, int newSizeInBytes) throws SevereMessageStoreException
{
boolean doCallback = false;
synchronized(this)
{
// We're only replacing an old size estimation
// with a new one so we do not need to change
// or inspect the count total and watermark
// Check whether we were between our limits before
// before this update.
boolean wasBelowHighLimit = (_countTotalBytes < _watermarkBytesHigh);
boolean wasAboveLowLimit = (_countTotalBytes >= _watermarkBytesLow);
// Update our count to the new value by adding the
// difference between the old and new sizes
_countTotalBytes = _countTotalBytes + (newSizeInBytes - oldSizeInBytes);
if ((wasBelowHighLimit && _countTotalBytes >= _watermarkBytesHigh) // Was below the HIGH watermark but now isn't
|| (wasAboveLowLimit && _countTotalBytes < _watermarkBytesLow)) // OR was above LOW watermark but now isn't
{
doCallback = true;
}
}
if (doCallback)
{
_owningStreamLink.eventWatermarkBreached();
}
} | [
"public",
"final",
"void",
"updateTotal",
"(",
"int",
"oldSizeInBytes",
",",
"int",
"newSizeInBytes",
")",
"throws",
"SevereMessageStoreException",
"{",
"boolean",
"doCallback",
"=",
"false",
";",
"synchronized",
"(",
"this",
")",
"{",
"// We're only replacing an old size estimation",
"// with a new one so we do not need to change",
"// or inspect the count total and watermark",
"// Check whether we were between our limits before",
"// before this update.",
"boolean",
"wasBelowHighLimit",
"=",
"(",
"_countTotalBytes",
"<",
"_watermarkBytesHigh",
")",
";",
"boolean",
"wasAboveLowLimit",
"=",
"(",
"_countTotalBytes",
">=",
"_watermarkBytesLow",
")",
";",
"// Update our count to the new value by adding the",
"// difference between the old and new sizes",
"_countTotalBytes",
"=",
"_countTotalBytes",
"+",
"(",
"newSizeInBytes",
"-",
"oldSizeInBytes",
")",
";",
"if",
"(",
"(",
"wasBelowHighLimit",
"&&",
"_countTotalBytes",
">=",
"_watermarkBytesHigh",
")",
"// Was below the HIGH watermark but now isn't",
"||",
"(",
"wasAboveLowLimit",
"&&",
"_countTotalBytes",
"<",
"_watermarkBytesLow",
")",
")",
"// OR was above LOW watermark but now isn't",
"{",
"doCallback",
"=",
"true",
";",
"}",
"}",
"if",
"(",
"doCallback",
")",
"{",
"_owningStreamLink",
".",
"eventWatermarkBreached",
"(",
")",
";",
"}",
"}"
] | once we have the Item available to determine it from. | [
"once",
"we",
"have",
"the",
"Item",
"available",
"to",
"determine",
"it",
"from",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/cache/statemodel/ListStatistics.java#L588-L618 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/composite/CompositeTagAttributeUtils.java | CompositeTagAttributeUtils.addUnspecifiedAttributes | public static void addUnspecifiedAttributes(FeatureDescriptor descriptor,
Tag tag, String[] standardAttributesSorted, FaceletContext ctx)
{
for (TagAttribute attribute : tag.getAttributes().getAll())
{
final String name = attribute.getLocalName();
if (Arrays.binarySearch(standardAttributesSorted, name) < 0)
{
// attribute not found in standard attributes
// --> put it on the BeanDescriptor
descriptor.setValue(name, attribute.getValueExpression(ctx, Object.class));
}
}
} | java | public static void addUnspecifiedAttributes(FeatureDescriptor descriptor,
Tag tag, String[] standardAttributesSorted, FaceletContext ctx)
{
for (TagAttribute attribute : tag.getAttributes().getAll())
{
final String name = attribute.getLocalName();
if (Arrays.binarySearch(standardAttributesSorted, name) < 0)
{
// attribute not found in standard attributes
// --> put it on the BeanDescriptor
descriptor.setValue(name, attribute.getValueExpression(ctx, Object.class));
}
}
} | [
"public",
"static",
"void",
"addUnspecifiedAttributes",
"(",
"FeatureDescriptor",
"descriptor",
",",
"Tag",
"tag",
",",
"String",
"[",
"]",
"standardAttributesSorted",
",",
"FaceletContext",
"ctx",
")",
"{",
"for",
"(",
"TagAttribute",
"attribute",
":",
"tag",
".",
"getAttributes",
"(",
")",
".",
"getAll",
"(",
")",
")",
"{",
"final",
"String",
"name",
"=",
"attribute",
".",
"getLocalName",
"(",
")",
";",
"if",
"(",
"Arrays",
".",
"binarySearch",
"(",
"standardAttributesSorted",
",",
"name",
")",
"<",
"0",
")",
"{",
"// attribute not found in standard attributes",
"// --> put it on the BeanDescriptor",
"descriptor",
".",
"setValue",
"(",
"name",
",",
"attribute",
".",
"getValueExpression",
"(",
"ctx",
",",
"Object",
".",
"class",
")",
")",
";",
"}",
"}",
"}"
] | Adds all attributes from the given Tag which are NOT listed in
standardAttributesSorted as a ValueExpression to the given BeanDescriptor.
NOTE that standardAttributesSorted has to be alphabetically sorted in
order to use binary search.
@param descriptor
@param tag
@param standardAttributesSorted
@param ctx | [
"Adds",
"all",
"attributes",
"from",
"the",
"given",
"Tag",
"which",
"are",
"NOT",
"listed",
"in",
"standardAttributesSorted",
"as",
"a",
"ValueExpression",
"to",
"the",
"given",
"BeanDescriptor",
".",
"NOTE",
"that",
"standardAttributesSorted",
"has",
"to",
"be",
"alphabetically",
"sorted",
"in",
"order",
"to",
"use",
"binary",
"search",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/composite/CompositeTagAttributeUtils.java#L52-L65 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/composite/CompositeTagAttributeUtils.java | CompositeTagAttributeUtils.containsUnspecifiedAttributes | public static boolean containsUnspecifiedAttributes(Tag tag, String[] standardAttributesSorted)
{
for (TagAttribute attribute : tag.getAttributes().getAll())
{
final String name = attribute.getLocalName();
if (Arrays.binarySearch(standardAttributesSorted, name) < 0)
{
return true;
}
}
return false;
} | java | public static boolean containsUnspecifiedAttributes(Tag tag, String[] standardAttributesSorted)
{
for (TagAttribute attribute : tag.getAttributes().getAll())
{
final String name = attribute.getLocalName();
if (Arrays.binarySearch(standardAttributesSorted, name) < 0)
{
return true;
}
}
return false;
} | [
"public",
"static",
"boolean",
"containsUnspecifiedAttributes",
"(",
"Tag",
"tag",
",",
"String",
"[",
"]",
"standardAttributesSorted",
")",
"{",
"for",
"(",
"TagAttribute",
"attribute",
":",
"tag",
".",
"getAttributes",
"(",
")",
".",
"getAll",
"(",
")",
")",
"{",
"final",
"String",
"name",
"=",
"attribute",
".",
"getLocalName",
"(",
")",
";",
"if",
"(",
"Arrays",
".",
"binarySearch",
"(",
"standardAttributesSorted",
",",
"name",
")",
"<",
"0",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
] | Returns true if the given Tag contains attributes that are not
specified in standardAttributesSorted.
NOTE that standardAttributesSorted has to be alphabetically sorted in
order to use binary search.
@param tag
@param standardAttributesSorted
@return | [
"Returns",
"true",
"if",
"the",
"given",
"Tag",
"contains",
"attributes",
"that",
"are",
"not",
"specified",
"in",
"standardAttributesSorted",
".",
"NOTE",
"that",
"standardAttributesSorted",
"has",
"to",
"be",
"alphabetically",
"sorted",
"in",
"order",
"to",
"use",
"binary",
"search",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/composite/CompositeTagAttributeUtils.java#L76-L87 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/composite/CompositeTagAttributeUtils.java | CompositeTagAttributeUtils.addDevelopmentAttributes | public static void addDevelopmentAttributes(FeatureDescriptor descriptor,
FaceletContext ctx, TagAttribute displayName, TagAttribute shortDescription,
TagAttribute expert, TagAttribute hidden, TagAttribute preferred)
{
if (displayName != null)
{
descriptor.setDisplayName(displayName.getValue(ctx));
}
if (shortDescription != null)
{
descriptor.setShortDescription(shortDescription.getValue(ctx));
}
if (expert != null)
{
descriptor.setExpert(expert.getBoolean(ctx));
}
if (hidden != null)
{
descriptor.setHidden(hidden.getBoolean(ctx));
}
if (preferred != null)
{
descriptor.setPreferred(preferred.getBoolean(ctx));
}
} | java | public static void addDevelopmentAttributes(FeatureDescriptor descriptor,
FaceletContext ctx, TagAttribute displayName, TagAttribute shortDescription,
TagAttribute expert, TagAttribute hidden, TagAttribute preferred)
{
if (displayName != null)
{
descriptor.setDisplayName(displayName.getValue(ctx));
}
if (shortDescription != null)
{
descriptor.setShortDescription(shortDescription.getValue(ctx));
}
if (expert != null)
{
descriptor.setExpert(expert.getBoolean(ctx));
}
if (hidden != null)
{
descriptor.setHidden(hidden.getBoolean(ctx));
}
if (preferred != null)
{
descriptor.setPreferred(preferred.getBoolean(ctx));
}
} | [
"public",
"static",
"void",
"addDevelopmentAttributes",
"(",
"FeatureDescriptor",
"descriptor",
",",
"FaceletContext",
"ctx",
",",
"TagAttribute",
"displayName",
",",
"TagAttribute",
"shortDescription",
",",
"TagAttribute",
"expert",
",",
"TagAttribute",
"hidden",
",",
"TagAttribute",
"preferred",
")",
"{",
"if",
"(",
"displayName",
"!=",
"null",
")",
"{",
"descriptor",
".",
"setDisplayName",
"(",
"displayName",
".",
"getValue",
"(",
"ctx",
")",
")",
";",
"}",
"if",
"(",
"shortDescription",
"!=",
"null",
")",
"{",
"descriptor",
".",
"setShortDescription",
"(",
"shortDescription",
".",
"getValue",
"(",
"ctx",
")",
")",
";",
"}",
"if",
"(",
"expert",
"!=",
"null",
")",
"{",
"descriptor",
".",
"setExpert",
"(",
"expert",
".",
"getBoolean",
"(",
"ctx",
")",
")",
";",
"}",
"if",
"(",
"hidden",
"!=",
"null",
")",
"{",
"descriptor",
".",
"setHidden",
"(",
"hidden",
".",
"getBoolean",
"(",
"ctx",
")",
")",
";",
"}",
"if",
"(",
"preferred",
"!=",
"null",
")",
"{",
"descriptor",
".",
"setPreferred",
"(",
"preferred",
".",
"getBoolean",
"(",
"ctx",
")",
")",
";",
"}",
"}"
] | Applies the "displayName", "shortDescription", "expert", "hidden",
and "preferred" attributes to the BeanDescriptor.
@param descriptor
@param ctx
@param displayName
@param shortDescription
@param expert
@param hidden
@param preferred | [
"Applies",
"the",
"displayName",
"shortDescription",
"expert",
"hidden",
"and",
"preferred",
"attributes",
"to",
"the",
"BeanDescriptor",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/composite/CompositeTagAttributeUtils.java#L100-L124 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/composite/CompositeTagAttributeUtils.java | CompositeTagAttributeUtils.addDevelopmentAttributesLiteral | public static void addDevelopmentAttributesLiteral(FeatureDescriptor descriptor,
TagAttribute displayName, TagAttribute shortDescription,
TagAttribute expert, TagAttribute hidden, TagAttribute preferred)
{
if (displayName != null)
{
descriptor.setDisplayName(displayName.getValue());
}
if (shortDescription != null)
{
descriptor.setShortDescription(shortDescription.getValue());
}
if (expert != null)
{
descriptor.setExpert(Boolean.valueOf(expert.getValue()));
}
if (hidden != null)
{
descriptor.setHidden(Boolean.valueOf(hidden.getValue()));
}
if (preferred != null)
{
descriptor.setPreferred(Boolean.valueOf(preferred.getValue()));
}
} | java | public static void addDevelopmentAttributesLiteral(FeatureDescriptor descriptor,
TagAttribute displayName, TagAttribute shortDescription,
TagAttribute expert, TagAttribute hidden, TagAttribute preferred)
{
if (displayName != null)
{
descriptor.setDisplayName(displayName.getValue());
}
if (shortDescription != null)
{
descriptor.setShortDescription(shortDescription.getValue());
}
if (expert != null)
{
descriptor.setExpert(Boolean.valueOf(expert.getValue()));
}
if (hidden != null)
{
descriptor.setHidden(Boolean.valueOf(hidden.getValue()));
}
if (preferred != null)
{
descriptor.setPreferred(Boolean.valueOf(preferred.getValue()));
}
} | [
"public",
"static",
"void",
"addDevelopmentAttributesLiteral",
"(",
"FeatureDescriptor",
"descriptor",
",",
"TagAttribute",
"displayName",
",",
"TagAttribute",
"shortDescription",
",",
"TagAttribute",
"expert",
",",
"TagAttribute",
"hidden",
",",
"TagAttribute",
"preferred",
")",
"{",
"if",
"(",
"displayName",
"!=",
"null",
")",
"{",
"descriptor",
".",
"setDisplayName",
"(",
"displayName",
".",
"getValue",
"(",
")",
")",
";",
"}",
"if",
"(",
"shortDescription",
"!=",
"null",
")",
"{",
"descriptor",
".",
"setShortDescription",
"(",
"shortDescription",
".",
"getValue",
"(",
")",
")",
";",
"}",
"if",
"(",
"expert",
"!=",
"null",
")",
"{",
"descriptor",
".",
"setExpert",
"(",
"Boolean",
".",
"valueOf",
"(",
"expert",
".",
"getValue",
"(",
")",
")",
")",
";",
"}",
"if",
"(",
"hidden",
"!=",
"null",
")",
"{",
"descriptor",
".",
"setHidden",
"(",
"Boolean",
".",
"valueOf",
"(",
"hidden",
".",
"getValue",
"(",
")",
")",
")",
";",
"}",
"if",
"(",
"preferred",
"!=",
"null",
")",
"{",
"descriptor",
".",
"setPreferred",
"(",
"Boolean",
".",
"valueOf",
"(",
"preferred",
".",
"getValue",
"(",
")",
")",
")",
";",
"}",
"}"
] | Applies the "displayName", "shortDescription", "expert", "hidden",
and "preferred" attributes to the BeanDescriptor if they are all literal values.
Thus no FaceletContext is necessary.
@param descriptor
@param displayName
@param shortDescription
@param expert
@param hidden
@param preferred | [
"Applies",
"the",
"displayName",
"shortDescription",
"expert",
"hidden",
"and",
"preferred",
"attributes",
"to",
"the",
"BeanDescriptor",
"if",
"they",
"are",
"all",
"literal",
"values",
".",
"Thus",
"no",
"FaceletContext",
"is",
"necessary",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/composite/CompositeTagAttributeUtils.java#L137-L161 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/composite/CompositeTagAttributeUtils.java | CompositeTagAttributeUtils.areAttributesLiteral | public static boolean areAttributesLiteral(TagAttribute... attributes)
{
for (TagAttribute attribute : attributes)
{
if (attribute != null && !attribute.isLiteral())
{
// the attribute exists and is not literal
return false;
}
}
// all attributes are literal
return true;
} | java | public static boolean areAttributesLiteral(TagAttribute... attributes)
{
for (TagAttribute attribute : attributes)
{
if (attribute != null && !attribute.isLiteral())
{
// the attribute exists and is not literal
return false;
}
}
// all attributes are literal
return true;
} | [
"public",
"static",
"boolean",
"areAttributesLiteral",
"(",
"TagAttribute",
"...",
"attributes",
")",
"{",
"for",
"(",
"TagAttribute",
"attribute",
":",
"attributes",
")",
"{",
"if",
"(",
"attribute",
"!=",
"null",
"&&",
"!",
"attribute",
".",
"isLiteral",
"(",
")",
")",
"{",
"// the attribute exists and is not literal",
"return",
"false",
";",
"}",
"}",
"// all attributes are literal",
"return",
"true",
";",
"}"
] | Returns true if all specified attributes are either null or literal.
@param attributes | [
"Returns",
"true",
"if",
"all",
"specified",
"attributes",
"are",
"either",
"null",
"or",
"literal",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/composite/CompositeTagAttributeUtils.java#L167-L179 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/resource/BaseResourceHandlerSupport.java | BaseResourceHandlerSupport.calculateFacesServletMapping | protected static FacesServletMapping calculateFacesServletMapping(
String servletPath, String pathInfo)
{
if (pathInfo != null)
{
// If there is a "extra path", it's definitely no extension mapping.
// Now we just have to determine the path which has been specified
// in the url-pattern, but that's easy as it's the same as the
// current servletPath. It doesn't even matter if "/*" has been used
// as in this case the servletPath is just an empty string according
// to the Servlet Specification (SRV 4.4).
return FacesServletMapping.createPrefixMapping(servletPath);
}
else
{
// In the case of extension mapping, no "extra path" is available.
// Still it's possible that prefix-based mapping has been used.
// Actually, if there was an exact match no "extra path"
// is available (e.g. if the url-pattern is "/faces/*"
// and the request-uri is "/context/faces").
int slashPos = servletPath.lastIndexOf('/');
int extensionPos = servletPath.lastIndexOf('.');
if (extensionPos > -1 && extensionPos > slashPos)
{
String extension = servletPath.substring(extensionPos);
return FacesServletMapping.createExtensionMapping(extension);
}
else
{
// There is no extension in the given servletPath and therefore
// we assume that it's an exact match using prefix-based mapping.
return FacesServletMapping.createPrefixMapping(servletPath);
}
}
} | java | protected static FacesServletMapping calculateFacesServletMapping(
String servletPath, String pathInfo)
{
if (pathInfo != null)
{
// If there is a "extra path", it's definitely no extension mapping.
// Now we just have to determine the path which has been specified
// in the url-pattern, but that's easy as it's the same as the
// current servletPath. It doesn't even matter if "/*" has been used
// as in this case the servletPath is just an empty string according
// to the Servlet Specification (SRV 4.4).
return FacesServletMapping.createPrefixMapping(servletPath);
}
else
{
// In the case of extension mapping, no "extra path" is available.
// Still it's possible that prefix-based mapping has been used.
// Actually, if there was an exact match no "extra path"
// is available (e.g. if the url-pattern is "/faces/*"
// and the request-uri is "/context/faces").
int slashPos = servletPath.lastIndexOf('/');
int extensionPos = servletPath.lastIndexOf('.');
if (extensionPos > -1 && extensionPos > slashPos)
{
String extension = servletPath.substring(extensionPos);
return FacesServletMapping.createExtensionMapping(extension);
}
else
{
// There is no extension in the given servletPath and therefore
// we assume that it's an exact match using prefix-based mapping.
return FacesServletMapping.createPrefixMapping(servletPath);
}
}
} | [
"protected",
"static",
"FacesServletMapping",
"calculateFacesServletMapping",
"(",
"String",
"servletPath",
",",
"String",
"pathInfo",
")",
"{",
"if",
"(",
"pathInfo",
"!=",
"null",
")",
"{",
"// If there is a \"extra path\", it's definitely no extension mapping.",
"// Now we just have to determine the path which has been specified",
"// in the url-pattern, but that's easy as it's the same as the",
"// current servletPath. It doesn't even matter if \"/*\" has been used",
"// as in this case the servletPath is just an empty string according",
"// to the Servlet Specification (SRV 4.4).",
"return",
"FacesServletMapping",
".",
"createPrefixMapping",
"(",
"servletPath",
")",
";",
"}",
"else",
"{",
"// In the case of extension mapping, no \"extra path\" is available.",
"// Still it's possible that prefix-based mapping has been used.",
"// Actually, if there was an exact match no \"extra path\"",
"// is available (e.g. if the url-pattern is \"/faces/*\"",
"// and the request-uri is \"/context/faces\").",
"int",
"slashPos",
"=",
"servletPath",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
";",
"int",
"extensionPos",
"=",
"servletPath",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"extensionPos",
">",
"-",
"1",
"&&",
"extensionPos",
">",
"slashPos",
")",
"{",
"String",
"extension",
"=",
"servletPath",
".",
"substring",
"(",
"extensionPos",
")",
";",
"return",
"FacesServletMapping",
".",
"createExtensionMapping",
"(",
"extension",
")",
";",
"}",
"else",
"{",
"// There is no extension in the given servletPath and therefore",
"// we assume that it's an exact match using prefix-based mapping.",
"return",
"FacesServletMapping",
".",
"createPrefixMapping",
"(",
"servletPath",
")",
";",
"}",
"}",
"}"
] | Determines the mapping of the FacesServlet in the web.xml configuration
file. However, there is no need to actually parse this configuration file
as runtime information is sufficient.
@param servletPath The servletPath of the current request
@param pathInfo The pathInfo of the current request
@return the mapping of the FacesServlet in the web.xml configuration file | [
"Determines",
"the",
"mapping",
"of",
"the",
"FacesServlet",
"in",
"the",
"web",
".",
"xml",
"configuration",
"file",
".",
"However",
"there",
"is",
"no",
"need",
"to",
"actually",
"parse",
"this",
"configuration",
"file",
"as",
"runtime",
"information",
"is",
"sufficient",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/resource/BaseResourceHandlerSupport.java#L190-L224 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.cdi.weld/src/com/ibm/ws/cdi/impl/weld/WebSphereCDIDeploymentImpl.java | WebSphereCDIDeploymentImpl.isCDIEnabled | private boolean isCDIEnabled(Collection<WebSphereBeanDeploymentArchive> bdas) {
boolean anyHasBeans = false;
for (WebSphereBeanDeploymentArchive bda : bdas) {
boolean hasBeans = false;
if (bda.getType() != ArchiveType.RUNTIME_EXTENSION) {
hasBeans = isCDIEnabled(bda);
}
anyHasBeans = anyHasBeans || hasBeans;
if (anyHasBeans) {
break;
}
}
return anyHasBeans;
} | java | private boolean isCDIEnabled(Collection<WebSphereBeanDeploymentArchive> bdas) {
boolean anyHasBeans = false;
for (WebSphereBeanDeploymentArchive bda : bdas) {
boolean hasBeans = false;
if (bda.getType() != ArchiveType.RUNTIME_EXTENSION) {
hasBeans = isCDIEnabled(bda);
}
anyHasBeans = anyHasBeans || hasBeans;
if (anyHasBeans) {
break;
}
}
return anyHasBeans;
} | [
"private",
"boolean",
"isCDIEnabled",
"(",
"Collection",
"<",
"WebSphereBeanDeploymentArchive",
">",
"bdas",
")",
"{",
"boolean",
"anyHasBeans",
"=",
"false",
";",
"for",
"(",
"WebSphereBeanDeploymentArchive",
"bda",
":",
"bdas",
")",
"{",
"boolean",
"hasBeans",
"=",
"false",
";",
"if",
"(",
"bda",
".",
"getType",
"(",
")",
"!=",
"ArchiveType",
".",
"RUNTIME_EXTENSION",
")",
"{",
"hasBeans",
"=",
"isCDIEnabled",
"(",
"bda",
")",
";",
"}",
"anyHasBeans",
"=",
"anyHasBeans",
"||",
"hasBeans",
";",
"if",
"(",
"anyHasBeans",
")",
"{",
"break",
";",
"}",
"}",
"return",
"anyHasBeans",
";",
"}"
] | Do any of the specified BDAs, or any of BDAs accessible by them, have any beans
BDAs for Runtime Extensions are ignored
@param bdas
@return
@throws CDIException | [
"Do",
"any",
"of",
"the",
"specified",
"BDAs",
"or",
"any",
"of",
"BDAs",
"accessible",
"by",
"them",
"have",
"any",
"beans"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.cdi.weld/src/com/ibm/ws/cdi/impl/weld/WebSphereCDIDeploymentImpl.java#L202-L217 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.cdi.weld/src/com/ibm/ws/cdi/impl/weld/WebSphereCDIDeploymentImpl.java | WebSphereCDIDeploymentImpl.isCDIEnabled | private boolean isCDIEnabled(WebSphereBeanDeploymentArchive bda) {
Boolean hasBeans = cdiStatusMap.get(bda.getId());
if (hasBeans == null) {
//it's enabled if it has beans or it is an extension which could add beans
hasBeans = bda.hasBeans() || bda.isExtension();
//setting this now should prevent loops when checking children in the next step
cdiStatusMap.put(bda.getId(), hasBeans);
//it's also enabled if any of it's children are enabled (but not including runtime extensions)
hasBeans = hasBeans || isCDIEnabled(bda.getWebSphereBeanDeploymentArchives());
//remember the result
cdiStatusMap.put(bda.getId(), hasBeans);
}
return hasBeans;
} | java | private boolean isCDIEnabled(WebSphereBeanDeploymentArchive bda) {
Boolean hasBeans = cdiStatusMap.get(bda.getId());
if (hasBeans == null) {
//it's enabled if it has beans or it is an extension which could add beans
hasBeans = bda.hasBeans() || bda.isExtension();
//setting this now should prevent loops when checking children in the next step
cdiStatusMap.put(bda.getId(), hasBeans);
//it's also enabled if any of it's children are enabled (but not including runtime extensions)
hasBeans = hasBeans || isCDIEnabled(bda.getWebSphereBeanDeploymentArchives());
//remember the result
cdiStatusMap.put(bda.getId(), hasBeans);
}
return hasBeans;
} | [
"private",
"boolean",
"isCDIEnabled",
"(",
"WebSphereBeanDeploymentArchive",
"bda",
")",
"{",
"Boolean",
"hasBeans",
"=",
"cdiStatusMap",
".",
"get",
"(",
"bda",
".",
"getId",
"(",
")",
")",
";",
"if",
"(",
"hasBeans",
"==",
"null",
")",
"{",
"//it's enabled if it has beans or it is an extension which could add beans",
"hasBeans",
"=",
"bda",
".",
"hasBeans",
"(",
")",
"||",
"bda",
".",
"isExtension",
"(",
")",
";",
"//setting this now should prevent loops when checking children in the next step",
"cdiStatusMap",
".",
"put",
"(",
"bda",
".",
"getId",
"(",
")",
",",
"hasBeans",
")",
";",
"//it's also enabled if any of it's children are enabled (but not including runtime extensions)",
"hasBeans",
"=",
"hasBeans",
"||",
"isCDIEnabled",
"(",
"bda",
".",
"getWebSphereBeanDeploymentArchives",
"(",
")",
")",
";",
"//remember the result",
"cdiStatusMap",
".",
"put",
"(",
"bda",
".",
"getId",
"(",
")",
",",
"hasBeans",
")",
";",
"}",
"return",
"hasBeans",
";",
"}"
] | Does the specified BDA, or any of BDAs accessible by it, have any beans or it is an extension which could add beans
@param bda the BDA
@return true if the specified BDA, or any of BDAs accessible by it, have any beans | [
"Does",
"the",
"specified",
"BDA",
"or",
"any",
"of",
"BDAs",
"accessible",
"by",
"it",
"have",
"any",
"beans",
"or",
"it",
"is",
"an",
"extension",
"which",
"could",
"add",
"beans"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.cdi.weld/src/com/ibm/ws/cdi/impl/weld/WebSphereCDIDeploymentImpl.java#L225-L240 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.cdi.weld/src/com/ibm/ws/cdi/impl/weld/WebSphereCDIDeploymentImpl.java | WebSphereCDIDeploymentImpl.isCDIEnabled | @Override
public boolean isCDIEnabled(String bdaId) {
boolean hasBeans = false;
//the top level isCDIEnabled can fail faster
if (isCDIEnabled()) {
Boolean hasBeansBoolean = cdiStatusMap.get(bdaId);
if (hasBeansBoolean == null) {
WebSphereBeanDeploymentArchive bda = deploymentDBAs.get(bdaId);
if (bda == null) {
// turns out that JAXWS create modules dynamically at runtime. That should be the only way
// that there is no bda for a valid module/bda id. At the moment, CDI is not supported in
// a module unless it exists at startup.
hasBeans = false;
} else {
hasBeans = isCDIEnabled(bda);
}
} else {
hasBeans = hasBeansBoolean;
}
}
return hasBeans;
} | java | @Override
public boolean isCDIEnabled(String bdaId) {
boolean hasBeans = false;
//the top level isCDIEnabled can fail faster
if (isCDIEnabled()) {
Boolean hasBeansBoolean = cdiStatusMap.get(bdaId);
if (hasBeansBoolean == null) {
WebSphereBeanDeploymentArchive bda = deploymentDBAs.get(bdaId);
if (bda == null) {
// turns out that JAXWS create modules dynamically at runtime. That should be the only way
// that there is no bda for a valid module/bda id. At the moment, CDI is not supported in
// a module unless it exists at startup.
hasBeans = false;
} else {
hasBeans = isCDIEnabled(bda);
}
} else {
hasBeans = hasBeansBoolean;
}
}
return hasBeans;
} | [
"@",
"Override",
"public",
"boolean",
"isCDIEnabled",
"(",
"String",
"bdaId",
")",
"{",
"boolean",
"hasBeans",
"=",
"false",
";",
"//the top level isCDIEnabled can fail faster",
"if",
"(",
"isCDIEnabled",
"(",
")",
")",
"{",
"Boolean",
"hasBeansBoolean",
"=",
"cdiStatusMap",
".",
"get",
"(",
"bdaId",
")",
";",
"if",
"(",
"hasBeansBoolean",
"==",
"null",
")",
"{",
"WebSphereBeanDeploymentArchive",
"bda",
"=",
"deploymentDBAs",
".",
"get",
"(",
"bdaId",
")",
";",
"if",
"(",
"bda",
"==",
"null",
")",
"{",
"// turns out that JAXWS create modules dynamically at runtime. That should be the only way",
"// that there is no bda for a valid module/bda id. At the moment, CDI is not supported in",
"// a module unless it exists at startup.",
"hasBeans",
"=",
"false",
";",
"}",
"else",
"{",
"hasBeans",
"=",
"isCDIEnabled",
"(",
"bda",
")",
";",
"}",
"}",
"else",
"{",
"hasBeans",
"=",
"hasBeansBoolean",
";",
"}",
"}",
"return",
"hasBeans",
";",
"}"
] | Does the specified BDA, or any of BDAs accessible by it, have any beans or an extension which might add beans.
@param bdaId the id of the BDA
@return true if the specified BDA, or any of BDAs accessible by it, have any beans | [
"Does",
"the",
"specified",
"BDA",
"or",
"any",
"of",
"BDAs",
"accessible",
"by",
"it",
"have",
"any",
"beans",
"or",
"an",
"extension",
"which",
"might",
"add",
"beans",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.cdi.weld/src/com/ibm/ws/cdi/impl/weld/WebSphereCDIDeploymentImpl.java#L248-L272 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.cdi.weld/src/com/ibm/ws/cdi/impl/weld/WebSphereCDIDeploymentImpl.java | WebSphereCDIDeploymentImpl.createBDAOntheFly | private BeanDeploymentArchive createBDAOntheFly(Class<?> beanClass) throws CDIException {
//Add the class in one of the bdas if an existing bda share the same classloader as the beanClass
//Otherwise, we need to create a brand new bda and then add the bda to the graph
//when it reaches here, it means no bda found for this class. We need to create a bda
//Let's see whether there is a bda with the same classloader as the beanClass, if there is, let's add this class
BeanDeploymentArchive bdaToReturn = findCandidateBDAtoAddThisClass(beanClass);
if (bdaToReturn != null) {
return bdaToReturn;
} else {
//If it comes here, it means no bda exists with the same classloader as the bean class, so we need to create a bda for it.
return createNewBdaAndMakeWiring(beanClass);
}
} | java | private BeanDeploymentArchive createBDAOntheFly(Class<?> beanClass) throws CDIException {
//Add the class in one of the bdas if an existing bda share the same classloader as the beanClass
//Otherwise, we need to create a brand new bda and then add the bda to the graph
//when it reaches here, it means no bda found for this class. We need to create a bda
//Let's see whether there is a bda with the same classloader as the beanClass, if there is, let's add this class
BeanDeploymentArchive bdaToReturn = findCandidateBDAtoAddThisClass(beanClass);
if (bdaToReturn != null) {
return bdaToReturn;
} else {
//If it comes here, it means no bda exists with the same classloader as the bean class, so we need to create a bda for it.
return createNewBdaAndMakeWiring(beanClass);
}
} | [
"private",
"BeanDeploymentArchive",
"createBDAOntheFly",
"(",
"Class",
"<",
"?",
">",
"beanClass",
")",
"throws",
"CDIException",
"{",
"//Add the class in one of the bdas if an existing bda share the same classloader as the beanClass",
"//Otherwise, we need to create a brand new bda and then add the bda to the graph",
"//when it reaches here, it means no bda found for this class. We need to create a bda",
"//Let's see whether there is a bda with the same classloader as the beanClass, if there is, let's add this class",
"BeanDeploymentArchive",
"bdaToReturn",
"=",
"findCandidateBDAtoAddThisClass",
"(",
"beanClass",
")",
";",
"if",
"(",
"bdaToReturn",
"!=",
"null",
")",
"{",
"return",
"bdaToReturn",
";",
"}",
"else",
"{",
"//If it comes here, it means no bda exists with the same classloader as the bean class, so we need to create a bda for it.",
"return",
"createNewBdaAndMakeWiring",
"(",
"beanClass",
")",
";",
"}",
"}"
] | Create a bda and wire it in the deployment graph
@param beanClass the bean class
@return the newly created bda
@throws CDIException | [
"Create",
"a",
"bda",
"and",
"wire",
"it",
"in",
"the",
"deployment",
"graph"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.cdi.weld/src/com/ibm/ws/cdi/impl/weld/WebSphereCDIDeploymentImpl.java#L327-L342 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.cdi.weld/src/com/ibm/ws/cdi/impl/weld/WebSphereCDIDeploymentImpl.java | WebSphereCDIDeploymentImpl.createNewBdaAndMakeWiring | private BeanDeploymentArchive createNewBdaAndMakeWiring(Class<?> beanClass) {
try {
OnDemandArchive onDemandArchive = new OnDemandArchive(cdiRuntime, application, beanClass);
WebSphereBeanDeploymentArchive newBda = BDAFactory.createBDA(this, onDemandArchive, cdiRuntime);
ClassLoader beanClassCL = onDemandArchive.getClassLoader();
// need to make this bda to be accessible to other bdas according to classloader hierarchy
for (WebSphereBeanDeploymentArchive wbda : getWebSphereBeanDeploymentArchives()) {
ClassLoader thisBDACL = wbda.getClassLoader();
//If the current archive is an extension bda, let's add this newly created bda accessible to it
if (wbda.getType() == ArchiveType.RUNTIME_EXTENSION) {
newBda.addBeanDeploymentArchive(wbda);
} else {
//let's check to see whether the wbda needs to be accessible to this new bda
//The current bda should be accessible to the newly created bda if the newly created bda's classloader
// is the same or the child classloader of the current bda
makeWiring(newBda, wbda, thisBDACL, beanClassCL);
}
if ((wbda.getType() == ArchiveType.RUNTIME_EXTENSION) && wbda.extensionCanSeeApplicationBDAs()) {
wbda.addBeanDeploymentArchive(newBda);
} else {
//Let's check whether the wbda's classloader is the descendant classloader of the new bda
makeWiring(wbda, newBda, beanClassCL, thisBDACL);
}
}
//Add this new bda to the deployment graph
addBeanDeploymentArchive(newBda);
return newBda;
} catch (CDIException e) {
throw new IllegalStateException(e);
}
} | java | private BeanDeploymentArchive createNewBdaAndMakeWiring(Class<?> beanClass) {
try {
OnDemandArchive onDemandArchive = new OnDemandArchive(cdiRuntime, application, beanClass);
WebSphereBeanDeploymentArchive newBda = BDAFactory.createBDA(this, onDemandArchive, cdiRuntime);
ClassLoader beanClassCL = onDemandArchive.getClassLoader();
// need to make this bda to be accessible to other bdas according to classloader hierarchy
for (WebSphereBeanDeploymentArchive wbda : getWebSphereBeanDeploymentArchives()) {
ClassLoader thisBDACL = wbda.getClassLoader();
//If the current archive is an extension bda, let's add this newly created bda accessible to it
if (wbda.getType() == ArchiveType.RUNTIME_EXTENSION) {
newBda.addBeanDeploymentArchive(wbda);
} else {
//let's check to see whether the wbda needs to be accessible to this new bda
//The current bda should be accessible to the newly created bda if the newly created bda's classloader
// is the same or the child classloader of the current bda
makeWiring(newBda, wbda, thisBDACL, beanClassCL);
}
if ((wbda.getType() == ArchiveType.RUNTIME_EXTENSION) && wbda.extensionCanSeeApplicationBDAs()) {
wbda.addBeanDeploymentArchive(newBda);
} else {
//Let's check whether the wbda's classloader is the descendant classloader of the new bda
makeWiring(wbda, newBda, beanClassCL, thisBDACL);
}
}
//Add this new bda to the deployment graph
addBeanDeploymentArchive(newBda);
return newBda;
} catch (CDIException e) {
throw new IllegalStateException(e);
}
} | [
"private",
"BeanDeploymentArchive",
"createNewBdaAndMakeWiring",
"(",
"Class",
"<",
"?",
">",
"beanClass",
")",
"{",
"try",
"{",
"OnDemandArchive",
"onDemandArchive",
"=",
"new",
"OnDemandArchive",
"(",
"cdiRuntime",
",",
"application",
",",
"beanClass",
")",
";",
"WebSphereBeanDeploymentArchive",
"newBda",
"=",
"BDAFactory",
".",
"createBDA",
"(",
"this",
",",
"onDemandArchive",
",",
"cdiRuntime",
")",
";",
"ClassLoader",
"beanClassCL",
"=",
"onDemandArchive",
".",
"getClassLoader",
"(",
")",
";",
"// need to make this bda to be accessible to other bdas according to classloader hierarchy",
"for",
"(",
"WebSphereBeanDeploymentArchive",
"wbda",
":",
"getWebSphereBeanDeploymentArchives",
"(",
")",
")",
"{",
"ClassLoader",
"thisBDACL",
"=",
"wbda",
".",
"getClassLoader",
"(",
")",
";",
"//If the current archive is an extension bda, let's add this newly created bda accessible to it",
"if",
"(",
"wbda",
".",
"getType",
"(",
")",
"==",
"ArchiveType",
".",
"RUNTIME_EXTENSION",
")",
"{",
"newBda",
".",
"addBeanDeploymentArchive",
"(",
"wbda",
")",
";",
"}",
"else",
"{",
"//let's check to see whether the wbda needs to be accessible to this new bda",
"//The current bda should be accessible to the newly created bda if the newly created bda's classloader",
"// is the same or the child classloader of the current bda",
"makeWiring",
"(",
"newBda",
",",
"wbda",
",",
"thisBDACL",
",",
"beanClassCL",
")",
";",
"}",
"if",
"(",
"(",
"wbda",
".",
"getType",
"(",
")",
"==",
"ArchiveType",
".",
"RUNTIME_EXTENSION",
")",
"&&",
"wbda",
".",
"extensionCanSeeApplicationBDAs",
"(",
")",
")",
"{",
"wbda",
".",
"addBeanDeploymentArchive",
"(",
"newBda",
")",
";",
"}",
"else",
"{",
"//Let's check whether the wbda's classloader is the descendant classloader of the new bda",
"makeWiring",
"(",
"wbda",
",",
"newBda",
",",
"beanClassCL",
",",
"thisBDACL",
")",
";",
"}",
"}",
"//Add this new bda to the deployment graph",
"addBeanDeploymentArchive",
"(",
"newBda",
")",
";",
"return",
"newBda",
";",
"}",
"catch",
"(",
"CDIException",
"e",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"e",
")",
";",
"}",
"}"
] | Create a new bda and put the beanClass to the bda and then wire this bda in the deployment according to the classloading hierarchy
@param beanClass
@param beanClassCL the beanClass classloader
@return the newly created bda | [
"Create",
"a",
"new",
"bda",
"and",
"put",
"the",
"beanClass",
"to",
"the",
"bda",
"and",
"then",
"wire",
"this",
"bda",
"in",
"the",
"deployment",
"according",
"to",
"the",
"classloading",
"hierarchy"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.cdi.weld/src/com/ibm/ws/cdi/impl/weld/WebSphereCDIDeploymentImpl.java#L351-L389 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.cdi.weld/src/com/ibm/ws/cdi/impl/weld/WebSphereCDIDeploymentImpl.java | WebSphereCDIDeploymentImpl.findCandidateBDAtoAddThisClass | private BeanDeploymentArchive findCandidateBDAtoAddThisClass(Class<?> beanClass) throws CDIException {
for (WebSphereBeanDeploymentArchive wbda : getWebSphereBeanDeploymentArchives()) {
if (wbda.getClassLoader() == beanClass.getClassLoader()) {
wbda.addToBeanClazzes(beanClass);
return wbda;
}
//if the cl is null, which means the classloader is the root classloader
//for this kind of bda, its id ends with CDIUtils.BDA_FOR_CLASSES_LOADED_BY_ROOT_CLASSLOADER
//all classes loaded by the root classloader should be in a bda with the id ends with CDIUtils.BDA_FOR_CLASSES_LOADED_BY_ROOT_CLASSLOADER
if ((beanClass.getClassLoader() == null) && (wbda.getId().endsWith(CDIUtils.BDA_FOR_CLASSES_LOADED_BY_ROOT_CLASSLOADER))) {
wbda.addToBeanClazzes(beanClass);
return wbda;
}
}
return null;
} | java | private BeanDeploymentArchive findCandidateBDAtoAddThisClass(Class<?> beanClass) throws CDIException {
for (WebSphereBeanDeploymentArchive wbda : getWebSphereBeanDeploymentArchives()) {
if (wbda.getClassLoader() == beanClass.getClassLoader()) {
wbda.addToBeanClazzes(beanClass);
return wbda;
}
//if the cl is null, which means the classloader is the root classloader
//for this kind of bda, its id ends with CDIUtils.BDA_FOR_CLASSES_LOADED_BY_ROOT_CLASSLOADER
//all classes loaded by the root classloader should be in a bda with the id ends with CDIUtils.BDA_FOR_CLASSES_LOADED_BY_ROOT_CLASSLOADER
if ((beanClass.getClassLoader() == null) && (wbda.getId().endsWith(CDIUtils.BDA_FOR_CLASSES_LOADED_BY_ROOT_CLASSLOADER))) {
wbda.addToBeanClazzes(beanClass);
return wbda;
}
}
return null;
} | [
"private",
"BeanDeploymentArchive",
"findCandidateBDAtoAddThisClass",
"(",
"Class",
"<",
"?",
">",
"beanClass",
")",
"throws",
"CDIException",
"{",
"for",
"(",
"WebSphereBeanDeploymentArchive",
"wbda",
":",
"getWebSphereBeanDeploymentArchives",
"(",
")",
")",
"{",
"if",
"(",
"wbda",
".",
"getClassLoader",
"(",
")",
"==",
"beanClass",
".",
"getClassLoader",
"(",
")",
")",
"{",
"wbda",
".",
"addToBeanClazzes",
"(",
"beanClass",
")",
";",
"return",
"wbda",
";",
"}",
"//if the cl is null, which means the classloader is the root classloader",
"//for this kind of bda, its id ends with CDIUtils.BDA_FOR_CLASSES_LOADED_BY_ROOT_CLASSLOADER",
"//all classes loaded by the root classloader should be in a bda with the id ends with CDIUtils.BDA_FOR_CLASSES_LOADED_BY_ROOT_CLASSLOADER",
"if",
"(",
"(",
"beanClass",
".",
"getClassLoader",
"(",
")",
"==",
"null",
")",
"&&",
"(",
"wbda",
".",
"getId",
"(",
")",
".",
"endsWith",
"(",
"CDIUtils",
".",
"BDA_FOR_CLASSES_LOADED_BY_ROOT_CLASSLOADER",
")",
")",
")",
"{",
"wbda",
".",
"addToBeanClazzes",
"(",
"beanClass",
")",
";",
"return",
"wbda",
";",
"}",
"}",
"return",
"null",
";",
"}"
] | Find the bda with the same classloader as the beanClass and then add the beanclasses to it
@param beanClass
@param beanClassCL the beanClass classloader
@return the found bda
@throws CDIException | [
"Find",
"the",
"bda",
"with",
"the",
"same",
"classloader",
"as",
"the",
"beanClass",
"and",
"then",
"add",
"the",
"beanclasses",
"to",
"it"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.cdi.weld/src/com/ibm/ws/cdi/impl/weld/WebSphereCDIDeploymentImpl.java#L399-L418 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.cdi.weld/src/com/ibm/ws/cdi/impl/weld/WebSphereCDIDeploymentImpl.java | WebSphereCDIDeploymentImpl.makeWiring | private void makeWiring(WebSphereBeanDeploymentArchive wireFromBda, WebSphereBeanDeploymentArchive wireToBda, ClassLoader wireToBdaCL, ClassLoader wireFromBdaCL) {
while (wireFromBdaCL != null) {
if (wireFromBdaCL == wireToBdaCL) {
wireFromBda.addBeanDeploymentArchive(wireToBda);
break;
} else {
wireFromBdaCL = wireFromBdaCL.getParent();
}
}
//if we are here, it means the wireToBdaCL is root classloader, loading java.xx classes. All other bdas should be accessible to this new bda.
if (wireFromBdaCL == wireToBdaCL) {
wireFromBda.addBeanDeploymentArchive(wireToBda);
}
} | java | private void makeWiring(WebSphereBeanDeploymentArchive wireFromBda, WebSphereBeanDeploymentArchive wireToBda, ClassLoader wireToBdaCL, ClassLoader wireFromBdaCL) {
while (wireFromBdaCL != null) {
if (wireFromBdaCL == wireToBdaCL) {
wireFromBda.addBeanDeploymentArchive(wireToBda);
break;
} else {
wireFromBdaCL = wireFromBdaCL.getParent();
}
}
//if we are here, it means the wireToBdaCL is root classloader, loading java.xx classes. All other bdas should be accessible to this new bda.
if (wireFromBdaCL == wireToBdaCL) {
wireFromBda.addBeanDeploymentArchive(wireToBda);
}
} | [
"private",
"void",
"makeWiring",
"(",
"WebSphereBeanDeploymentArchive",
"wireFromBda",
",",
"WebSphereBeanDeploymentArchive",
"wireToBda",
",",
"ClassLoader",
"wireToBdaCL",
",",
"ClassLoader",
"wireFromBdaCL",
")",
"{",
"while",
"(",
"wireFromBdaCL",
"!=",
"null",
")",
"{",
"if",
"(",
"wireFromBdaCL",
"==",
"wireToBdaCL",
")",
"{",
"wireFromBda",
".",
"addBeanDeploymentArchive",
"(",
"wireToBda",
")",
";",
"break",
";",
"}",
"else",
"{",
"wireFromBdaCL",
"=",
"wireFromBdaCL",
".",
"getParent",
"(",
")",
";",
"}",
"}",
"//if we are here, it means the wireToBdaCL is root classloader, loading java.xx classes. All other bdas should be accessible to this new bda.",
"if",
"(",
"wireFromBdaCL",
"==",
"wireToBdaCL",
")",
"{",
"wireFromBda",
".",
"addBeanDeploymentArchive",
"(",
"wireToBda",
")",
";",
"}",
"}"
] | Make a wiring from the wireFromBda to the wireToBda if the wireFromBda's classloader is the descendant of the wireToBda's classloader
@param wireFromBda
@param wireToBda
@param wireToBdaCL
@param wireFromBdaCL | [
"Make",
"a",
"wiring",
"from",
"the",
"wireFromBda",
"to",
"the",
"wireToBda",
"if",
"the",
"wireFromBda",
"s",
"classloader",
"is",
"the",
"descendant",
"of",
"the",
"wireToBda",
"s",
"classloader"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.cdi.weld/src/com/ibm/ws/cdi/impl/weld/WebSphereCDIDeploymentImpl.java#L428-L441 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.cdi.weld/src/com/ibm/ws/cdi/impl/weld/WebSphereCDIDeploymentImpl.java | WebSphereCDIDeploymentImpl.addBeanDeploymentArchive | @Override
public void addBeanDeploymentArchive(WebSphereBeanDeploymentArchive bda) throws CDIException {
deploymentDBAs.put(bda.getId(), bda);
extensionClassLoaders.add(bda.getClassLoader());
ArchiveType type = bda.getType();
if (type != ArchiveType.SHARED_LIB &&
type != ArchiveType.RUNTIME_EXTENSION) {
applicationBDAs.add(bda);
}
} | java | @Override
public void addBeanDeploymentArchive(WebSphereBeanDeploymentArchive bda) throws CDIException {
deploymentDBAs.put(bda.getId(), bda);
extensionClassLoaders.add(bda.getClassLoader());
ArchiveType type = bda.getType();
if (type != ArchiveType.SHARED_LIB &&
type != ArchiveType.RUNTIME_EXTENSION) {
applicationBDAs.add(bda);
}
} | [
"@",
"Override",
"public",
"void",
"addBeanDeploymentArchive",
"(",
"WebSphereBeanDeploymentArchive",
"bda",
")",
"throws",
"CDIException",
"{",
"deploymentDBAs",
".",
"put",
"(",
"bda",
".",
"getId",
"(",
")",
",",
"bda",
")",
";",
"extensionClassLoaders",
".",
"add",
"(",
"bda",
".",
"getClassLoader",
"(",
")",
")",
";",
"ArchiveType",
"type",
"=",
"bda",
".",
"getType",
"(",
")",
";",
"if",
"(",
"type",
"!=",
"ArchiveType",
".",
"SHARED_LIB",
"&&",
"type",
"!=",
"ArchiveType",
".",
"RUNTIME_EXTENSION",
")",
"{",
"applicationBDAs",
".",
"add",
"(",
"bda",
")",
";",
"}",
"}"
] | Add a BeanDeploymentArchive to this deployment
@param bda the BDA to add
@throws CDIException | [
"Add",
"a",
"BeanDeploymentArchive",
"to",
"this",
"deployment"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.cdi.weld/src/com/ibm/ws/cdi/impl/weld/WebSphereCDIDeploymentImpl.java#L561-L570 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.cdi.weld/src/com/ibm/ws/cdi/impl/weld/WebSphereCDIDeploymentImpl.java | WebSphereCDIDeploymentImpl.addBeanDeploymentArchives | @Override
public void addBeanDeploymentArchives(Set<WebSphereBeanDeploymentArchive> bdas) throws CDIException {
for (WebSphereBeanDeploymentArchive bda : bdas) {
addBeanDeploymentArchive(bda);
}
} | java | @Override
public void addBeanDeploymentArchives(Set<WebSphereBeanDeploymentArchive> bdas) throws CDIException {
for (WebSphereBeanDeploymentArchive bda : bdas) {
addBeanDeploymentArchive(bda);
}
} | [
"@",
"Override",
"public",
"void",
"addBeanDeploymentArchives",
"(",
"Set",
"<",
"WebSphereBeanDeploymentArchive",
">",
"bdas",
")",
"throws",
"CDIException",
"{",
"for",
"(",
"WebSphereBeanDeploymentArchive",
"bda",
":",
"bdas",
")",
"{",
"addBeanDeploymentArchive",
"(",
"bda",
")",
";",
"}",
"}"
] | Add a Set of BDAs to the deployment
@param bdas the BDAs to add
@throws CDIException | [
"Add",
"a",
"Set",
"of",
"BDAs",
"to",
"the",
"deployment"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.cdi.weld/src/com/ibm/ws/cdi/impl/weld/WebSphereCDIDeploymentImpl.java#L578-L583 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.cdi.weld/src/com/ibm/ws/cdi/impl/weld/WebSphereCDIDeploymentImpl.java | WebSphereCDIDeploymentImpl.scan | @Override
public void scan() throws CDIException {
Collection<WebSphereBeanDeploymentArchive> allBDAs = new ArrayList<WebSphereBeanDeploymentArchive>(deploymentDBAs.values());
for (WebSphereBeanDeploymentArchive bda : allBDAs) {
bda.scanForBeanDefiningAnnotations(true);
}
for (WebSphereBeanDeploymentArchive bda : allBDAs) {
if (!bda.hasBeenScanned()) {
bda.scan();
}
}
} | java | @Override
public void scan() throws CDIException {
Collection<WebSphereBeanDeploymentArchive> allBDAs = new ArrayList<WebSphereBeanDeploymentArchive>(deploymentDBAs.values());
for (WebSphereBeanDeploymentArchive bda : allBDAs) {
bda.scanForBeanDefiningAnnotations(true);
}
for (WebSphereBeanDeploymentArchive bda : allBDAs) {
if (!bda.hasBeenScanned()) {
bda.scan();
}
}
} | [
"@",
"Override",
"public",
"void",
"scan",
"(",
")",
"throws",
"CDIException",
"{",
"Collection",
"<",
"WebSphereBeanDeploymentArchive",
">",
"allBDAs",
"=",
"new",
"ArrayList",
"<",
"WebSphereBeanDeploymentArchive",
">",
"(",
"deploymentDBAs",
".",
"values",
"(",
")",
")",
";",
"for",
"(",
"WebSphereBeanDeploymentArchive",
"bda",
":",
"allBDAs",
")",
"{",
"bda",
".",
"scanForBeanDefiningAnnotations",
"(",
"true",
")",
";",
"}",
"for",
"(",
"WebSphereBeanDeploymentArchive",
"bda",
":",
"allBDAs",
")",
"{",
"if",
"(",
"!",
"bda",
".",
"hasBeenScanned",
"(",
")",
")",
"{",
"bda",
".",
"scan",
"(",
")",
";",
"}",
"}",
"}"
] | Scan all the BDAs in the deployment to see if there are any bean classes.
This method must be called before scanForEjbEndpoints() and before we try to do
any real work with the deployment or the BDAs
@throws CDIException | [
"Scan",
"all",
"the",
"BDAs",
"in",
"the",
"deployment",
"to",
"see",
"if",
"there",
"are",
"any",
"bean",
"classes",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.cdi.weld/src/com/ibm/ws/cdi/impl/weld/WebSphereCDIDeploymentImpl.java#L593-L604 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.cdi.weld/src/com/ibm/ws/cdi/impl/weld/WebSphereCDIDeploymentImpl.java | WebSphereCDIDeploymentImpl.initializeInjectionServices | @Override
public void initializeInjectionServices() throws CDIException {
Set<ReferenceContext> cdiReferenceContexts = new HashSet<ReferenceContext>();
//first we need to initialize the injection service and collect the reference contexts and the injection classes
for (WebSphereBeanDeploymentArchive bda : getApplicationBDAs()) {
// Don't initialize child libraries, instead aggregate for the whole module
if (bda.getType() != ArchiveType.MANIFEST_CLASSPATH && bda.getType() != ArchiveType.WEB_INF_LIB) {
ReferenceContext referenceContext = bda.initializeInjectionServices();
cdiReferenceContexts.add(referenceContext);
}
}
// now we need to process the injections
for (ReferenceContext referenceContext : cdiReferenceContexts) {
try {
referenceContext.process();
} catch (InjectionException e) {
throw new CDIException(e);
}
}
} | java | @Override
public void initializeInjectionServices() throws CDIException {
Set<ReferenceContext> cdiReferenceContexts = new HashSet<ReferenceContext>();
//first we need to initialize the injection service and collect the reference contexts and the injection classes
for (WebSphereBeanDeploymentArchive bda : getApplicationBDAs()) {
// Don't initialize child libraries, instead aggregate for the whole module
if (bda.getType() != ArchiveType.MANIFEST_CLASSPATH && bda.getType() != ArchiveType.WEB_INF_LIB) {
ReferenceContext referenceContext = bda.initializeInjectionServices();
cdiReferenceContexts.add(referenceContext);
}
}
// now we need to process the injections
for (ReferenceContext referenceContext : cdiReferenceContexts) {
try {
referenceContext.process();
} catch (InjectionException e) {
throw new CDIException(e);
}
}
} | [
"@",
"Override",
"public",
"void",
"initializeInjectionServices",
"(",
")",
"throws",
"CDIException",
"{",
"Set",
"<",
"ReferenceContext",
">",
"cdiReferenceContexts",
"=",
"new",
"HashSet",
"<",
"ReferenceContext",
">",
"(",
")",
";",
"//first we need to initialize the injection service and collect the reference contexts and the injection classes",
"for",
"(",
"WebSphereBeanDeploymentArchive",
"bda",
":",
"getApplicationBDAs",
"(",
")",
")",
"{",
"// Don't initialize child libraries, instead aggregate for the whole module",
"if",
"(",
"bda",
".",
"getType",
"(",
")",
"!=",
"ArchiveType",
".",
"MANIFEST_CLASSPATH",
"&&",
"bda",
".",
"getType",
"(",
")",
"!=",
"ArchiveType",
".",
"WEB_INF_LIB",
")",
"{",
"ReferenceContext",
"referenceContext",
"=",
"bda",
".",
"initializeInjectionServices",
"(",
")",
";",
"cdiReferenceContexts",
".",
"add",
"(",
"referenceContext",
")",
";",
"}",
"}",
"// now we need to process the injections",
"for",
"(",
"ReferenceContext",
"referenceContext",
":",
"cdiReferenceContexts",
")",
"{",
"try",
"{",
"referenceContext",
".",
"process",
"(",
")",
";",
"}",
"catch",
"(",
"InjectionException",
"e",
")",
"{",
"throw",
"new",
"CDIException",
"(",
"e",
")",
";",
"}",
"}",
"}"
] | Initialize the Resource Injection Service with each BDA's bean classes.
This method must be called after scanForBeans() and scanForEjbEndpoints() but before we try to do
any real work with the deployment or the BDAs
@throws CDIException | [
"Initialize",
"the",
"Resource",
"Injection",
"Service",
"with",
"each",
"BDA",
"s",
"bean",
"classes",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.cdi.weld/src/com/ibm/ws/cdi/impl/weld/WebSphereCDIDeploymentImpl.java#L614-L637 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.cdi.weld/src/com/ibm/ws/cdi/impl/weld/WebSphereCDIDeploymentImpl.java | WebSphereCDIDeploymentImpl.shutdown | @Override
public void shutdown() {
if (this.bootstrap != null) {
AccessController.doPrivileged(new PrivilegedAction<Void>() {
@Override
public Void run() {
bootstrap.shutdown();
return null;
}
});
this.bootstrap = null;
this.deploymentDBAs.clear();
this.applicationBDAs.clear();
this.classloader = null;
this.extensionClassLoaders.clear();
this.cdiEnabled = false;
this.cdiStatusMap.clear();
this.application = null;
this.classBDAMap.clear();
}
} | java | @Override
public void shutdown() {
if (this.bootstrap != null) {
AccessController.doPrivileged(new PrivilegedAction<Void>() {
@Override
public Void run() {
bootstrap.shutdown();
return null;
}
});
this.bootstrap = null;
this.deploymentDBAs.clear();
this.applicationBDAs.clear();
this.classloader = null;
this.extensionClassLoaders.clear();
this.cdiEnabled = false;
this.cdiStatusMap.clear();
this.application = null;
this.classBDAMap.clear();
}
} | [
"@",
"Override",
"public",
"void",
"shutdown",
"(",
")",
"{",
"if",
"(",
"this",
".",
"bootstrap",
"!=",
"null",
")",
"{",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"PrivilegedAction",
"<",
"Void",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Void",
"run",
"(",
")",
"{",
"bootstrap",
".",
"shutdown",
"(",
")",
";",
"return",
"null",
";",
"}",
"}",
")",
";",
"this",
".",
"bootstrap",
"=",
"null",
";",
"this",
".",
"deploymentDBAs",
".",
"clear",
"(",
")",
";",
"this",
".",
"applicationBDAs",
".",
"clear",
"(",
")",
";",
"this",
".",
"classloader",
"=",
"null",
";",
"this",
".",
"extensionClassLoaders",
".",
"clear",
"(",
")",
";",
"this",
".",
"cdiEnabled",
"=",
"false",
";",
"this",
".",
"cdiStatusMap",
".",
"clear",
"(",
")",
";",
"this",
".",
"application",
"=",
"null",
";",
"this",
".",
"classBDAMap",
".",
"clear",
"(",
")",
";",
"}",
"}"
] | Shutdown and clean up the whole deployment. The deployment will not be usable after this call has been made. | [
"Shutdown",
"and",
"clean",
"up",
"the",
"whole",
"deployment",
".",
"The",
"deployment",
"will",
"not",
"be",
"usable",
"after",
"this",
"call",
"has",
"been",
"made",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.cdi.weld/src/com/ibm/ws/cdi/impl/weld/WebSphereCDIDeploymentImpl.java#L642-L664 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.social/src/com/ibm/ws/security/social/tai/SocialLoginTAI.java | SocialLoginTAI.isConfigValid | boolean isConfigValid(ConvergedClientConfig config) {
boolean valid = true;
String clientId = config.getClientId();
String clientSecret = config.getClientSecret();
String authorizationEndpoint = config.getAuthorizationEndpointUrl();
String jwksUri = config.getJwkEndpointUrl();
if (clientId == null || clientId.length() == 0) {
Tr.error(tc, "INVALID_CONFIG_PARAM", new Object[] { OidcLoginConfigImpl.KEY_clientId, clientId }); //CWWKS5500E
valid = false;
}
if (clientSecret == null || clientSecret.length() == 0) {
Tr.error(tc, "INVALID_CONFIG_PARAM", new Object[] { OidcLoginConfigImpl.KEY_clientSecret, "" }); //CWWKS5500E
valid = false;
}
if (authorizationEndpoint == null || authorizationEndpoint.length() == 0
|| (!authorizationEndpoint.toLowerCase().startsWith("http"))) {
Tr.error(tc, "INVALID_CONFIG_PARAM", new Object[] { OidcLoginConfigImpl.KEY_authorizationEndpoint, authorizationEndpoint }); //CWWKS5500E
valid = false;
}
// TODO: we need a message when we have bad jwks uri's, but this kind of check fails when jwks uri is not set.
/*
* if (jwksUri == null || jwksUri.length() == 0
* || (!jwksUri.toLowerCase().startsWith("http"))) {
* Tr.error(tc, "INVALID_CONFIG_PARAM", new Object[] { OidcLoginConfigImpl.KEY_jwksUri, jwksUri }); //CWWKS5500E
*
* }
*/
return valid;
} | java | boolean isConfigValid(ConvergedClientConfig config) {
boolean valid = true;
String clientId = config.getClientId();
String clientSecret = config.getClientSecret();
String authorizationEndpoint = config.getAuthorizationEndpointUrl();
String jwksUri = config.getJwkEndpointUrl();
if (clientId == null || clientId.length() == 0) {
Tr.error(tc, "INVALID_CONFIG_PARAM", new Object[] { OidcLoginConfigImpl.KEY_clientId, clientId }); //CWWKS5500E
valid = false;
}
if (clientSecret == null || clientSecret.length() == 0) {
Tr.error(tc, "INVALID_CONFIG_PARAM", new Object[] { OidcLoginConfigImpl.KEY_clientSecret, "" }); //CWWKS5500E
valid = false;
}
if (authorizationEndpoint == null || authorizationEndpoint.length() == 0
|| (!authorizationEndpoint.toLowerCase().startsWith("http"))) {
Tr.error(tc, "INVALID_CONFIG_PARAM", new Object[] { OidcLoginConfigImpl.KEY_authorizationEndpoint, authorizationEndpoint }); //CWWKS5500E
valid = false;
}
// TODO: we need a message when we have bad jwks uri's, but this kind of check fails when jwks uri is not set.
/*
* if (jwksUri == null || jwksUri.length() == 0
* || (!jwksUri.toLowerCase().startsWith("http"))) {
* Tr.error(tc, "INVALID_CONFIG_PARAM", new Object[] { OidcLoginConfigImpl.KEY_jwksUri, jwksUri }); //CWWKS5500E
*
* }
*/
return valid;
} | [
"boolean",
"isConfigValid",
"(",
"ConvergedClientConfig",
"config",
")",
"{",
"boolean",
"valid",
"=",
"true",
";",
"String",
"clientId",
"=",
"config",
".",
"getClientId",
"(",
")",
";",
"String",
"clientSecret",
"=",
"config",
".",
"getClientSecret",
"(",
")",
";",
"String",
"authorizationEndpoint",
"=",
"config",
".",
"getAuthorizationEndpointUrl",
"(",
")",
";",
"String",
"jwksUri",
"=",
"config",
".",
"getJwkEndpointUrl",
"(",
")",
";",
"if",
"(",
"clientId",
"==",
"null",
"||",
"clientId",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"Tr",
".",
"error",
"(",
"tc",
",",
"\"INVALID_CONFIG_PARAM\"",
",",
"new",
"Object",
"[",
"]",
"{",
"OidcLoginConfigImpl",
".",
"KEY_clientId",
",",
"clientId",
"}",
")",
";",
"//CWWKS5500E",
"valid",
"=",
"false",
";",
"}",
"if",
"(",
"clientSecret",
"==",
"null",
"||",
"clientSecret",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"Tr",
".",
"error",
"(",
"tc",
",",
"\"INVALID_CONFIG_PARAM\"",
",",
"new",
"Object",
"[",
"]",
"{",
"OidcLoginConfigImpl",
".",
"KEY_clientSecret",
",",
"\"\"",
"}",
")",
";",
"//CWWKS5500E",
"valid",
"=",
"false",
";",
"}",
"if",
"(",
"authorizationEndpoint",
"==",
"null",
"||",
"authorizationEndpoint",
".",
"length",
"(",
")",
"==",
"0",
"||",
"(",
"!",
"authorizationEndpoint",
".",
"toLowerCase",
"(",
")",
".",
"startsWith",
"(",
"\"http\"",
")",
")",
")",
"{",
"Tr",
".",
"error",
"(",
"tc",
",",
"\"INVALID_CONFIG_PARAM\"",
",",
"new",
"Object",
"[",
"]",
"{",
"OidcLoginConfigImpl",
".",
"KEY_authorizationEndpoint",
",",
"authorizationEndpoint",
"}",
")",
";",
"//CWWKS5500E",
"valid",
"=",
"false",
";",
"}",
"// TODO: we need a message when we have bad jwks uri's, but this kind of check fails when jwks uri is not set.",
"/*\n * if (jwksUri == null || jwksUri.length() == 0\n * || (!jwksUri.toLowerCase().startsWith(\"http\"))) {\n * Tr.error(tc, \"INVALID_CONFIG_PARAM\", new Object[] { OidcLoginConfigImpl.KEY_jwksUri, jwksUri }); //CWWKS5500E\n *\n * }\n */",
"return",
"valid",
";",
"}"
] | Check for some things that will always fail and emit message about bad config.
Do here so 1) classic oidc messages don't change and 2) put error message closer in log to failure.
@param config
@return true if config is valid | [
"Check",
"for",
"some",
"things",
"that",
"will",
"always",
"fail",
"and",
"emit",
"message",
"about",
"bad",
"config",
".",
"Do",
"here",
"so",
"1",
")",
"classic",
"oidc",
"messages",
"don",
"t",
"change",
"and",
"2",
")",
"put",
"error",
"message",
"closer",
"in",
"log",
"to",
"failure",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.social/src/com/ibm/ws/security/social/tai/SocialLoginTAI.java#L550-L580 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AbstractLockedMessageEnumeration.java | AbstractLockedMessageEnumeration.cleanOutBifurcatedMessages | protected void cleanOutBifurcatedMessages(BifurcatedConsumerSessionImpl owner, boolean bumpRedeliveryOnClose) throws SIResourceException, SISessionDroppedException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "cleanOutBifurcatedMessages", new Object[]{new Integer(hashCode()),this});
int unlockedMessages = 0;
synchronized(this)
{
if(firstMsg != null)
{
LMEMessage message = firstMsg;
LMEMessage unlockMsg = null;
while(message != null)
{
unlockMsg = message;
message = message.next;
// Only unlock messages that are owned by the bifurcated consumer.
if(unlockMsg.owner == owner)
{
// Unlock the message from the message store
if(unlockMsg.isStored)
{
try
{
unlockMessage(unlockMsg.message, bumpRedeliveryOnClose);
}
catch (SIMPMessageNotLockedException e)
{
// No FFDC code needed
SibTr.exception(tc, e);
// See defect 387591
// We should only get this exception if the message was deleted via
// the controllable objects i.e. the admin console. If we are here for
// another reason that we have a real error.
}
}
// Remove the element from the liss
removeMessage(unlockMsg);
unlockedMessages++;
}
}
}
}
if(unlockedMessages != 0)
localConsumerPoint.removeActiveMessages(unlockedMessages);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "cleanOutBifurcatedMessages", this);
} | java | protected void cleanOutBifurcatedMessages(BifurcatedConsumerSessionImpl owner, boolean bumpRedeliveryOnClose) throws SIResourceException, SISessionDroppedException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "cleanOutBifurcatedMessages", new Object[]{new Integer(hashCode()),this});
int unlockedMessages = 0;
synchronized(this)
{
if(firstMsg != null)
{
LMEMessage message = firstMsg;
LMEMessage unlockMsg = null;
while(message != null)
{
unlockMsg = message;
message = message.next;
// Only unlock messages that are owned by the bifurcated consumer.
if(unlockMsg.owner == owner)
{
// Unlock the message from the message store
if(unlockMsg.isStored)
{
try
{
unlockMessage(unlockMsg.message, bumpRedeliveryOnClose);
}
catch (SIMPMessageNotLockedException e)
{
// No FFDC code needed
SibTr.exception(tc, e);
// See defect 387591
// We should only get this exception if the message was deleted via
// the controllable objects i.e. the admin console. If we are here for
// another reason that we have a real error.
}
}
// Remove the element from the liss
removeMessage(unlockMsg);
unlockedMessages++;
}
}
}
}
if(unlockedMessages != 0)
localConsumerPoint.removeActiveMessages(unlockedMessages);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "cleanOutBifurcatedMessages", this);
} | [
"protected",
"void",
"cleanOutBifurcatedMessages",
"(",
"BifurcatedConsumerSessionImpl",
"owner",
",",
"boolean",
"bumpRedeliveryOnClose",
")",
"throws",
"SIResourceException",
",",
"SISessionDroppedException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"cleanOutBifurcatedMessages\"",
",",
"new",
"Object",
"[",
"]",
"{",
"new",
"Integer",
"(",
"hashCode",
"(",
")",
")",
",",
"this",
"}",
")",
";",
"int",
"unlockedMessages",
"=",
"0",
";",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"firstMsg",
"!=",
"null",
")",
"{",
"LMEMessage",
"message",
"=",
"firstMsg",
";",
"LMEMessage",
"unlockMsg",
"=",
"null",
";",
"while",
"(",
"message",
"!=",
"null",
")",
"{",
"unlockMsg",
"=",
"message",
";",
"message",
"=",
"message",
".",
"next",
";",
"// Only unlock messages that are owned by the bifurcated consumer.",
"if",
"(",
"unlockMsg",
".",
"owner",
"==",
"owner",
")",
"{",
"// Unlock the message from the message store",
"if",
"(",
"unlockMsg",
".",
"isStored",
")",
"{",
"try",
"{",
"unlockMessage",
"(",
"unlockMsg",
".",
"message",
",",
"bumpRedeliveryOnClose",
")",
";",
"}",
"catch",
"(",
"SIMPMessageNotLockedException",
"e",
")",
"{",
"// No FFDC code needed",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"e",
")",
";",
"// See defect 387591",
"// We should only get this exception if the message was deleted via",
"// the controllable objects i.e. the admin console. If we are here for",
"// another reason that we have a real error.",
"}",
"}",
"// Remove the element from the liss",
"removeMessage",
"(",
"unlockMsg",
")",
";",
"unlockedMessages",
"++",
";",
"}",
"}",
"}",
"}",
"if",
"(",
"unlockedMessages",
"!=",
"0",
")",
"localConsumerPoint",
".",
"removeActiveMessages",
"(",
"unlockedMessages",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"cleanOutBifurcatedMessages\"",
",",
"this",
")",
";",
"}"
] | When a bifurcated consumer is closed all locked messages owned by that consumer must
be unlocked
@param owner
@throws SIResourceException
@throws SISessionDroppedException | [
"When",
"a",
"bifurcated",
"consumer",
"is",
"closed",
"all",
"locked",
"messages",
"owned",
"by",
"that",
"consumer",
"must",
"be",
"unlocked"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AbstractLockedMessageEnumeration.java#L741-L798 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AbstractLockedMessageEnumeration.java | AbstractLockedMessageEnumeration.getNumberOfLockedMessages | protected int getNumberOfLockedMessages()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getNumberOfLockedMessages");
int count = 0;
synchronized(this)
{
LMEMessage message;
message = firstMsg;
while(message != null)
{
count++;
message = message.next;
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getNumberOfLockedMessages", new Integer(count));
return count;
} | java | protected int getNumberOfLockedMessages()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getNumberOfLockedMessages");
int count = 0;
synchronized(this)
{
LMEMessage message;
message = firstMsg;
while(message != null)
{
count++;
message = message.next;
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getNumberOfLockedMessages", new Integer(count));
return count;
} | [
"protected",
"int",
"getNumberOfLockedMessages",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"getNumberOfLockedMessages\"",
")",
";",
"int",
"count",
"=",
"0",
";",
"synchronized",
"(",
"this",
")",
"{",
"LMEMessage",
"message",
";",
"message",
"=",
"firstMsg",
";",
"while",
"(",
"message",
"!=",
"null",
")",
"{",
"count",
"++",
";",
"message",
"=",
"message",
".",
"next",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"getNumberOfLockedMessages\"",
",",
"new",
"Integer",
"(",
"count",
")",
")",
";",
"return",
"count",
";",
"}"
] | Return the number of locked messages that are part of this locked message enumeration.
The count will start from thr firstMsg unlike th getRemainingMessageCount which starts
from the currentMsg.
@return the number of locked messages | [
"Return",
"the",
"number",
"of",
"locked",
"messages",
"that",
"are",
"part",
"of",
"this",
"locked",
"message",
"enumeration",
".",
"The",
"count",
"will",
"start",
"from",
"thr",
"firstMsg",
"unlike",
"th",
"getRemainingMessageCount",
"which",
"starts",
"from",
"the",
"currentMsg",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AbstractLockedMessageEnumeration.java#L1073-L1095 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AbstractLockedMessageEnumeration.java | AbstractLockedMessageEnumeration.removeMessage | protected void removeMessage(LMEMessage message)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "removeMessage", new Object[] {new Integer(hashCode()), message, this });
// If this was the message we entered the callback with we need
// to move the start point back a bit
if(message == callbackEntryMsg)
callbackEntryMsg = message.previous;
// If this is our current message we need to move the cursor
// back a bit
if(message == currentMsg)
currentMsg = message.previous;
// If this message was the next to expire we move the expiry cursor on to
// the next eligible message. We leave any alarm registered so that it pops,
// when this happens it realises the alarm is not valid for the next expiring
// message and re-registers itself for the correct time. This gives us the
// best performance when no locks are expiring as we're not continually
// registering and de-registering alarms for every message
if(message == nextMsgToExpire)
{
do
{
nextMsgToExpire = nextMsgToExpire.next;
}
while((nextMsgToExpire != null) && (nextMsgToExpire.expiryTime == 0));
}
if(message == nextMsgReferenceToExpire)
{
do
{
nextMsgReferenceToExpire = nextMsgReferenceToExpire.next;
}
while((nextMsgReferenceToExpire != null) && (nextMsgReferenceToExpire.expiryTime == 0));
}
// Unlink this message from the list
if(message.previous != null)
message.previous.next = message.next;
else
firstMsg = message.next;
if(message.next != null)
message.next.previous = message.previous;
else
lastMsg = message.previous;
// Pool the element if there's space
if(pooledCount < poolSize)
{
message.message = null;
message.next = pooledMsg;
message.previous = null;
message.owner = null;
message.jsMessage = null;
message.expiryTime = 0;
message.expiryMsgReferenceTime = 0;
pooledMsg = message;
pooledCount++;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "removeMessage", this);
} | java | protected void removeMessage(LMEMessage message)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "removeMessage", new Object[] {new Integer(hashCode()), message, this });
// If this was the message we entered the callback with we need
// to move the start point back a bit
if(message == callbackEntryMsg)
callbackEntryMsg = message.previous;
// If this is our current message we need to move the cursor
// back a bit
if(message == currentMsg)
currentMsg = message.previous;
// If this message was the next to expire we move the expiry cursor on to
// the next eligible message. We leave any alarm registered so that it pops,
// when this happens it realises the alarm is not valid for the next expiring
// message and re-registers itself for the correct time. This gives us the
// best performance when no locks are expiring as we're not continually
// registering and de-registering alarms for every message
if(message == nextMsgToExpire)
{
do
{
nextMsgToExpire = nextMsgToExpire.next;
}
while((nextMsgToExpire != null) && (nextMsgToExpire.expiryTime == 0));
}
if(message == nextMsgReferenceToExpire)
{
do
{
nextMsgReferenceToExpire = nextMsgReferenceToExpire.next;
}
while((nextMsgReferenceToExpire != null) && (nextMsgReferenceToExpire.expiryTime == 0));
}
// Unlink this message from the list
if(message.previous != null)
message.previous.next = message.next;
else
firstMsg = message.next;
if(message.next != null)
message.next.previous = message.previous;
else
lastMsg = message.previous;
// Pool the element if there's space
if(pooledCount < poolSize)
{
message.message = null;
message.next = pooledMsg;
message.previous = null;
message.owner = null;
message.jsMessage = null;
message.expiryTime = 0;
message.expiryMsgReferenceTime = 0;
pooledMsg = message;
pooledCount++;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "removeMessage", this);
} | [
"protected",
"void",
"removeMessage",
"(",
"LMEMessage",
"message",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"removeMessage\"",
",",
"new",
"Object",
"[",
"]",
"{",
"new",
"Integer",
"(",
"hashCode",
"(",
")",
")",
",",
"message",
",",
"this",
"}",
")",
";",
"// If this was the message we entered the callback with we need",
"// to move the start point back a bit",
"if",
"(",
"message",
"==",
"callbackEntryMsg",
")",
"callbackEntryMsg",
"=",
"message",
".",
"previous",
";",
"// If this is our current message we need to move the cursor",
"// back a bit",
"if",
"(",
"message",
"==",
"currentMsg",
")",
"currentMsg",
"=",
"message",
".",
"previous",
";",
"// If this message was the next to expire we move the expiry cursor on to",
"// the next eligible message. We leave any alarm registered so that it pops,",
"// when this happens it realises the alarm is not valid for the next expiring",
"// message and re-registers itself for the correct time. This gives us the",
"// best performance when no locks are expiring as we're not continually",
"// registering and de-registering alarms for every message",
"if",
"(",
"message",
"==",
"nextMsgToExpire",
")",
"{",
"do",
"{",
"nextMsgToExpire",
"=",
"nextMsgToExpire",
".",
"next",
";",
"}",
"while",
"(",
"(",
"nextMsgToExpire",
"!=",
"null",
")",
"&&",
"(",
"nextMsgToExpire",
".",
"expiryTime",
"==",
"0",
")",
")",
";",
"}",
"if",
"(",
"message",
"==",
"nextMsgReferenceToExpire",
")",
"{",
"do",
"{",
"nextMsgReferenceToExpire",
"=",
"nextMsgReferenceToExpire",
".",
"next",
";",
"}",
"while",
"(",
"(",
"nextMsgReferenceToExpire",
"!=",
"null",
")",
"&&",
"(",
"nextMsgReferenceToExpire",
".",
"expiryTime",
"==",
"0",
")",
")",
";",
"}",
"// Unlink this message from the list",
"if",
"(",
"message",
".",
"previous",
"!=",
"null",
")",
"message",
".",
"previous",
".",
"next",
"=",
"message",
".",
"next",
";",
"else",
"firstMsg",
"=",
"message",
".",
"next",
";",
"if",
"(",
"message",
".",
"next",
"!=",
"null",
")",
"message",
".",
"next",
".",
"previous",
"=",
"message",
".",
"previous",
";",
"else",
"lastMsg",
"=",
"message",
".",
"previous",
";",
"// Pool the element if there's space",
"if",
"(",
"pooledCount",
"<",
"poolSize",
")",
"{",
"message",
".",
"message",
"=",
"null",
";",
"message",
".",
"next",
"=",
"pooledMsg",
";",
"message",
".",
"previous",
"=",
"null",
";",
"message",
".",
"owner",
"=",
"null",
";",
"message",
".",
"jsMessage",
"=",
"null",
";",
"message",
".",
"expiryTime",
"=",
"0",
";",
"message",
".",
"expiryMsgReferenceTime",
"=",
"0",
";",
"pooledMsg",
"=",
"message",
";",
"pooledCount",
"++",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"removeMessage\"",
",",
"this",
")",
";",
"}"
] | Remove a message object from the list
@param message | [
"Remove",
"a",
"message",
"object",
"from",
"the",
"list"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AbstractLockedMessageEnumeration.java#L1755-L1821 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AbstractLockedMessageEnumeration.java | AbstractLockedMessageEnumeration.resetCallbackCursor | protected void resetCallbackCursor() throws SIResourceException, SISessionDroppedException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "resetCallbackCursor", new Integer(hashCode()));
synchronized(this)
{
unlockAllUnread();
callbackEntryMsg = lastMsg;
currentMsg = lastMsg;
messageAvailable = false;
endReached = false;
validState = false;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "resetCallbackCursor", this);
} | java | protected void resetCallbackCursor() throws SIResourceException, SISessionDroppedException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "resetCallbackCursor", new Integer(hashCode()));
synchronized(this)
{
unlockAllUnread();
callbackEntryMsg = lastMsg;
currentMsg = lastMsg;
messageAvailable = false;
endReached = false;
validState = false;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "resetCallbackCursor", this);
} | [
"protected",
"void",
"resetCallbackCursor",
"(",
")",
"throws",
"SIResourceException",
",",
"SISessionDroppedException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"resetCallbackCursor\"",
",",
"new",
"Integer",
"(",
"hashCode",
"(",
")",
")",
")",
";",
"synchronized",
"(",
"this",
")",
"{",
"unlockAllUnread",
"(",
")",
";",
"callbackEntryMsg",
"=",
"lastMsg",
";",
"currentMsg",
"=",
"lastMsg",
";",
"messageAvailable",
"=",
"false",
";",
"endReached",
"=",
"false",
";",
"validState",
"=",
"false",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"resetCallbackCursor\"",
",",
"this",
")",
";",
"}"
] | This is called when a consumeMessages call has completed, it returns the
LME to a consistent state ready for the next consumeMessages.
This will unlock any messages that were locked on this LME that haven't been read.
@throws SISessionDroppedException | [
"This",
"is",
"called",
"when",
"a",
"consumeMessages",
"call",
"has",
"completed",
"it",
"returns",
"the",
"LME",
"to",
"a",
"consistent",
"state",
"ready",
"for",
"the",
"next",
"consumeMessages",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AbstractLockedMessageEnumeration.java#L1835-L1853 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AbstractLockedMessageEnumeration.java | AbstractLockedMessageEnumeration.setPropertiesInMessage | final JsMessage setPropertiesInMessage(LMEMessage theMessage)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "setPropertiesInMessage", theMessage);
boolean copyMade = false;
// If this is pubsub we share this message with other subscribers so we have
// to make a copy prior to any updates. If this is pt-to-pt then any changes
// we make here can be done before the copy, the copy is still required to
// prevent a consumer from rolling back after modifying the message but
// anything we set here will be reset the next time round so there's no harm
// done. It is best to defer the 'copy' until after we've changed it so there
// is less likelyhood of a real copy being required.
JsMessageWrapper jsMessageWrapper = (JsMessageWrapper) theMessage.message;
JsMessage jsMsg = jsMessageWrapper.getMessage();
try
{
//set the redeliveredCount if required
if (jsMessageWrapper.guessRedeliveredCount() != 0)
{
if(isPubsub)
{
jsMsg = jsMsg.getReceived();
copyMade = true;
}
jsMsg.setRedeliveredCount(jsMessageWrapper.guessRedeliveredCount());
}
long waitTime = jsMessageWrapper.updateStatisticsMessageWaitTime();
//Only store wait time in message where explicitly
// asked
if (setWaitTime )
{
//defect 256701: we only set the message wait time if it is
//a significant value.
boolean waitTimeIsSignificant =
waitTime > messageProcessor.getCustomProperties().get_message_wait_time_granularity();
if(waitTimeIsSignificant)
{
if(isPubsub && !copyMade)
{
jsMsg = jsMsg.getReceived();
copyMade = true;
}
jsMsg.setMessageWaitTime(waitTime);
}
}
// If we deferred the copy till now we need to see if one is
// needed. This will be the case either if the consumer has indicated that
// it may change the message (not a comms client) and the message is still
// on an itemStream (i.e. they could rollback the message with their changes).
// Otherwise we can just give them our copy as we'll never want it back or
// give it to anyone else.
if(!copyMade && ((theMessage.isStored && copyMsg) || isPubsub))
jsMsg = jsMsg.getReceived();
}
catch (MessageCopyFailedException e)
{
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.AbstractLockedMessageEnumeration.setPropertiesInMessage",
"1:2086:1.154.3.1",
this);
SibTr.exception(tc, e);
SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.impl.AbstractLockedMessageEnumeration",
"1:2093:1.154.3.1",
e });
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "setPropertiesInMessage", e);
throw new SIErrorException(
nls.getFormattedMessage(
"INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.impl.AbstractLockedMessageEnumeration",
"1:2104:1.154.3.1",
e },
null),
e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "setPropertiesInMessage", jsMsg);
return jsMsg;
} | java | final JsMessage setPropertiesInMessage(LMEMessage theMessage)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "setPropertiesInMessage", theMessage);
boolean copyMade = false;
// If this is pubsub we share this message with other subscribers so we have
// to make a copy prior to any updates. If this is pt-to-pt then any changes
// we make here can be done before the copy, the copy is still required to
// prevent a consumer from rolling back after modifying the message but
// anything we set here will be reset the next time round so there's no harm
// done. It is best to defer the 'copy' until after we've changed it so there
// is less likelyhood of a real copy being required.
JsMessageWrapper jsMessageWrapper = (JsMessageWrapper) theMessage.message;
JsMessage jsMsg = jsMessageWrapper.getMessage();
try
{
//set the redeliveredCount if required
if (jsMessageWrapper.guessRedeliveredCount() != 0)
{
if(isPubsub)
{
jsMsg = jsMsg.getReceived();
copyMade = true;
}
jsMsg.setRedeliveredCount(jsMessageWrapper.guessRedeliveredCount());
}
long waitTime = jsMessageWrapper.updateStatisticsMessageWaitTime();
//Only store wait time in message where explicitly
// asked
if (setWaitTime )
{
//defect 256701: we only set the message wait time if it is
//a significant value.
boolean waitTimeIsSignificant =
waitTime > messageProcessor.getCustomProperties().get_message_wait_time_granularity();
if(waitTimeIsSignificant)
{
if(isPubsub && !copyMade)
{
jsMsg = jsMsg.getReceived();
copyMade = true;
}
jsMsg.setMessageWaitTime(waitTime);
}
}
// If we deferred the copy till now we need to see if one is
// needed. This will be the case either if the consumer has indicated that
// it may change the message (not a comms client) and the message is still
// on an itemStream (i.e. they could rollback the message with their changes).
// Otherwise we can just give them our copy as we'll never want it back or
// give it to anyone else.
if(!copyMade && ((theMessage.isStored && copyMsg) || isPubsub))
jsMsg = jsMsg.getReceived();
}
catch (MessageCopyFailedException e)
{
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.AbstractLockedMessageEnumeration.setPropertiesInMessage",
"1:2086:1.154.3.1",
this);
SibTr.exception(tc, e);
SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.impl.AbstractLockedMessageEnumeration",
"1:2093:1.154.3.1",
e });
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "setPropertiesInMessage", e);
throw new SIErrorException(
nls.getFormattedMessage(
"INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.impl.AbstractLockedMessageEnumeration",
"1:2104:1.154.3.1",
e },
null),
e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "setPropertiesInMessage", jsMsg);
return jsMsg;
} | [
"final",
"JsMessage",
"setPropertiesInMessage",
"(",
"LMEMessage",
"theMessage",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"setPropertiesInMessage\"",
",",
"theMessage",
")",
";",
"boolean",
"copyMade",
"=",
"false",
";",
"// If this is pubsub we share this message with other subscribers so we have",
"// to make a copy prior to any updates. If this is pt-to-pt then any changes",
"// we make here can be done before the copy, the copy is still required to",
"// prevent a consumer from rolling back after modifying the message but",
"// anything we set here will be reset the next time round so there's no harm",
"// done. It is best to defer the 'copy' until after we've changed it so there",
"// is less likelyhood of a real copy being required.",
"JsMessageWrapper",
"jsMessageWrapper",
"=",
"(",
"JsMessageWrapper",
")",
"theMessage",
".",
"message",
";",
"JsMessage",
"jsMsg",
"=",
"jsMessageWrapper",
".",
"getMessage",
"(",
")",
";",
"try",
"{",
"//set the redeliveredCount if required",
"if",
"(",
"jsMessageWrapper",
".",
"guessRedeliveredCount",
"(",
")",
"!=",
"0",
")",
"{",
"if",
"(",
"isPubsub",
")",
"{",
"jsMsg",
"=",
"jsMsg",
".",
"getReceived",
"(",
")",
";",
"copyMade",
"=",
"true",
";",
"}",
"jsMsg",
".",
"setRedeliveredCount",
"(",
"jsMessageWrapper",
".",
"guessRedeliveredCount",
"(",
")",
")",
";",
"}",
"long",
"waitTime",
"=",
"jsMessageWrapper",
".",
"updateStatisticsMessageWaitTime",
"(",
")",
";",
"//Only store wait time in message where explicitly",
"// asked",
"if",
"(",
"setWaitTime",
")",
"{",
"//defect 256701: we only set the message wait time if it is",
"//a significant value.",
"boolean",
"waitTimeIsSignificant",
"=",
"waitTime",
">",
"messageProcessor",
".",
"getCustomProperties",
"(",
")",
".",
"get_message_wait_time_granularity",
"(",
")",
";",
"if",
"(",
"waitTimeIsSignificant",
")",
"{",
"if",
"(",
"isPubsub",
"&&",
"!",
"copyMade",
")",
"{",
"jsMsg",
"=",
"jsMsg",
".",
"getReceived",
"(",
")",
";",
"copyMade",
"=",
"true",
";",
"}",
"jsMsg",
".",
"setMessageWaitTime",
"(",
"waitTime",
")",
";",
"}",
"}",
"// If we deferred the copy till now we need to see if one is",
"// needed. This will be the case either if the consumer has indicated that",
"// it may change the message (not a comms client) and the message is still",
"// on an itemStream (i.e. they could rollback the message with their changes).",
"// Otherwise we can just give them our copy as we'll never want it back or",
"// give it to anyone else.",
"if",
"(",
"!",
"copyMade",
"&&",
"(",
"(",
"theMessage",
".",
"isStored",
"&&",
"copyMsg",
")",
"||",
"isPubsub",
")",
")",
"jsMsg",
"=",
"jsMsg",
".",
"getReceived",
"(",
")",
";",
"}",
"catch",
"(",
"MessageCopyFailedException",
"e",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"\"com.ibm.ws.sib.processor.impl.AbstractLockedMessageEnumeration.setPropertiesInMessage\"",
",",
"\"1:2086:1.154.3.1\"",
",",
"this",
")",
";",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"e",
")",
";",
"SibTr",
".",
"error",
"(",
"tc",
",",
"\"INTERNAL_MESSAGING_ERROR_CWSIP0002\"",
",",
"new",
"Object",
"[",
"]",
"{",
"\"com.ibm.ws.sib.processor.impl.AbstractLockedMessageEnumeration\"",
",",
"\"1:2093:1.154.3.1\"",
",",
"e",
"}",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"setPropertiesInMessage\"",
",",
"e",
")",
";",
"throw",
"new",
"SIErrorException",
"(",
"nls",
".",
"getFormattedMessage",
"(",
"\"INTERNAL_MESSAGING_ERROR_CWSIP0002\"",
",",
"new",
"Object",
"[",
"]",
"{",
"\"com.ibm.ws.sib.processor.impl.AbstractLockedMessageEnumeration\"",
",",
"\"1:2104:1.154.3.1\"",
",",
"e",
"}",
",",
"null",
")",
",",
"e",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"setPropertiesInMessage\"",
",",
"jsMsg",
")",
";",
"return",
"jsMsg",
";",
"}"
] | Sets the redelivered count and the message wait time if required.
Copies the message if required
@param theMessage
@return | [
"Sets",
"the",
"redelivered",
"count",
"and",
"the",
"message",
"wait",
"time",
"if",
"required",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AbstractLockedMessageEnumeration.java#L1913-L2009 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AbstractLockedMessageEnumeration.java | AbstractLockedMessageEnumeration.unlockAll | protected void unlockAll(boolean closingSession) throws SIResourceException, SIMPMessageNotLockedException, SISessionDroppedException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "unlockAll", new Object[]{new Integer(hashCode()),this});
int unlockedMessages = 0;
SIMPMessageNotLockedException notLockedException = null;
int notLockedExceptionMessageIndex = 0;
synchronized(this)
{
messageAvailable = false;
if(firstMsg != null)
{
LMEMessage pointerMsg = firstMsg;
LMEMessage removedMsg = null;
SIMessageHandle[] messageHandles = new SIMessageHandle[getNumberOfLockedMessages()];
boolean more = true;
while(more)
{
// See if this is the last message in the list
if(pointerMsg == lastMsg)
more = false;
// Only unlock messages that are in the MS (and haven't already
// been unlocked by us)
if(pointerMsg != currentUnlockedMessage)
{
if(pointerMsg.isStored)
{
try
{
unlockMessage(pointerMsg.message,true);
}
catch (SIMPMessageNotLockedException e)
{
// No FFDC code needed
SibTr.exception(tc, e);
// See defect 387591
// We should only get this exception if the message was deleted via
// the controllable objects i.e. the admin console. If we are here for
// another reason that we have a real error.
SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.impl.AbstractLockedMessageEnumeration",
"1:2229:1.154.3.1",
e });
messageHandles[notLockedExceptionMessageIndex] = pointerMsg.getJsMessage().getMessageHandle();
notLockedExceptionMessageIndex++;
if(notLockedException == null)
notLockedException = e;
}
catch (SISessionDroppedException e)
{
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.AbstractLockedMessageEnumeration.unlockAll",
"1:2243:1.154.3.1",
this);
if(!closingSession)
{
handleSessionDroppedException(e);
}
SibTr.exception(tc, e);
SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.impl.AbstractLockedMessageEnumeration.unlockAll",
"1:2255:1.154.3.1",
e });
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "unlockAll", e);
throw e;
}
}
unlockedMessages++;
}
removedMsg = pointerMsg;
pointerMsg = pointerMsg.next;
// Remove the element from the list
removeMessage(removedMsg);
}
currentUnlockedMessage = null;
}
}
if(unlockedMessages != 0)
localConsumerPoint.removeActiveMessages(unlockedMessages);
if (notLockedException != null)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "unlockAll", this);
throw notLockedException;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "unlockAll", this);
} | java | protected void unlockAll(boolean closingSession) throws SIResourceException, SIMPMessageNotLockedException, SISessionDroppedException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "unlockAll", new Object[]{new Integer(hashCode()),this});
int unlockedMessages = 0;
SIMPMessageNotLockedException notLockedException = null;
int notLockedExceptionMessageIndex = 0;
synchronized(this)
{
messageAvailable = false;
if(firstMsg != null)
{
LMEMessage pointerMsg = firstMsg;
LMEMessage removedMsg = null;
SIMessageHandle[] messageHandles = new SIMessageHandle[getNumberOfLockedMessages()];
boolean more = true;
while(more)
{
// See if this is the last message in the list
if(pointerMsg == lastMsg)
more = false;
// Only unlock messages that are in the MS (and haven't already
// been unlocked by us)
if(pointerMsg != currentUnlockedMessage)
{
if(pointerMsg.isStored)
{
try
{
unlockMessage(pointerMsg.message,true);
}
catch (SIMPMessageNotLockedException e)
{
// No FFDC code needed
SibTr.exception(tc, e);
// See defect 387591
// We should only get this exception if the message was deleted via
// the controllable objects i.e. the admin console. If we are here for
// another reason that we have a real error.
SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.impl.AbstractLockedMessageEnumeration",
"1:2229:1.154.3.1",
e });
messageHandles[notLockedExceptionMessageIndex] = pointerMsg.getJsMessage().getMessageHandle();
notLockedExceptionMessageIndex++;
if(notLockedException == null)
notLockedException = e;
}
catch (SISessionDroppedException e)
{
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.AbstractLockedMessageEnumeration.unlockAll",
"1:2243:1.154.3.1",
this);
if(!closingSession)
{
handleSessionDroppedException(e);
}
SibTr.exception(tc, e);
SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.impl.AbstractLockedMessageEnumeration.unlockAll",
"1:2255:1.154.3.1",
e });
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "unlockAll", e);
throw e;
}
}
unlockedMessages++;
}
removedMsg = pointerMsg;
pointerMsg = pointerMsg.next;
// Remove the element from the list
removeMessage(removedMsg);
}
currentUnlockedMessage = null;
}
}
if(unlockedMessages != 0)
localConsumerPoint.removeActiveMessages(unlockedMessages);
if (notLockedException != null)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "unlockAll", this);
throw notLockedException;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "unlockAll", this);
} | [
"protected",
"void",
"unlockAll",
"(",
"boolean",
"closingSession",
")",
"throws",
"SIResourceException",
",",
"SIMPMessageNotLockedException",
",",
"SISessionDroppedException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"unlockAll\"",
",",
"new",
"Object",
"[",
"]",
"{",
"new",
"Integer",
"(",
"hashCode",
"(",
")",
")",
",",
"this",
"}",
")",
";",
"int",
"unlockedMessages",
"=",
"0",
";",
"SIMPMessageNotLockedException",
"notLockedException",
"=",
"null",
";",
"int",
"notLockedExceptionMessageIndex",
"=",
"0",
";",
"synchronized",
"(",
"this",
")",
"{",
"messageAvailable",
"=",
"false",
";",
"if",
"(",
"firstMsg",
"!=",
"null",
")",
"{",
"LMEMessage",
"pointerMsg",
"=",
"firstMsg",
";",
"LMEMessage",
"removedMsg",
"=",
"null",
";",
"SIMessageHandle",
"[",
"]",
"messageHandles",
"=",
"new",
"SIMessageHandle",
"[",
"getNumberOfLockedMessages",
"(",
")",
"]",
";",
"boolean",
"more",
"=",
"true",
";",
"while",
"(",
"more",
")",
"{",
"// See if this is the last message in the list",
"if",
"(",
"pointerMsg",
"==",
"lastMsg",
")",
"more",
"=",
"false",
";",
"// Only unlock messages that are in the MS (and haven't already",
"// been unlocked by us)",
"if",
"(",
"pointerMsg",
"!=",
"currentUnlockedMessage",
")",
"{",
"if",
"(",
"pointerMsg",
".",
"isStored",
")",
"{",
"try",
"{",
"unlockMessage",
"(",
"pointerMsg",
".",
"message",
",",
"true",
")",
";",
"}",
"catch",
"(",
"SIMPMessageNotLockedException",
"e",
")",
"{",
"// No FFDC code needed",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"e",
")",
";",
"// See defect 387591",
"// We should only get this exception if the message was deleted via",
"// the controllable objects i.e. the admin console. If we are here for",
"// another reason that we have a real error.",
"SibTr",
".",
"error",
"(",
"tc",
",",
"\"INTERNAL_MESSAGING_ERROR_CWSIP0002\"",
",",
"new",
"Object",
"[",
"]",
"{",
"\"com.ibm.ws.sib.processor.impl.AbstractLockedMessageEnumeration\"",
",",
"\"1:2229:1.154.3.1\"",
",",
"e",
"}",
")",
";",
"messageHandles",
"[",
"notLockedExceptionMessageIndex",
"]",
"=",
"pointerMsg",
".",
"getJsMessage",
"(",
")",
".",
"getMessageHandle",
"(",
")",
";",
"notLockedExceptionMessageIndex",
"++",
";",
"if",
"(",
"notLockedException",
"==",
"null",
")",
"notLockedException",
"=",
"e",
";",
"}",
"catch",
"(",
"SISessionDroppedException",
"e",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"\"com.ibm.ws.sib.processor.impl.AbstractLockedMessageEnumeration.unlockAll\"",
",",
"\"1:2243:1.154.3.1\"",
",",
"this",
")",
";",
"if",
"(",
"!",
"closingSession",
")",
"{",
"handleSessionDroppedException",
"(",
"e",
")",
";",
"}",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"e",
")",
";",
"SibTr",
".",
"error",
"(",
"tc",
",",
"\"INTERNAL_MESSAGING_ERROR_CWSIP0002\"",
",",
"new",
"Object",
"[",
"]",
"{",
"\"com.ibm.ws.sib.processor.impl.AbstractLockedMessageEnumeration.unlockAll\"",
",",
"\"1:2255:1.154.3.1\"",
",",
"e",
"}",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"unlockAll\"",
",",
"e",
")",
";",
"throw",
"e",
";",
"}",
"}",
"unlockedMessages",
"++",
";",
"}",
"removedMsg",
"=",
"pointerMsg",
";",
"pointerMsg",
"=",
"pointerMsg",
".",
"next",
";",
"// Remove the element from the list",
"removeMessage",
"(",
"removedMsg",
")",
";",
"}",
"currentUnlockedMessage",
"=",
"null",
";",
"}",
"}",
"if",
"(",
"unlockedMessages",
"!=",
"0",
")",
"localConsumerPoint",
".",
"removeActiveMessages",
"(",
"unlockedMessages",
")",
";",
"if",
"(",
"notLockedException",
"!=",
"null",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"unlockAll\"",
",",
"this",
")",
";",
"throw",
"notLockedException",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"unlockAll\"",
",",
"this",
")",
";",
"}"
] | Unlock all the messages in the list
@throws SISessionDroppedException
@throws SIStoreException | [
"Unlock",
"all",
"the",
"messages",
"in",
"the",
"list"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AbstractLockedMessageEnumeration.java#L2076-L2186 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AbstractLockedMessageEnumeration.java | AbstractLockedMessageEnumeration.unlockAllUnread | private void unlockAllUnread() throws SIResourceException, SISessionDroppedException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "unlockAllUnread", new Object[] { new Integer(hashCode()), this });
int unlockedMessages = 0;
synchronized(this)
{
messageAvailable = false;
// Only unlock messages if we have reached the end of the list.
if(firstMsg != null && !endReached)
{
LMEMessage pointerMsg = null;
if (currentMsg == null)
pointerMsg = firstMsg;
else
pointerMsg = currentMsg.next;
LMEMessage removedMsg = null;
boolean more = true;
if (pointerMsg != null)
{
while(more)
{
// See if this is the last message in the list
if(pointerMsg == lastMsg)
more = false;
// Only unlock messages that are in the MS (and haven't already
// been unlocked by us)
if(pointerMsg != currentUnlockedMessage)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Unlocking Message " + pointerMsg);
if(pointerMsg.isStored)
{
try
{
unlockMessage(pointerMsg.message,false);
}
catch (SIMPMessageNotLockedException e)
{
// No FFDC code needed
SibTr.exception(tc, e);
// See defect 387591
// We should only get this exception if the message was deleted via
// the controllable objects i.e. the admin console. If we are here for
// another reason that we have a real error.
}
}
unlockedMessages++;
}
removedMsg = pointerMsg;
pointerMsg = pointerMsg.next;
// Remove the element from the list
removeMessage(removedMsg);
}
}
}
}
if(unlockedMessages != 0)
localConsumerPoint.removeActiveMessages(unlockedMessages);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "unlockAllUnread", this);
} | java | private void unlockAllUnread() throws SIResourceException, SISessionDroppedException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "unlockAllUnread", new Object[] { new Integer(hashCode()), this });
int unlockedMessages = 0;
synchronized(this)
{
messageAvailable = false;
// Only unlock messages if we have reached the end of the list.
if(firstMsg != null && !endReached)
{
LMEMessage pointerMsg = null;
if (currentMsg == null)
pointerMsg = firstMsg;
else
pointerMsg = currentMsg.next;
LMEMessage removedMsg = null;
boolean more = true;
if (pointerMsg != null)
{
while(more)
{
// See if this is the last message in the list
if(pointerMsg == lastMsg)
more = false;
// Only unlock messages that are in the MS (and haven't already
// been unlocked by us)
if(pointerMsg != currentUnlockedMessage)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Unlocking Message " + pointerMsg);
if(pointerMsg.isStored)
{
try
{
unlockMessage(pointerMsg.message,false);
}
catch (SIMPMessageNotLockedException e)
{
// No FFDC code needed
SibTr.exception(tc, e);
// See defect 387591
// We should only get this exception if the message was deleted via
// the controllable objects i.e. the admin console. If we are here for
// another reason that we have a real error.
}
}
unlockedMessages++;
}
removedMsg = pointerMsg;
pointerMsg = pointerMsg.next;
// Remove the element from the list
removeMessage(removedMsg);
}
}
}
}
if(unlockedMessages != 0)
localConsumerPoint.removeActiveMessages(unlockedMessages);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "unlockAllUnread", this);
} | [
"private",
"void",
"unlockAllUnread",
"(",
")",
"throws",
"SIResourceException",
",",
"SISessionDroppedException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"unlockAllUnread\"",
",",
"new",
"Object",
"[",
"]",
"{",
"new",
"Integer",
"(",
"hashCode",
"(",
")",
")",
",",
"this",
"}",
")",
";",
"int",
"unlockedMessages",
"=",
"0",
";",
"synchronized",
"(",
"this",
")",
"{",
"messageAvailable",
"=",
"false",
";",
"// Only unlock messages if we have reached the end of the list.",
"if",
"(",
"firstMsg",
"!=",
"null",
"&&",
"!",
"endReached",
")",
"{",
"LMEMessage",
"pointerMsg",
"=",
"null",
";",
"if",
"(",
"currentMsg",
"==",
"null",
")",
"pointerMsg",
"=",
"firstMsg",
";",
"else",
"pointerMsg",
"=",
"currentMsg",
".",
"next",
";",
"LMEMessage",
"removedMsg",
"=",
"null",
";",
"boolean",
"more",
"=",
"true",
";",
"if",
"(",
"pointerMsg",
"!=",
"null",
")",
"{",
"while",
"(",
"more",
")",
"{",
"// See if this is the last message in the list",
"if",
"(",
"pointerMsg",
"==",
"lastMsg",
")",
"more",
"=",
"false",
";",
"// Only unlock messages that are in the MS (and haven't already",
"// been unlocked by us)",
"if",
"(",
"pointerMsg",
"!=",
"currentUnlockedMessage",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"Unlocking Message \"",
"+",
"pointerMsg",
")",
";",
"if",
"(",
"pointerMsg",
".",
"isStored",
")",
"{",
"try",
"{",
"unlockMessage",
"(",
"pointerMsg",
".",
"message",
",",
"false",
")",
";",
"}",
"catch",
"(",
"SIMPMessageNotLockedException",
"e",
")",
"{",
"// No FFDC code needed",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"e",
")",
";",
"// See defect 387591",
"// We should only get this exception if the message was deleted via",
"// the controllable objects i.e. the admin console. If we are here for",
"// another reason that we have a real error.",
"}",
"}",
"unlockedMessages",
"++",
";",
"}",
"removedMsg",
"=",
"pointerMsg",
";",
"pointerMsg",
"=",
"pointerMsg",
".",
"next",
";",
"// Remove the element from the list",
"removeMessage",
"(",
"removedMsg",
")",
";",
"}",
"}",
"}",
"}",
"if",
"(",
"unlockedMessages",
"!=",
"0",
")",
"localConsumerPoint",
".",
"removeActiveMessages",
"(",
"unlockedMessages",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"unlockAllUnread\"",
",",
"this",
")",
";",
"}"
] | Method to unlock all messages which haven't been read
@param incrementRedeliveryCount
@throws SISessionDroppedException | [
"Method",
"to",
"unlock",
"all",
"messages",
"which",
"haven",
"t",
"been",
"read"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AbstractLockedMessageEnumeration.java#L2195-L2268 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/AbstractMapView.java | AbstractMapView.containsValue | public boolean containsValue(Token value,
Transaction transaction)
throws ObjectManagerException
{
try {
for (Iterator iterator = entrySet().iterator();;) {
Entry entry = (Entry) iterator.next(transaction);
Token entryValue = entry.getValue();
if (value == entryValue) {
return true;
}
}
} catch (java.util.NoSuchElementException exception) {
// No FFDC code needed, just exited search.
return false;
} // try.
} | java | public boolean containsValue(Token value,
Transaction transaction)
throws ObjectManagerException
{
try {
for (Iterator iterator = entrySet().iterator();;) {
Entry entry = (Entry) iterator.next(transaction);
Token entryValue = entry.getValue();
if (value == entryValue) {
return true;
}
}
} catch (java.util.NoSuchElementException exception) {
// No FFDC code needed, just exited search.
return false;
} // try.
} | [
"public",
"boolean",
"containsValue",
"(",
"Token",
"value",
",",
"Transaction",
"transaction",
")",
"throws",
"ObjectManagerException",
"{",
"try",
"{",
"for",
"(",
"Iterator",
"iterator",
"=",
"entrySet",
"(",
")",
".",
"iterator",
"(",
")",
";",
";",
")",
"{",
"Entry",
"entry",
"=",
"(",
"Entry",
")",
"iterator",
".",
"next",
"(",
"transaction",
")",
";",
"Token",
"entryValue",
"=",
"entry",
".",
"getValue",
"(",
")",
";",
"if",
"(",
"value",
"==",
"entryValue",
")",
"{",
"return",
"true",
";",
"}",
"}",
"}",
"catch",
"(",
"java",
".",
"util",
".",
"NoSuchElementException",
"exception",
")",
"{",
"// No FFDC code needed, just exited search.",
"return",
"false",
";",
"}",
"// try.",
"}"
] | Determines if the Map contains the Token
@param Token whose presence in this map is to be tested.
@param Transaction which determines visibility of Entries in the Map.
@return Boolean <tt>true</tt> if the map contains at least one mapping to the Token visible to the Transaction.
@exception ObjectManagerException. | [
"Determines",
"if",
"the",
"Map",
"contains",
"the",
"Token"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/AbstractMapView.java#L90-L107 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/AIStream.java | AIStream.countAllMessagesOnStream | public long countAllMessagesOnStream()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "countAllMessagesOnStream");
long count=0;
_targetStream.setCursor(0);
// Get the first TickRange
TickRange tr = _targetStream.getNext();
while (tr.endstamp < RangeList.INFINITY)
{
if (tr.type == TickRange.Value)
{
count++;
}
if (tr.type == TickRange.Requested)
{
// If we are an restarted IME (gathering) then we may have to restore msgs from the
// DME which were previously Value msgs in this stream. We need to count any re-requests
// in our count as they contribute to the total.
if (((AIRequestedTick)tr.value).getRestoringAOValue() != null)
count++;
}
tr = _targetStream.getNext();
} // end while
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "countAllMessagesOnStream", Long.valueOf(count));
return count;
} | java | public long countAllMessagesOnStream()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "countAllMessagesOnStream");
long count=0;
_targetStream.setCursor(0);
// Get the first TickRange
TickRange tr = _targetStream.getNext();
while (tr.endstamp < RangeList.INFINITY)
{
if (tr.type == TickRange.Value)
{
count++;
}
if (tr.type == TickRange.Requested)
{
// If we are an restarted IME (gathering) then we may have to restore msgs from the
// DME which were previously Value msgs in this stream. We need to count any re-requests
// in our count as they contribute to the total.
if (((AIRequestedTick)tr.value).getRestoringAOValue() != null)
count++;
}
tr = _targetStream.getNext();
} // end while
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "countAllMessagesOnStream", Long.valueOf(count));
return count;
} | [
"public",
"long",
"countAllMessagesOnStream",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"countAllMessagesOnStream\"",
")",
";",
"long",
"count",
"=",
"0",
";",
"_targetStream",
".",
"setCursor",
"(",
"0",
")",
";",
"// Get the first TickRange",
"TickRange",
"tr",
"=",
"_targetStream",
".",
"getNext",
"(",
")",
";",
"while",
"(",
"tr",
".",
"endstamp",
"<",
"RangeList",
".",
"INFINITY",
")",
"{",
"if",
"(",
"tr",
".",
"type",
"==",
"TickRange",
".",
"Value",
")",
"{",
"count",
"++",
";",
"}",
"if",
"(",
"tr",
".",
"type",
"==",
"TickRange",
".",
"Requested",
")",
"{",
"// If we are an restarted IME (gathering) then we may have to restore msgs from the",
"// DME which were previously Value msgs in this stream. We need to count any re-requests",
"// in our count as they contribute to the total.",
"if",
"(",
"(",
"(",
"AIRequestedTick",
")",
"tr",
".",
"value",
")",
".",
"getRestoringAOValue",
"(",
")",
"!=",
"null",
")",
"count",
"++",
";",
"}",
"tr",
"=",
"_targetStream",
".",
"getNext",
"(",
")",
";",
"}",
"// end while",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"countAllMessagesOnStream\"",
",",
"Long",
".",
"valueOf",
"(",
"count",
")",
")",
";",
"return",
"count",
";",
"}"
] | Counts the number of messages in the value state on the stream.
NOTE: this method is not synchronized - the client should protect
against concurrent access.
@return a long for the number of messages in 'value' on the stream. | [
"Counts",
"the",
"number",
"of",
"messages",
"in",
"the",
"value",
"state",
"on",
"the",
"stream",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/AIStream.java#L322-L351 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/AIStream.java | AIStream.incrementUnlockCount | public final void incrementUnlockCount(long tick)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "incrementUnlockCount", Long.valueOf(tick));
_targetStream.setCursor(tick);
TickRange tickRange = _targetStream.getNext();
if (tickRange.type == TickRange.Value)
{
AIValueTick valueTick = (AIValueTick) tickRange.value;
if (valueTick != null)
valueTick.incRMEUnlockCount();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "incrementUnlockCount", tickRange);
} | java | public final void incrementUnlockCount(long tick)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "incrementUnlockCount", Long.valueOf(tick));
_targetStream.setCursor(tick);
TickRange tickRange = _targetStream.getNext();
if (tickRange.type == TickRange.Value)
{
AIValueTick valueTick = (AIValueTick) tickRange.value;
if (valueTick != null)
valueTick.incRMEUnlockCount();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "incrementUnlockCount", tickRange);
} | [
"public",
"final",
"void",
"incrementUnlockCount",
"(",
"long",
"tick",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"incrementUnlockCount\"",
",",
"Long",
".",
"valueOf",
"(",
"tick",
")",
")",
";",
"_targetStream",
".",
"setCursor",
"(",
"tick",
")",
";",
"TickRange",
"tickRange",
"=",
"_targetStream",
".",
"getNext",
"(",
")",
";",
"if",
"(",
"tickRange",
".",
"type",
"==",
"TickRange",
".",
"Value",
")",
"{",
"AIValueTick",
"valueTick",
"=",
"(",
"AIValueTick",
")",
"tickRange",
".",
"value",
";",
"if",
"(",
"valueTick",
"!=",
"null",
")",
"valueTick",
".",
"incRMEUnlockCount",
"(",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"incrementUnlockCount\"",
",",
"tickRange",
")",
";",
"}"
] | sets the unlock count of the value tick's msg.
@param tick The tick in the stream | [
"sets",
"the",
"unlock",
"count",
"of",
"the",
"value",
"tick",
"s",
"msg",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/AIStream.java#L537-L553 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/AIStream.java | AIStream.processRequestAck | public void processRequestAck(long tick, long dmeVersion)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"processRequestAck",
new Object[] { Long.valueOf(tick), Long.valueOf(dmeVersion)});
// Only consider non-stale request acks
if (dmeVersion >= _latestDMEVersion)
{
_targetStream.setCursor(tick);
TickRange tickRange = _targetStream.getNext();
// Make sure that we still have a Q/G
if (tickRange.type == TickRange.Requested)
{
AIRequestedTick airt = (AIRequestedTick) tickRange.value;
// serialize with get repetition and request timeouts
synchronized (airt)
{
// Set the request timer to slow, but only if it is not already slowed
if (!airt.isSlowed())
{
_eagerGetTOM.removeTimeoutEntry(airt);
airt.setSlowed(true);
airt.setAckingDMEVersion(dmeVersion);
long to = airt.getTimeout();
if (to > 0 || to == _mp.getCustomProperties().get_infinite_timeout())
{
_slowedGetTOM.addTimeoutEntry(airt);
}
}
}
}
else
{
// This can happen if the request ack got in too late and the Q/G was timed out and rejected
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "processRequestAck");
} | java | public void processRequestAck(long tick, long dmeVersion)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"processRequestAck",
new Object[] { Long.valueOf(tick), Long.valueOf(dmeVersion)});
// Only consider non-stale request acks
if (dmeVersion >= _latestDMEVersion)
{
_targetStream.setCursor(tick);
TickRange tickRange = _targetStream.getNext();
// Make sure that we still have a Q/G
if (tickRange.type == TickRange.Requested)
{
AIRequestedTick airt = (AIRequestedTick) tickRange.value;
// serialize with get repetition and request timeouts
synchronized (airt)
{
// Set the request timer to slow, but only if it is not already slowed
if (!airt.isSlowed())
{
_eagerGetTOM.removeTimeoutEntry(airt);
airt.setSlowed(true);
airt.setAckingDMEVersion(dmeVersion);
long to = airt.getTimeout();
if (to > 0 || to == _mp.getCustomProperties().get_infinite_timeout())
{
_slowedGetTOM.addTimeoutEntry(airt);
}
}
}
}
else
{
// This can happen if the request ack got in too late and the Q/G was timed out and rejected
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "processRequestAck");
} | [
"public",
"void",
"processRequestAck",
"(",
"long",
"tick",
",",
"long",
"dmeVersion",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"processRequestAck\"",
",",
"new",
"Object",
"[",
"]",
"{",
"Long",
".",
"valueOf",
"(",
"tick",
")",
",",
"Long",
".",
"valueOf",
"(",
"dmeVersion",
")",
"}",
")",
";",
"// Only consider non-stale request acks",
"if",
"(",
"dmeVersion",
">=",
"_latestDMEVersion",
")",
"{",
"_targetStream",
".",
"setCursor",
"(",
"tick",
")",
";",
"TickRange",
"tickRange",
"=",
"_targetStream",
".",
"getNext",
"(",
")",
";",
"// Make sure that we still have a Q/G",
"if",
"(",
"tickRange",
".",
"type",
"==",
"TickRange",
".",
"Requested",
")",
"{",
"AIRequestedTick",
"airt",
"=",
"(",
"AIRequestedTick",
")",
"tickRange",
".",
"value",
";",
"// serialize with get repetition and request timeouts",
"synchronized",
"(",
"airt",
")",
"{",
"// Set the request timer to slow, but only if it is not already slowed",
"if",
"(",
"!",
"airt",
".",
"isSlowed",
"(",
")",
")",
"{",
"_eagerGetTOM",
".",
"removeTimeoutEntry",
"(",
"airt",
")",
";",
"airt",
".",
"setSlowed",
"(",
"true",
")",
";",
"airt",
".",
"setAckingDMEVersion",
"(",
"dmeVersion",
")",
";",
"long",
"to",
"=",
"airt",
".",
"getTimeout",
"(",
")",
";",
"if",
"(",
"to",
">",
"0",
"||",
"to",
"==",
"_mp",
".",
"getCustomProperties",
"(",
")",
".",
"get_infinite_timeout",
"(",
")",
")",
"{",
"_slowedGetTOM",
".",
"addTimeoutEntry",
"(",
"airt",
")",
";",
"}",
"}",
"}",
"}",
"else",
"{",
"// This can happen if the request ack got in too late and the Q/G was timed out and rejected",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"processRequestAck\"",
")",
";",
"}"
] | A ControlRequestAck message tells the RME to slow down its get repetition timeout since we now know that the
DME has received the request. | [
"A",
"ControlRequestAck",
"message",
"tells",
"the",
"RME",
"to",
"slow",
"down",
"its",
"get",
"repetition",
"timeout",
"since",
"we",
"now",
"know",
"that",
"the",
"DME",
"has",
"received",
"the",
"request",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/AIStream.java#L1246-L1290 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/AIStream.java | AIStream.processResetRequestAck | public void processResetRequestAck(long dmeVersion, SendDispatcher sendDispatcher)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "processResetRequestAck", Long.valueOf(dmeVersion));
// Only consider non-stale request acks
if (dmeVersion >= _latestDMEVersion)
{
if (dmeVersion > _latestDMEVersion)
_latestDMEVersion = dmeVersion;
_slowedGetTOM.applyToEachEntry(new AddToEagerTOM(_slowedGetTOM, dmeVersion));
sendDispatcher.sendResetRequestAckAck(dmeVersion);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "processResetRequestAck");
} | java | public void processResetRequestAck(long dmeVersion, SendDispatcher sendDispatcher)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "processResetRequestAck", Long.valueOf(dmeVersion));
// Only consider non-stale request acks
if (dmeVersion >= _latestDMEVersion)
{
if (dmeVersion > _latestDMEVersion)
_latestDMEVersion = dmeVersion;
_slowedGetTOM.applyToEachEntry(new AddToEagerTOM(_slowedGetTOM, dmeVersion));
sendDispatcher.sendResetRequestAckAck(dmeVersion);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "processResetRequestAck");
} | [
"public",
"void",
"processResetRequestAck",
"(",
"long",
"dmeVersion",
",",
"SendDispatcher",
"sendDispatcher",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"processResetRequestAck\"",
",",
"Long",
".",
"valueOf",
"(",
"dmeVersion",
")",
")",
";",
"// Only consider non-stale request acks",
"if",
"(",
"dmeVersion",
">=",
"_latestDMEVersion",
")",
"{",
"if",
"(",
"dmeVersion",
">",
"_latestDMEVersion",
")",
"_latestDMEVersion",
"=",
"dmeVersion",
";",
"_slowedGetTOM",
".",
"applyToEachEntry",
"(",
"new",
"AddToEagerTOM",
"(",
"_slowedGetTOM",
",",
"dmeVersion",
")",
")",
";",
"sendDispatcher",
".",
"sendResetRequestAckAck",
"(",
"dmeVersion",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"processResetRequestAck\"",
")",
";",
"}"
] | A ControlResetRequestAck message tells the RME to start re-sending get requests with an eager timeout since
the DME has crashed and recovered. | [
"A",
"ControlResetRequestAck",
"message",
"tells",
"the",
"RME",
"to",
"start",
"re",
"-",
"sending",
"get",
"requests",
"with",
"an",
"eager",
"timeout",
"since",
"the",
"DME",
"has",
"crashed",
"and",
"recovered",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/AIStream.java#L1297-L1314 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/AIStream.java | AIStream.getAnycastInputHandler | public AnycastInputHandler getAnycastInputHandler()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "getAnycastInputHandler");
SibTr.exit(tc, "getAnycastInputHandler", _parent);
}
return _parent;
} | java | public AnycastInputHandler getAnycastInputHandler()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "getAnycastInputHandler");
SibTr.exit(tc, "getAnycastInputHandler", _parent);
}
return _parent;
} | [
"public",
"AnycastInputHandler",
"getAnycastInputHandler",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"getAnycastInputHandler\"",
")",
";",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"getAnycastInputHandler\"",
",",
"_parent",
")",
";",
"}",
"return",
"_parent",
";",
"}"
] | Returns the AnycastInputHandler associated with this AIStream
@return | [
"Returns",
"the",
"AnycastInputHandler",
"associated",
"with",
"this",
"AIStream"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/AIStream.java#L1331-L1339 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/ra/inbound/impl/SibRaEndpointActivation.java | SibRaEndpointActivation.messagingEngineStarting | public void messagingEngineStarting(final JsMessagingEngine messagingEngine) {
final String methodName = "messagingEngineStarting";
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, methodName, messagingEngine);
}
try {
addMessagingEngine(messagingEngine);
} catch (final ResourceException exception) {
FFDCFilter.processException(exception, CLASS_NAME + "."
+ methodName, "1:608:1.40", this);
SibTr.error(TRACE, "MESSAGING_ENGINE_STARTING_CWSIV0555",
new Object[] { exception, messagingEngine.getName(),
messagingEngine.getBusName(), this });
// To reach this point would mean a more serious error has occurred like
// the destination does not exist. Deactivate the MDB so that the user
// knows there is a problem. This behaviour is consistent with the MDB
// being deactivated if the MDB fails during initial startup (an exception
// thrown to J2C and they would deactivate the MDB).
deactivate();
}
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, methodName);
}
} | java | public void messagingEngineStarting(final JsMessagingEngine messagingEngine) {
final String methodName = "messagingEngineStarting";
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, methodName, messagingEngine);
}
try {
addMessagingEngine(messagingEngine);
} catch (final ResourceException exception) {
FFDCFilter.processException(exception, CLASS_NAME + "."
+ methodName, "1:608:1.40", this);
SibTr.error(TRACE, "MESSAGING_ENGINE_STARTING_CWSIV0555",
new Object[] { exception, messagingEngine.getName(),
messagingEngine.getBusName(), this });
// To reach this point would mean a more serious error has occurred like
// the destination does not exist. Deactivate the MDB so that the user
// knows there is a problem. This behaviour is consistent with the MDB
// being deactivated if the MDB fails during initial startup (an exception
// thrown to J2C and they would deactivate the MDB).
deactivate();
}
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, methodName);
}
} | [
"public",
"void",
"messagingEngineStarting",
"(",
"final",
"JsMessagingEngine",
"messagingEngine",
")",
"{",
"final",
"String",
"methodName",
"=",
"\"messagingEngineStarting\"",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"this",
",",
"TRACE",
",",
"methodName",
",",
"messagingEngine",
")",
";",
"}",
"try",
"{",
"addMessagingEngine",
"(",
"messagingEngine",
")",
";",
"}",
"catch",
"(",
"final",
"ResourceException",
"exception",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"exception",
",",
"CLASS_NAME",
"+",
"\".\"",
"+",
"methodName",
",",
"\"1:608:1.40\"",
",",
"this",
")",
";",
"SibTr",
".",
"error",
"(",
"TRACE",
",",
"\"MESSAGING_ENGINE_STARTING_CWSIV0555\"",
",",
"new",
"Object",
"[",
"]",
"{",
"exception",
",",
"messagingEngine",
".",
"getName",
"(",
")",
",",
"messagingEngine",
".",
"getBusName",
"(",
")",
",",
"this",
"}",
")",
";",
"// To reach this point would mean a more serious error has occurred like",
"// the destination does not exist. Deactivate the MDB so that the user",
"// knows there is a problem. This behaviour is consistent with the MDB",
"// being deactivated if the MDB fails during initial startup (an exception",
"// thrown to J2C and they would deactivate the MDB).",
"deactivate",
"(",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exit",
"(",
"this",
",",
"TRACE",
",",
"methodName",
")",
";",
"}",
"}"
] | Called to indicate that a messaging engine has been started. Adds it to
the set of active messaging engines.
@param messagingEngine
the messaging engine that is starting | [
"Called",
"to",
"indicate",
"that",
"a",
"messaging",
"engine",
"has",
"been",
"started",
".",
"Adds",
"it",
"to",
"the",
"set",
"of",
"active",
"messaging",
"engines",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/ra/inbound/impl/SibRaEndpointActivation.java#L554-L585 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/ra/inbound/impl/SibRaEndpointActivation.java | SibRaEndpointActivation.messagingEngineStopping | public void messagingEngineStopping(
final JsMessagingEngine messagingEngine, final int mode) {
final String methodName = "messagingEngineStopping";
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, methodName, new Object[] {
messagingEngine, mode });
}
closeConnection(messagingEngine);
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, methodName);
}
} | java | public void messagingEngineStopping(
final JsMessagingEngine messagingEngine, final int mode) {
final String methodName = "messagingEngineStopping";
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, methodName, new Object[] {
messagingEngine, mode });
}
closeConnection(messagingEngine);
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, methodName);
}
} | [
"public",
"void",
"messagingEngineStopping",
"(",
"final",
"JsMessagingEngine",
"messagingEngine",
",",
"final",
"int",
"mode",
")",
"{",
"final",
"String",
"methodName",
"=",
"\"messagingEngineStopping\"",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"this",
",",
"TRACE",
",",
"methodName",
",",
"new",
"Object",
"[",
"]",
"{",
"messagingEngine",
",",
"mode",
"}",
")",
";",
"}",
"closeConnection",
"(",
"messagingEngine",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exit",
"(",
"this",
",",
"TRACE",
",",
"methodName",
")",
";",
"}",
"}"
] | Called to indicate that a messaging engine is stopping. Removes it from
the set of active messaging engines and closes any open connection.
@param messagingEngine
the messaging engine that is stopping
@param mode
the stop mode | [
"Called",
"to",
"indicate",
"that",
"a",
"messaging",
"engine",
"is",
"stopping",
".",
"Removes",
"it",
"from",
"the",
"set",
"of",
"active",
"messaging",
"engines",
"and",
"closes",
"any",
"open",
"connection",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/ra/inbound/impl/SibRaEndpointActivation.java#L596-L611 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/jdbc/internal/JDBCDriverService.java | JDBCDriverService.classNotFound | private SQLException classNotFound(Object interfaceNames, Set<String> packagesSearched, String dsId, Throwable cause) {
if (cause instanceof SQLException)
return (SQLException) cause;
// TODO need an appropriate message when sharedLib is null and classes are loaded from the application
String sharedLibId = sharedLib.id();
// Determine the list of folders that should contain the JDBC driver files.
Collection<String> driverJARs = getClasspath(sharedLib, false);
String message = sharedLibId.startsWith("com.ibm.ws.jdbc.jdbcDriver-")
? AdapterUtil.getNLSMessage("DSRA4001.no.suitable.driver.nested", interfaceNames, dsId, driverJARs, packagesSearched)
: AdapterUtil.getNLSMessage("DSRA4000.no.suitable.driver", interfaceNames, dsId, sharedLibId, driverJARs, packagesSearched);
return new SQLNonTransientException(message, cause);
} | java | private SQLException classNotFound(Object interfaceNames, Set<String> packagesSearched, String dsId, Throwable cause) {
if (cause instanceof SQLException)
return (SQLException) cause;
// TODO need an appropriate message when sharedLib is null and classes are loaded from the application
String sharedLibId = sharedLib.id();
// Determine the list of folders that should contain the JDBC driver files.
Collection<String> driverJARs = getClasspath(sharedLib, false);
String message = sharedLibId.startsWith("com.ibm.ws.jdbc.jdbcDriver-")
? AdapterUtil.getNLSMessage("DSRA4001.no.suitable.driver.nested", interfaceNames, dsId, driverJARs, packagesSearched)
: AdapterUtil.getNLSMessage("DSRA4000.no.suitable.driver", interfaceNames, dsId, sharedLibId, driverJARs, packagesSearched);
return new SQLNonTransientException(message, cause);
} | [
"private",
"SQLException",
"classNotFound",
"(",
"Object",
"interfaceNames",
",",
"Set",
"<",
"String",
">",
"packagesSearched",
",",
"String",
"dsId",
",",
"Throwable",
"cause",
")",
"{",
"if",
"(",
"cause",
"instanceof",
"SQLException",
")",
"return",
"(",
"SQLException",
")",
"cause",
";",
"// TODO need an appropriate message when sharedLib is null and classes are loaded from the application",
"String",
"sharedLibId",
"=",
"sharedLib",
".",
"id",
"(",
")",
";",
"// Determine the list of folders that should contain the JDBC driver files.",
"Collection",
"<",
"String",
">",
"driverJARs",
"=",
"getClasspath",
"(",
"sharedLib",
",",
"false",
")",
";",
"String",
"message",
"=",
"sharedLibId",
".",
"startsWith",
"(",
"\"com.ibm.ws.jdbc.jdbcDriver-\"",
")",
"?",
"AdapterUtil",
".",
"getNLSMessage",
"(",
"\"DSRA4001.no.suitable.driver.nested\"",
",",
"interfaceNames",
",",
"dsId",
",",
"driverJARs",
",",
"packagesSearched",
")",
":",
"AdapterUtil",
".",
"getNLSMessage",
"(",
"\"DSRA4000.no.suitable.driver\"",
",",
"interfaceNames",
",",
"dsId",
",",
"sharedLibId",
",",
"driverJARs",
",",
"packagesSearched",
")",
";",
"return",
"new",
"SQLNonTransientException",
"(",
"message",
",",
"cause",
")",
";",
"}"
] | Returns an exception to raise when the data source class is not found.
@param interfaceNames names of data source interface(s) or java.sql.Driver for which we could not find an implementation class.
@param packagesSearched packages in or beneath which we have searched for data source implementation classes.
@param dsId identifier for the data source that is using this JDBC driver.
@param cause error that already occurred. Null if not applicable.
@return an exception to raise when the data source class is not found. | [
"Returns",
"an",
"exception",
"to",
"raise",
"when",
"the",
"data",
"source",
"class",
"is",
"not",
"found",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/jdbc/internal/JDBCDriverService.java#L206-L221 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/jdbc/internal/JDBCDriverService.java | JDBCDriverService.createConnectionPoolDataSource | public ConnectionPoolDataSource createConnectionPoolDataSource(Properties props, String dataSourceID) throws SQLException {
lock.readLock().lock();
try {
if (!isInitialized)
try {
// Switch to write lock for lazy initialization
lock.readLock().unlock();
lock.writeLock().lock();
if (!isInitialized) {
if (!loadFromApp())
classloader = AdapterUtil.getClassLoaderWithPriv(sharedLib);
isInitialized = true;
}
} finally {
// Downgrade to read lock for rest of method
lock.readLock().lock();
lock.writeLock().unlock();
}
String className = (String) properties.get(ConnectionPoolDataSource.class.getName());
if (className == null) {
String vendorPropertiesPID = props instanceof PropertyService ? ((PropertyService) props).getFactoryPID() : PropertyService.FACTORY_PID;
className = JDBCDrivers.getConnectionPoolDataSourceClassName(vendorPropertiesPID);
if (className == null) {
//if properties.oracle.ucp is configured do not search based on classname or infer because the customer has indicated
//they want to use UCP, but this will likely pick up the Oracle driver instead of the UCP driver (since UCP has no ConnectionPoolDataSource)
if("com.ibm.ws.jdbc.dataSource.properties.oracle.ucp".equals(vendorPropertiesPID)) {
throw new SQLNonTransientException(AdapterUtil.getNLSMessage("DSRA4015.no.ucp.connection.pool.datasource", dataSourceID, ConnectionPoolDataSource.class.getName()));
}
className = JDBCDrivers.getConnectionPoolDataSourceClassName(getClasspath(sharedLib, true));
if (className == null) {
Set<String> packagesSearched = new LinkedHashSet<String>();
SimpleEntry<Integer, String> dsEntry = JDBCDrivers.inferDataSourceClassFromDriver //
(classloader, packagesSearched, JDBCDrivers.CONNECTION_POOL_DATA_SOURCE);
className = dsEntry == null ? null : dsEntry.getValue();
if (className == null)
throw classNotFound(ConnectionPoolDataSource.class.getName(), packagesSearched, dataSourceID, null);
}
}
}
return create(className, props, dataSourceID);
} finally {
lock.readLock().unlock();
}
} | java | public ConnectionPoolDataSource createConnectionPoolDataSource(Properties props, String dataSourceID) throws SQLException {
lock.readLock().lock();
try {
if (!isInitialized)
try {
// Switch to write lock for lazy initialization
lock.readLock().unlock();
lock.writeLock().lock();
if (!isInitialized) {
if (!loadFromApp())
classloader = AdapterUtil.getClassLoaderWithPriv(sharedLib);
isInitialized = true;
}
} finally {
// Downgrade to read lock for rest of method
lock.readLock().lock();
lock.writeLock().unlock();
}
String className = (String) properties.get(ConnectionPoolDataSource.class.getName());
if (className == null) {
String vendorPropertiesPID = props instanceof PropertyService ? ((PropertyService) props).getFactoryPID() : PropertyService.FACTORY_PID;
className = JDBCDrivers.getConnectionPoolDataSourceClassName(vendorPropertiesPID);
if (className == null) {
//if properties.oracle.ucp is configured do not search based on classname or infer because the customer has indicated
//they want to use UCP, but this will likely pick up the Oracle driver instead of the UCP driver (since UCP has no ConnectionPoolDataSource)
if("com.ibm.ws.jdbc.dataSource.properties.oracle.ucp".equals(vendorPropertiesPID)) {
throw new SQLNonTransientException(AdapterUtil.getNLSMessage("DSRA4015.no.ucp.connection.pool.datasource", dataSourceID, ConnectionPoolDataSource.class.getName()));
}
className = JDBCDrivers.getConnectionPoolDataSourceClassName(getClasspath(sharedLib, true));
if (className == null) {
Set<String> packagesSearched = new LinkedHashSet<String>();
SimpleEntry<Integer, String> dsEntry = JDBCDrivers.inferDataSourceClassFromDriver //
(classloader, packagesSearched, JDBCDrivers.CONNECTION_POOL_DATA_SOURCE);
className = dsEntry == null ? null : dsEntry.getValue();
if (className == null)
throw classNotFound(ConnectionPoolDataSource.class.getName(), packagesSearched, dataSourceID, null);
}
}
}
return create(className, props, dataSourceID);
} finally {
lock.readLock().unlock();
}
} | [
"public",
"ConnectionPoolDataSource",
"createConnectionPoolDataSource",
"(",
"Properties",
"props",
",",
"String",
"dataSourceID",
")",
"throws",
"SQLException",
"{",
"lock",
".",
"readLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"!",
"isInitialized",
")",
"try",
"{",
"// Switch to write lock for lazy initialization",
"lock",
".",
"readLock",
"(",
")",
".",
"unlock",
"(",
")",
";",
"lock",
".",
"writeLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"if",
"(",
"!",
"isInitialized",
")",
"{",
"if",
"(",
"!",
"loadFromApp",
"(",
")",
")",
"classloader",
"=",
"AdapterUtil",
".",
"getClassLoaderWithPriv",
"(",
"sharedLib",
")",
";",
"isInitialized",
"=",
"true",
";",
"}",
"}",
"finally",
"{",
"// Downgrade to read lock for rest of method",
"lock",
".",
"readLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"lock",
".",
"writeLock",
"(",
")",
".",
"unlock",
"(",
")",
";",
"}",
"String",
"className",
"=",
"(",
"String",
")",
"properties",
".",
"get",
"(",
"ConnectionPoolDataSource",
".",
"class",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"className",
"==",
"null",
")",
"{",
"String",
"vendorPropertiesPID",
"=",
"props",
"instanceof",
"PropertyService",
"?",
"(",
"(",
"PropertyService",
")",
"props",
")",
".",
"getFactoryPID",
"(",
")",
":",
"PropertyService",
".",
"FACTORY_PID",
";",
"className",
"=",
"JDBCDrivers",
".",
"getConnectionPoolDataSourceClassName",
"(",
"vendorPropertiesPID",
")",
";",
"if",
"(",
"className",
"==",
"null",
")",
"{",
"//if properties.oracle.ucp is configured do not search based on classname or infer because the customer has indicated",
"//they want to use UCP, but this will likely pick up the Oracle driver instead of the UCP driver (since UCP has no ConnectionPoolDataSource)",
"if",
"(",
"\"com.ibm.ws.jdbc.dataSource.properties.oracle.ucp\"",
".",
"equals",
"(",
"vendorPropertiesPID",
")",
")",
"{",
"throw",
"new",
"SQLNonTransientException",
"(",
"AdapterUtil",
".",
"getNLSMessage",
"(",
"\"DSRA4015.no.ucp.connection.pool.datasource\"",
",",
"dataSourceID",
",",
"ConnectionPoolDataSource",
".",
"class",
".",
"getName",
"(",
")",
")",
")",
";",
"}",
"className",
"=",
"JDBCDrivers",
".",
"getConnectionPoolDataSourceClassName",
"(",
"getClasspath",
"(",
"sharedLib",
",",
"true",
")",
")",
";",
"if",
"(",
"className",
"==",
"null",
")",
"{",
"Set",
"<",
"String",
">",
"packagesSearched",
"=",
"new",
"LinkedHashSet",
"<",
"String",
">",
"(",
")",
";",
"SimpleEntry",
"<",
"Integer",
",",
"String",
">",
"dsEntry",
"=",
"JDBCDrivers",
".",
"inferDataSourceClassFromDriver",
"//",
"(",
"classloader",
",",
"packagesSearched",
",",
"JDBCDrivers",
".",
"CONNECTION_POOL_DATA_SOURCE",
")",
";",
"className",
"=",
"dsEntry",
"==",
"null",
"?",
"null",
":",
"dsEntry",
".",
"getValue",
"(",
")",
";",
"if",
"(",
"className",
"==",
"null",
")",
"throw",
"classNotFound",
"(",
"ConnectionPoolDataSource",
".",
"class",
".",
"getName",
"(",
")",
",",
"packagesSearched",
",",
"dataSourceID",
",",
"null",
")",
";",
"}",
"}",
"}",
"return",
"create",
"(",
"className",
",",
"props",
",",
"dataSourceID",
")",
";",
"}",
"finally",
"{",
"lock",
".",
"readLock",
"(",
")",
".",
"unlock",
"(",
")",
";",
"}",
"}"
] | Create a ConnectionPoolDataSource
@param props typed data source properties
@param dataSourceID identifier for the data source config
@return the data source
@throws SQLException if an error occurs | [
"Create",
"a",
"ConnectionPoolDataSource"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/jdbc/internal/JDBCDriverService.java#L510-L556 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/jdbc/internal/JDBCDriverService.java | JDBCDriverService.createDataSource | public DataSource createDataSource(Properties props, String dataSourceID) throws SQLException {
lock.readLock().lock();
try {
if (!isInitialized)
try {
// Switch to write lock for lazy initialization
lock.readLock().unlock();
lock.writeLock().lock();
if (!isInitialized) {
if (!loadFromApp())
classloader = AdapterUtil.getClassLoaderWithPriv(sharedLib);
isInitialized = true;
}
} finally {
// Downgrade to read lock for rest of method
lock.readLock().lock();
lock.writeLock().unlock();
}
String className = (String) properties.get(DataSource.class.getName());
if (className == null) {
String vendorPropertiesPID = props instanceof PropertyService ? ((PropertyService) props).getFactoryPID() : PropertyService.FACTORY_PID;
className = JDBCDrivers.getDataSourceClassName(vendorPropertiesPID);
if (className == null) {
className = JDBCDrivers.getDataSourceClassName(getClasspath(sharedLib, true));
if (className == null) {
Set<String> packagesSearched = new LinkedHashSet<String>();
SimpleEntry<Integer, String> dsEntry = JDBCDrivers.inferDataSourceClassFromDriver //
(classloader, packagesSearched, JDBCDrivers.DATA_SOURCE);
className = dsEntry == null ? null : dsEntry.getValue();
if (className == null)
throw classNotFound(DataSource.class.getName(), packagesSearched, dataSourceID, null);
}
}
}
return create(className, props, dataSourceID);
} finally {
lock.readLock().unlock();
}
} | java | public DataSource createDataSource(Properties props, String dataSourceID) throws SQLException {
lock.readLock().lock();
try {
if (!isInitialized)
try {
// Switch to write lock for lazy initialization
lock.readLock().unlock();
lock.writeLock().lock();
if (!isInitialized) {
if (!loadFromApp())
classloader = AdapterUtil.getClassLoaderWithPriv(sharedLib);
isInitialized = true;
}
} finally {
// Downgrade to read lock for rest of method
lock.readLock().lock();
lock.writeLock().unlock();
}
String className = (String) properties.get(DataSource.class.getName());
if (className == null) {
String vendorPropertiesPID = props instanceof PropertyService ? ((PropertyService) props).getFactoryPID() : PropertyService.FACTORY_PID;
className = JDBCDrivers.getDataSourceClassName(vendorPropertiesPID);
if (className == null) {
className = JDBCDrivers.getDataSourceClassName(getClasspath(sharedLib, true));
if (className == null) {
Set<String> packagesSearched = new LinkedHashSet<String>();
SimpleEntry<Integer, String> dsEntry = JDBCDrivers.inferDataSourceClassFromDriver //
(classloader, packagesSearched, JDBCDrivers.DATA_SOURCE);
className = dsEntry == null ? null : dsEntry.getValue();
if (className == null)
throw classNotFound(DataSource.class.getName(), packagesSearched, dataSourceID, null);
}
}
}
return create(className, props, dataSourceID);
} finally {
lock.readLock().unlock();
}
} | [
"public",
"DataSource",
"createDataSource",
"(",
"Properties",
"props",
",",
"String",
"dataSourceID",
")",
"throws",
"SQLException",
"{",
"lock",
".",
"readLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"!",
"isInitialized",
")",
"try",
"{",
"// Switch to write lock for lazy initialization",
"lock",
".",
"readLock",
"(",
")",
".",
"unlock",
"(",
")",
";",
"lock",
".",
"writeLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"if",
"(",
"!",
"isInitialized",
")",
"{",
"if",
"(",
"!",
"loadFromApp",
"(",
")",
")",
"classloader",
"=",
"AdapterUtil",
".",
"getClassLoaderWithPriv",
"(",
"sharedLib",
")",
";",
"isInitialized",
"=",
"true",
";",
"}",
"}",
"finally",
"{",
"// Downgrade to read lock for rest of method",
"lock",
".",
"readLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"lock",
".",
"writeLock",
"(",
")",
".",
"unlock",
"(",
")",
";",
"}",
"String",
"className",
"=",
"(",
"String",
")",
"properties",
".",
"get",
"(",
"DataSource",
".",
"class",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"className",
"==",
"null",
")",
"{",
"String",
"vendorPropertiesPID",
"=",
"props",
"instanceof",
"PropertyService",
"?",
"(",
"(",
"PropertyService",
")",
"props",
")",
".",
"getFactoryPID",
"(",
")",
":",
"PropertyService",
".",
"FACTORY_PID",
";",
"className",
"=",
"JDBCDrivers",
".",
"getDataSourceClassName",
"(",
"vendorPropertiesPID",
")",
";",
"if",
"(",
"className",
"==",
"null",
")",
"{",
"className",
"=",
"JDBCDrivers",
".",
"getDataSourceClassName",
"(",
"getClasspath",
"(",
"sharedLib",
",",
"true",
")",
")",
";",
"if",
"(",
"className",
"==",
"null",
")",
"{",
"Set",
"<",
"String",
">",
"packagesSearched",
"=",
"new",
"LinkedHashSet",
"<",
"String",
">",
"(",
")",
";",
"SimpleEntry",
"<",
"Integer",
",",
"String",
">",
"dsEntry",
"=",
"JDBCDrivers",
".",
"inferDataSourceClassFromDriver",
"//",
"(",
"classloader",
",",
"packagesSearched",
",",
"JDBCDrivers",
".",
"DATA_SOURCE",
")",
";",
"className",
"=",
"dsEntry",
"==",
"null",
"?",
"null",
":",
"dsEntry",
".",
"getValue",
"(",
")",
";",
"if",
"(",
"className",
"==",
"null",
")",
"throw",
"classNotFound",
"(",
"DataSource",
".",
"class",
".",
"getName",
"(",
")",
",",
"packagesSearched",
",",
"dataSourceID",
",",
"null",
")",
";",
"}",
"}",
"}",
"return",
"create",
"(",
"className",
",",
"props",
",",
"dataSourceID",
")",
";",
"}",
"finally",
"{",
"lock",
".",
"readLock",
"(",
")",
".",
"unlock",
"(",
")",
";",
"}",
"}"
] | Create a DataSource
@param props typed data source properties
@param dataSourceID identifier for the data source config
@return the data source
@throws SQLException if an error occurs | [
"Create",
"a",
"DataSource"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/jdbc/internal/JDBCDriverService.java#L566-L607 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/jdbc/internal/JDBCDriverService.java | JDBCDriverService.getDriver | public Object getDriver(String url, Properties props, String dataSourceID) throws Exception {
lock.readLock().lock();
try {
if (!isInitialized)
try {
// Switch to write lock for lazy initialization
lock.readLock().unlock();
lock.writeLock().lock();
if (!isInitialized) {
if (!loadFromApp())
classloader = AdapterUtil.getClassLoaderWithPriv(sharedLib);
isInitialized = true;
}
} finally {
// Downgrade to read lock for rest of method
lock.readLock().lock();
lock.writeLock().unlock();
}
final String className = (String) properties.get(Driver.class.getName());
if (className == null) {
String vendorPropertiesPID = props instanceof PropertyService ? ((PropertyService) props).getFactoryPID() : PropertyService.FACTORY_PID;
//if properties.oracle.ucp is configured do not search for driver impls because the customer has indicated
//they want to use UCP, but this will likely pick up the Oracle driver instead of the UCP driver (since UCP has no Driver interface)
if("com.ibm.ws.jdbc.dataSource.properties.oracle.ucp".equals(vendorPropertiesPID)) {
throw new SQLNonTransientException(AdapterUtil.getNLSMessage("DSRA4015.no.ucp.connection.pool.datasource", dataSourceID, Driver.class.getName()));
}
}
Driver driver = loadDriver(className, url, classloader, props, dataSourceID);
if (driver == null)
throw classNotFound(Driver.class.getName(), Collections.singleton("META-INF/services/java.sql.Driver"), dataSourceID, null);
return driver;
} finally {
lock.readLock().unlock();
}
} | java | public Object getDriver(String url, Properties props, String dataSourceID) throws Exception {
lock.readLock().lock();
try {
if (!isInitialized)
try {
// Switch to write lock for lazy initialization
lock.readLock().unlock();
lock.writeLock().lock();
if (!isInitialized) {
if (!loadFromApp())
classloader = AdapterUtil.getClassLoaderWithPriv(sharedLib);
isInitialized = true;
}
} finally {
// Downgrade to read lock for rest of method
lock.readLock().lock();
lock.writeLock().unlock();
}
final String className = (String) properties.get(Driver.class.getName());
if (className == null) {
String vendorPropertiesPID = props instanceof PropertyService ? ((PropertyService) props).getFactoryPID() : PropertyService.FACTORY_PID;
//if properties.oracle.ucp is configured do not search for driver impls because the customer has indicated
//they want to use UCP, but this will likely pick up the Oracle driver instead of the UCP driver (since UCP has no Driver interface)
if("com.ibm.ws.jdbc.dataSource.properties.oracle.ucp".equals(vendorPropertiesPID)) {
throw new SQLNonTransientException(AdapterUtil.getNLSMessage("DSRA4015.no.ucp.connection.pool.datasource", dataSourceID, Driver.class.getName()));
}
}
Driver driver = loadDriver(className, url, classloader, props, dataSourceID);
if (driver == null)
throw classNotFound(Driver.class.getName(), Collections.singleton("META-INF/services/java.sql.Driver"), dataSourceID, null);
return driver;
} finally {
lock.readLock().unlock();
}
} | [
"public",
"Object",
"getDriver",
"(",
"String",
"url",
",",
"Properties",
"props",
",",
"String",
"dataSourceID",
")",
"throws",
"Exception",
"{",
"lock",
".",
"readLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"!",
"isInitialized",
")",
"try",
"{",
"// Switch to write lock for lazy initialization",
"lock",
".",
"readLock",
"(",
")",
".",
"unlock",
"(",
")",
";",
"lock",
".",
"writeLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"if",
"(",
"!",
"isInitialized",
")",
"{",
"if",
"(",
"!",
"loadFromApp",
"(",
")",
")",
"classloader",
"=",
"AdapterUtil",
".",
"getClassLoaderWithPriv",
"(",
"sharedLib",
")",
";",
"isInitialized",
"=",
"true",
";",
"}",
"}",
"finally",
"{",
"// Downgrade to read lock for rest of method",
"lock",
".",
"readLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"lock",
".",
"writeLock",
"(",
")",
".",
"unlock",
"(",
")",
";",
"}",
"final",
"String",
"className",
"=",
"(",
"String",
")",
"properties",
".",
"get",
"(",
"Driver",
".",
"class",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"className",
"==",
"null",
")",
"{",
"String",
"vendorPropertiesPID",
"=",
"props",
"instanceof",
"PropertyService",
"?",
"(",
"(",
"PropertyService",
")",
"props",
")",
".",
"getFactoryPID",
"(",
")",
":",
"PropertyService",
".",
"FACTORY_PID",
";",
"//if properties.oracle.ucp is configured do not search for driver impls because the customer has indicated",
"//they want to use UCP, but this will likely pick up the Oracle driver instead of the UCP driver (since UCP has no Driver interface)",
"if",
"(",
"\"com.ibm.ws.jdbc.dataSource.properties.oracle.ucp\"",
".",
"equals",
"(",
"vendorPropertiesPID",
")",
")",
"{",
"throw",
"new",
"SQLNonTransientException",
"(",
"AdapterUtil",
".",
"getNLSMessage",
"(",
"\"DSRA4015.no.ucp.connection.pool.datasource\"",
",",
"dataSourceID",
",",
"Driver",
".",
"class",
".",
"getName",
"(",
")",
")",
")",
";",
"}",
"}",
"Driver",
"driver",
"=",
"loadDriver",
"(",
"className",
",",
"url",
",",
"classloader",
",",
"props",
",",
"dataSourceID",
")",
";",
"if",
"(",
"driver",
"==",
"null",
")",
"throw",
"classNotFound",
"(",
"Driver",
".",
"class",
".",
"getName",
"(",
")",
",",
"Collections",
".",
"singleton",
"(",
"\"META-INF/services/java.sql.Driver\"",
")",
",",
"dataSourceID",
",",
"null",
")",
";",
"return",
"driver",
";",
"}",
"finally",
"{",
"lock",
".",
"readLock",
"(",
")",
".",
"unlock",
"(",
")",
";",
"}",
"}"
] | Load the Driver instance for the specified URL.
@param url JDBC driver URL.
@return the driver
@throws Exception if an error occurs | [
"Load",
"the",
"Driver",
"instance",
"for",
"the",
"specified",
"URL",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/jdbc/internal/JDBCDriverService.java#L667-L703 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/jdbc/internal/JDBCDriverService.java | JDBCDriverService.getClasspath | public static Collection<String> getClasspath(Library sharedLib, boolean upperCaseFileNamesOnly) {
final boolean trace = TraceComponent.isAnyTracingEnabled();
if (trace && tc.isEntryEnabled())
Tr.entry(tc, "getClasspath", sharedLib);
Collection<String> classpath = new LinkedList<String>();
if (sharedLib != null && sharedLib.getFiles() != null)
for (File file : sharedLib.getFiles())
classpath.add(upperCaseFileNamesOnly ? file.getName().toUpperCase() : file.getAbsolutePath());
if (sharedLib != null && sharedLib.getFilesets() != null)
for (Fileset fileset : sharedLib.getFilesets())
for (File file : fileset.getFileset())
classpath.add(upperCaseFileNamesOnly ? file.getName().toUpperCase() : file.getAbsolutePath());
if (trace && tc.isEntryEnabled())
Tr.exit(tc, "getClasspath", classpath);
return classpath;
} | java | public static Collection<String> getClasspath(Library sharedLib, boolean upperCaseFileNamesOnly) {
final boolean trace = TraceComponent.isAnyTracingEnabled();
if (trace && tc.isEntryEnabled())
Tr.entry(tc, "getClasspath", sharedLib);
Collection<String> classpath = new LinkedList<String>();
if (sharedLib != null && sharedLib.getFiles() != null)
for (File file : sharedLib.getFiles())
classpath.add(upperCaseFileNamesOnly ? file.getName().toUpperCase() : file.getAbsolutePath());
if (sharedLib != null && sharedLib.getFilesets() != null)
for (Fileset fileset : sharedLib.getFilesets())
for (File file : fileset.getFileset())
classpath.add(upperCaseFileNamesOnly ? file.getName().toUpperCase() : file.getAbsolutePath());
if (trace && tc.isEntryEnabled())
Tr.exit(tc, "getClasspath", classpath);
return classpath;
} | [
"public",
"static",
"Collection",
"<",
"String",
">",
"getClasspath",
"(",
"Library",
"sharedLib",
",",
"boolean",
"upperCaseFileNamesOnly",
")",
"{",
"final",
"boolean",
"trace",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"if",
"(",
"trace",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"getClasspath\"",
",",
"sharedLib",
")",
";",
"Collection",
"<",
"String",
">",
"classpath",
"=",
"new",
"LinkedList",
"<",
"String",
">",
"(",
")",
";",
"if",
"(",
"sharedLib",
"!=",
"null",
"&&",
"sharedLib",
".",
"getFiles",
"(",
")",
"!=",
"null",
")",
"for",
"(",
"File",
"file",
":",
"sharedLib",
".",
"getFiles",
"(",
")",
")",
"classpath",
".",
"(",
"upperCaseFileNamesOnly",
"?",
"file",
".",
"getName",
"(",
")",
".",
"toUpperCase",
"(",
")",
":",
"file",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"if",
"(",
"sharedLib",
"!=",
"null",
"&&",
"sharedLib",
".",
"getFilesets",
"(",
")",
"!=",
"null",
")",
"for",
"(",
"Fileset",
"fileset",
":",
"sharedLib",
".",
"getFilesets",
"(",
")",
")",
"for",
"(",
"File",
"file",
":",
"fileset",
".",
"getFileset",
"(",
")",
")",
"classpath",
".",
"(",
"upperCaseFileNamesOnly",
"?",
"file",
".",
"getName",
"(",
")",
".",
"toUpperCase",
"(",
")",
":",
"file",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"if",
"(",
"trace",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"getClasspath\"",
",",
"classpath",
")",
";",
"return",
"classpath",
";",
"}"
] | Returns a list of file names for the specified library.
@param sharedLib library
@param upperCaseFileNamesOnly indicates whether or not to include file names only (not paths) and to convert the names to all upper case.
@return list of file names for the library. If the library is null, returns an empty list. | [
"Returns",
"a",
"list",
"of",
"file",
"names",
"for",
"the",
"specified",
"library",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/jdbc/internal/JDBCDriverService.java#L758-L775 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/jdbc/internal/JDBCDriverService.java | JDBCDriverService.modified | private void modified(Dictionary<String, ?> newProperties, boolean logMessage) {
final boolean trace = TraceComponent.isAnyTracingEnabled();
if (trace && tc.isEntryEnabled())
Tr.entry(this, tc, "modified", newProperties);
boolean replaced = false;
lock.writeLock().lock();
try {
if (isInitialized) {
if (classloader != null) {
if (isDerbyEmbedded.compareAndSet(true, false)) // assume false for any future usage until shown otherwise
shutdownDerbyEmbedded();
classloader = null;
}
for (Iterator<Class<? extends CommonDataSource>> it = introspectedClasses.iterator(); it.hasNext(); it.remove())
Introspector.flushFromCaches(it.next());
replaced = true;
isInitialized = false;
}
if (newProperties != null)
properties = newProperties;
} finally {
lock.writeLock().unlock();
}
if (replaced)
try {
setChanged();
notifyObservers();
} catch (Throwable x) {
FFDCFilter.processException(x, getClass().getName(), "254", this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, x.getMessage(), AdapterUtil.stackTraceToString(x));
}
if (trace && tc.isEntryEnabled())
Tr.exit(this, tc, "modified");
} | java | private void modified(Dictionary<String, ?> newProperties, boolean logMessage) {
final boolean trace = TraceComponent.isAnyTracingEnabled();
if (trace && tc.isEntryEnabled())
Tr.entry(this, tc, "modified", newProperties);
boolean replaced = false;
lock.writeLock().lock();
try {
if (isInitialized) {
if (classloader != null) {
if (isDerbyEmbedded.compareAndSet(true, false)) // assume false for any future usage until shown otherwise
shutdownDerbyEmbedded();
classloader = null;
}
for (Iterator<Class<? extends CommonDataSource>> it = introspectedClasses.iterator(); it.hasNext(); it.remove())
Introspector.flushFromCaches(it.next());
replaced = true;
isInitialized = false;
}
if (newProperties != null)
properties = newProperties;
} finally {
lock.writeLock().unlock();
}
if (replaced)
try {
setChanged();
notifyObservers();
} catch (Throwable x) {
FFDCFilter.processException(x, getClass().getName(), "254", this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, x.getMessage(), AdapterUtil.stackTraceToString(x));
}
if (trace && tc.isEntryEnabled())
Tr.exit(this, tc, "modified");
} | [
"private",
"void",
"modified",
"(",
"Dictionary",
"<",
"String",
",",
"?",
">",
"newProperties",
",",
"boolean",
"logMessage",
")",
"{",
"final",
"boolean",
"trace",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"if",
"(",
"trace",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"modified\"",
",",
"newProperties",
")",
";",
"boolean",
"replaced",
"=",
"false",
";",
"lock",
".",
"writeLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"isInitialized",
")",
"{",
"if",
"(",
"classloader",
"!=",
"null",
")",
"{",
"if",
"(",
"isDerbyEmbedded",
".",
"compareAndSet",
"(",
"true",
",",
"false",
")",
")",
"// assume false for any future usage until shown otherwise",
"shutdownDerbyEmbedded",
"(",
")",
";",
"classloader",
"=",
"null",
";",
"}",
"for",
"(",
"Iterator",
"<",
"Class",
"<",
"?",
"extends",
"CommonDataSource",
">",
">",
"it",
"=",
"introspectedClasses",
".",
"iterator",
"(",
")",
";",
"it",
".",
"hasNext",
"(",
")",
";",
"it",
".",
"remove",
"(",
")",
")",
"Introspector",
".",
"flushFromCaches",
"(",
"it",
".",
"next",
"(",
")",
")",
";",
"replaced",
"=",
"true",
";",
"isInitialized",
"=",
"false",
";",
"}",
"if",
"(",
"newProperties",
"!=",
"null",
")",
"properties",
"=",
"newProperties",
";",
"}",
"finally",
"{",
"lock",
".",
"writeLock",
"(",
")",
".",
"unlock",
"(",
")",
";",
"}",
"if",
"(",
"replaced",
")",
"try",
"{",
"setChanged",
"(",
")",
";",
"notifyObservers",
"(",
")",
";",
"}",
"catch",
"(",
"Throwable",
"x",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"x",
",",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
",",
"\"254\"",
",",
"this",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"x",
".",
"getMessage",
"(",
")",
",",
"AdapterUtil",
".",
"stackTraceToString",
"(",
"x",
")",
")",
";",
"}",
"if",
"(",
"trace",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"modified\"",
")",
";",
"}"
] | Clears the configuration of this JDBCDriverService so that it can
lazily initialize with the new configuration on next use.
@param newProperties new properties to use. Can be null if there are no changes to existing properties.
@param logMessage indicates whether or not to log a message about the update. | [
"Clears",
"the",
"configuration",
"of",
"this",
"JDBCDriverService",
"so",
"that",
"it",
"can",
"lazily",
"initialize",
"with",
"the",
"new",
"configuration",
"on",
"next",
"use",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/jdbc/internal/JDBCDriverService.java#L903-L942 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/jdbc/internal/JDBCDriverService.java | JDBCDriverService.setProperty | private static void setProperty(Object obj, PropertyDescriptor pd, String value,
boolean doTraceValue) throws Exception {
Object param = null;
String propName = pd.getName();
if (tc.isDebugEnabled()) {
if("URL".equals(propName) || "url".equals(propName)) {
Tr.debug(tc, "set " + propName + " = " + PropertyService.filterURL(value));
} else {
Tr.debug(tc, "set " + propName + " = " + (doTraceValue ? value : "******"));
}
}
java.lang.reflect.Method setter = pd.getWriteMethod();
if (setter == null)
throw new NoSuchMethodException(AdapterUtil.getNLSMessage("NO_SETTER_METHOD", propName));
Class<?> paramType = setter.getParameterTypes()[0];
if (!paramType.isPrimitive()) {
if (paramType.equals(String.class)) // the most common case: String
param = value;
else if (paramType.equals(Properties.class)) // special case: Properties
param = AdapterUtil.toProperties(value);
else if (paramType.equals(Character.class)) // special case: Character
param = Character.valueOf(value.charAt(0));
else // the generic case: any object with a single parameter String constructor
param = paramType.getConstructor(String.class).newInstance(value);
}
else if (paramType.equals(int.class))
param = Integer.valueOf(value);
else if (paramType.equals(long.class))
param = Long.valueOf(value);
else if (paramType.equals(boolean.class))
param = Boolean.valueOf(value);
else if (paramType.equals(double.class))
param = Double.valueOf(value);
else if (paramType.equals(float.class))
param = Float.valueOf(value);
else if (paramType.equals(short.class))
param = Short.valueOf(value);
else if (paramType.equals(byte.class))
param = Byte.valueOf(value);
else if (paramType.equals(char.class))
param = Character.valueOf(value.charAt(0));
setter.invoke(obj, new Object[] { param });
} | java | private static void setProperty(Object obj, PropertyDescriptor pd, String value,
boolean doTraceValue) throws Exception {
Object param = null;
String propName = pd.getName();
if (tc.isDebugEnabled()) {
if("URL".equals(propName) || "url".equals(propName)) {
Tr.debug(tc, "set " + propName + " = " + PropertyService.filterURL(value));
} else {
Tr.debug(tc, "set " + propName + " = " + (doTraceValue ? value : "******"));
}
}
java.lang.reflect.Method setter = pd.getWriteMethod();
if (setter == null)
throw new NoSuchMethodException(AdapterUtil.getNLSMessage("NO_SETTER_METHOD", propName));
Class<?> paramType = setter.getParameterTypes()[0];
if (!paramType.isPrimitive()) {
if (paramType.equals(String.class)) // the most common case: String
param = value;
else if (paramType.equals(Properties.class)) // special case: Properties
param = AdapterUtil.toProperties(value);
else if (paramType.equals(Character.class)) // special case: Character
param = Character.valueOf(value.charAt(0));
else // the generic case: any object with a single parameter String constructor
param = paramType.getConstructor(String.class).newInstance(value);
}
else if (paramType.equals(int.class))
param = Integer.valueOf(value);
else if (paramType.equals(long.class))
param = Long.valueOf(value);
else if (paramType.equals(boolean.class))
param = Boolean.valueOf(value);
else if (paramType.equals(double.class))
param = Double.valueOf(value);
else if (paramType.equals(float.class))
param = Float.valueOf(value);
else if (paramType.equals(short.class))
param = Short.valueOf(value);
else if (paramType.equals(byte.class))
param = Byte.valueOf(value);
else if (paramType.equals(char.class))
param = Character.valueOf(value.charAt(0));
setter.invoke(obj, new Object[] { param });
} | [
"private",
"static",
"void",
"setProperty",
"(",
"Object",
"obj",
",",
"PropertyDescriptor",
"pd",
",",
"String",
"value",
",",
"boolean",
"doTraceValue",
")",
"throws",
"Exception",
"{",
"Object",
"param",
"=",
"null",
";",
"String",
"propName",
"=",
"pd",
".",
"getName",
"(",
")",
";",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"if",
"(",
"\"URL\"",
".",
"equals",
"(",
"propName",
")",
"||",
"\"url\"",
".",
"equals",
"(",
"propName",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"set \"",
"+",
"propName",
"+",
"\" = \"",
"+",
"PropertyService",
".",
"filterURL",
"(",
"value",
")",
")",
";",
"}",
"else",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"set \"",
"+",
"propName",
"+",
"\" = \"",
"+",
"(",
"doTraceValue",
"?",
"value",
":",
"\"******\"",
")",
")",
";",
"}",
"}",
"java",
".",
"lang",
".",
"reflect",
".",
"Method",
"setter",
"=",
"pd",
".",
"getWriteMethod",
"(",
")",
";",
"if",
"(",
"setter",
"==",
"null",
")",
"throw",
"new",
"NoSuchMethodException",
"(",
"AdapterUtil",
".",
"getNLSMessage",
"(",
"\"NO_SETTER_METHOD\"",
",",
"propName",
")",
")",
";",
"Class",
"<",
"?",
">",
"paramType",
"=",
"setter",
".",
"getParameterTypes",
"(",
")",
"[",
"0",
"]",
";",
"if",
"(",
"!",
"paramType",
".",
"isPrimitive",
"(",
")",
")",
"{",
"if",
"(",
"paramType",
".",
"equals",
"(",
"String",
".",
"class",
")",
")",
"// the most common case: String",
"param",
"=",
"value",
";",
"else",
"if",
"(",
"paramType",
".",
"equals",
"(",
"Properties",
".",
"class",
")",
")",
"// special case: Properties",
"param",
"=",
"AdapterUtil",
".",
"toProperties",
"(",
"value",
")",
";",
"else",
"if",
"(",
"paramType",
".",
"equals",
"(",
"Character",
".",
"class",
")",
")",
"// special case: Character",
"param",
"=",
"Character",
".",
"valueOf",
"(",
"value",
".",
"charAt",
"(",
"0",
")",
")",
";",
"else",
"// the generic case: any object with a single parameter String constructor",
"param",
"=",
"paramType",
".",
"getConstructor",
"(",
"String",
".",
"class",
")",
".",
"newInstance",
"(",
"value",
")",
";",
"}",
"else",
"if",
"(",
"paramType",
".",
"equals",
"(",
"int",
".",
"class",
")",
")",
"param",
"=",
"Integer",
".",
"valueOf",
"(",
"value",
")",
";",
"else",
"if",
"(",
"paramType",
".",
"equals",
"(",
"long",
".",
"class",
")",
")",
"param",
"=",
"Long",
".",
"valueOf",
"(",
"value",
")",
";",
"else",
"if",
"(",
"paramType",
".",
"equals",
"(",
"boolean",
".",
"class",
")",
")",
"param",
"=",
"Boolean",
".",
"valueOf",
"(",
"value",
")",
";",
"else",
"if",
"(",
"paramType",
".",
"equals",
"(",
"double",
".",
"class",
")",
")",
"param",
"=",
"Double",
".",
"valueOf",
"(",
"value",
")",
";",
"else",
"if",
"(",
"paramType",
".",
"equals",
"(",
"float",
".",
"class",
")",
")",
"param",
"=",
"Float",
".",
"valueOf",
"(",
"value",
")",
";",
"else",
"if",
"(",
"paramType",
".",
"equals",
"(",
"short",
".",
"class",
")",
")",
"param",
"=",
"Short",
".",
"valueOf",
"(",
"value",
")",
";",
"else",
"if",
"(",
"paramType",
".",
"equals",
"(",
"byte",
".",
"class",
")",
")",
"param",
"=",
"Byte",
".",
"valueOf",
"(",
"value",
")",
";",
"else",
"if",
"(",
"paramType",
".",
"equals",
"(",
"char",
".",
"class",
")",
")",
"param",
"=",
"Character",
".",
"valueOf",
"(",
"value",
".",
"charAt",
"(",
"0",
")",
")",
";",
"setter",
".",
"invoke",
"(",
"obj",
",",
"new",
"Object",
"[",
"]",
"{",
"param",
"}",
")",
";",
"}"
] | Handles the setting of any property for which a public single-parameter setter exists on
the DataSource and for which the property data type is either a primitive or has a
single-parameter String constructor.
@param obj the Object to set the property on.
@param pd the PropertyDescriptor describing the property to set.
@param value a String representing the new value.
@param doTraceValue indicates if the value should be traced.
@throws Exception if an error occurs. | [
"Handles",
"the",
"setting",
"of",
"any",
"property",
"for",
"which",
"a",
"public",
"single",
"-",
"parameter",
"setter",
"exists",
"on",
"the",
"DataSource",
"and",
"for",
"which",
"the",
"property",
"data",
"type",
"is",
"either",
"a",
"primitive",
"or",
"has",
"a",
"single",
"-",
"parameter",
"String",
"constructor",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/jdbc/internal/JDBCDriverService.java#L963-L1014 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/jdbc/internal/JDBCDriverService.java | JDBCDriverService.setSharedLib | protected void setSharedLib(Library lib) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "setSharedLib", lib);
sharedLib = lib;
} | java | protected void setSharedLib(Library lib) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "setSharedLib", lib);
sharedLib = lib;
} | [
"protected",
"void",
"setSharedLib",
"(",
"Library",
"lib",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"setSharedLib\"",
",",
"lib",
")",
";",
"sharedLib",
"=",
"lib",
";",
"}"
] | Declarative Services method for setting the SharedLibrary service
@param lib the service | [
"Declarative",
"Services",
"method",
"for",
"setting",
"the",
"SharedLibrary",
"service"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/jdbc/internal/JDBCDriverService.java#L1021-L1025 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/jdbc/internal/JDBCDriverService.java | JDBCDriverService.shutdownDerbyEmbedded | private void shutdownDerbyEmbedded() {
final boolean trace = TraceComponent.isAnyTracingEnabled();
if (trace && tc.isEntryEnabled())
Tr.entry(this, tc, "shutdownDerbyEmbedded", classloader, embDerbyRefCount);
// Shut down Derby embedded if the reference count drops to 0
if (embDerbyRefCount.remove(classloader) && !embDerbyRefCount.contains(classloader))
try {
Class<?> EmbDS = AdapterUtil.forNameWithPriv("org.apache.derby.jdbc.EmbeddedDataSource40", true, classloader);
DataSource ds = (DataSource) EmbDS.newInstance();
EmbDS.getMethod("setShutdownDatabase", String.class).invoke(ds, "shutdown");
ds.getConnection().close();
if (trace && tc.isEntryEnabled())
Tr.exit(this, tc, "shutdownDerbyEmbedded");
} catch (SQLException x) {
// expected for shutdown
if (trace && tc.isEntryEnabled())
Tr.exit(this, tc, "shutdownDerbyEmbedded", x.getSQLState() + ' ' + x.getErrorCode() + ':' + x.getMessage());
} catch (Throwable x) {
// Work around Derby issue when the JVM is shutting down while Derby shutdown is requested.
if (trace && tc.isEntryEnabled())
Tr.exit(this, tc, "shutdownDerbyEmbedded", x);
}
else if (trace && tc.isEntryEnabled())
Tr.exit(this, tc, "shutdownDerbyEmbedded", false);
} | java | private void shutdownDerbyEmbedded() {
final boolean trace = TraceComponent.isAnyTracingEnabled();
if (trace && tc.isEntryEnabled())
Tr.entry(this, tc, "shutdownDerbyEmbedded", classloader, embDerbyRefCount);
// Shut down Derby embedded if the reference count drops to 0
if (embDerbyRefCount.remove(classloader) && !embDerbyRefCount.contains(classloader))
try {
Class<?> EmbDS = AdapterUtil.forNameWithPriv("org.apache.derby.jdbc.EmbeddedDataSource40", true, classloader);
DataSource ds = (DataSource) EmbDS.newInstance();
EmbDS.getMethod("setShutdownDatabase", String.class).invoke(ds, "shutdown");
ds.getConnection().close();
if (trace && tc.isEntryEnabled())
Tr.exit(this, tc, "shutdownDerbyEmbedded");
} catch (SQLException x) {
// expected for shutdown
if (trace && tc.isEntryEnabled())
Tr.exit(this, tc, "shutdownDerbyEmbedded", x.getSQLState() + ' ' + x.getErrorCode() + ':' + x.getMessage());
} catch (Throwable x) {
// Work around Derby issue when the JVM is shutting down while Derby shutdown is requested.
if (trace && tc.isEntryEnabled())
Tr.exit(this, tc, "shutdownDerbyEmbedded", x);
}
else if (trace && tc.isEntryEnabled())
Tr.exit(this, tc, "shutdownDerbyEmbedded", false);
} | [
"private",
"void",
"shutdownDerbyEmbedded",
"(",
")",
"{",
"final",
"boolean",
"trace",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"if",
"(",
"trace",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"shutdownDerbyEmbedded\"",
",",
"classloader",
",",
"embDerbyRefCount",
")",
";",
"// Shut down Derby embedded if the reference count drops to 0",
"if",
"(",
"embDerbyRefCount",
".",
"remove",
"(",
"classloader",
")",
"&&",
"!",
"embDerbyRefCount",
".",
"contains",
"(",
"classloader",
")",
")",
"try",
"{",
"Class",
"<",
"?",
">",
"EmbDS",
"=",
"AdapterUtil",
".",
"forNameWithPriv",
"(",
"\"org.apache.derby.jdbc.EmbeddedDataSource40\"",
",",
"true",
",",
"classloader",
")",
";",
"DataSource",
"ds",
"=",
"(",
"DataSource",
")",
"EmbDS",
".",
"newInstance",
"(",
")",
";",
"EmbDS",
".",
"getMethod",
"(",
"\"setShutdownDatabase\"",
",",
"String",
".",
"class",
")",
".",
"invoke",
"(",
"ds",
",",
"\"shutdown\"",
")",
";",
"ds",
".",
"getConnection",
"(",
")",
".",
"close",
"(",
")",
";",
"if",
"(",
"trace",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"shutdownDerbyEmbedded\"",
")",
";",
"}",
"catch",
"(",
"SQLException",
"x",
")",
"{",
"// expected for shutdown",
"if",
"(",
"trace",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"shutdownDerbyEmbedded\"",
",",
"x",
".",
"getSQLState",
"(",
")",
"+",
"'",
"'",
"+",
"x",
".",
"getErrorCode",
"(",
")",
"+",
"'",
"'",
"+",
"x",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"catch",
"(",
"Throwable",
"x",
")",
"{",
"// Work around Derby issue when the JVM is shutting down while Derby shutdown is requested.",
"if",
"(",
"trace",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"shutdownDerbyEmbedded\"",
",",
"x",
")",
";",
"}",
"else",
"if",
"(",
"trace",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"shutdownDerbyEmbedded\"",
",",
"false",
")",
";",
"}"
] | Shut down the Derby system if the reference count for the class loader drops to 0. | [
"Shut",
"down",
"the",
"Derby",
"system",
"if",
"the",
"reference",
"count",
"for",
"the",
"class",
"loader",
"drops",
"to",
"0",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/jdbc/internal/JDBCDriverService.java#L1030-L1055 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/jdbc/internal/JDBCDriverService.java | JDBCDriverService.unsetSharedLib | protected void unsetSharedLib(Library lib) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "unsetSharedLib", lib);
modified(null, false);
} | java | protected void unsetSharedLib(Library lib) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "unsetSharedLib", lib);
modified(null, false);
} | [
"protected",
"void",
"unsetSharedLib",
"(",
"Library",
"lib",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"unsetSharedLib\"",
",",
"lib",
")",
";",
"modified",
"(",
"null",
",",
"false",
")",
";",
"}"
] | Declarative Services method for unsetting the SharedLibrary service
@param lib the service | [
"Declarative",
"Services",
"method",
"for",
"unsetting",
"the",
"SharedLibrary",
"service"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/jdbc/internal/JDBCDriverService.java#L1069-L1073 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsMetaDataImpl.java | JmsMetaDataImpl.retrieveManifestData | private static void retrieveManifestData() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "retrieveManifestData");
try {
// Set up the defaults that will be overriden if possible.
JmsMetaDataImpl.setProblemDefaults();
Package thisPackage = Package.getPackage(packageName);
if (thisPackage != null) {
// This string will contain something like "IBM".
String tempProv = thisPackage.getImplementationVendor();
// Only set it if it is not null.
if (tempProv != null) {
JmsMetaDataImpl.provName = tempProv;
}
// d336782 rework of build level processing
//
// The format for the implementation version will depend on how the jar containing
// our package was built.
// The builds of sib.api.jmsImpl.jar will contain something like this:
// Implementation-Version: WASX.SIB [o0602.101]
// Implementation-Vendor: IBM Corp.
// However, the product is build into a larger package com.ibm.ws.sib.server.jar
// with entries in the manifest like this:
// Implementation-Version: 1.0.0
// Implementation-Vendor: IBM Corp.
//
// We parse the implementation version and if it has the former format
// we use that build level, otherwise we will use the build level
// reported by the BuildInfo class.
//
// We will set provVersion to the whole build level string,
// provMajorVersion to the 4 numbers before the dot (yyww - year and week)
// and provMinorVersion to the two or three numbers after the dot
// (build sequence)
String version = thisPackage.getImplementationVersion();
if (version != null) {
Matcher m = sibOldVersionPattern.matcher(version);
if (!(m.matches())) { // is there a valid build level in the version strng?
// NO. New format or some unknown format. Use BuildInfo class
version = "1.0.0";//BuildInfo.getBuildLevel(); //this will bever be used is the assumption -lohith //lohith liberty change
m = sibBuildLevelPattern.matcher(version); // re-match for just the build level
}
if (m.matches()) { // check again
JmsMetaDataImpl.provVersion = m.group(1); // e.g. wwwdddd.ddd
try {
JmsMetaDataImpl.provMajorVersion = Integer.valueOf(m.group(2)).intValue();
JmsMetaDataImpl.provMinorVersion = Integer.valueOf(m.group(3)).intValue();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "provMajorVersion=" + JmsMetaDataImpl.provMajorVersion + "provMinorVersion=" + JmsMetaDataImpl.provMinorVersion);
} catch (RuntimeException e2) {
// No FFDC code needed
// This exception should never happen if the regex worked properly returning numbers for group 2 and 3
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Unable to convert major or minor version number from build level " + version + " to int", e2);
}
}
else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Unable to find a valid build level in " + version);
}
}
else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Implementation version from manifest was null");
}
}
else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "The package was null - unable to retrieve information");
} //if package not null
} catch (RuntimeException e) {
// No FFDC code needed
FFDCFilter.processException(e, "com.ibm.ws.sib.api.jms.impl.JmsMetaDataImpl", "retrieveManifestData#1");
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Error retrieving manifest information", e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "retrieveManifestData");
} | java | private static void retrieveManifestData() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "retrieveManifestData");
try {
// Set up the defaults that will be overriden if possible.
JmsMetaDataImpl.setProblemDefaults();
Package thisPackage = Package.getPackage(packageName);
if (thisPackage != null) {
// This string will contain something like "IBM".
String tempProv = thisPackage.getImplementationVendor();
// Only set it if it is not null.
if (tempProv != null) {
JmsMetaDataImpl.provName = tempProv;
}
// d336782 rework of build level processing
//
// The format for the implementation version will depend on how the jar containing
// our package was built.
// The builds of sib.api.jmsImpl.jar will contain something like this:
// Implementation-Version: WASX.SIB [o0602.101]
// Implementation-Vendor: IBM Corp.
// However, the product is build into a larger package com.ibm.ws.sib.server.jar
// with entries in the manifest like this:
// Implementation-Version: 1.0.0
// Implementation-Vendor: IBM Corp.
//
// We parse the implementation version and if it has the former format
// we use that build level, otherwise we will use the build level
// reported by the BuildInfo class.
//
// We will set provVersion to the whole build level string,
// provMajorVersion to the 4 numbers before the dot (yyww - year and week)
// and provMinorVersion to the two or three numbers after the dot
// (build sequence)
String version = thisPackage.getImplementationVersion();
if (version != null) {
Matcher m = sibOldVersionPattern.matcher(version);
if (!(m.matches())) { // is there a valid build level in the version strng?
// NO. New format or some unknown format. Use BuildInfo class
version = "1.0.0";//BuildInfo.getBuildLevel(); //this will bever be used is the assumption -lohith //lohith liberty change
m = sibBuildLevelPattern.matcher(version); // re-match for just the build level
}
if (m.matches()) { // check again
JmsMetaDataImpl.provVersion = m.group(1); // e.g. wwwdddd.ddd
try {
JmsMetaDataImpl.provMajorVersion = Integer.valueOf(m.group(2)).intValue();
JmsMetaDataImpl.provMinorVersion = Integer.valueOf(m.group(3)).intValue();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "provMajorVersion=" + JmsMetaDataImpl.provMajorVersion + "provMinorVersion=" + JmsMetaDataImpl.provMinorVersion);
} catch (RuntimeException e2) {
// No FFDC code needed
// This exception should never happen if the regex worked properly returning numbers for group 2 and 3
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Unable to convert major or minor version number from build level " + version + " to int", e2);
}
}
else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Unable to find a valid build level in " + version);
}
}
else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Implementation version from manifest was null");
}
}
else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "The package was null - unable to retrieve information");
} //if package not null
} catch (RuntimeException e) {
// No FFDC code needed
FFDCFilter.processException(e, "com.ibm.ws.sib.api.jms.impl.JmsMetaDataImpl", "retrieveManifestData#1");
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Error retrieving manifest information", e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "retrieveManifestData");
} | [
"private",
"static",
"void",
"retrieveManifestData",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"retrieveManifestData\"",
")",
";",
"try",
"{",
"// Set up the defaults that will be overriden if possible.",
"JmsMetaDataImpl",
".",
"setProblemDefaults",
"(",
")",
";",
"Package",
"thisPackage",
"=",
"Package",
".",
"getPackage",
"(",
"packageName",
")",
";",
"if",
"(",
"thisPackage",
"!=",
"null",
")",
"{",
"// This string will contain something like \"IBM\".",
"String",
"tempProv",
"=",
"thisPackage",
".",
"getImplementationVendor",
"(",
")",
";",
"// Only set it if it is not null.",
"if",
"(",
"tempProv",
"!=",
"null",
")",
"{",
"JmsMetaDataImpl",
".",
"provName",
"=",
"tempProv",
";",
"}",
"// d336782 rework of build level processing",
"//",
"// The format for the implementation version will depend on how the jar containing",
"// our package was built.",
"// The builds of sib.api.jmsImpl.jar will contain something like this:",
"// Implementation-Version: WASX.SIB [o0602.101]",
"// Implementation-Vendor: IBM Corp.",
"// However, the product is build into a larger package com.ibm.ws.sib.server.jar",
"// with entries in the manifest like this:",
"// Implementation-Version: 1.0.0",
"// Implementation-Vendor: IBM Corp.",
"//",
"// We parse the implementation version and if it has the former format",
"// we use that build level, otherwise we will use the build level",
"// reported by the BuildInfo class.",
"//",
"// We will set provVersion to the whole build level string,",
"// provMajorVersion to the 4 numbers before the dot (yyww - year and week)",
"// and provMinorVersion to the two or three numbers after the dot",
"// (build sequence)",
"String",
"version",
"=",
"thisPackage",
".",
"getImplementationVersion",
"(",
")",
";",
"if",
"(",
"version",
"!=",
"null",
")",
"{",
"Matcher",
"m",
"=",
"sibOldVersionPattern",
".",
"matcher",
"(",
"version",
")",
";",
"if",
"(",
"!",
"(",
"m",
".",
"matches",
"(",
")",
")",
")",
"{",
"// is there a valid build level in the version strng?",
"// NO. New format or some unknown format. Use BuildInfo class",
"version",
"=",
"\"1.0.0\"",
";",
"//BuildInfo.getBuildLevel(); //this will bever be used is the assumption -lohith //lohith liberty change",
"m",
"=",
"sibBuildLevelPattern",
".",
"matcher",
"(",
"version",
")",
";",
"// re-match for just the build level",
"}",
"if",
"(",
"m",
".",
"matches",
"(",
")",
")",
"{",
"// check again",
"JmsMetaDataImpl",
".",
"provVersion",
"=",
"m",
".",
"group",
"(",
"1",
")",
";",
"// e.g. wwwdddd.ddd",
"try",
"{",
"JmsMetaDataImpl",
".",
"provMajorVersion",
"=",
"Integer",
".",
"valueOf",
"(",
"m",
".",
"group",
"(",
"2",
")",
")",
".",
"intValue",
"(",
")",
";",
"JmsMetaDataImpl",
".",
"provMinorVersion",
"=",
"Integer",
".",
"valueOf",
"(",
"m",
".",
"group",
"(",
"3",
")",
")",
".",
"intValue",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"provMajorVersion=\"",
"+",
"JmsMetaDataImpl",
".",
"provMajorVersion",
"+",
"\"provMinorVersion=\"",
"+",
"JmsMetaDataImpl",
".",
"provMinorVersion",
")",
";",
"}",
"catch",
"(",
"RuntimeException",
"e2",
")",
"{",
"// No FFDC code needed",
"// This exception should never happen if the regex worked properly returning numbers for group 2 and 3",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"Unable to convert major or minor version number from build level \"",
"+",
"version",
"+",
"\" to int\"",
",",
"e2",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"Unable to find a valid build level in \"",
"+",
"version",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"Implementation version from manifest was null\"",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"The package was null - unable to retrieve information\"",
")",
";",
"}",
"//if package not null",
"}",
"catch",
"(",
"RuntimeException",
"e",
")",
"{",
"// No FFDC code needed",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"\"com.ibm.ws.sib.api.jms.impl.JmsMetaDataImpl\"",
",",
"\"retrieveManifestData#1\"",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"Error retrieving manifest information\"",
",",
"e",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"retrieveManifestData\"",
")",
";",
"}"
] | This method retrieves the information stored in the jar manifest and uses
it to populate the implementation information to be returned to the user.
If the build level is not available in the manifest, the BuildInfo class
is used to get the value instead. | [
"This",
"method",
"retrieves",
"the",
"information",
"stored",
"in",
"the",
"jar",
"manifest",
"and",
"uses",
"it",
"to",
"populate",
"the",
"implementation",
"information",
"to",
"be",
"returned",
"to",
"the",
"user",
"."
] | 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/JmsMetaDataImpl.java#L184-L276 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/impl/LockedMessageEnumerationImpl.java | LockedMessageEnumerationImpl.nextLocked | public SIBusMessage nextLocked()
throws SISessionUnavailableException, SISessionDroppedException,
SIConnectionUnavailableException, SIConnectionDroppedException,
SIResourceException, SIConnectionLostException,
SIErrorException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc,"nextLocked");
JsMessage retMsg = null;
synchronized(lmeOperationMonitor)
{
checkValid();
// At this point we look at each item in the array up to end of the array for the next
// non-null item. This is because some points in the array may be null if they have been
// deleted or unlocked.
while (nextIndex != messages.length)
{
retMsg = messages[nextIndex];
nextIndex++;
if (retMsg != null) break;
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc,"nextLocked", retMsg);
return retMsg;
} | java | public SIBusMessage nextLocked()
throws SISessionUnavailableException, SISessionDroppedException,
SIConnectionUnavailableException, SIConnectionDroppedException,
SIResourceException, SIConnectionLostException,
SIErrorException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc,"nextLocked");
JsMessage retMsg = null;
synchronized(lmeOperationMonitor)
{
checkValid();
// At this point we look at each item in the array up to end of the array for the next
// non-null item. This is because some points in the array may be null if they have been
// deleted or unlocked.
while (nextIndex != messages.length)
{
retMsg = messages[nextIndex];
nextIndex++;
if (retMsg != null) break;
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc,"nextLocked", retMsg);
return retMsg;
} | [
"public",
"SIBusMessage",
"nextLocked",
"(",
")",
"throws",
"SISessionUnavailableException",
",",
"SISessionDroppedException",
",",
"SIConnectionUnavailableException",
",",
"SIConnectionDroppedException",
",",
"SIResourceException",
",",
"SIConnectionLostException",
",",
"SIErrorException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"nextLocked\"",
")",
";",
"JsMessage",
"retMsg",
"=",
"null",
";",
"synchronized",
"(",
"lmeOperationMonitor",
")",
"{",
"checkValid",
"(",
")",
";",
"// At this point we look at each item in the array up to end of the array for the next",
"// non-null item. This is because some points in the array may be null if they have been",
"// deleted or unlocked.",
"while",
"(",
"nextIndex",
"!=",
"messages",
".",
"length",
")",
"{",
"retMsg",
"=",
"messages",
"[",
"nextIndex",
"]",
";",
"nextIndex",
"++",
";",
"if",
"(",
"retMsg",
"!=",
"null",
")",
"break",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"nextLocked\"",
",",
"retMsg",
")",
";",
"return",
"retMsg",
";",
"}"
] | Returns the next available locked message in the enumeration.
A value of null is returned if there is no next message.
@see com.ibm.wsspi.sib.core.LockedMessageEnumeration#nextLocked() | [
"Returns",
"the",
"next",
"available",
"locked",
"message",
"in",
"the",
"enumeration",
".",
"A",
"value",
"of",
"null",
"is",
"returned",
"if",
"there",
"is",
"no",
"next",
"message",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/impl/LockedMessageEnumerationImpl.java#L139-L166 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/impl/LockedMessageEnumerationImpl.java | LockedMessageEnumerationImpl.unlockCurrent | public void unlockCurrent()
throws SISessionUnavailableException, SISessionDroppedException,
SIConnectionUnavailableException, SIConnectionDroppedException,
SIResourceException, SIConnectionLostException,
SIIncorrectCallException, SIMessageNotLockedException,
SIErrorException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc,"unlockCurrent");
synchronized(lmeOperationMonitor)
{
checkValid();
// If nextIndex = 0 then we are pointing at the first item, therefore unlocking the current
// is invalid. Also, if the message is null, then we must have deleted - therefore also
// invalid.
if ((nextIndex == 0) || (messages[nextIndex - 1] == null))
{
throw new SIIncorrectCallException(
nls.getFormattedMessage("LME_UNLOCK_INVALID_MSG_SICO1017", null, null)
);
}
JsMessage retMsg = messages[nextIndex - 1];
if (CommsUtils.isRecoverable(retMsg, consumerSession.getUnrecoverableReliability()))
{
convHelper.unlockSet(new SIMessageHandle[] {retMsg.getMessageHandle()});
}
messages[nextIndex - 1] = null;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc,"unlockCurrent");
} | java | public void unlockCurrent()
throws SISessionUnavailableException, SISessionDroppedException,
SIConnectionUnavailableException, SIConnectionDroppedException,
SIResourceException, SIConnectionLostException,
SIIncorrectCallException, SIMessageNotLockedException,
SIErrorException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc,"unlockCurrent");
synchronized(lmeOperationMonitor)
{
checkValid();
// If nextIndex = 0 then we are pointing at the first item, therefore unlocking the current
// is invalid. Also, if the message is null, then we must have deleted - therefore also
// invalid.
if ((nextIndex == 0) || (messages[nextIndex - 1] == null))
{
throw new SIIncorrectCallException(
nls.getFormattedMessage("LME_UNLOCK_INVALID_MSG_SICO1017", null, null)
);
}
JsMessage retMsg = messages[nextIndex - 1];
if (CommsUtils.isRecoverable(retMsg, consumerSession.getUnrecoverableReliability()))
{
convHelper.unlockSet(new SIMessageHandle[] {retMsg.getMessageHandle()});
}
messages[nextIndex - 1] = null;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc,"unlockCurrent");
} | [
"public",
"void",
"unlockCurrent",
"(",
")",
"throws",
"SISessionUnavailableException",
",",
"SISessionDroppedException",
",",
"SIConnectionUnavailableException",
",",
"SIConnectionDroppedException",
",",
"SIResourceException",
",",
"SIConnectionLostException",
",",
"SIIncorrectCallException",
",",
"SIMessageNotLockedException",
",",
"SIErrorException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"unlockCurrent\"",
")",
";",
"synchronized",
"(",
"lmeOperationMonitor",
")",
"{",
"checkValid",
"(",
")",
";",
"// If nextIndex = 0 then we are pointing at the first item, therefore unlocking the current",
"// is invalid. Also, if the message is null, then we must have deleted - therefore also",
"// invalid.",
"if",
"(",
"(",
"nextIndex",
"==",
"0",
")",
"||",
"(",
"messages",
"[",
"nextIndex",
"-",
"1",
"]",
"==",
"null",
")",
")",
"{",
"throw",
"new",
"SIIncorrectCallException",
"(",
"nls",
".",
"getFormattedMessage",
"(",
"\"LME_UNLOCK_INVALID_MSG_SICO1017\"",
",",
"null",
",",
"null",
")",
")",
";",
"}",
"JsMessage",
"retMsg",
"=",
"messages",
"[",
"nextIndex",
"-",
"1",
"]",
";",
"if",
"(",
"CommsUtils",
".",
"isRecoverable",
"(",
"retMsg",
",",
"consumerSession",
".",
"getUnrecoverableReliability",
"(",
")",
")",
")",
"{",
"convHelper",
".",
"unlockSet",
"(",
"new",
"SIMessageHandle",
"[",
"]",
"{",
"retMsg",
".",
"getMessageHandle",
"(",
")",
"}",
")",
";",
"}",
"messages",
"[",
"nextIndex",
"-",
"1",
"]",
"=",
"null",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"unlockCurrent\"",
")",
";",
"}"
] | Unlocks the current message.
@see com.ibm.wsspi.sib.core.LockedMessageEnumeration#unlockCurrent() | [
"Unlocks",
"the",
"current",
"message",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/impl/LockedMessageEnumerationImpl.java#L173-L207 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/impl/LockedMessageEnumerationImpl.java | LockedMessageEnumerationImpl.deleteCurrent | public void deleteCurrent(SITransaction transaction)
throws SISessionUnavailableException, SISessionDroppedException,
SIConnectionUnavailableException, SIConnectionDroppedException,
SIResourceException, SIConnectionLostException, SILimitExceededException,
SIIncorrectCallException, SIMessageNotLockedException,
SIErrorException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc,"deleteCurrent", transaction);
synchronized(lmeOperationMonitor)
{
checkValid();
// If nextIndex = 0 then we are pointing at the first item, therefore unlocking the current
// is invalid. Also, if the message is null, then we must have deleted - therefore also
// invalid.
if ((nextIndex == 0) || (messages[nextIndex - 1] == null))
{
throw new SIIncorrectCallException(
nls.getFormattedMessage("LME_DELETE_INVALID_MSG_SICO1018", null, null)
);
}
JsMessage retMsg = messages[nextIndex - 1];
// Only flow the delete if it would not have been done on the server already.
// This will have been done if the message is determined to be 'unrecoverable'.
if (CommsUtils.isRecoverable(retMsg, consumerSession.getUnrecoverableReliability()))
{
// Start d181719
JsMessage[] msgs = new JsMessage[] {retMsg}; // f191114
if (transaction != null)
{
synchronized (transaction)
{
// Check transaction is in a valid state.
// Enlisted for an XA UOW and not rolledback or
// completed for a local transaction.
if (!((Transaction)transaction).isValid())
{
throw new SIIncorrectCallException(
nls.getFormattedMessage("TRANSACTION_COMPLETE_SICO1022", null, null)
);
}
deleteMessages(msgs, transaction); // f191114
}
}
else
{
deleteMessages(msgs, null); // f191114
}
// End d181719
}
// Now remove it from the LME
messages[nextIndex - 1] = null;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc,"deleteCurrent");
} | java | public void deleteCurrent(SITransaction transaction)
throws SISessionUnavailableException, SISessionDroppedException,
SIConnectionUnavailableException, SIConnectionDroppedException,
SIResourceException, SIConnectionLostException, SILimitExceededException,
SIIncorrectCallException, SIMessageNotLockedException,
SIErrorException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc,"deleteCurrent", transaction);
synchronized(lmeOperationMonitor)
{
checkValid();
// If nextIndex = 0 then we are pointing at the first item, therefore unlocking the current
// is invalid. Also, if the message is null, then we must have deleted - therefore also
// invalid.
if ((nextIndex == 0) || (messages[nextIndex - 1] == null))
{
throw new SIIncorrectCallException(
nls.getFormattedMessage("LME_DELETE_INVALID_MSG_SICO1018", null, null)
);
}
JsMessage retMsg = messages[nextIndex - 1];
// Only flow the delete if it would not have been done on the server already.
// This will have been done if the message is determined to be 'unrecoverable'.
if (CommsUtils.isRecoverable(retMsg, consumerSession.getUnrecoverableReliability()))
{
// Start d181719
JsMessage[] msgs = new JsMessage[] {retMsg}; // f191114
if (transaction != null)
{
synchronized (transaction)
{
// Check transaction is in a valid state.
// Enlisted for an XA UOW and not rolledback or
// completed for a local transaction.
if (!((Transaction)transaction).isValid())
{
throw new SIIncorrectCallException(
nls.getFormattedMessage("TRANSACTION_COMPLETE_SICO1022", null, null)
);
}
deleteMessages(msgs, transaction); // f191114
}
}
else
{
deleteMessages(msgs, null); // f191114
}
// End d181719
}
// Now remove it from the LME
messages[nextIndex - 1] = null;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc,"deleteCurrent");
} | [
"public",
"void",
"deleteCurrent",
"(",
"SITransaction",
"transaction",
")",
"throws",
"SISessionUnavailableException",
",",
"SISessionDroppedException",
",",
"SIConnectionUnavailableException",
",",
"SIConnectionDroppedException",
",",
"SIResourceException",
",",
"SIConnectionLostException",
",",
"SILimitExceededException",
",",
"SIIncorrectCallException",
",",
"SIMessageNotLockedException",
",",
"SIErrorException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"deleteCurrent\"",
",",
"transaction",
")",
";",
"synchronized",
"(",
"lmeOperationMonitor",
")",
"{",
"checkValid",
"(",
")",
";",
"// If nextIndex = 0 then we are pointing at the first item, therefore unlocking the current",
"// is invalid. Also, if the message is null, then we must have deleted - therefore also",
"// invalid.",
"if",
"(",
"(",
"nextIndex",
"==",
"0",
")",
"||",
"(",
"messages",
"[",
"nextIndex",
"-",
"1",
"]",
"==",
"null",
")",
")",
"{",
"throw",
"new",
"SIIncorrectCallException",
"(",
"nls",
".",
"getFormattedMessage",
"(",
"\"LME_DELETE_INVALID_MSG_SICO1018\"",
",",
"null",
",",
"null",
")",
")",
";",
"}",
"JsMessage",
"retMsg",
"=",
"messages",
"[",
"nextIndex",
"-",
"1",
"]",
";",
"// Only flow the delete if it would not have been done on the server already.",
"// This will have been done if the message is determined to be 'unrecoverable'.",
"if",
"(",
"CommsUtils",
".",
"isRecoverable",
"(",
"retMsg",
",",
"consumerSession",
".",
"getUnrecoverableReliability",
"(",
")",
")",
")",
"{",
"// Start d181719",
"JsMessage",
"[",
"]",
"msgs",
"=",
"new",
"JsMessage",
"[",
"]",
"{",
"retMsg",
"}",
";",
"// f191114",
"if",
"(",
"transaction",
"!=",
"null",
")",
"{",
"synchronized",
"(",
"transaction",
")",
"{",
"// Check transaction is in a valid state.",
"// Enlisted for an XA UOW and not rolledback or",
"// completed for a local transaction.",
"if",
"(",
"!",
"(",
"(",
"Transaction",
")",
"transaction",
")",
".",
"isValid",
"(",
")",
")",
"{",
"throw",
"new",
"SIIncorrectCallException",
"(",
"nls",
".",
"getFormattedMessage",
"(",
"\"TRANSACTION_COMPLETE_SICO1022\"",
",",
"null",
",",
"null",
")",
")",
";",
"}",
"deleteMessages",
"(",
"msgs",
",",
"transaction",
")",
";",
"// f191114",
"}",
"}",
"else",
"{",
"deleteMessages",
"(",
"msgs",
",",
"null",
")",
";",
"// f191114",
"}",
"// End d181719",
"}",
"// Now remove it from the LME",
"messages",
"[",
"nextIndex",
"-",
"1",
"]",
"=",
"null",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"deleteCurrent\"",
")",
";",
"}"
] | Deletes the current message.
@param transaction
@see com.ibm.wsspi.sib.core.LockedMessageEnumeration#deleteCurrent(SITransaction) | [
"Deletes",
"the",
"current",
"message",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/impl/LockedMessageEnumerationImpl.java#L216-L278 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/impl/LockedMessageEnumerationImpl.java | LockedMessageEnumerationImpl.deleteSeen | public void deleteSeen(SITransaction transaction)
throws SISessionUnavailableException, SISessionDroppedException,
SIConnectionUnavailableException, SIConnectionDroppedException,
SIResourceException, SIConnectionLostException, SILimitExceededException,
SIIncorrectCallException, SIMessageNotLockedException,
SIErrorException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc,"deleteSeen", transaction);
synchronized(lmeOperationMonitor)
{
checkValid();
// If we have seen any messages....
int numSeenMsgs = getSeenMessageCount();
if (numSeenMsgs > 0)
{
// Start d181719
JsMessage[] seenRecoverableMessages = new JsMessage[numSeenMsgs];
int numOfMessagesNeedingDeleting = 0;
// Go through each seen message
for (int i=0; i < nextIndex; ++i)
{
if (messages[i] != null)
{
// Only add the message to the list of messages to delete if it is recoverable
if (CommsUtils.isRecoverable(messages[i], consumerSession.getUnrecoverableReliability())) // f177889
{ // f177889
seenRecoverableMessages[numOfMessagesNeedingDeleting] = messages[i]; // f177889
++numOfMessagesNeedingDeleting;
} // f177889
// Delete it from the main pile
messages[i] = null;
}
}
if (numOfMessagesNeedingDeleting > 0)
{
if (transaction != null)
{
synchronized (transaction)
{
// Check transaction is in a valid state.
// Enlisted for an XA UOW and not rolledback or
// completed for a local transaction.
if (!((Transaction) transaction).isValid())
{
throw new SIIncorrectCallException(
nls.getFormattedMessage("TRANSACTION_COMPLETE_SICO1022", null, null)
);
}
deleteMessages(seenRecoverableMessages, transaction);
}
}
else
{
deleteMessages(seenRecoverableMessages, null);
}
}
// End d181719
}
// End f191114
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc,"deleteSeen");
} | java | public void deleteSeen(SITransaction transaction)
throws SISessionUnavailableException, SISessionDroppedException,
SIConnectionUnavailableException, SIConnectionDroppedException,
SIResourceException, SIConnectionLostException, SILimitExceededException,
SIIncorrectCallException, SIMessageNotLockedException,
SIErrorException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc,"deleteSeen", transaction);
synchronized(lmeOperationMonitor)
{
checkValid();
// If we have seen any messages....
int numSeenMsgs = getSeenMessageCount();
if (numSeenMsgs > 0)
{
// Start d181719
JsMessage[] seenRecoverableMessages = new JsMessage[numSeenMsgs];
int numOfMessagesNeedingDeleting = 0;
// Go through each seen message
for (int i=0; i < nextIndex; ++i)
{
if (messages[i] != null)
{
// Only add the message to the list of messages to delete if it is recoverable
if (CommsUtils.isRecoverable(messages[i], consumerSession.getUnrecoverableReliability())) // f177889
{ // f177889
seenRecoverableMessages[numOfMessagesNeedingDeleting] = messages[i]; // f177889
++numOfMessagesNeedingDeleting;
} // f177889
// Delete it from the main pile
messages[i] = null;
}
}
if (numOfMessagesNeedingDeleting > 0)
{
if (transaction != null)
{
synchronized (transaction)
{
// Check transaction is in a valid state.
// Enlisted for an XA UOW and not rolledback or
// completed for a local transaction.
if (!((Transaction) transaction).isValid())
{
throw new SIIncorrectCallException(
nls.getFormattedMessage("TRANSACTION_COMPLETE_SICO1022", null, null)
);
}
deleteMessages(seenRecoverableMessages, transaction);
}
}
else
{
deleteMessages(seenRecoverableMessages, null);
}
}
// End d181719
}
// End f191114
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc,"deleteSeen");
} | [
"public",
"void",
"deleteSeen",
"(",
"SITransaction",
"transaction",
")",
"throws",
"SISessionUnavailableException",
",",
"SISessionDroppedException",
",",
"SIConnectionUnavailableException",
",",
"SIConnectionDroppedException",
",",
"SIResourceException",
",",
"SIConnectionLostException",
",",
"SILimitExceededException",
",",
"SIIncorrectCallException",
",",
"SIMessageNotLockedException",
",",
"SIErrorException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"deleteSeen\"",
",",
"transaction",
")",
";",
"synchronized",
"(",
"lmeOperationMonitor",
")",
"{",
"checkValid",
"(",
")",
";",
"// If we have seen any messages....",
"int",
"numSeenMsgs",
"=",
"getSeenMessageCount",
"(",
")",
";",
"if",
"(",
"numSeenMsgs",
">",
"0",
")",
"{",
"// Start d181719",
"JsMessage",
"[",
"]",
"seenRecoverableMessages",
"=",
"new",
"JsMessage",
"[",
"numSeenMsgs",
"]",
";",
"int",
"numOfMessagesNeedingDeleting",
"=",
"0",
";",
"// Go through each seen message",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"nextIndex",
";",
"++",
"i",
")",
"{",
"if",
"(",
"messages",
"[",
"i",
"]",
"!=",
"null",
")",
"{",
"// Only add the message to the list of messages to delete if it is recoverable",
"if",
"(",
"CommsUtils",
".",
"isRecoverable",
"(",
"messages",
"[",
"i",
"]",
",",
"consumerSession",
".",
"getUnrecoverableReliability",
"(",
")",
")",
")",
"// f177889",
"{",
"// f177889",
"seenRecoverableMessages",
"[",
"numOfMessagesNeedingDeleting",
"]",
"=",
"messages",
"[",
"i",
"]",
";",
"// f177889",
"++",
"numOfMessagesNeedingDeleting",
";",
"}",
"// f177889",
"// Delete it from the main pile",
"messages",
"[",
"i",
"]",
"=",
"null",
";",
"}",
"}",
"if",
"(",
"numOfMessagesNeedingDeleting",
">",
"0",
")",
"{",
"if",
"(",
"transaction",
"!=",
"null",
")",
"{",
"synchronized",
"(",
"transaction",
")",
"{",
"// Check transaction is in a valid state.",
"// Enlisted for an XA UOW and not rolledback or",
"// completed for a local transaction.",
"if",
"(",
"!",
"(",
"(",
"Transaction",
")",
"transaction",
")",
".",
"isValid",
"(",
")",
")",
"{",
"throw",
"new",
"SIIncorrectCallException",
"(",
"nls",
".",
"getFormattedMessage",
"(",
"\"TRANSACTION_COMPLETE_SICO1022\"",
",",
"null",
",",
"null",
")",
")",
";",
"}",
"deleteMessages",
"(",
"seenRecoverableMessages",
",",
"transaction",
")",
";",
"}",
"}",
"else",
"{",
"deleteMessages",
"(",
"seenRecoverableMessages",
",",
"null",
")",
";",
"}",
"}",
"// End d181719",
"}",
"// End f191114",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"deleteSeen\"",
")",
";",
"}"
] | Deletes all messages seen so far.
@param transaction
@see com.ibm.wsspi.sib.core.LockedMessageEnumeration#deleteSeen(SITransaction) | [
"Deletes",
"all",
"messages",
"seen",
"so",
"far",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/impl/LockedMessageEnumerationImpl.java#L286-L356 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/impl/LockedMessageEnumerationImpl.java | LockedMessageEnumerationImpl.deleteMessages | private void deleteMessages(JsMessage[] messagesToDelete, SITransaction transaction)
throws SISessionUnavailableException, SISessionDroppedException,
SIConnectionUnavailableException, SIConnectionDroppedException,
SIResourceException, SIConnectionLostException, SILimitExceededException,
SIIncorrectCallException, SIMessageNotLockedException,
SIErrorException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc,"deleteMessages");
int priority = JFapChannelConstants.PRIORITY_MEDIUM; // d178368
if (transaction != null) {
Transaction commsTransaction = (Transaction)transaction;
priority = commsTransaction.getLowestMessagePriority(); // d178368 // f181927
// Inform the transaction that our consumer session has deleted
// a recoverable message under this transaction. This means that if
// a rollback is performed (and strict rollback ordering is enabled)
// we can ensure that this message will be redelivered in order.
commsTransaction.associateConsumer(consumerSession);
}
// begin F219476.2
SIMessageHandle[] messageHandles = new SIMessageHandle[messagesToDelete.length];
for (int x = 0; x < messagesToDelete.length; x++) // f192215
{
if (messagesToDelete[x] != null)
{
messageHandles[x] = messagesToDelete[x].getMessageHandle();
}
}
convHelper.deleteMessages(messageHandles, transaction, priority); // d178368
// end F219476.2
// }
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc,"deleteMessages");
} | java | private void deleteMessages(JsMessage[] messagesToDelete, SITransaction transaction)
throws SISessionUnavailableException, SISessionDroppedException,
SIConnectionUnavailableException, SIConnectionDroppedException,
SIResourceException, SIConnectionLostException, SILimitExceededException,
SIIncorrectCallException, SIMessageNotLockedException,
SIErrorException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc,"deleteMessages");
int priority = JFapChannelConstants.PRIORITY_MEDIUM; // d178368
if (transaction != null) {
Transaction commsTransaction = (Transaction)transaction;
priority = commsTransaction.getLowestMessagePriority(); // d178368 // f181927
// Inform the transaction that our consumer session has deleted
// a recoverable message under this transaction. This means that if
// a rollback is performed (and strict rollback ordering is enabled)
// we can ensure that this message will be redelivered in order.
commsTransaction.associateConsumer(consumerSession);
}
// begin F219476.2
SIMessageHandle[] messageHandles = new SIMessageHandle[messagesToDelete.length];
for (int x = 0; x < messagesToDelete.length; x++) // f192215
{
if (messagesToDelete[x] != null)
{
messageHandles[x] = messagesToDelete[x].getMessageHandle();
}
}
convHelper.deleteMessages(messageHandles, transaction, priority); // d178368
// end F219476.2
// }
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc,"deleteMessages");
} | [
"private",
"void",
"deleteMessages",
"(",
"JsMessage",
"[",
"]",
"messagesToDelete",
",",
"SITransaction",
"transaction",
")",
"throws",
"SISessionUnavailableException",
",",
"SISessionDroppedException",
",",
"SIConnectionUnavailableException",
",",
"SIConnectionDroppedException",
",",
"SIResourceException",
",",
"SIConnectionLostException",
",",
"SILimitExceededException",
",",
"SIIncorrectCallException",
",",
"SIMessageNotLockedException",
",",
"SIErrorException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"deleteMessages\"",
")",
";",
"int",
"priority",
"=",
"JFapChannelConstants",
".",
"PRIORITY_MEDIUM",
";",
"// d178368",
"if",
"(",
"transaction",
"!=",
"null",
")",
"{",
"Transaction",
"commsTransaction",
"=",
"(",
"Transaction",
")",
"transaction",
";",
"priority",
"=",
"commsTransaction",
".",
"getLowestMessagePriority",
"(",
")",
";",
"// d178368 // f181927",
"// Inform the transaction that our consumer session has deleted",
"// a recoverable message under this transaction. This means that if",
"// a rollback is performed (and strict rollback ordering is enabled)",
"// we can ensure that this message will be redelivered in order.",
"commsTransaction",
".",
"associateConsumer",
"(",
"consumerSession",
")",
";",
"}",
"// begin F219476.2",
"SIMessageHandle",
"[",
"]",
"messageHandles",
"=",
"new",
"SIMessageHandle",
"[",
"messagesToDelete",
".",
"length",
"]",
";",
"for",
"(",
"int",
"x",
"=",
"0",
";",
"x",
"<",
"messagesToDelete",
".",
"length",
";",
"x",
"++",
")",
"// f192215",
"{",
"if",
"(",
"messagesToDelete",
"[",
"x",
"]",
"!=",
"null",
")",
"{",
"messageHandles",
"[",
"x",
"]",
"=",
"messagesToDelete",
"[",
"x",
"]",
".",
"getMessageHandle",
"(",
")",
";",
"}",
"}",
"convHelper",
".",
"deleteMessages",
"(",
"messageHandles",
",",
"transaction",
",",
"priority",
")",
";",
"// d178368",
"// end F219476.2",
"// }",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"deleteMessages\"",
")",
";",
"}"
] | This private method actually performs the delete by asking the conversation helper
to flow the request across the wire. However, this method does not obtain any locks
required to perform this operation and as such should be called by a method that does
do this.
@param messagesToDelete
@param transaction
@throws SICommsException | [
"This",
"private",
"method",
"actually",
"performs",
"the",
"delete",
"by",
"asking",
"the",
"conversation",
"helper",
"to",
"flow",
"the",
"request",
"across",
"the",
"wire",
".",
"However",
"this",
"method",
"does",
"not",
"obtain",
"any",
"locks",
"required",
"to",
"perform",
"this",
"operation",
"and",
"as",
"such",
"should",
"be",
"called",
"by",
"a",
"method",
"that",
"does",
"do",
"this",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/impl/LockedMessageEnumerationImpl.java#L371-L407 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/impl/LockedMessageEnumerationImpl.java | LockedMessageEnumerationImpl.resetCursor | public void resetCursor()
throws SISessionUnavailableException, SISessionDroppedException,
SIConnectionUnavailableException, SIConnectionDroppedException,
SIResourceException, SIConnectionLostException,
SIErrorException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc,"resetCursor");
nextIndex = 0;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc,"resetCursor");
} | java | public void resetCursor()
throws SISessionUnavailableException, SISessionDroppedException,
SIConnectionUnavailableException, SIConnectionDroppedException,
SIResourceException, SIConnectionLostException,
SIErrorException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc,"resetCursor");
nextIndex = 0;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc,"resetCursor");
} | [
"public",
"void",
"resetCursor",
"(",
")",
"throws",
"SISessionUnavailableException",
",",
"SISessionDroppedException",
",",
"SIConnectionUnavailableException",
",",
"SIConnectionDroppedException",
",",
"SIResourceException",
",",
"SIConnectionLostException",
",",
"SIErrorException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"resetCursor\"",
")",
";",
"nextIndex",
"=",
"0",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"resetCursor\"",
")",
";",
"}"
] | This method will reset the cursor and allow the LME to be traversed again. Note that any
messages that were deleted or unlocked will not be available again. | [
"This",
"method",
"will",
"reset",
"the",
"cursor",
"and",
"allow",
"the",
"LME",
"to",
"be",
"traversed",
"again",
".",
"Note",
"that",
"any",
"messages",
"that",
"were",
"deleted",
"or",
"unlocked",
"will",
"not",
"be",
"available",
"again",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/impl/LockedMessageEnumerationImpl.java#L416-L427 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/impl/LockedMessageEnumerationImpl.java | LockedMessageEnumerationImpl.getRemainingMessageCount | public int getRemainingMessageCount()
throws SISessionUnavailableException, SISessionDroppedException,
SIConnectionUnavailableException, SIConnectionDroppedException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc,"getRemainingMessageCount");
checkValid();
int remain = getUnSeenMessageCount();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc,"getRemainingMessageCount", ""+remain);
return remain;
} | java | public int getRemainingMessageCount()
throws SISessionUnavailableException, SISessionDroppedException,
SIConnectionUnavailableException, SIConnectionDroppedException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc,"getRemainingMessageCount");
checkValid();
int remain = getUnSeenMessageCount();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc,"getRemainingMessageCount", ""+remain);
return remain;
} | [
"public",
"int",
"getRemainingMessageCount",
"(",
")",
"throws",
"SISessionUnavailableException",
",",
"SISessionDroppedException",
",",
"SIConnectionUnavailableException",
",",
"SIConnectionDroppedException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"getRemainingMessageCount\"",
")",
";",
"checkValid",
"(",
")",
";",
"int",
"remain",
"=",
"getUnSeenMessageCount",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"getRemainingMessageCount\"",
",",
"\"\"",
"+",
"remain",
")",
";",
"return",
"remain",
";",
"}"
] | Returns the amount of messages left in the locked message enumeration.
@return int | [
"Returns",
"the",
"amount",
"of",
"messages",
"left",
"in",
"the",
"locked",
"message",
"enumeration",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/impl/LockedMessageEnumerationImpl.java#L435-L446 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.