repo
stringlengths 7
58
| path
stringlengths 12
218
| func_name
stringlengths 3
140
| original_string
stringlengths 73
34.1k
| language
stringclasses 1
value | code
stringlengths 73
34.1k
| code_tokens
sequence | docstring
stringlengths 3
16k
| docstring_tokens
sequence | sha
stringlengths 40
40
| url
stringlengths 105
339
| partition
stringclasses 1
value |
---|---|---|---|---|---|---|---|---|---|---|---|
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/inbound/HttpInboundLink.java | HttpInboundLink.checkIfUpgradeHeaders | private boolean checkIfUpgradeHeaders(Map<String, String> headers) {
// looking for two headers.
// connection header with a value of "upgrade"
// upgrade header with a value of "h2c"
boolean connection_upgrade = false;
boolean upgrade_h2c = false;
String headerValue = null;
Set<Entry<String, String>> headerEntrys = headers.entrySet();
for (Entry<String, String> header : headerEntrys) {
String name = header.getKey();
//check if it's an HTTP2 non-secure upgrade connection.
if (name.equalsIgnoreCase(CONSTANT_connection)) {
headerValue = header.getValue();
if (tc.isDebugEnabled()) {
Tr.debug(tc, "connection header found with value: " + headerValue);
}
if (headerValue != null && headerValue.equalsIgnoreCase(CONSTANT_connection_value)) {
if (connection_upgrade == true) {
// should not have two of these, log debug and return false
// TODO: determine if we should throw an exception here, or if this error will be dealt with in subsequent processing
if (tc.isDebugEnabled()) {
Tr.debug(tc, "malformed: second connection header found");
}
return false;
}
connection_upgrade = true;
}
}
if (name.equalsIgnoreCase(CONSTANT_upgrade)) {
headerValue = header.getValue();
if (tc.isDebugEnabled()) {
Tr.debug(tc, "upgrade header found with value: " + headerValue);
}
if (headerValue != null && headerValue.equalsIgnoreCase(CONSTANT_h2c)) {
if (upgrade_h2c == true) {
// should not have two of these, log debug and return false
// TODO: determine if we should throw an exception here, or if this error will be dealt with in subsequent processing
if (tc.isDebugEnabled()) {
Tr.debug(tc, "malformed: second upgrade header found");
}
return false;
}
upgrade_h2c = true;
}
}
}
if (connection_upgrade && upgrade_h2c) {
return true;
}
return false;
} | java | private boolean checkIfUpgradeHeaders(Map<String, String> headers) {
// looking for two headers.
// connection header with a value of "upgrade"
// upgrade header with a value of "h2c"
boolean connection_upgrade = false;
boolean upgrade_h2c = false;
String headerValue = null;
Set<Entry<String, String>> headerEntrys = headers.entrySet();
for (Entry<String, String> header : headerEntrys) {
String name = header.getKey();
//check if it's an HTTP2 non-secure upgrade connection.
if (name.equalsIgnoreCase(CONSTANT_connection)) {
headerValue = header.getValue();
if (tc.isDebugEnabled()) {
Tr.debug(tc, "connection header found with value: " + headerValue);
}
if (headerValue != null && headerValue.equalsIgnoreCase(CONSTANT_connection_value)) {
if (connection_upgrade == true) {
// should not have two of these, log debug and return false
// TODO: determine if we should throw an exception here, or if this error will be dealt with in subsequent processing
if (tc.isDebugEnabled()) {
Tr.debug(tc, "malformed: second connection header found");
}
return false;
}
connection_upgrade = true;
}
}
if (name.equalsIgnoreCase(CONSTANT_upgrade)) {
headerValue = header.getValue();
if (tc.isDebugEnabled()) {
Tr.debug(tc, "upgrade header found with value: " + headerValue);
}
if (headerValue != null && headerValue.equalsIgnoreCase(CONSTANT_h2c)) {
if (upgrade_h2c == true) {
// should not have two of these, log debug and return false
// TODO: determine if we should throw an exception here, or if this error will be dealt with in subsequent processing
if (tc.isDebugEnabled()) {
Tr.debug(tc, "malformed: second upgrade header found");
}
return false;
}
upgrade_h2c = true;
}
}
}
if (connection_upgrade && upgrade_h2c) {
return true;
}
return false;
} | [
"private",
"boolean",
"checkIfUpgradeHeaders",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"headers",
")",
"{",
"// looking for two headers.",
"// connection header with a value of \"upgrade\"",
"// upgrade header with a value of \"h2c\"",
"boolean",
"connection_upgrade",
"=",
"false",
";",
"boolean",
"upgrade_h2c",
"=",
"false",
";",
"String",
"headerValue",
"=",
"null",
";",
"Set",
"<",
"Entry",
"<",
"String",
",",
"String",
">",
">",
"headerEntrys",
"=",
"headers",
".",
"entrySet",
"(",
")",
";",
"for",
"(",
"Entry",
"<",
"String",
",",
"String",
">",
"header",
":",
"headerEntrys",
")",
"{",
"String",
"name",
"=",
"header",
".",
"getKey",
"(",
")",
";",
"//check if it's an HTTP2 non-secure upgrade connection.",
"if",
"(",
"name",
".",
"equalsIgnoreCase",
"(",
"CONSTANT_connection",
")",
")",
"{",
"headerValue",
"=",
"header",
".",
"getValue",
"(",
")",
";",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"connection header found with value: \"",
"+",
"headerValue",
")",
";",
"}",
"if",
"(",
"headerValue",
"!=",
"null",
"&&",
"headerValue",
".",
"equalsIgnoreCase",
"(",
"CONSTANT_connection_value",
")",
")",
"{",
"if",
"(",
"connection_upgrade",
"==",
"true",
")",
"{",
"// should not have two of these, log debug and return false",
"// TODO: determine if we should throw an exception here, or if this error will be dealt with in subsequent processing",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"malformed: second connection header found\"",
")",
";",
"}",
"return",
"false",
";",
"}",
"connection_upgrade",
"=",
"true",
";",
"}",
"}",
"if",
"(",
"name",
".",
"equalsIgnoreCase",
"(",
"CONSTANT_upgrade",
")",
")",
"{",
"headerValue",
"=",
"header",
".",
"getValue",
"(",
")",
";",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"upgrade header found with value: \"",
"+",
"headerValue",
")",
";",
"}",
"if",
"(",
"headerValue",
"!=",
"null",
"&&",
"headerValue",
".",
"equalsIgnoreCase",
"(",
"CONSTANT_h2c",
")",
")",
"{",
"if",
"(",
"upgrade_h2c",
"==",
"true",
")",
"{",
"// should not have two of these, log debug and return false",
"// TODO: determine if we should throw an exception here, or if this error will be dealt with in subsequent processing",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"malformed: second upgrade header found\"",
")",
";",
"}",
"return",
"false",
";",
"}",
"upgrade_h2c",
"=",
"true",
";",
"}",
"}",
"}",
"if",
"(",
"connection_upgrade",
"&&",
"upgrade_h2c",
")",
"{",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] | Determine if a map of headers contains http2 upgrade headers
@param headers a String map of http header key and value pairs
@return true if an http2 upgrade header is found | [
"Determine",
"if",
"a",
"map",
"of",
"headers",
"contains",
"http2",
"upgrade",
"headers"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/inbound/HttpInboundLink.java#L931-L983 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/asset/ESAVirtualAsset.java | ESAVirtualAsset.createLicenseProvider | @Override
protected LicenseProvider createLicenseProvider(String licenseAgreementPrefix, String licenseInformationPrefix,
String subsystemLicenseType) {
String featureLicenseAgreementPrefix = this.featureName + "/" + licenseAgreementPrefix;
String featureLicenseInformationPrefix = licenseInformationPrefix == null ? null : this.featureName + "/" + licenseInformationPrefix;
if (featureLicenseInformationPrefix == null) {
LicenseProvider lp = ZipLicenseProvider.createInstance(zip, featureLicenseAgreementPrefix);
if (lp != null)
return lp;
} else {
wlp.lib.extract.ReturnCode licenseReturnCode = ZipLicenseProvider.buildInstance(zip, featureLicenseAgreementPrefix,
featureLicenseInformationPrefix);
if (licenseReturnCode == wlp.lib.extract.ReturnCode.OK) {
// Everything is set up ok so carry on
return ZipLicenseProvider.getInstance();
}
}
// An error indicates that the IBM licenses could not be found so we can use the subsystem header
if (subsystemLicenseType != null && subsystemLicenseType.length() > 0) {
return new ThirdPartyLicenseProvider(featureDefinition.getFeatureName(), subsystemLicenseType);
}
return null;
} | java | @Override
protected LicenseProvider createLicenseProvider(String licenseAgreementPrefix, String licenseInformationPrefix,
String subsystemLicenseType) {
String featureLicenseAgreementPrefix = this.featureName + "/" + licenseAgreementPrefix;
String featureLicenseInformationPrefix = licenseInformationPrefix == null ? null : this.featureName + "/" + licenseInformationPrefix;
if (featureLicenseInformationPrefix == null) {
LicenseProvider lp = ZipLicenseProvider.createInstance(zip, featureLicenseAgreementPrefix);
if (lp != null)
return lp;
} else {
wlp.lib.extract.ReturnCode licenseReturnCode = ZipLicenseProvider.buildInstance(zip, featureLicenseAgreementPrefix,
featureLicenseInformationPrefix);
if (licenseReturnCode == wlp.lib.extract.ReturnCode.OK) {
// Everything is set up ok so carry on
return ZipLicenseProvider.getInstance();
}
}
// An error indicates that the IBM licenses could not be found so we can use the subsystem header
if (subsystemLicenseType != null && subsystemLicenseType.length() > 0) {
return new ThirdPartyLicenseProvider(featureDefinition.getFeatureName(), subsystemLicenseType);
}
return null;
} | [
"@",
"Override",
"protected",
"LicenseProvider",
"createLicenseProvider",
"(",
"String",
"licenseAgreementPrefix",
",",
"String",
"licenseInformationPrefix",
",",
"String",
"subsystemLicenseType",
")",
"{",
"String",
"featureLicenseAgreementPrefix",
"=",
"this",
".",
"featureName",
"+",
"\"/\"",
"+",
"licenseAgreementPrefix",
";",
"String",
"featureLicenseInformationPrefix",
"=",
"licenseInformationPrefix",
"==",
"null",
"?",
"null",
":",
"this",
".",
"featureName",
"+",
"\"/\"",
"+",
"licenseInformationPrefix",
";",
"if",
"(",
"featureLicenseInformationPrefix",
"==",
"null",
")",
"{",
"LicenseProvider",
"lp",
"=",
"ZipLicenseProvider",
".",
"createInstance",
"(",
"zip",
",",
"featureLicenseAgreementPrefix",
")",
";",
"if",
"(",
"lp",
"!=",
"null",
")",
"return",
"lp",
";",
"}",
"else",
"{",
"wlp",
".",
"lib",
".",
"extract",
".",
"ReturnCode",
"licenseReturnCode",
"=",
"ZipLicenseProvider",
".",
"buildInstance",
"(",
"zip",
",",
"featureLicenseAgreementPrefix",
",",
"featureLicenseInformationPrefix",
")",
";",
"if",
"(",
"licenseReturnCode",
"==",
"wlp",
".",
"lib",
".",
"extract",
".",
"ReturnCode",
".",
"OK",
")",
"{",
"// Everything is set up ok so carry on",
"return",
"ZipLicenseProvider",
".",
"getInstance",
"(",
")",
";",
"}",
"}",
"// An error indicates that the IBM licenses could not be found so we can use the subsystem header",
"if",
"(",
"subsystemLicenseType",
"!=",
"null",
"&&",
"subsystemLicenseType",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"return",
"new",
"ThirdPartyLicenseProvider",
"(",
"featureDefinition",
".",
"getFeatureName",
"(",
")",
",",
"subsystemLicenseType",
")",
";",
"}",
"return",
"null",
";",
"}"
] | will need to override | [
"will",
"need",
"to",
"override"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/asset/ESAVirtualAsset.java#L37-L59 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/store/SIMPTransactionManager.java | SIMPTransactionManager.createLocalTransaction | public LocalTransaction createLocalTransaction(boolean useSingleResourceOnly)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "createLocalTransaction");
LocalTransaction tran = null;
//Venu Removing the createLocalTransactionWithSubordinates() as it has to happen only
// in case of PEV resources
tran = transactionFactory.createLocalTransaction();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "createLocalTransaction", tran);
return tran;
} | java | public LocalTransaction createLocalTransaction(boolean useSingleResourceOnly)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "createLocalTransaction");
LocalTransaction tran = null;
//Venu Removing the createLocalTransactionWithSubordinates() as it has to happen only
// in case of PEV resources
tran = transactionFactory.createLocalTransaction();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "createLocalTransaction", tran);
return tran;
} | [
"public",
"LocalTransaction",
"createLocalTransaction",
"(",
"boolean",
"useSingleResourceOnly",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"createLocalTransaction\"",
")",
";",
"LocalTransaction",
"tran",
"=",
"null",
";",
"//Venu Removing the createLocalTransactionWithSubordinates() as it has to happen only",
"// in case of PEV resources",
"tran",
"=",
"transactionFactory",
".",
"createLocalTransaction",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"createLocalTransaction\"",
",",
"tran",
")",
";",
"return",
"tran",
";",
"}"
] | Creates a local transaction.
@return The uncoordinated transaction | [
"Creates",
"a",
"local",
"transaction",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/store/SIMPTransactionManager.java#L83-L99 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/store/SIMPTransactionManager.java | SIMPTransactionManager.createAutoCommitTransaction | public ExternalAutoCommitTransaction createAutoCommitTransaction()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "createAutoCommitTransaction");
ExternalAutoCommitTransaction transaction =
transactionFactory.createAutoCommitTransaction();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "createAutoCommitTransaction", transaction);
return transaction;
} | java | public ExternalAutoCommitTransaction createAutoCommitTransaction()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "createAutoCommitTransaction");
ExternalAutoCommitTransaction transaction =
transactionFactory.createAutoCommitTransaction();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "createAutoCommitTransaction", transaction);
return transaction;
} | [
"public",
"ExternalAutoCommitTransaction",
"createAutoCommitTransaction",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"createAutoCommitTransaction\"",
")",
";",
"ExternalAutoCommitTransaction",
"transaction",
"=",
"transactionFactory",
".",
"createAutoCommitTransaction",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"createAutoCommitTransaction\"",
",",
"transaction",
")",
";",
"return",
"transaction",
";",
"}"
] | Creates a Auto Commit Transaction
@return Transaction The auto commit transaction object | [
"Creates",
"a",
"Auto",
"Commit",
"Transaction"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/store/SIMPTransactionManager.java#L106-L118 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/store/SIMPTransactionManager.java | SIMPTransactionManager.createXAResource | public SIXAResource createXAResource(boolean useSingleResource)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "createXAResource", new Boolean(useSingleResource));
SIXAResource resource = null;
//get the message store resource
resource = transactionFactory.createXAResource();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "createXAResource", resource);
return resource;
} | java | public SIXAResource createXAResource(boolean useSingleResource)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "createXAResource", new Boolean(useSingleResource));
SIXAResource resource = null;
//get the message store resource
resource = transactionFactory.createXAResource();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "createXAResource", resource);
return resource;
} | [
"public",
"SIXAResource",
"createXAResource",
"(",
"boolean",
"useSingleResource",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"createXAResource\"",
",",
"new",
"Boolean",
"(",
"useSingleResource",
")",
")",
";",
"SIXAResource",
"resource",
"=",
"null",
";",
"//get the message store resource",
"resource",
"=",
"transactionFactory",
".",
"createXAResource",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"createXAResource\"",
",",
"resource",
")",
";",
"return",
"resource",
";",
"}"
] | Creates an XA transaction resource
@return a new XA resource | [
"Creates",
"an",
"XA",
"transaction",
"resource"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/store/SIMPTransactionManager.java#L125-L140 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/ObjectCacheUnitImpl.java | ObjectCacheUnitImpl.createObjectCache | public Object createObjectCache(String reference) {
final String methodName = "createCacheInstance()";
if (tc.isEntryEnabled())
Tr.entry(tc, methodName + " cacheName=" + reference);
CacheConfig config = ServerCache.getCacheService().getCacheInstanceConfig(reference);
if (config == null) {
// DYNA1004E=DYNA1004E: WebSphere Dynamic Cache instance named {0} can not be initialized because it is not
// configured.
// DYNA1004E.explanation=This message indicates the named WebSphere Dynamic Cache instance can not be
// initialized. The named instance is not avaliable.
// DYNA1004E.useraction=Use the WebSphere Administrative Console to configure a cache instance resource
// named {0}.
Tr.error(tc, "DYNA1004E", new Object[] { reference });
}
/*
* Sync on the WCCMConfig because multiple cache readers might have entered the createCacheInstance at the same
* time. With this sync one reader has to wait till the other has finished creating the cache instance
*/
DistributedObjectCache dCache = null;
synchronized (config) { // ADDED FOR 378973
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Entered synchronized (config) for " + config.getCacheName());
}
dCache = config.getDistributedObjectCache();
if (dCache == null) {
dCache = createDistributedObjectCache(config);
config.setDistributedObjectCache(dCache);
}
}
if (tc.isDebugEnabled()) {
Tr.debug(tc, methodName + " cacheName in=" + reference + " out=" + reference);
}
if (tc.isEntryEnabled())
Tr.exit(tc, methodName + " distributedObjectCache=" + dCache);
return dCache;
} | java | public Object createObjectCache(String reference) {
final String methodName = "createCacheInstance()";
if (tc.isEntryEnabled())
Tr.entry(tc, methodName + " cacheName=" + reference);
CacheConfig config = ServerCache.getCacheService().getCacheInstanceConfig(reference);
if (config == null) {
// DYNA1004E=DYNA1004E: WebSphere Dynamic Cache instance named {0} can not be initialized because it is not
// configured.
// DYNA1004E.explanation=This message indicates the named WebSphere Dynamic Cache instance can not be
// initialized. The named instance is not avaliable.
// DYNA1004E.useraction=Use the WebSphere Administrative Console to configure a cache instance resource
// named {0}.
Tr.error(tc, "DYNA1004E", new Object[] { reference });
}
/*
* Sync on the WCCMConfig because multiple cache readers might have entered the createCacheInstance at the same
* time. With this sync one reader has to wait till the other has finished creating the cache instance
*/
DistributedObjectCache dCache = null;
synchronized (config) { // ADDED FOR 378973
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Entered synchronized (config) for " + config.getCacheName());
}
dCache = config.getDistributedObjectCache();
if (dCache == null) {
dCache = createDistributedObjectCache(config);
config.setDistributedObjectCache(dCache);
}
}
if (tc.isDebugEnabled()) {
Tr.debug(tc, methodName + " cacheName in=" + reference + " out=" + reference);
}
if (tc.isEntryEnabled())
Tr.exit(tc, methodName + " distributedObjectCache=" + dCache);
return dCache;
} | [
"public",
"Object",
"createObjectCache",
"(",
"String",
"reference",
")",
"{",
"final",
"String",
"methodName",
"=",
"\"createCacheInstance()\"",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"methodName",
"+",
"\" cacheName=\"",
"+",
"reference",
")",
";",
"CacheConfig",
"config",
"=",
"ServerCache",
".",
"getCacheService",
"(",
")",
".",
"getCacheInstanceConfig",
"(",
"reference",
")",
";",
"if",
"(",
"config",
"==",
"null",
")",
"{",
"// DYNA1004E=DYNA1004E: WebSphere Dynamic Cache instance named {0} can not be initialized because it is not",
"// configured.",
"// DYNA1004E.explanation=This message indicates the named WebSphere Dynamic Cache instance can not be",
"// initialized. The named instance is not avaliable.",
"// DYNA1004E.useraction=Use the WebSphere Administrative Console to configure a cache instance resource",
"// named {0}.",
"Tr",
".",
"error",
"(",
"tc",
",",
"\"DYNA1004E\"",
",",
"new",
"Object",
"[",
"]",
"{",
"reference",
"}",
")",
";",
"}",
"/*\n * Sync on the WCCMConfig because multiple cache readers might have entered the createCacheInstance at the same\n * time. With this sync one reader has to wait till the other has finished creating the cache instance\n */",
"DistributedObjectCache",
"dCache",
"=",
"null",
";",
"synchronized",
"(",
"config",
")",
"{",
"// ADDED FOR 378973",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Entered synchronized (config) for \"",
"+",
"config",
".",
"getCacheName",
"(",
")",
")",
";",
"}",
"dCache",
"=",
"config",
".",
"getDistributedObjectCache",
"(",
")",
";",
"if",
"(",
"dCache",
"==",
"null",
")",
"{",
"dCache",
"=",
"createDistributedObjectCache",
"(",
"config",
")",
";",
"config",
".",
"setDistributedObjectCache",
"(",
"dCache",
")",
";",
"}",
"}",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"methodName",
"+",
"\" cacheName in=\"",
"+",
"reference",
"+",
"\" out=\"",
"+",
"reference",
")",
";",
"}",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"methodName",
"+",
"\" distributedObjectCache=\"",
"+",
"dCache",
")",
";",
"return",
"dCache",
";",
"}"
] | Create a DistributedObjectCache from a string reference. The config for the reference must already exist.
@param reference
@return The returned object can be type cast to DistributedObjectCache and will be a DistributedMap,
DistributedLockingMap or DistributedNioMap. | [
"Create",
"a",
"DistributedObjectCache",
"from",
"a",
"string",
"reference",
".",
"The",
"config",
"for",
"the",
"reference",
"must",
"already",
"exist",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/ObjectCacheUnitImpl.java#L35-L76 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/ObjectCacheUnitImpl.java | ObjectCacheUnitImpl.createDistributedObjectCache | private DistributedObjectCache createDistributedObjectCache(CacheConfig config) {
final String methodName = "createDistributedObjectCache()";
if (tc.isEntryEnabled())
Tr.entry(tc, methodName + " cacheName=" + (config != null ? config.getCacheName() : "null"));
DCache dCache = ServerCache.createCache(config.getCacheName(), config);
config.setCache(dCache);
DistributedObjectCache distributedObjectCache = null;
if (config.isEnableNioSupport()) {
distributedObjectCache = new DistributedNioMapImpl(dCache);
} else {
distributedObjectCache = new DistributedMapImpl(dCache);
}
if (tc.isEntryEnabled())
Tr.exit(tc, methodName + " distributedObjectCache=" + distributedObjectCache);
return distributedObjectCache;
} | java | private DistributedObjectCache createDistributedObjectCache(CacheConfig config) {
final String methodName = "createDistributedObjectCache()";
if (tc.isEntryEnabled())
Tr.entry(tc, methodName + " cacheName=" + (config != null ? config.getCacheName() : "null"));
DCache dCache = ServerCache.createCache(config.getCacheName(), config);
config.setCache(dCache);
DistributedObjectCache distributedObjectCache = null;
if (config.isEnableNioSupport()) {
distributedObjectCache = new DistributedNioMapImpl(dCache);
} else {
distributedObjectCache = new DistributedMapImpl(dCache);
}
if (tc.isEntryEnabled())
Tr.exit(tc, methodName + " distributedObjectCache=" + distributedObjectCache);
return distributedObjectCache;
} | [
"private",
"DistributedObjectCache",
"createDistributedObjectCache",
"(",
"CacheConfig",
"config",
")",
"{",
"final",
"String",
"methodName",
"=",
"\"createDistributedObjectCache()\"",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"methodName",
"+",
"\" cacheName=\"",
"+",
"(",
"config",
"!=",
"null",
"?",
"config",
".",
"getCacheName",
"(",
")",
":",
"\"null\"",
")",
")",
";",
"DCache",
"dCache",
"=",
"ServerCache",
".",
"createCache",
"(",
"config",
".",
"getCacheName",
"(",
")",
",",
"config",
")",
";",
"config",
".",
"setCache",
"(",
"dCache",
")",
";",
"DistributedObjectCache",
"distributedObjectCache",
"=",
"null",
";",
"if",
"(",
"config",
".",
"isEnableNioSupport",
"(",
")",
")",
"{",
"distributedObjectCache",
"=",
"new",
"DistributedNioMapImpl",
"(",
"dCache",
")",
";",
"}",
"else",
"{",
"distributedObjectCache",
"=",
"new",
"DistributedMapImpl",
"(",
"dCache",
")",
";",
"}",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"methodName",
"+",
"\" distributedObjectCache=\"",
"+",
"distributedObjectCache",
")",
";",
"return",
"distributedObjectCache",
";",
"}"
] | Create a DistributedObjectCache from a cacheConfig object.
Entry ( only call this method once per cache name ) config != null config.distributedObjectCache == null Exit
newly created DistributedObjectCache
@param config
@return The returned object will be a DistributedMap, DistributedLockingMap or DistributedNioMap. | [
"Create",
"a",
"DistributedObjectCache",
"from",
"a",
"cacheConfig",
"object",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/ObjectCacheUnitImpl.java#L89-L107 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/ObjectCacheUnitImpl.java | ObjectCacheUnitImpl.createEventSource | public EventSource createEventSource(boolean createAsyncEventSource, String cacheName) {
EventSource eventSource = new DCEventSource(cacheName, createAsyncEventSource);
if (tc.isDebugEnabled())
Tr.debug(tc, "Using caller thread context for callback - cacheName= " + cacheName);
return eventSource;
} | java | public EventSource createEventSource(boolean createAsyncEventSource, String cacheName) {
EventSource eventSource = new DCEventSource(cacheName, createAsyncEventSource);
if (tc.isDebugEnabled())
Tr.debug(tc, "Using caller thread context for callback - cacheName= " + cacheName);
return eventSource;
} | [
"public",
"EventSource",
"createEventSource",
"(",
"boolean",
"createAsyncEventSource",
",",
"String",
"cacheName",
")",
"{",
"EventSource",
"eventSource",
"=",
"new",
"DCEventSource",
"(",
"cacheName",
",",
"createAsyncEventSource",
")",
";",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Using caller thread context for callback - cacheName= \"",
"+",
"cacheName",
")",
";",
"return",
"eventSource",
";",
"}"
] | This implements the method in the ServletCacheUnit interface. This method is used to initialize event source for
invalidation listener
@param createAsyncEventSource
boolean true - using async thread context for callback; false - using caller thread for callback
@param cacheName
The cache name
@return EventSourceIntf The event source | [
"This",
"implements",
"the",
"method",
"in",
"the",
"ServletCacheUnit",
"interface",
".",
"This",
"method",
"is",
"used",
"to",
"initialize",
"event",
"source",
"for",
"invalidation",
"listener"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/ObjectCacheUnitImpl.java#L121-L128 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/JNDIEnvironmentRefBindingHelper.java | JNDIEnvironmentRefBindingHelper.createAllBindingsMap | public static Map<JNDIEnvironmentRefType, Map<String, String>> createAllBindingsMap() {
Map<JNDIEnvironmentRefType, Map<String, String>> allBindings = new EnumMap<JNDIEnvironmentRefType, Map<String, String>>(JNDIEnvironmentRefType.class);
for (JNDIEnvironmentRefType refType : JNDIEnvironmentRefType.VALUES) {
if (refType.getBindingElementName() != null) {
allBindings.put(refType, new HashMap<String, String>());
}
}
return allBindings;
} | java | public static Map<JNDIEnvironmentRefType, Map<String, String>> createAllBindingsMap() {
Map<JNDIEnvironmentRefType, Map<String, String>> allBindings = new EnumMap<JNDIEnvironmentRefType, Map<String, String>>(JNDIEnvironmentRefType.class);
for (JNDIEnvironmentRefType refType : JNDIEnvironmentRefType.VALUES) {
if (refType.getBindingElementName() != null) {
allBindings.put(refType, new HashMap<String, String>());
}
}
return allBindings;
} | [
"public",
"static",
"Map",
"<",
"JNDIEnvironmentRefType",
",",
"Map",
"<",
"String",
",",
"String",
">",
">",
"createAllBindingsMap",
"(",
")",
"{",
"Map",
"<",
"JNDIEnvironmentRefType",
",",
"Map",
"<",
"String",
",",
"String",
">",
">",
"allBindings",
"=",
"new",
"EnumMap",
"<",
"JNDIEnvironmentRefType",
",",
"Map",
"<",
"String",
",",
"String",
">",
">",
"(",
"JNDIEnvironmentRefType",
".",
"class",
")",
";",
"for",
"(",
"JNDIEnvironmentRefType",
"refType",
":",
"JNDIEnvironmentRefType",
".",
"VALUES",
")",
"{",
"if",
"(",
"refType",
".",
"getBindingElementName",
"(",
")",
"!=",
"null",
")",
"{",
"allBindings",
".",
"put",
"(",
"refType",
",",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
")",
";",
"}",
"}",
"return",
"allBindings",
";",
"}"
] | Create a new map for holding all JNDIEnvironmentRef bindings. | [
"Create",
"a",
"new",
"map",
"for",
"holding",
"all",
"JNDIEnvironmentRef",
"bindings",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/JNDIEnvironmentRefBindingHelper.java#L23-L31 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/JNDIEnvironmentRefBindingHelper.java | JNDIEnvironmentRefBindingHelper.setAllBndAndExt | public static void setAllBndAndExt(ComponentNameSpaceConfiguration compNSConfig,
Map<JNDIEnvironmentRefType, Map<String, String>> allBindings,
Map<String, String> envEntryValues,
ResourceRefConfigList resRefList) {
for (JNDIEnvironmentRefType refType : JNDIEnvironmentRefType.VALUES) {
if (refType.getBindingElementName() != null) {
compNSConfig.setJNDIEnvironmentRefBindings(refType.getType(), allBindings.get(refType));
}
}
compNSConfig.setEnvEntryValues(envEntryValues);
compNSConfig.setResourceRefConfigList(resRefList);
} | java | public static void setAllBndAndExt(ComponentNameSpaceConfiguration compNSConfig,
Map<JNDIEnvironmentRefType, Map<String, String>> allBindings,
Map<String, String> envEntryValues,
ResourceRefConfigList resRefList) {
for (JNDIEnvironmentRefType refType : JNDIEnvironmentRefType.VALUES) {
if (refType.getBindingElementName() != null) {
compNSConfig.setJNDIEnvironmentRefBindings(refType.getType(), allBindings.get(refType));
}
}
compNSConfig.setEnvEntryValues(envEntryValues);
compNSConfig.setResourceRefConfigList(resRefList);
} | [
"public",
"static",
"void",
"setAllBndAndExt",
"(",
"ComponentNameSpaceConfiguration",
"compNSConfig",
",",
"Map",
"<",
"JNDIEnvironmentRefType",
",",
"Map",
"<",
"String",
",",
"String",
">",
">",
"allBindings",
",",
"Map",
"<",
"String",
",",
"String",
">",
"envEntryValues",
",",
"ResourceRefConfigList",
"resRefList",
")",
"{",
"for",
"(",
"JNDIEnvironmentRefType",
"refType",
":",
"JNDIEnvironmentRefType",
".",
"VALUES",
")",
"{",
"if",
"(",
"refType",
".",
"getBindingElementName",
"(",
")",
"!=",
"null",
")",
"{",
"compNSConfig",
".",
"setJNDIEnvironmentRefBindings",
"(",
"refType",
".",
"getType",
"(",
")",
",",
"allBindings",
".",
"get",
"(",
"refType",
")",
")",
";",
"}",
"}",
"compNSConfig",
".",
"setEnvEntryValues",
"(",
"envEntryValues",
")",
";",
"compNSConfig",
".",
"setResourceRefConfigList",
"(",
"resRefList",
")",
";",
"}"
] | Update a ComponentNameSpaceConfiguration object with processed binding
and extension metadata.
@param compNSConfig the configuration to update
@param allBindings the map of all bindings
@param envEntryValues the env-entry value bindings map
@param resRefList the resource-ref binding and extension list | [
"Update",
"a",
"ComponentNameSpaceConfiguration",
"object",
"with",
"processed",
"binding",
"and",
"extension",
"metadata",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/JNDIEnvironmentRefBindingHelper.java#L42-L54 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer/src/com/ibm/websphere/servlet/filter/ServletChain.java | ServletChain.chainRequestDispatchers | public static void chainRequestDispatchers(RequestDispatcher[] dispatchers, HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException{
for(int i=0; i<dispatchers.length-1; i++) {
ChainedResponse chainedResp = new ChainedResponse(request, response);
dispatchers[i].forward(request, chainedResp);
request = chainedResp.getChainedRequest();
}
dispatchers[dispatchers.length-1].forward(request, response);
} | java | public static void chainRequestDispatchers(RequestDispatcher[] dispatchers, HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException{
for(int i=0; i<dispatchers.length-1; i++) {
ChainedResponse chainedResp = new ChainedResponse(request, response);
dispatchers[i].forward(request, chainedResp);
request = chainedResp.getChainedRequest();
}
dispatchers[dispatchers.length-1].forward(request, response);
} | [
"public",
"static",
"void",
"chainRequestDispatchers",
"(",
"RequestDispatcher",
"[",
"]",
"dispatchers",
",",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
")",
"throws",
"IOException",
",",
"ServletException",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"dispatchers",
".",
"length",
"-",
"1",
";",
"i",
"++",
")",
"{",
"ChainedResponse",
"chainedResp",
"=",
"new",
"ChainedResponse",
"(",
"request",
",",
"response",
")",
";",
"dispatchers",
"[",
"i",
"]",
".",
"forward",
"(",
"request",
",",
"chainedResp",
")",
";",
"request",
"=",
"chainedResp",
".",
"getChainedRequest",
"(",
")",
";",
"}",
"dispatchers",
"[",
"dispatchers",
".",
"length",
"-",
"1",
"]",
".",
"forward",
"(",
"request",
",",
"response",
")",
";",
"}"
] | Chain the responses of a set of request dispatchers together. | [
"Chain",
"the",
"responses",
"of",
"a",
"set",
"of",
"request",
"dispatchers",
"together",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/websphere/servlet/filter/ServletChain.java#L192-L200 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.persistence.mbean/src/com/ibm/ws/persistence/mbean/internal/DDLGenerationMBeanImpl.java | DDLGenerationMBeanImpl.setGenerator | @Reference(name = KEY_GENERATOR, service = DDLGenerationParticipant.class, policy = ReferencePolicy.DYNAMIC, cardinality = ReferenceCardinality.MULTIPLE)
protected void setGenerator(ServiceReference<DDLGenerationParticipant> ref) {
generators.addReference(ref);
} | java | @Reference(name = KEY_GENERATOR, service = DDLGenerationParticipant.class, policy = ReferencePolicy.DYNAMIC, cardinality = ReferenceCardinality.MULTIPLE)
protected void setGenerator(ServiceReference<DDLGenerationParticipant> ref) {
generators.addReference(ref);
} | [
"@",
"Reference",
"(",
"name",
"=",
"KEY_GENERATOR",
",",
"service",
"=",
"DDLGenerationParticipant",
".",
"class",
",",
"policy",
"=",
"ReferencePolicy",
".",
"DYNAMIC",
",",
"cardinality",
"=",
"ReferenceCardinality",
".",
"MULTIPLE",
")",
"protected",
"void",
"setGenerator",
"(",
"ServiceReference",
"<",
"DDLGenerationParticipant",
">",
"ref",
")",
"{",
"generators",
".",
"addReference",
"(",
"ref",
")",
";",
"}"
] | Method which registers a DDL generator. All OSGi services providing this
interface will be set here. | [
"Method",
"which",
"registers",
"a",
"DDL",
"generator",
".",
"All",
"OSGi",
"services",
"providing",
"this",
"interface",
"will",
"be",
"set",
"here",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.persistence.mbean/src/com/ibm/ws/persistence/mbean/internal/DDLGenerationMBeanImpl.java#L78-L81 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.persistence.mbean/src/com/ibm/ws/persistence/mbean/internal/DDLGenerationMBeanImpl.java | DDLGenerationMBeanImpl.generateDDL | @Override
synchronized public Map<String, Serializable> generateDDL() {
Map<String, Serializable> returnMap = new HashMap<String, Serializable>();
WsResource ddlOutputDirectory = locationService.get().resolveResource(OUTPUT_DIR);
if (ddlOutputDirectory.exists() == false) {
ddlOutputDirectory.create();
}
// Try to put the canonical path to the DDL output directory in the results.
// If we can't, then put the symbolic name.
try {
returnMap.put(OUTPUT_DIRECTORY, ddlOutputDirectory.asFile().getCanonicalPath());
} catch (IOException ioe) {
returnMap.put(OUTPUT_DIRECTORY, OUTPUT_DIR);
}
boolean success = true;
int fileCount = 0;
Map<String, DDLGenerationParticipant> participants = new HashMap<String, DDLGenerationParticipant>();
Iterator<ServiceAndServiceReferencePair<DDLGenerationParticipant>> i = generators.getServicesWithReferences();
while (i.hasNext()) {
// We'll request the DDL be written to a file whose name is chosen by the component providing the service.
ServiceAndServiceReferencePair<DDLGenerationParticipant> generatorPair = i.next();
DDLGenerationParticipant generator = generatorPair.getService();
String rawId = generator.getDDLFileName();
// Remove any restricted characters from the file name, and make sure
// that the resulting string is not empty. If it's empty, supply a
// default name.
String id = (rawId != null) ? PathUtils.replaceRestrictedCharactersInFileName(rawId) : null;
if ((id == null) || (id.length() == 0)) {
throw new IllegalArgumentException("Service " + generator.toString() + " DDL file name: " + rawId);
}
participants.put(id, generator);
}
for (Map.Entry<String, DDLGenerationParticipant> entry : participants.entrySet()) {
String id = entry.getKey();
DDLGenerationParticipant participant = entry.getValue();
// The path to the file is in the server's output directory.
WsResource ddlOutputResource = locationService.get().resolveResource(OUTPUT_DIR + id + ".ddl");
if (ddlOutputResource.exists() == false) {
ddlOutputResource.create();
}
// Use the text file output stream factory to create the file so that
// it is readable on distributed and z/OS platforms. Overwrite the
// file if it already exists. We have to specify the encoding explicitly
// on the OutputStreamWriter or Findbugs gets upset. We always specify
// UTF-8 because the output DDL might have UNICODE characters. We use
// a TextFileOutputStreamFactory in an attempt to make the file readable
// on z/OS. The file will be tagged as 'ISO8859-1' on z/OS, allowing at
// least some of the characters to be printable. The z/OS chtag command
// does not appear to honor 'UTF-8' as an encoding, even though iconv
// supports it. The data on the disk will be correct in any case, the
// customer may need to FTP it to a distributed machine, or use iconv,
// to be able to view the data.
try {
TextFileOutputStreamFactory f = TrConfigurator.getFileOutputStreamFactory();
OutputStream os = f.createOutputStream(ddlOutputResource.asFile(), false);
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(os, "UTF-8"));
participant.generate(bw);
// The JPA code may close the stream for us. Just make sure it's
// closed so that we flush any data out.
bw.close();
fileCount++;
} catch (Throwable t) {
// We'll get an FFDC here... indicate that we had trouble.
success = false;
}
}
returnMap.put(SUCCESS, Boolean.valueOf(success));
returnMap.put(FILE_COUNT, Integer.valueOf(fileCount));
return returnMap;
} | java | @Override
synchronized public Map<String, Serializable> generateDDL() {
Map<String, Serializable> returnMap = new HashMap<String, Serializable>();
WsResource ddlOutputDirectory = locationService.get().resolveResource(OUTPUT_DIR);
if (ddlOutputDirectory.exists() == false) {
ddlOutputDirectory.create();
}
// Try to put the canonical path to the DDL output directory in the results.
// If we can't, then put the symbolic name.
try {
returnMap.put(OUTPUT_DIRECTORY, ddlOutputDirectory.asFile().getCanonicalPath());
} catch (IOException ioe) {
returnMap.put(OUTPUT_DIRECTORY, OUTPUT_DIR);
}
boolean success = true;
int fileCount = 0;
Map<String, DDLGenerationParticipant> participants = new HashMap<String, DDLGenerationParticipant>();
Iterator<ServiceAndServiceReferencePair<DDLGenerationParticipant>> i = generators.getServicesWithReferences();
while (i.hasNext()) {
// We'll request the DDL be written to a file whose name is chosen by the component providing the service.
ServiceAndServiceReferencePair<DDLGenerationParticipant> generatorPair = i.next();
DDLGenerationParticipant generator = generatorPair.getService();
String rawId = generator.getDDLFileName();
// Remove any restricted characters from the file name, and make sure
// that the resulting string is not empty. If it's empty, supply a
// default name.
String id = (rawId != null) ? PathUtils.replaceRestrictedCharactersInFileName(rawId) : null;
if ((id == null) || (id.length() == 0)) {
throw new IllegalArgumentException("Service " + generator.toString() + " DDL file name: " + rawId);
}
participants.put(id, generator);
}
for (Map.Entry<String, DDLGenerationParticipant> entry : participants.entrySet()) {
String id = entry.getKey();
DDLGenerationParticipant participant = entry.getValue();
// The path to the file is in the server's output directory.
WsResource ddlOutputResource = locationService.get().resolveResource(OUTPUT_DIR + id + ".ddl");
if (ddlOutputResource.exists() == false) {
ddlOutputResource.create();
}
// Use the text file output stream factory to create the file so that
// it is readable on distributed and z/OS platforms. Overwrite the
// file if it already exists. We have to specify the encoding explicitly
// on the OutputStreamWriter or Findbugs gets upset. We always specify
// UTF-8 because the output DDL might have UNICODE characters. We use
// a TextFileOutputStreamFactory in an attempt to make the file readable
// on z/OS. The file will be tagged as 'ISO8859-1' on z/OS, allowing at
// least some of the characters to be printable. The z/OS chtag command
// does not appear to honor 'UTF-8' as an encoding, even though iconv
// supports it. The data on the disk will be correct in any case, the
// customer may need to FTP it to a distributed machine, or use iconv,
// to be able to view the data.
try {
TextFileOutputStreamFactory f = TrConfigurator.getFileOutputStreamFactory();
OutputStream os = f.createOutputStream(ddlOutputResource.asFile(), false);
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(os, "UTF-8"));
participant.generate(bw);
// The JPA code may close the stream for us. Just make sure it's
// closed so that we flush any data out.
bw.close();
fileCount++;
} catch (Throwable t) {
// We'll get an FFDC here... indicate that we had trouble.
success = false;
}
}
returnMap.put(SUCCESS, Boolean.valueOf(success));
returnMap.put(FILE_COUNT, Integer.valueOf(fileCount));
return returnMap;
} | [
"@",
"Override",
"synchronized",
"public",
"Map",
"<",
"String",
",",
"Serializable",
">",
"generateDDL",
"(",
")",
"{",
"Map",
"<",
"String",
",",
"Serializable",
">",
"returnMap",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Serializable",
">",
"(",
")",
";",
"WsResource",
"ddlOutputDirectory",
"=",
"locationService",
".",
"get",
"(",
")",
".",
"resolveResource",
"(",
"OUTPUT_DIR",
")",
";",
"if",
"(",
"ddlOutputDirectory",
".",
"exists",
"(",
")",
"==",
"false",
")",
"{",
"ddlOutputDirectory",
".",
"create",
"(",
")",
";",
"}",
"// Try to put the canonical path to the DDL output directory in the results. ",
"// If we can't, then put the symbolic name.",
"try",
"{",
"returnMap",
".",
"put",
"(",
"OUTPUT_DIRECTORY",
",",
"ddlOutputDirectory",
".",
"asFile",
"(",
")",
".",
"getCanonicalPath",
"(",
")",
")",
";",
"}",
"catch",
"(",
"IOException",
"ioe",
")",
"{",
"returnMap",
".",
"put",
"(",
"OUTPUT_DIRECTORY",
",",
"OUTPUT_DIR",
")",
";",
"}",
"boolean",
"success",
"=",
"true",
";",
"int",
"fileCount",
"=",
"0",
";",
"Map",
"<",
"String",
",",
"DDLGenerationParticipant",
">",
"participants",
"=",
"new",
"HashMap",
"<",
"String",
",",
"DDLGenerationParticipant",
">",
"(",
")",
";",
"Iterator",
"<",
"ServiceAndServiceReferencePair",
"<",
"DDLGenerationParticipant",
">",
">",
"i",
"=",
"generators",
".",
"getServicesWithReferences",
"(",
")",
";",
"while",
"(",
"i",
".",
"hasNext",
"(",
")",
")",
"{",
"// We'll request the DDL be written to a file whose name is chosen by the component providing the service.",
"ServiceAndServiceReferencePair",
"<",
"DDLGenerationParticipant",
">",
"generatorPair",
"=",
"i",
".",
"next",
"(",
")",
";",
"DDLGenerationParticipant",
"generator",
"=",
"generatorPair",
".",
"getService",
"(",
")",
";",
"String",
"rawId",
"=",
"generator",
".",
"getDDLFileName",
"(",
")",
";",
"// Remove any restricted characters from the file name, and make sure",
"// that the resulting string is not empty. If it's empty, supply a",
"// default name.",
"String",
"id",
"=",
"(",
"rawId",
"!=",
"null",
")",
"?",
"PathUtils",
".",
"replaceRestrictedCharactersInFileName",
"(",
"rawId",
")",
":",
"null",
";",
"if",
"(",
"(",
"id",
"==",
"null",
")",
"||",
"(",
"id",
".",
"length",
"(",
")",
"==",
"0",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Service \"",
"+",
"generator",
".",
"toString",
"(",
")",
"+",
"\" DDL file name: \"",
"+",
"rawId",
")",
";",
"}",
"participants",
".",
"put",
"(",
"id",
",",
"generator",
")",
";",
"}",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"DDLGenerationParticipant",
">",
"entry",
":",
"participants",
".",
"entrySet",
"(",
")",
")",
"{",
"String",
"id",
"=",
"entry",
".",
"getKey",
"(",
")",
";",
"DDLGenerationParticipant",
"participant",
"=",
"entry",
".",
"getValue",
"(",
")",
";",
"// The path to the file is in the server's output directory.",
"WsResource",
"ddlOutputResource",
"=",
"locationService",
".",
"get",
"(",
")",
".",
"resolveResource",
"(",
"OUTPUT_DIR",
"+",
"id",
"+",
"\".ddl\"",
")",
";",
"if",
"(",
"ddlOutputResource",
".",
"exists",
"(",
")",
"==",
"false",
")",
"{",
"ddlOutputResource",
".",
"create",
"(",
")",
";",
"}",
"// Use the text file output stream factory to create the file so that",
"// it is readable on distributed and z/OS platforms. Overwrite the",
"// file if it already exists. We have to specify the encoding explicitly",
"// on the OutputStreamWriter or Findbugs gets upset. We always specify",
"// UTF-8 because the output DDL might have UNICODE characters. We use",
"// a TextFileOutputStreamFactory in an attempt to make the file readable",
"// on z/OS. The file will be tagged as 'ISO8859-1' on z/OS, allowing at",
"// least some of the characters to be printable. The z/OS chtag command",
"// does not appear to honor 'UTF-8' as an encoding, even though iconv",
"// supports it. The data on the disk will be correct in any case, the",
"// customer may need to FTP it to a distributed machine, or use iconv,",
"// to be able to view the data.",
"try",
"{",
"TextFileOutputStreamFactory",
"f",
"=",
"TrConfigurator",
".",
"getFileOutputStreamFactory",
"(",
")",
";",
"OutputStream",
"os",
"=",
"f",
".",
"createOutputStream",
"(",
"ddlOutputResource",
".",
"asFile",
"(",
")",
",",
"false",
")",
";",
"BufferedWriter",
"bw",
"=",
"new",
"BufferedWriter",
"(",
"new",
"OutputStreamWriter",
"(",
"os",
",",
"\"UTF-8\"",
")",
")",
";",
"participant",
".",
"generate",
"(",
"bw",
")",
";",
"// The JPA code may close the stream for us. Just make sure it's",
"// closed so that we flush any data out.",
"bw",
".",
"close",
"(",
")",
";",
"fileCount",
"++",
";",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"// We'll get an FFDC here... indicate that we had trouble. ",
"success",
"=",
"false",
";",
"}",
"}",
"returnMap",
".",
"put",
"(",
"SUCCESS",
",",
"Boolean",
".",
"valueOf",
"(",
"success",
")",
")",
";",
"returnMap",
".",
"put",
"(",
"FILE_COUNT",
",",
"Integer",
".",
"valueOf",
"(",
"fileCount",
")",
")",
";",
"return",
"returnMap",
";",
"}"
] | Trigger DDL generation for anyone who needs to generate DDL. | [
"Trigger",
"DDL",
"generation",
"for",
"anyone",
"who",
"needs",
"to",
"generate",
"DDL",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.persistence.mbean/src/com/ibm/ws/persistence/mbean/internal/DDLGenerationMBeanImpl.java#L112-L190 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/jsf/BehaviorTagHandlerDelegate.java | BehaviorTagHandlerDelegate.createMetaRuleset | @Override
public MetaRuleset createMetaRuleset(Class type)
{
MetaRuleset ruleset = new MetaRulesetImpl(_delegate.getTag(), type);
ruleset.ignore("binding");
ruleset.ignore("event");
return ruleset;
} | java | @Override
public MetaRuleset createMetaRuleset(Class type)
{
MetaRuleset ruleset = new MetaRulesetImpl(_delegate.getTag(), type);
ruleset.ignore("binding");
ruleset.ignore("event");
return ruleset;
} | [
"@",
"Override",
"public",
"MetaRuleset",
"createMetaRuleset",
"(",
"Class",
"type",
")",
"{",
"MetaRuleset",
"ruleset",
"=",
"new",
"MetaRulesetImpl",
"(",
"_delegate",
".",
"getTag",
"(",
")",
",",
"type",
")",
";",
"ruleset",
".",
"ignore",
"(",
"\"binding\"",
")",
";",
"ruleset",
".",
"ignore",
"(",
"\"event\"",
")",
";",
"return",
"ruleset",
";",
"}"
] | This tag call _delegate.setAttributes, so the returned MetaRuleset
should ignore attributes that are not supposed to be there like
"binding" and "event" | [
"This",
"tag",
"call",
"_delegate",
".",
"setAttributes",
"so",
"the",
"returned",
"MetaRuleset",
"should",
"ignore",
"attributes",
"that",
"are",
"not",
"supposed",
"to",
"be",
"there",
"like",
"binding",
"and",
"event"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/jsf/BehaviorTagHandlerDelegate.java#L110-L117 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/jsf/BehaviorTagHandlerDelegate.java | BehaviorTagHandlerDelegate.applyAttachedObject | public void applyAttachedObject(FacesContext context, UIComponent parent)
{
// Retrieve the current FaceletContext from FacesContext object
FaceletContext faceletContext = (FaceletContext) context.getAttributes().get(
FaceletContext.FACELET_CONTEXT_KEY);
ValueExpression ve = null;
Behavior behavior = null;
if (_delegate.getBinding() != null)
{
ve = _delegate.getBinding().getValueExpression(faceletContext, Behavior.class);
behavior = (Behavior) ve.getValue(faceletContext);
}
if (behavior == null)
{
behavior = this.createBehavior(faceletContext);
if (ve != null)
{
ve.setValue(faceletContext, behavior);
}
}
if (behavior == null)
{
throw new TagException(_delegate.getTag(), "No Validator was created");
}
_delegate.setAttributes(faceletContext, behavior);
if (behavior instanceof ClientBehavior)
{
// cast to a ClientBehaviorHolder
ClientBehaviorHolder cvh = (ClientBehaviorHolder) parent;
// TODO: check if the behavior could be applied to the current parent
// For run tests it is not necessary, so we let this one pending.
// It is necessary to obtain a event name for add it, so we have to
// look first to the defined event name, otherwise take the default from
// the holder
String eventName = getEventName();
if (eventName == null)
{
eventName = cvh.getDefaultEventName();
}
if (eventName == null)
{
throw new TagAttributeException(_delegate.getEvent(),
"eventName could not be defined for client behavior "+ behavior.toString());
}
else if (!cvh.getEventNames().contains(eventName))
{
throw new TagAttributeException(_delegate.getEvent(),
"eventName "+eventName+" not found on component instance");
}
else
{
cvh.addClientBehavior(eventName, (ClientBehavior) behavior);
}
AjaxHandler.registerJsfAjaxDefaultResource(faceletContext, parent);
}
} | java | public void applyAttachedObject(FacesContext context, UIComponent parent)
{
// Retrieve the current FaceletContext from FacesContext object
FaceletContext faceletContext = (FaceletContext) context.getAttributes().get(
FaceletContext.FACELET_CONTEXT_KEY);
ValueExpression ve = null;
Behavior behavior = null;
if (_delegate.getBinding() != null)
{
ve = _delegate.getBinding().getValueExpression(faceletContext, Behavior.class);
behavior = (Behavior) ve.getValue(faceletContext);
}
if (behavior == null)
{
behavior = this.createBehavior(faceletContext);
if (ve != null)
{
ve.setValue(faceletContext, behavior);
}
}
if (behavior == null)
{
throw new TagException(_delegate.getTag(), "No Validator was created");
}
_delegate.setAttributes(faceletContext, behavior);
if (behavior instanceof ClientBehavior)
{
// cast to a ClientBehaviorHolder
ClientBehaviorHolder cvh = (ClientBehaviorHolder) parent;
// TODO: check if the behavior could be applied to the current parent
// For run tests it is not necessary, so we let this one pending.
// It is necessary to obtain a event name for add it, so we have to
// look first to the defined event name, otherwise take the default from
// the holder
String eventName = getEventName();
if (eventName == null)
{
eventName = cvh.getDefaultEventName();
}
if (eventName == null)
{
throw new TagAttributeException(_delegate.getEvent(),
"eventName could not be defined for client behavior "+ behavior.toString());
}
else if (!cvh.getEventNames().contains(eventName))
{
throw new TagAttributeException(_delegate.getEvent(),
"eventName "+eventName+" not found on component instance");
}
else
{
cvh.addClientBehavior(eventName, (ClientBehavior) behavior);
}
AjaxHandler.registerJsfAjaxDefaultResource(faceletContext, parent);
}
} | [
"public",
"void",
"applyAttachedObject",
"(",
"FacesContext",
"context",
",",
"UIComponent",
"parent",
")",
"{",
"// Retrieve the current FaceletContext from FacesContext object",
"FaceletContext",
"faceletContext",
"=",
"(",
"FaceletContext",
")",
"context",
".",
"getAttributes",
"(",
")",
".",
"get",
"(",
"FaceletContext",
".",
"FACELET_CONTEXT_KEY",
")",
";",
"ValueExpression",
"ve",
"=",
"null",
";",
"Behavior",
"behavior",
"=",
"null",
";",
"if",
"(",
"_delegate",
".",
"getBinding",
"(",
")",
"!=",
"null",
")",
"{",
"ve",
"=",
"_delegate",
".",
"getBinding",
"(",
")",
".",
"getValueExpression",
"(",
"faceletContext",
",",
"Behavior",
".",
"class",
")",
";",
"behavior",
"=",
"(",
"Behavior",
")",
"ve",
".",
"getValue",
"(",
"faceletContext",
")",
";",
"}",
"if",
"(",
"behavior",
"==",
"null",
")",
"{",
"behavior",
"=",
"this",
".",
"createBehavior",
"(",
"faceletContext",
")",
";",
"if",
"(",
"ve",
"!=",
"null",
")",
"{",
"ve",
".",
"setValue",
"(",
"faceletContext",
",",
"behavior",
")",
";",
"}",
"}",
"if",
"(",
"behavior",
"==",
"null",
")",
"{",
"throw",
"new",
"TagException",
"(",
"_delegate",
".",
"getTag",
"(",
")",
",",
"\"No Validator was created\"",
")",
";",
"}",
"_delegate",
".",
"setAttributes",
"(",
"faceletContext",
",",
"behavior",
")",
";",
"if",
"(",
"behavior",
"instanceof",
"ClientBehavior",
")",
"{",
"// cast to a ClientBehaviorHolder",
"ClientBehaviorHolder",
"cvh",
"=",
"(",
"ClientBehaviorHolder",
")",
"parent",
";",
"// TODO: check if the behavior could be applied to the current parent",
"// For run tests it is not necessary, so we let this one pending.",
"// It is necessary to obtain a event name for add it, so we have to",
"// look first to the defined event name, otherwise take the default from",
"// the holder",
"String",
"eventName",
"=",
"getEventName",
"(",
")",
";",
"if",
"(",
"eventName",
"==",
"null",
")",
"{",
"eventName",
"=",
"cvh",
".",
"getDefaultEventName",
"(",
")",
";",
"}",
"if",
"(",
"eventName",
"==",
"null",
")",
"{",
"throw",
"new",
"TagAttributeException",
"(",
"_delegate",
".",
"getEvent",
"(",
")",
",",
"\"eventName could not be defined for client behavior \"",
"+",
"behavior",
".",
"toString",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"!",
"cvh",
".",
"getEventNames",
"(",
")",
".",
"contains",
"(",
"eventName",
")",
")",
"{",
"throw",
"new",
"TagAttributeException",
"(",
"_delegate",
".",
"getEvent",
"(",
")",
",",
"\"eventName \"",
"+",
"eventName",
"+",
"\" not found on component instance\"",
")",
";",
"}",
"else",
"{",
"cvh",
".",
"addClientBehavior",
"(",
"eventName",
",",
"(",
"ClientBehavior",
")",
"behavior",
")",
";",
"}",
"AjaxHandler",
".",
"registerJsfAjaxDefaultResource",
"(",
"faceletContext",
",",
"parent",
")",
";",
"}",
"}"
] | Create a ClientBehavior and attach it to the component | [
"Create",
"a",
"ClientBehavior",
"and",
"attach",
"it",
"to",
"the",
"component"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/jsf/BehaviorTagHandlerDelegate.java#L122-L182 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.mongo/src/com/ibm/ws/mongo/internal/MongoService.java | MongoService.getDB | @FFDCIgnore(InvocationTargetException.class)
Object getDB(String databaseName) throws Exception {
final boolean trace = TraceComponent.isAnyTracingEnabled();
lock.readLock().lock();
try {
if (mongoClient == null) {
// Switch to write lock for lazy initialization
lock.readLock().unlock();
lock.writeLock().lock();
try {
if (mongoClient == null)
init();
} finally {
// Downgrade to read lock for rest of method
lock.readLock().lock();
lock.writeLock().unlock();
}
}
Object db = MongoClient_getDB.invoke(mongoClient, databaseName);
// authentication
String user = (String) props.get(USER);
if (user != null) {
if ((Boolean) DB_isAuthenticated.invoke(db)) {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "already authenticated");
} else {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "authenticate as: " + user);
SerializableProtectedString password = (SerializableProtectedString) props.get(PASSWORD);
String pwdStr = password == null ? null : String.valueOf(password.getChars());
pwdStr = PasswordUtil.getCryptoAlgorithm(pwdStr) == null ? pwdStr : PasswordUtil.decode(pwdStr);
char[] pwdChars = pwdStr == null ? null : pwdStr.toCharArray();
try {
if (!(Boolean) DB_authenticate.invoke(db, user, pwdChars))
if ((Boolean) DB_isAuthenticated.invoke(db)) {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "another thread must have authenticated first");
} else
throw new IllegalArgumentException(Tr.formatMessage(tc, "CWKKD0012.authentication.error", MONGO, id, databaseName));
} catch (InvocationTargetException x) {
// If already authenticated, Mongo raises:
// IllegalStateException: can't authenticate twice on the same database
// Maybe another thread did the authentication right after we checked, so check again.
Throwable cause = x.getCause();
if (cause instanceof IllegalStateException && (Boolean) DB_isAuthenticated.invoke(db)) {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "another thread must have authenticated first", cause);
} else
throw cause;
}
}
} else if (useCertAuth) {
// If we specified a certificate we will already have used the client constructor that
// specified the credential so if we have got to here we are already authenticated and
// JIT should remove this so it will not be an overhead.
}
return db;
} catch (Throwable x) {
// rethrowing the exception allows it to be captured in FFDC and traced automatically
x = x instanceof InvocationTargetException ? x.getCause() : x;
if (x instanceof Exception)
throw (Exception) x;
else if (x instanceof Error)
throw (Error) x;
else
throw new RuntimeException(x);
} finally {
lock.readLock().unlock();
}
} | java | @FFDCIgnore(InvocationTargetException.class)
Object getDB(String databaseName) throws Exception {
final boolean trace = TraceComponent.isAnyTracingEnabled();
lock.readLock().lock();
try {
if (mongoClient == null) {
// Switch to write lock for lazy initialization
lock.readLock().unlock();
lock.writeLock().lock();
try {
if (mongoClient == null)
init();
} finally {
// Downgrade to read lock for rest of method
lock.readLock().lock();
lock.writeLock().unlock();
}
}
Object db = MongoClient_getDB.invoke(mongoClient, databaseName);
// authentication
String user = (String) props.get(USER);
if (user != null) {
if ((Boolean) DB_isAuthenticated.invoke(db)) {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "already authenticated");
} else {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "authenticate as: " + user);
SerializableProtectedString password = (SerializableProtectedString) props.get(PASSWORD);
String pwdStr = password == null ? null : String.valueOf(password.getChars());
pwdStr = PasswordUtil.getCryptoAlgorithm(pwdStr) == null ? pwdStr : PasswordUtil.decode(pwdStr);
char[] pwdChars = pwdStr == null ? null : pwdStr.toCharArray();
try {
if (!(Boolean) DB_authenticate.invoke(db, user, pwdChars))
if ((Boolean) DB_isAuthenticated.invoke(db)) {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "another thread must have authenticated first");
} else
throw new IllegalArgumentException(Tr.formatMessage(tc, "CWKKD0012.authentication.error", MONGO, id, databaseName));
} catch (InvocationTargetException x) {
// If already authenticated, Mongo raises:
// IllegalStateException: can't authenticate twice on the same database
// Maybe another thread did the authentication right after we checked, so check again.
Throwable cause = x.getCause();
if (cause instanceof IllegalStateException && (Boolean) DB_isAuthenticated.invoke(db)) {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "another thread must have authenticated first", cause);
} else
throw cause;
}
}
} else if (useCertAuth) {
// If we specified a certificate we will already have used the client constructor that
// specified the credential so if we have got to here we are already authenticated and
// JIT should remove this so it will not be an overhead.
}
return db;
} catch (Throwable x) {
// rethrowing the exception allows it to be captured in FFDC and traced automatically
x = x instanceof InvocationTargetException ? x.getCause() : x;
if (x instanceof Exception)
throw (Exception) x;
else if (x instanceof Error)
throw (Error) x;
else
throw new RuntimeException(x);
} finally {
lock.readLock().unlock();
}
} | [
"@",
"FFDCIgnore",
"(",
"InvocationTargetException",
".",
"class",
")",
"Object",
"getDB",
"(",
"String",
"databaseName",
")",
"throws",
"Exception",
"{",
"final",
"boolean",
"trace",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"lock",
".",
"readLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"mongoClient",
"==",
"null",
")",
"{",
"// Switch to write lock for lazy initialization",
"lock",
".",
"readLock",
"(",
")",
".",
"unlock",
"(",
")",
";",
"lock",
".",
"writeLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"mongoClient",
"==",
"null",
")",
"init",
"(",
")",
";",
"}",
"finally",
"{",
"// Downgrade to read lock for rest of method",
"lock",
".",
"readLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"lock",
".",
"writeLock",
"(",
")",
".",
"unlock",
"(",
")",
";",
"}",
"}",
"Object",
"db",
"=",
"MongoClient_getDB",
".",
"invoke",
"(",
"mongoClient",
",",
"databaseName",
")",
";",
"// authentication",
"String",
"user",
"=",
"(",
"String",
")",
"props",
".",
"get",
"(",
"USER",
")",
";",
"if",
"(",
"user",
"!=",
"null",
")",
"{",
"if",
"(",
"(",
"Boolean",
")",
"DB_isAuthenticated",
".",
"invoke",
"(",
"db",
")",
")",
"{",
"if",
"(",
"trace",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"already authenticated\"",
")",
";",
"}",
"else",
"{",
"if",
"(",
"trace",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"authenticate as: \"",
"+",
"user",
")",
";",
"SerializableProtectedString",
"password",
"=",
"(",
"SerializableProtectedString",
")",
"props",
".",
"get",
"(",
"PASSWORD",
")",
";",
"String",
"pwdStr",
"=",
"password",
"==",
"null",
"?",
"null",
":",
"String",
".",
"valueOf",
"(",
"password",
".",
"getChars",
"(",
")",
")",
";",
"pwdStr",
"=",
"PasswordUtil",
".",
"getCryptoAlgorithm",
"(",
"pwdStr",
")",
"==",
"null",
"?",
"pwdStr",
":",
"PasswordUtil",
".",
"decode",
"(",
"pwdStr",
")",
";",
"char",
"[",
"]",
"pwdChars",
"=",
"pwdStr",
"==",
"null",
"?",
"null",
":",
"pwdStr",
".",
"toCharArray",
"(",
")",
";",
"try",
"{",
"if",
"(",
"!",
"(",
"Boolean",
")",
"DB_authenticate",
".",
"invoke",
"(",
"db",
",",
"user",
",",
"pwdChars",
")",
")",
"if",
"(",
"(",
"Boolean",
")",
"DB_isAuthenticated",
".",
"invoke",
"(",
"db",
")",
")",
"{",
"if",
"(",
"trace",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"another thread must have authenticated first\"",
")",
";",
"}",
"else",
"throw",
"new",
"IllegalArgumentException",
"(",
"Tr",
".",
"formatMessage",
"(",
"tc",
",",
"\"CWKKD0012.authentication.error\"",
",",
"MONGO",
",",
"id",
",",
"databaseName",
")",
")",
";",
"}",
"catch",
"(",
"InvocationTargetException",
"x",
")",
"{",
"// If already authenticated, Mongo raises:",
"// IllegalStateException: can't authenticate twice on the same database",
"// Maybe another thread did the authentication right after we checked, so check again.",
"Throwable",
"cause",
"=",
"x",
".",
"getCause",
"(",
")",
";",
"if",
"(",
"cause",
"instanceof",
"IllegalStateException",
"&&",
"(",
"Boolean",
")",
"DB_isAuthenticated",
".",
"invoke",
"(",
"db",
")",
")",
"{",
"if",
"(",
"trace",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"another thread must have authenticated first\"",
",",
"cause",
")",
";",
"}",
"else",
"throw",
"cause",
";",
"}",
"}",
"}",
"else",
"if",
"(",
"useCertAuth",
")",
"{",
"// If we specified a certificate we will already have used the client constructor that",
"// specified the credential so if we have got to here we are already authenticated and",
"// JIT should remove this so it will not be an overhead.",
"}",
"return",
"db",
";",
"}",
"catch",
"(",
"Throwable",
"x",
")",
"{",
"// rethrowing the exception allows it to be captured in FFDC and traced automatically",
"x",
"=",
"x",
"instanceof",
"InvocationTargetException",
"?",
"x",
".",
"getCause",
"(",
")",
":",
"x",
";",
"if",
"(",
"x",
"instanceof",
"Exception",
")",
"throw",
"(",
"Exception",
")",
"x",
";",
"else",
"if",
"(",
"x",
"instanceof",
"Error",
")",
"throw",
"(",
"Error",
")",
"x",
";",
"else",
"throw",
"new",
"RuntimeException",
"(",
"x",
")",
";",
"}",
"finally",
"{",
"lock",
".",
"readLock",
"(",
")",
".",
"unlock",
"(",
")",
";",
"}",
"}"
] | Get a Mongo DB instance, authenticated with the specified user and password if specified.
@param databaseName the database name.
@return com.mongodb.DB instance
@throws Exception if an error occurs. | [
"Get",
"a",
"Mongo",
"DB",
"instance",
"authenticated",
"with",
"the",
"specified",
"user",
"and",
"password",
"if",
"specified",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.mongo/src/com/ibm/ws/mongo/internal/MongoService.java#L268-L340 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.mongo/src/com/ibm/ws/mongo/internal/MongoService.java | MongoService.getCerticateSubject | private String getCerticateSubject(AtomicServiceReference<Object> serviceRef, Properties sslProperties) {
String certificateDN = null;
try {
certificateDN = sslHelper.getClientKeyCertSubject(serviceRef, sslProperties);
} catch (KeyStoreException ke) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.error(tc, "CWKKD0020.ssl.get.certificate.user", MONGO, id, ke);
}
throw new RuntimeException(Tr.formatMessage(tc, "CWKKD0020.ssl.get.certificate.user", MONGO, id, ke));
} catch (CertificateException ce) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.error(tc, "CWKKD0020.ssl.get.certificate.user", MONGO, id, ce);
}
throw new RuntimeException(Tr.formatMessage(tc, "CWKKD0020.ssl.get.certificate.user", MONGO, id, ce));
}
// handle null .... cannot find the client key
if (certificateDN == null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.error(tc, "CWKKD0026.ssl.certificate.exception", MONGO, id);
}
throw new RuntimeException(Tr.formatMessage(tc, "CWKKD0026.ssl.certificate.exception", MONGO, id));
}
return certificateDN;
} | java | private String getCerticateSubject(AtomicServiceReference<Object> serviceRef, Properties sslProperties) {
String certificateDN = null;
try {
certificateDN = sslHelper.getClientKeyCertSubject(serviceRef, sslProperties);
} catch (KeyStoreException ke) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.error(tc, "CWKKD0020.ssl.get.certificate.user", MONGO, id, ke);
}
throw new RuntimeException(Tr.formatMessage(tc, "CWKKD0020.ssl.get.certificate.user", MONGO, id, ke));
} catch (CertificateException ce) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.error(tc, "CWKKD0020.ssl.get.certificate.user", MONGO, id, ce);
}
throw new RuntimeException(Tr.formatMessage(tc, "CWKKD0020.ssl.get.certificate.user", MONGO, id, ce));
}
// handle null .... cannot find the client key
if (certificateDN == null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.error(tc, "CWKKD0026.ssl.certificate.exception", MONGO, id);
}
throw new RuntimeException(Tr.formatMessage(tc, "CWKKD0026.ssl.certificate.exception", MONGO, id));
}
return certificateDN;
} | [
"private",
"String",
"getCerticateSubject",
"(",
"AtomicServiceReference",
"<",
"Object",
">",
"serviceRef",
",",
"Properties",
"sslProperties",
")",
"{",
"String",
"certificateDN",
"=",
"null",
";",
"try",
"{",
"certificateDN",
"=",
"sslHelper",
".",
"getClientKeyCertSubject",
"(",
"serviceRef",
",",
"sslProperties",
")",
";",
"}",
"catch",
"(",
"KeyStoreException",
"ke",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"error",
"(",
"tc",
",",
"\"CWKKD0020.ssl.get.certificate.user\"",
",",
"MONGO",
",",
"id",
",",
"ke",
")",
";",
"}",
"throw",
"new",
"RuntimeException",
"(",
"Tr",
".",
"formatMessage",
"(",
"tc",
",",
"\"CWKKD0020.ssl.get.certificate.user\"",
",",
"MONGO",
",",
"id",
",",
"ke",
")",
")",
";",
"}",
"catch",
"(",
"CertificateException",
"ce",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"error",
"(",
"tc",
",",
"\"CWKKD0020.ssl.get.certificate.user\"",
",",
"MONGO",
",",
"id",
",",
"ce",
")",
";",
"}",
"throw",
"new",
"RuntimeException",
"(",
"Tr",
".",
"formatMessage",
"(",
"tc",
",",
"\"CWKKD0020.ssl.get.certificate.user\"",
",",
"MONGO",
",",
"id",
",",
"ce",
")",
")",
";",
"}",
"// handle null .... cannot find the client key",
"if",
"(",
"certificateDN",
"==",
"null",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"error",
"(",
"tc",
",",
"\"CWKKD0026.ssl.certificate.exception\"",
",",
"MONGO",
",",
"id",
")",
";",
"}",
"throw",
"new",
"RuntimeException",
"(",
"Tr",
".",
"formatMessage",
"(",
"tc",
",",
"\"CWKKD0026.ssl.certificate.exception\"",
",",
"MONGO",
",",
"id",
")",
")",
";",
"}",
"return",
"certificateDN",
";",
"}"
] | Call security code to read the subject name from the key in the keystore
@param serviceRef
@param sslProperties
@return | [
"Call",
"security",
"code",
"to",
"read",
"the",
"subject",
"name",
"from",
"the",
"key",
"in",
"the",
"keystore"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.mongo/src/com/ibm/ws/mongo/internal/MongoService.java#L504-L529 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.mongo/src/com/ibm/ws/mongo/internal/MongoService.java | MongoService.set | @FFDCIgnore(Throwable.class)
@Trivial
private void set(Class<?> MongoClientOptions_Builder, Object optionsBuilder, String propName,
Object value) throws IntrospectionException, IllegalArgumentException, IllegalAccessException, InvocationTargetException {
try {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, propName + '=' + value);
Class<?> type = MONGO_CLIENT_OPTIONS_TYPES.get(propName);
// setter methods are just propName, no setPropName.
Method method = MongoClientOptions_Builder.getMethod(propName, type);
// even though we told the config service that some of these props are Integers, they get converted to longs. Need
// to convert them back to int so that our .invoke(..) method doesn't blow up.
if (type.equals(int.class) && value instanceof Long) {
value = ((Long) value).intValue();
}
method.invoke(optionsBuilder, value);
return;
} catch (Throwable x) {
if (x instanceof InvocationTargetException)
x = x.getCause();
IllegalArgumentException failure = ignoreWarnOrFail(x, IllegalArgumentException.class, "CWKKD0010.prop.error", propName, MONGO, id, x);
if (failure != null) {
FFDCFilter.processException(failure, getClass().getName(), "394", this, new Object[] { value == null ? null : value.getClass(), value });
throw failure;
}
}
} | java | @FFDCIgnore(Throwable.class)
@Trivial
private void set(Class<?> MongoClientOptions_Builder, Object optionsBuilder, String propName,
Object value) throws IntrospectionException, IllegalArgumentException, IllegalAccessException, InvocationTargetException {
try {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, propName + '=' + value);
Class<?> type = MONGO_CLIENT_OPTIONS_TYPES.get(propName);
// setter methods are just propName, no setPropName.
Method method = MongoClientOptions_Builder.getMethod(propName, type);
// even though we told the config service that some of these props are Integers, they get converted to longs. Need
// to convert them back to int so that our .invoke(..) method doesn't blow up.
if (type.equals(int.class) && value instanceof Long) {
value = ((Long) value).intValue();
}
method.invoke(optionsBuilder, value);
return;
} catch (Throwable x) {
if (x instanceof InvocationTargetException)
x = x.getCause();
IllegalArgumentException failure = ignoreWarnOrFail(x, IllegalArgumentException.class, "CWKKD0010.prop.error", propName, MONGO, id, x);
if (failure != null) {
FFDCFilter.processException(failure, getClass().getName(), "394", this, new Object[] { value == null ? null : value.getClass(), value });
throw failure;
}
}
} | [
"@",
"FFDCIgnore",
"(",
"Throwable",
".",
"class",
")",
"@",
"Trivial",
"private",
"void",
"set",
"(",
"Class",
"<",
"?",
">",
"MongoClientOptions_Builder",
",",
"Object",
"optionsBuilder",
",",
"String",
"propName",
",",
"Object",
"value",
")",
"throws",
"IntrospectionException",
",",
"IllegalArgumentException",
",",
"IllegalAccessException",
",",
"InvocationTargetException",
"{",
"try",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"propName",
"+",
"'",
"'",
"+",
"value",
")",
";",
"Class",
"<",
"?",
">",
"type",
"=",
"MONGO_CLIENT_OPTIONS_TYPES",
".",
"get",
"(",
"propName",
")",
";",
"// setter methods are just propName, no setPropName.",
"Method",
"method",
"=",
"MongoClientOptions_Builder",
".",
"getMethod",
"(",
"propName",
",",
"type",
")",
";",
"// even though we told the config service that some of these props are Integers, they get converted to longs. Need",
"// to convert them back to int so that our .invoke(..) method doesn't blow up.",
"if",
"(",
"type",
".",
"equals",
"(",
"int",
".",
"class",
")",
"&&",
"value",
"instanceof",
"Long",
")",
"{",
"value",
"=",
"(",
"(",
"Long",
")",
"value",
")",
".",
"intValue",
"(",
")",
";",
"}",
"method",
".",
"invoke",
"(",
"optionsBuilder",
",",
"value",
")",
";",
"return",
";",
"}",
"catch",
"(",
"Throwable",
"x",
")",
"{",
"if",
"(",
"x",
"instanceof",
"InvocationTargetException",
")",
"x",
"=",
"x",
".",
"getCause",
"(",
")",
";",
"IllegalArgumentException",
"failure",
"=",
"ignoreWarnOrFail",
"(",
"x",
",",
"IllegalArgumentException",
".",
"class",
",",
"\"CWKKD0010.prop.error\"",
",",
"propName",
",",
"MONGO",
",",
"id",
",",
"x",
")",
";",
"if",
"(",
"failure",
"!=",
"null",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"failure",
",",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
",",
"\"394\"",
",",
"this",
",",
"new",
"Object",
"[",
"]",
"{",
"value",
"==",
"null",
"?",
"null",
":",
"value",
".",
"getClass",
"(",
")",
",",
"value",
"}",
")",
";",
"throw",
"failure",
";",
"}",
"}",
"}"
] | Configure a mongo option.
@param MongoClientOptions_Builder builder class
@param optionsBuilder builder instance
@param propName name of the config property.
@param type type of the config property. | [
"Configure",
"a",
"mongo",
"option",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.mongo/src/com/ibm/ws/mongo/internal/MongoService.java#L600-L628 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.mongo/src/com/ibm/ws/mongo/internal/MongoService.java | MongoService.setReadPreference | @FFDCIgnore(Throwable.class)
@Trivial
private void setReadPreference(Class<?> MongoClientOptions_Builder, Object optionsBuilder,
String creatorMethod) throws ClassNotFoundException, IllegalArgumentException, SecurityException, IllegalAccessException, InvocationTargetException, NoSuchMethodException {
try {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, READ_PREFERENCE + '=' + creatorMethod);
Class<?> ReadPreference = MongoClientOptions_Builder.getClassLoader().loadClass("com.mongodb.ReadPreference");
// Calls static ReadPreference.nearest() (or whatever conf is set to) to get a ReadPreference object
Object readPreference = ReadPreference.getMethod(creatorMethod).invoke(ReadPreference);
// Set static ReadPreference on Builder.
MongoClientOptions_Builder.getMethod("readPreference", ReadPreference).invoke(optionsBuilder, readPreference);
} catch (Throwable x) {
if (x instanceof InvocationTargetException)
x = x.getCause();
IllegalArgumentException failure = ignoreWarnOrFail(x, IllegalArgumentException.class, "CWKKD0010.prop.error", READ_PREFERENCE, MONGO, id, x);
if (failure != null) {
FFDCFilter.processException(failure, getClass().getName(), "422", this);
throw failure;
}
}
} | java | @FFDCIgnore(Throwable.class)
@Trivial
private void setReadPreference(Class<?> MongoClientOptions_Builder, Object optionsBuilder,
String creatorMethod) throws ClassNotFoundException, IllegalArgumentException, SecurityException, IllegalAccessException, InvocationTargetException, NoSuchMethodException {
try {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, READ_PREFERENCE + '=' + creatorMethod);
Class<?> ReadPreference = MongoClientOptions_Builder.getClassLoader().loadClass("com.mongodb.ReadPreference");
// Calls static ReadPreference.nearest() (or whatever conf is set to) to get a ReadPreference object
Object readPreference = ReadPreference.getMethod(creatorMethod).invoke(ReadPreference);
// Set static ReadPreference on Builder.
MongoClientOptions_Builder.getMethod("readPreference", ReadPreference).invoke(optionsBuilder, readPreference);
} catch (Throwable x) {
if (x instanceof InvocationTargetException)
x = x.getCause();
IllegalArgumentException failure = ignoreWarnOrFail(x, IllegalArgumentException.class, "CWKKD0010.prop.error", READ_PREFERENCE, MONGO, id, x);
if (failure != null) {
FFDCFilter.processException(failure, getClass().getName(), "422", this);
throw failure;
}
}
} | [
"@",
"FFDCIgnore",
"(",
"Throwable",
".",
"class",
")",
"@",
"Trivial",
"private",
"void",
"setReadPreference",
"(",
"Class",
"<",
"?",
">",
"MongoClientOptions_Builder",
",",
"Object",
"optionsBuilder",
",",
"String",
"creatorMethod",
")",
"throws",
"ClassNotFoundException",
",",
"IllegalArgumentException",
",",
"SecurityException",
",",
"IllegalAccessException",
",",
"InvocationTargetException",
",",
"NoSuchMethodException",
"{",
"try",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"READ_PREFERENCE",
"+",
"'",
"'",
"+",
"creatorMethod",
")",
";",
"Class",
"<",
"?",
">",
"ReadPreference",
"=",
"MongoClientOptions_Builder",
".",
"getClassLoader",
"(",
")",
".",
"loadClass",
"(",
"\"com.mongodb.ReadPreference\"",
")",
";",
"// Calls static ReadPreference.nearest() (or whatever conf is set to) to get a ReadPreference object",
"Object",
"readPreference",
"=",
"ReadPreference",
".",
"getMethod",
"(",
"creatorMethod",
")",
".",
"invoke",
"(",
"ReadPreference",
")",
";",
"// Set static ReadPreference on Builder.",
"MongoClientOptions_Builder",
".",
"getMethod",
"(",
"\"readPreference\"",
",",
"ReadPreference",
")",
".",
"invoke",
"(",
"optionsBuilder",
",",
"readPreference",
")",
";",
"}",
"catch",
"(",
"Throwable",
"x",
")",
"{",
"if",
"(",
"x",
"instanceof",
"InvocationTargetException",
")",
"x",
"=",
"x",
".",
"getCause",
"(",
")",
";",
"IllegalArgumentException",
"failure",
"=",
"ignoreWarnOrFail",
"(",
"x",
",",
"IllegalArgumentException",
".",
"class",
",",
"\"CWKKD0010.prop.error\"",
",",
"READ_PREFERENCE",
",",
"MONGO",
",",
"id",
",",
"x",
")",
";",
"if",
"(",
"failure",
"!=",
"null",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"failure",
",",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
",",
"\"422\"",
",",
"this",
")",
";",
"throw",
"failure",
";",
"}",
"}",
"}"
] | Configure the "readPreference" mongo option, which is a special case.
@param MongoClientOptions_Builder builder class
@param optionsBuilder builder instance
@param creatorMethod name of a static method of ReadPreference that creates an instance. | [
"Configure",
"the",
"readPreference",
"mongo",
"option",
"which",
"is",
"a",
"special",
"case",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.mongo/src/com/ibm/ws/mongo/internal/MongoService.java#L637-L660 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.mongo/src/com/ibm/ws/mongo/internal/MongoService.java | MongoService.setWriteConcern | @FFDCIgnore(Throwable.class)
@Trivial
private void setWriteConcern(Class<?> MongoClientOptions_Builder, Object optionsBuilder,
String fieldName) throws ClassNotFoundException, IllegalArgumentException, SecurityException, IllegalAccessException, InvocationTargetException, NoSuchMethodException {
try {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, WRITE_CONCERN + '=' + fieldName);
Class<?> WriteConcern = MongoClientOptions_Builder.getClassLoader().loadClass("com.mongodb.WriteConcern");
// Set value to the static class value
Object writeConcern = WriteConcern.getField(fieldName).get(null);
MongoClientOptions_Builder.getMethod("writeConcern", WriteConcern).invoke(optionsBuilder, writeConcern);
} catch (Throwable x) {
if (x instanceof InvocationTargetException)
x = x.getCause();
IllegalArgumentException failure = ignoreWarnOrFail(x, IllegalArgumentException.class, "CWKKD0010.prop.error", WRITE_CONCERN, MONGO, id, x);
if (failure != null) {
FFDCFilter.processException(failure, getClass().getName(), "422", this);
throw failure;
}
}
} | java | @FFDCIgnore(Throwable.class)
@Trivial
private void setWriteConcern(Class<?> MongoClientOptions_Builder, Object optionsBuilder,
String fieldName) throws ClassNotFoundException, IllegalArgumentException, SecurityException, IllegalAccessException, InvocationTargetException, NoSuchMethodException {
try {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, WRITE_CONCERN + '=' + fieldName);
Class<?> WriteConcern = MongoClientOptions_Builder.getClassLoader().loadClass("com.mongodb.WriteConcern");
// Set value to the static class value
Object writeConcern = WriteConcern.getField(fieldName).get(null);
MongoClientOptions_Builder.getMethod("writeConcern", WriteConcern).invoke(optionsBuilder, writeConcern);
} catch (Throwable x) {
if (x instanceof InvocationTargetException)
x = x.getCause();
IllegalArgumentException failure = ignoreWarnOrFail(x, IllegalArgumentException.class, "CWKKD0010.prop.error", WRITE_CONCERN, MONGO, id, x);
if (failure != null) {
FFDCFilter.processException(failure, getClass().getName(), "422", this);
throw failure;
}
}
} | [
"@",
"FFDCIgnore",
"(",
"Throwable",
".",
"class",
")",
"@",
"Trivial",
"private",
"void",
"setWriteConcern",
"(",
"Class",
"<",
"?",
">",
"MongoClientOptions_Builder",
",",
"Object",
"optionsBuilder",
",",
"String",
"fieldName",
")",
"throws",
"ClassNotFoundException",
",",
"IllegalArgumentException",
",",
"SecurityException",
",",
"IllegalAccessException",
",",
"InvocationTargetException",
",",
"NoSuchMethodException",
"{",
"try",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"WRITE_CONCERN",
"+",
"'",
"'",
"+",
"fieldName",
")",
";",
"Class",
"<",
"?",
">",
"WriteConcern",
"=",
"MongoClientOptions_Builder",
".",
"getClassLoader",
"(",
")",
".",
"loadClass",
"(",
"\"com.mongodb.WriteConcern\"",
")",
";",
"// Set value to the static class value",
"Object",
"writeConcern",
"=",
"WriteConcern",
".",
"getField",
"(",
"fieldName",
")",
".",
"get",
"(",
"null",
")",
";",
"MongoClientOptions_Builder",
".",
"getMethod",
"(",
"\"writeConcern\"",
",",
"WriteConcern",
")",
".",
"invoke",
"(",
"optionsBuilder",
",",
"writeConcern",
")",
";",
"}",
"catch",
"(",
"Throwable",
"x",
")",
"{",
"if",
"(",
"x",
"instanceof",
"InvocationTargetException",
")",
"x",
"=",
"x",
".",
"getCause",
"(",
")",
";",
"IllegalArgumentException",
"failure",
"=",
"ignoreWarnOrFail",
"(",
"x",
",",
"IllegalArgumentException",
".",
"class",
",",
"\"CWKKD0010.prop.error\"",
",",
"WRITE_CONCERN",
",",
"MONGO",
",",
"id",
",",
"x",
")",
";",
"if",
"(",
"failure",
"!=",
"null",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"failure",
",",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
",",
"\"422\"",
",",
"this",
")",
";",
"throw",
"failure",
";",
"}",
"}",
"}"
] | Configure the "writeConcern" mongo option, which is a special case.
@param MongoClientOptions_Builder builder class
@param optionsBuilder builder instance
@param fieldName name of a static field of WriteConcern which is of the type WriteConcern. | [
"Configure",
"the",
"writeConcern",
"mongo",
"option",
"which",
"is",
"a",
"special",
"case",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.mongo/src/com/ibm/ws/mongo/internal/MongoService.java#L669-L691 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.mongo/src/com/ibm/ws/mongo/internal/MongoService.java | MongoService.setSsl | protected void setSsl(ServiceReference<Object> reference) {
sslConfigurationRef.setReference(reference);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "sslRef set to " + reference.getProperty(CONFIG_DISPLAY_ID));
}
} | java | protected void setSsl(ServiceReference<Object> reference) {
sslConfigurationRef.setReference(reference);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "sslRef set to " + reference.getProperty(CONFIG_DISPLAY_ID));
}
} | [
"protected",
"void",
"setSsl",
"(",
"ServiceReference",
"<",
"Object",
">",
"reference",
")",
"{",
"sslConfigurationRef",
".",
"setReference",
"(",
"reference",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"sslRef set to \"",
"+",
"reference",
".",
"getProperty",
"(",
"CONFIG_DISPLAY_ID",
")",
")",
";",
"}",
"}"
] | Declarative Services method for setting the SSL Support service reference
@param ref reference to the service | [
"Declarative",
"Services",
"method",
"for",
"setting",
"the",
"SSL",
"Support",
"service",
"reference"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.mongo/src/com/ibm/ws/mongo/internal/MongoService.java#L727-L732 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.mongo/src/com/ibm/ws/mongo/internal/MongoService.java | MongoService.unsetSsl | protected void unsetSsl(ServiceReference<Object> reference) {
sslConfigurationRef.unsetReference(reference);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "sslRef unset");
}
} | java | protected void unsetSsl(ServiceReference<Object> reference) {
sslConfigurationRef.unsetReference(reference);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "sslRef unset");
}
} | [
"protected",
"void",
"unsetSsl",
"(",
"ServiceReference",
"<",
"Object",
">",
"reference",
")",
"{",
"sslConfigurationRef",
".",
"unsetReference",
"(",
"reference",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"sslRef unset\"",
")",
";",
"}",
"}"
] | Declarative Services method for unsetting the SSL Support service reference
@param ref reference to the service | [
"Declarative",
"Services",
"method",
"for",
"unsetting",
"the",
"SSL",
"Support",
"service",
"reference"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.mongo/src/com/ibm/ws/mongo/internal/MongoService.java#L739-L744 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.mongo/src/com/ibm/ws/mongo/internal/MongoService.java | MongoService.assertValidSSLConfig | private void assertValidSSLConfig() {
final boolean trace = TraceComponent.isAnyTracingEnabled();
boolean sslEnabled = (((Boolean) props.get(SSL_ENABLED)) == null) ? false : (Boolean) props.get(SSL_ENABLED);
boolean sslRefExists = ((props.get(SSL_REF)) == null) ? false : true;
if (sslRefExists && !sslEnabled) {
if (trace && tc.isDebugEnabled()) {
// sslRef property set in the server.xml but sslEnabled not set to true.
Tr.error(tc, "CWKKD0024.ssl.sslref.no.ssl", MONGO, id);
}
throw new RuntimeException(Tr.formatMessage(tc, "CWKKD0024.ssl.sslref.no.ssl", MONGO, id));
}
if (sslEnabled) {
// we should have the ssl-1.0 feature selected
if (sslHelper == null) {
throw new RuntimeException(Tr.formatMessage(tc, "CWKKD0015.ssl.feature.missing", MONGO, id));
}
if (useCertAuth) {
if (!sslEnabled) {
// SSL not enabled, so shouldn't be using certificate authentication
throw new RuntimeException(Tr.formatMessage(tc, "CWKKD0019.ssl.certificate.no.ssl", MONGO, id));
}
if (props.get(USER) != null || props.get(PASSWORD) != null) {
// shouldn't be using userid and pasword with certificate authentication
throw new RuntimeException(Tr.formatMessage(tc, "CWKKD0018.ssl.user.pswd.certificate", MONGO, id));
}
}
}
} | java | private void assertValidSSLConfig() {
final boolean trace = TraceComponent.isAnyTracingEnabled();
boolean sslEnabled = (((Boolean) props.get(SSL_ENABLED)) == null) ? false : (Boolean) props.get(SSL_ENABLED);
boolean sslRefExists = ((props.get(SSL_REF)) == null) ? false : true;
if (sslRefExists && !sslEnabled) {
if (trace && tc.isDebugEnabled()) {
// sslRef property set in the server.xml but sslEnabled not set to true.
Tr.error(tc, "CWKKD0024.ssl.sslref.no.ssl", MONGO, id);
}
throw new RuntimeException(Tr.formatMessage(tc, "CWKKD0024.ssl.sslref.no.ssl", MONGO, id));
}
if (sslEnabled) {
// we should have the ssl-1.0 feature selected
if (sslHelper == null) {
throw new RuntimeException(Tr.formatMessage(tc, "CWKKD0015.ssl.feature.missing", MONGO, id));
}
if (useCertAuth) {
if (!sslEnabled) {
// SSL not enabled, so shouldn't be using certificate authentication
throw new RuntimeException(Tr.formatMessage(tc, "CWKKD0019.ssl.certificate.no.ssl", MONGO, id));
}
if (props.get(USER) != null || props.get(PASSWORD) != null) {
// shouldn't be using userid and pasword with certificate authentication
throw new RuntimeException(Tr.formatMessage(tc, "CWKKD0018.ssl.user.pswd.certificate", MONGO, id));
}
}
}
} | [
"private",
"void",
"assertValidSSLConfig",
"(",
")",
"{",
"final",
"boolean",
"trace",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"boolean",
"sslEnabled",
"=",
"(",
"(",
"(",
"Boolean",
")",
"props",
".",
"get",
"(",
"SSL_ENABLED",
")",
")",
"==",
"null",
")",
"?",
"false",
":",
"(",
"Boolean",
")",
"props",
".",
"get",
"(",
"SSL_ENABLED",
")",
";",
"boolean",
"sslRefExists",
"=",
"(",
"(",
"props",
".",
"get",
"(",
"SSL_REF",
")",
")",
"==",
"null",
")",
"?",
"false",
":",
"true",
";",
"if",
"(",
"sslRefExists",
"&&",
"!",
"sslEnabled",
")",
"{",
"if",
"(",
"trace",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"// sslRef property set in the server.xml but sslEnabled not set to true.",
"Tr",
".",
"error",
"(",
"tc",
",",
"\"CWKKD0024.ssl.sslref.no.ssl\"",
",",
"MONGO",
",",
"id",
")",
";",
"}",
"throw",
"new",
"RuntimeException",
"(",
"Tr",
".",
"formatMessage",
"(",
"tc",
",",
"\"CWKKD0024.ssl.sslref.no.ssl\"",
",",
"MONGO",
",",
"id",
")",
")",
";",
"}",
"if",
"(",
"sslEnabled",
")",
"{",
"// we should have the ssl-1.0 feature selected",
"if",
"(",
"sslHelper",
"==",
"null",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"Tr",
".",
"formatMessage",
"(",
"tc",
",",
"\"CWKKD0015.ssl.feature.missing\"",
",",
"MONGO",
",",
"id",
")",
")",
";",
"}",
"if",
"(",
"useCertAuth",
")",
"{",
"if",
"(",
"!",
"sslEnabled",
")",
"{",
"// SSL not enabled, so shouldn't be using certificate authentication",
"throw",
"new",
"RuntimeException",
"(",
"Tr",
".",
"formatMessage",
"(",
"tc",
",",
"\"CWKKD0019.ssl.certificate.no.ssl\"",
",",
"MONGO",
",",
"id",
")",
")",
";",
"}",
"if",
"(",
"props",
".",
"get",
"(",
"USER",
")",
"!=",
"null",
"||",
"props",
".",
"get",
"(",
"PASSWORD",
")",
"!=",
"null",
")",
"{",
"// shouldn't be using userid and pasword with certificate authentication",
"throw",
"new",
"RuntimeException",
"(",
"Tr",
".",
"formatMessage",
"(",
"tc",
",",
"\"CWKKD0018.ssl.user.pswd.certificate\"",
",",
"MONGO",
",",
"id",
")",
")",
";",
"}",
"}",
"}",
"}"
] | Validate combination of security parameters for certificate authentication. If
useCertificateAuthentication is specified SSL must be enabled, an ssslRef must be
specified and user and password should not be specified. | [
"Validate",
"combination",
"of",
"security",
"parameters",
"for",
"certificate",
"authentication",
".",
"If",
"useCertificateAuthentication",
"is",
"specified",
"SSL",
"must",
"be",
"enabled",
"an",
"ssslRef",
"must",
"be",
"specified",
"and",
"user",
"and",
"password",
"should",
"not",
"be",
"specified",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.mongo/src/com/ibm/ws/mongo/internal/MongoService.java#L783-L815 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/ReferrerURLCookieHandler.java | ReferrerURLCookieHandler.getReferrerURLFromCookies | @Sensitive
public String getReferrerURLFromCookies(HttpServletRequest req, String cookieName) {
Cookie[] cookies = req.getCookies();
String referrerURL = CookieHelper.getCookieValue(cookies, cookieName);
if (referrerURL != null) {
StringBuffer URL = req.getRequestURL();
referrerURL = decodeURL(referrerURL);
referrerURL = restoreHostNameToURL(referrerURL, URL.toString());
}
return referrerURL;
} | java | @Sensitive
public String getReferrerURLFromCookies(HttpServletRequest req, String cookieName) {
Cookie[] cookies = req.getCookies();
String referrerURL = CookieHelper.getCookieValue(cookies, cookieName);
if (referrerURL != null) {
StringBuffer URL = req.getRequestURL();
referrerURL = decodeURL(referrerURL);
referrerURL = restoreHostNameToURL(referrerURL, URL.toString());
}
return referrerURL;
} | [
"@",
"Sensitive",
"public",
"String",
"getReferrerURLFromCookies",
"(",
"HttpServletRequest",
"req",
",",
"String",
"cookieName",
")",
"{",
"Cookie",
"[",
"]",
"cookies",
"=",
"req",
".",
"getCookies",
"(",
")",
";",
"String",
"referrerURL",
"=",
"CookieHelper",
".",
"getCookieValue",
"(",
"cookies",
",",
"cookieName",
")",
";",
"if",
"(",
"referrerURL",
"!=",
"null",
")",
"{",
"StringBuffer",
"URL",
"=",
"req",
".",
"getRequestURL",
"(",
")",
";",
"referrerURL",
"=",
"decodeURL",
"(",
"referrerURL",
")",
";",
"referrerURL",
"=",
"restoreHostNameToURL",
"(",
"referrerURL",
",",
"URL",
".",
"toString",
"(",
")",
")",
";",
"}",
"return",
"referrerURL",
";",
"}"
] | Retrieve the referrer URL from the HttpServletRequest's cookies.
This will decode the URL and restore the host name if it was removed.
@param req
@return referrerURL | [
"Retrieve",
"the",
"referrer",
"URL",
"from",
"the",
"HttpServletRequest",
"s",
"cookies",
".",
"This",
"will",
"decode",
"the",
"URL",
"and",
"restore",
"the",
"host",
"name",
"if",
"it",
"was",
"removed",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/ReferrerURLCookieHandler.java#L50-L60 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/ReferrerURLCookieHandler.java | ReferrerURLCookieHandler.clearReferrerURLCookie | public void clearReferrerURLCookie(HttpServletRequest req, HttpServletResponse res, String cookieName) {
String url = CookieHelper.getCookieValue(req.getCookies(), cookieName);
if (url != null && url.length() > 0) {
invalidateReferrerURLCookie(req, res, cookieName);
}
} | java | public void clearReferrerURLCookie(HttpServletRequest req, HttpServletResponse res, String cookieName) {
String url = CookieHelper.getCookieValue(req.getCookies(), cookieName);
if (url != null && url.length() > 0) {
invalidateReferrerURLCookie(req, res, cookieName);
}
} | [
"public",
"void",
"clearReferrerURLCookie",
"(",
"HttpServletRequest",
"req",
",",
"HttpServletResponse",
"res",
",",
"String",
"cookieName",
")",
"{",
"String",
"url",
"=",
"CookieHelper",
".",
"getCookieValue",
"(",
"req",
".",
"getCookies",
"(",
")",
",",
"cookieName",
")",
";",
"if",
"(",
"url",
"!=",
"null",
"&&",
"url",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"invalidateReferrerURLCookie",
"(",
"req",
",",
"res",
",",
"cookieName",
")",
";",
"}",
"}"
] | Removes the referrer URL cookie from the HttpServletResponse if set in the
HttpServletRequest.
@param req
@param res | [
"Removes",
"the",
"referrer",
"URL",
"cookie",
"from",
"the",
"HttpServletResponse",
"if",
"set",
"in",
"the",
"HttpServletRequest",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/ReferrerURLCookieHandler.java#L154-L160 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/ReferrerURLCookieHandler.java | ReferrerURLCookieHandler.setReferrerURLCookie | public void setReferrerURLCookie(HttpServletRequest req, AuthenticationResult authResult, String url) {
//PM81345: If the URL contains favicon, then we will not update the value of the ReffererURL. The only way
//we will do it, is if the value of the cookie is null. This will solve the Error 500.
if (url.contains("/favicon.ico") && CookieHelper.getCookieValue(req.getCookies(), REFERRER_URL_COOKIENAME) != null) {
if (tc.isDebugEnabled())
Tr.debug(tc, "Will not update the WASReqURL cookie");
} else {
if (!webAppSecConfig.getPreserveFullyQualifiedReferrerUrl()) {
url = removeHostNameFromURL(url);
}
url = encodeURL(url);
authResult.setCookie(createReferrerUrlCookie(req, url));
if (tc.isDebugEnabled()) {
Tr.debug(tc, "set " + REFERRER_URL_COOKIENAME + " cookie into AuthenticationResult.");
Tr.debug(tc, "setReferrerURLCookie", "Referrer URL cookie set " + url);
}
}
} | java | public void setReferrerURLCookie(HttpServletRequest req, AuthenticationResult authResult, String url) {
//PM81345: If the URL contains favicon, then we will not update the value of the ReffererURL. The only way
//we will do it, is if the value of the cookie is null. This will solve the Error 500.
if (url.contains("/favicon.ico") && CookieHelper.getCookieValue(req.getCookies(), REFERRER_URL_COOKIENAME) != null) {
if (tc.isDebugEnabled())
Tr.debug(tc, "Will not update the WASReqURL cookie");
} else {
if (!webAppSecConfig.getPreserveFullyQualifiedReferrerUrl()) {
url = removeHostNameFromURL(url);
}
url = encodeURL(url);
authResult.setCookie(createReferrerUrlCookie(req, url));
if (tc.isDebugEnabled()) {
Tr.debug(tc, "set " + REFERRER_URL_COOKIENAME + " cookie into AuthenticationResult.");
Tr.debug(tc, "setReferrerURLCookie", "Referrer URL cookie set " + url);
}
}
} | [
"public",
"void",
"setReferrerURLCookie",
"(",
"HttpServletRequest",
"req",
",",
"AuthenticationResult",
"authResult",
",",
"String",
"url",
")",
"{",
"//PM81345: If the URL contains favicon, then we will not update the value of the ReffererURL. The only way",
"//we will do it, is if the value of the cookie is null. This will solve the Error 500.",
"if",
"(",
"url",
".",
"contains",
"(",
"\"/favicon.ico\"",
")",
"&&",
"CookieHelper",
".",
"getCookieValue",
"(",
"req",
".",
"getCookies",
"(",
")",
",",
"REFERRER_URL_COOKIENAME",
")",
"!=",
"null",
")",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Will not update the WASReqURL cookie\"",
")",
";",
"}",
"else",
"{",
"if",
"(",
"!",
"webAppSecConfig",
".",
"getPreserveFullyQualifiedReferrerUrl",
"(",
")",
")",
"{",
"url",
"=",
"removeHostNameFromURL",
"(",
"url",
")",
";",
"}",
"url",
"=",
"encodeURL",
"(",
"url",
")",
";",
"authResult",
".",
"setCookie",
"(",
"createReferrerUrlCookie",
"(",
"req",
",",
"url",
")",
")",
";",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"set \"",
"+",
"REFERRER_URL_COOKIENAME",
"+",
"\" cookie into AuthenticationResult.\"",
")",
";",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"setReferrerURLCookie\"",
",",
"\"Referrer URL cookie set \"",
"+",
"url",
")",
";",
"}",
"}",
"}"
] | Sets the referrer URL cookie into the AuthenticationResult. If
PRESERVE_FULLY_QUALIFIED_REFERRER_URL is not set, or set to false,
then the host name of the referrer URL is removed.
@param authResult AuthenticationResult instance
@param url non-null URL String
@param securityConfig SecurityConfig instance | [
"Sets",
"the",
"referrer",
"URL",
"cookie",
"into",
"the",
"AuthenticationResult",
".",
"If",
"PRESERVE_FULLY_QUALIFIED_REFERRER_URL",
"is",
"not",
"set",
"or",
"set",
"to",
"false",
"then",
"the",
"host",
"name",
"of",
"the",
"referrer",
"URL",
"is",
"removed",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/ReferrerURLCookieHandler.java#L221-L238 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transaction/src/com/ibm/ws/transaction/services/DeferredRecoveryStarter.java | DeferredRecoveryStarter.checkDataSource | @FFDCIgnore(Exception.class)
private boolean checkDataSource(DataSource nonTranDataSource)
{
boolean fullyFormedDS = false;
try
{
nonTranDataSource = (DataSource) _dataSourceFactory.createResource(null);
if (tc.isDebugEnabled())
Tr.debug(tc, "Non Tran dataSource is " + nonTranDataSource);
Connection conn = nonTranDataSource.getConnection();
if (tc.isDebugEnabled())
Tr.debug(tc, "Established connection " + conn);
DatabaseMetaData mdata = conn.getMetaData();
String dbName = mdata.getDatabaseProductName();
if (tc.isDebugEnabled())
Tr.debug(tc, "Database name " + dbName);
String dbVersion = mdata.getDatabaseProductVersion();
if (tc.isDebugEnabled())
Tr.debug(tc, "Database version " + dbVersion);
fullyFormedDS = true;
} catch (Exception e)
{
// We will catch an exception if the DataSource is not yet fully formed
if (tc.isDebugEnabled())
Tr.debug(tc, "Caught exception: " + e);
}
return fullyFormedDS;
} | java | @FFDCIgnore(Exception.class)
private boolean checkDataSource(DataSource nonTranDataSource)
{
boolean fullyFormedDS = false;
try
{
nonTranDataSource = (DataSource) _dataSourceFactory.createResource(null);
if (tc.isDebugEnabled())
Tr.debug(tc, "Non Tran dataSource is " + nonTranDataSource);
Connection conn = nonTranDataSource.getConnection();
if (tc.isDebugEnabled())
Tr.debug(tc, "Established connection " + conn);
DatabaseMetaData mdata = conn.getMetaData();
String dbName = mdata.getDatabaseProductName();
if (tc.isDebugEnabled())
Tr.debug(tc, "Database name " + dbName);
String dbVersion = mdata.getDatabaseProductVersion();
if (tc.isDebugEnabled())
Tr.debug(tc, "Database version " + dbVersion);
fullyFormedDS = true;
} catch (Exception e)
{
// We will catch an exception if the DataSource is not yet fully formed
if (tc.isDebugEnabled())
Tr.debug(tc, "Caught exception: " + e);
}
return fullyFormedDS;
} | [
"@",
"FFDCIgnore",
"(",
"Exception",
".",
"class",
")",
"private",
"boolean",
"checkDataSource",
"(",
"DataSource",
"nonTranDataSource",
")",
"{",
"boolean",
"fullyFormedDS",
"=",
"false",
";",
"try",
"{",
"nonTranDataSource",
"=",
"(",
"DataSource",
")",
"_dataSourceFactory",
".",
"createResource",
"(",
"null",
")",
";",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Non Tran dataSource is \"",
"+",
"nonTranDataSource",
")",
";",
"Connection",
"conn",
"=",
"nonTranDataSource",
".",
"getConnection",
"(",
")",
";",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Established connection \"",
"+",
"conn",
")",
";",
"DatabaseMetaData",
"mdata",
"=",
"conn",
".",
"getMetaData",
"(",
")",
";",
"String",
"dbName",
"=",
"mdata",
".",
"getDatabaseProductName",
"(",
")",
";",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Database name \"",
"+",
"dbName",
")",
";",
"String",
"dbVersion",
"=",
"mdata",
".",
"getDatabaseProductVersion",
"(",
")",
";",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Database version \"",
"+",
"dbVersion",
")",
";",
"fullyFormedDS",
"=",
"true",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"// We will catch an exception if the DataSource is not yet fully formed",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Caught exception: \"",
"+",
"e",
")",
";",
"}",
"return",
"fullyFormedDS",
";",
"}"
] | See whether it is possible to get a connection and metatdata from a DataSOurce.
@param nonTranDataSource
@return true if the DS is usable | [
"See",
"whether",
"it",
"is",
"possible",
"to",
"get",
"a",
"connection",
"and",
"metatdata",
"from",
"a",
"DataSOurce",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transaction/src/com/ibm/ws/transaction/services/DeferredRecoveryStarter.java#L82-L110 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/utils/TraceImpl.java | TraceImpl.bytes | public void bytes(Object source,
Class sourceClass,
byte[] data) {
internalBytes(source,
sourceClass,
data,
0,
0);
} | java | public void bytes(Object source,
Class sourceClass,
byte[] data) {
internalBytes(source,
sourceClass,
data,
0,
0);
} | [
"public",
"void",
"bytes",
"(",
"Object",
"source",
",",
"Class",
"sourceClass",
",",
"byte",
"[",
"]",
"data",
")",
"{",
"internalBytes",
"(",
"source",
",",
"sourceClass",
",",
"data",
",",
"0",
",",
"0",
")",
";",
"}"
] | Byte data trace.
@param source
@param sourceClass
@param data | [
"Byte",
"data",
"trace",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/utils/TraceImpl.java#L165-L173 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/utils/TraceImpl.java | TraceImpl.entry | public final void entry(Class sourceClass,
String methodName) {
internalEntry(null,
sourceClass,
methodName,
null);
} | java | public final void entry(Class sourceClass,
String methodName) {
internalEntry(null,
sourceClass,
methodName,
null);
} | [
"public",
"final",
"void",
"entry",
"(",
"Class",
"sourceClass",
",",
"String",
"methodName",
")",
"{",
"internalEntry",
"(",
"null",
",",
"sourceClass",
",",
"methodName",
",",
"null",
")",
";",
"}"
] | Method entry tracing for static classes.
@param sourceClass The type of class which called this method
@param methodName The method name to trace | [
"Method",
"entry",
"tracing",
"for",
"static",
"classes",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/utils/TraceImpl.java#L434-L440 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/utils/TraceImpl.java | TraceImpl.exit | public final void exit(Class sourceClass,
String methodName) {
internalExit(null,
sourceClass,
methodName,
null);
} | java | public final void exit(Class sourceClass,
String methodName) {
internalExit(null,
sourceClass,
methodName,
null);
} | [
"public",
"final",
"void",
"exit",
"(",
"Class",
"sourceClass",
",",
"String",
"methodName",
")",
"{",
"internalExit",
"(",
"null",
",",
"sourceClass",
",",
"methodName",
",",
"null",
")",
";",
"}"
] | Method exit tracing for static methods.
@param sourceClass The type of class which called this method
@param methodName The method name to trace | [
"Method",
"exit",
"tracing",
"for",
"static",
"methods",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/utils/TraceImpl.java#L590-L596 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/utils/TraceImpl.java | TraceImpl.internalExit | private final void internalExit(Object source,
Class sourceClass,
String methodName,
Object object) {
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append(methodName);
stringBuffer.append(" [");
if (source != null) {
stringBuffer.append(source);
} else {
stringBuffer.append("Static");
}
stringBuffer.append("]");
if (object != null) {
SibTr.exit(traceComponent,
stringBuffer.toString(),
object);
} else {
SibTr.exit(traceComponent,
stringBuffer.toString());
}
if (usePrintWriterForTrace) {
java.io.PrintWriter printWriter = traceFactory.getPrintWriter();
if (printWriter != null) {
printWriter.print(new java.util.Date() + " < ");
printWriter.print(sourceClass.getName());
printWriter.print(".");
printWriter.println(stringBuffer.toString());
if (object != null) {
if (object instanceof Object[]) {
Object[] objects = (Object[]) object;
for (int i = 0; i < objects.length; i++) {
printWriter.println("\t\t" + objects[i]);
}
} else {
printWriter.println("\t\t" + object);
}
}
printWriter.flush();
}
}
} | java | private final void internalExit(Object source,
Class sourceClass,
String methodName,
Object object) {
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append(methodName);
stringBuffer.append(" [");
if (source != null) {
stringBuffer.append(source);
} else {
stringBuffer.append("Static");
}
stringBuffer.append("]");
if (object != null) {
SibTr.exit(traceComponent,
stringBuffer.toString(),
object);
} else {
SibTr.exit(traceComponent,
stringBuffer.toString());
}
if (usePrintWriterForTrace) {
java.io.PrintWriter printWriter = traceFactory.getPrintWriter();
if (printWriter != null) {
printWriter.print(new java.util.Date() + " < ");
printWriter.print(sourceClass.getName());
printWriter.print(".");
printWriter.println(stringBuffer.toString());
if (object != null) {
if (object instanceof Object[]) {
Object[] objects = (Object[]) object;
for (int i = 0; i < objects.length; i++) {
printWriter.println("\t\t" + objects[i]);
}
} else {
printWriter.println("\t\t" + object);
}
}
printWriter.flush();
}
}
} | [
"private",
"final",
"void",
"internalExit",
"(",
"Object",
"source",
",",
"Class",
"sourceClass",
",",
"String",
"methodName",
",",
"Object",
"object",
")",
"{",
"StringBuffer",
"stringBuffer",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"stringBuffer",
".",
"append",
"(",
"methodName",
")",
";",
"stringBuffer",
".",
"append",
"(",
"\" [\"",
")",
";",
"if",
"(",
"source",
"!=",
"null",
")",
"{",
"stringBuffer",
".",
"append",
"(",
"source",
")",
";",
"}",
"else",
"{",
"stringBuffer",
".",
"append",
"(",
"\"Static\"",
")",
";",
"}",
"stringBuffer",
".",
"append",
"(",
"\"]\"",
")",
";",
"if",
"(",
"object",
"!=",
"null",
")",
"{",
"SibTr",
".",
"exit",
"(",
"traceComponent",
",",
"stringBuffer",
".",
"toString",
"(",
")",
",",
"object",
")",
";",
"}",
"else",
"{",
"SibTr",
".",
"exit",
"(",
"traceComponent",
",",
"stringBuffer",
".",
"toString",
"(",
")",
")",
";",
"}",
"if",
"(",
"usePrintWriterForTrace",
")",
"{",
"java",
".",
"io",
".",
"PrintWriter",
"printWriter",
"=",
"traceFactory",
".",
"getPrintWriter",
"(",
")",
";",
"if",
"(",
"printWriter",
"!=",
"null",
")",
"{",
"printWriter",
".",
"print",
"(",
"new",
"java",
".",
"util",
".",
"Date",
"(",
")",
"+",
"\" < \"",
")",
";",
"printWriter",
".",
"print",
"(",
"sourceClass",
".",
"getName",
"(",
")",
")",
";",
"printWriter",
".",
"print",
"(",
"\".\"",
")",
";",
"printWriter",
".",
"println",
"(",
"stringBuffer",
".",
"toString",
"(",
")",
")",
";",
"if",
"(",
"object",
"!=",
"null",
")",
"{",
"if",
"(",
"object",
"instanceof",
"Object",
"[",
"]",
")",
"{",
"Object",
"[",
"]",
"objects",
"=",
"(",
"Object",
"[",
"]",
")",
"object",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"objects",
".",
"length",
";",
"i",
"++",
")",
"{",
"printWriter",
".",
"println",
"(",
"\"\\t\\t\"",
"+",
"objects",
"[",
"i",
"]",
")",
";",
"}",
"}",
"else",
"{",
"printWriter",
".",
"println",
"(",
"\"\\t\\t\"",
"+",
"object",
")",
";",
"}",
"}",
"printWriter",
".",
"flush",
"(",
")",
";",
"}",
"}",
"}"
] | Internal implementation of method exit tracing.
@param source The class instance which called this method
@param sourceClass The type of class which called this method
@param methodName The method name to trace
@param object An object to trace with the exit point i.e. method parameter | [
"Internal",
"implementation",
"of",
"method",
"exit",
"tracing",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/utils/TraceImpl.java#L690-L738 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/utils/TraceImpl.java | TraceImpl.event | public final void event(Class sourceClass,
String methodName,
Throwable throwable) {
internalEvent(null,
sourceClass,
methodName,
throwable);
} | java | public final void event(Class sourceClass,
String methodName,
Throwable throwable) {
internalEvent(null,
sourceClass,
methodName,
throwable);
} | [
"public",
"final",
"void",
"event",
"(",
"Class",
"sourceClass",
",",
"String",
"methodName",
",",
"Throwable",
"throwable",
")",
"{",
"internalEvent",
"(",
"null",
",",
"sourceClass",
",",
"methodName",
",",
"throwable",
")",
";",
"}"
] | Event tracing when a throwable is caught in a static class.
@param sourceClass The type of class which called this method
@param methodName The method where the event took place
@param throwable The exception to trace | [
"Event",
"tracing",
"when",
"a",
"throwable",
"is",
"caught",
"in",
"a",
"static",
"class",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/utils/TraceImpl.java#L747-L754 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/utils/TraceImpl.java | TraceImpl.event | public final void event(Object source,
Class sourceClass,
String methodName,
Throwable throwable) {
internalEvent(source,
sourceClass,
methodName,
throwable);
} | java | public final void event(Object source,
Class sourceClass,
String methodName,
Throwable throwable) {
internalEvent(source,
sourceClass,
methodName,
throwable);
} | [
"public",
"final",
"void",
"event",
"(",
"Object",
"source",
",",
"Class",
"sourceClass",
",",
"String",
"methodName",
",",
"Throwable",
"throwable",
")",
"{",
"internalEvent",
"(",
"source",
",",
"sourceClass",
",",
"methodName",
",",
"throwable",
")",
";",
"}"
] | Event tracing.
@param source The class instance which called this method
@param sourceClass The type of class which called this method
@param methodName The method where the event took place
@param throwable The exception to trace | [
"Event",
"tracing",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/utils/TraceImpl.java#L764-L772 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/utils/TraceImpl.java | TraceImpl.internalEvent | private final void internalEvent(Object source,
Class sourceClass,
String methodName,
Throwable throwable) {
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append(methodName);
stringBuffer.append(" [");
if (source != null) {
stringBuffer.append(source);
} else {
stringBuffer.append("Static");
}
stringBuffer.append("]");
if (throwable != null) {
SibTr.event(traceComponent,
stringBuffer.toString(),
new Object[] { "Exception caught: ",
throwable });
} else {
SibTr.event(traceComponent,
stringBuffer.toString());
}
if (usePrintWriterForTrace) {
java.io.PrintWriter printWriter = traceFactory.getPrintWriter();
if (printWriter != null) {
printWriter.print(new java.util.Date() + " E ");
printWriter.print(sourceClass.getName());
printWriter.print(".");
printWriter.println(stringBuffer.toString());
if (throwable != null) {
throwable.printStackTrace(printWriter);
}
printWriter.flush();
}
}
} | java | private final void internalEvent(Object source,
Class sourceClass,
String methodName,
Throwable throwable) {
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append(methodName);
stringBuffer.append(" [");
if (source != null) {
stringBuffer.append(source);
} else {
stringBuffer.append("Static");
}
stringBuffer.append("]");
if (throwable != null) {
SibTr.event(traceComponent,
stringBuffer.toString(),
new Object[] { "Exception caught: ",
throwable });
} else {
SibTr.event(traceComponent,
stringBuffer.toString());
}
if (usePrintWriterForTrace) {
java.io.PrintWriter printWriter = traceFactory.getPrintWriter();
if (printWriter != null) {
printWriter.print(new java.util.Date() + " E ");
printWriter.print(sourceClass.getName());
printWriter.print(".");
printWriter.println(stringBuffer.toString());
if (throwable != null) {
throwable.printStackTrace(printWriter);
}
printWriter.flush();
}
}
} | [
"private",
"final",
"void",
"internalEvent",
"(",
"Object",
"source",
",",
"Class",
"sourceClass",
",",
"String",
"methodName",
",",
"Throwable",
"throwable",
")",
"{",
"StringBuffer",
"stringBuffer",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"stringBuffer",
".",
"append",
"(",
"methodName",
")",
";",
"stringBuffer",
".",
"append",
"(",
"\" [\"",
")",
";",
"if",
"(",
"source",
"!=",
"null",
")",
"{",
"stringBuffer",
".",
"append",
"(",
"source",
")",
";",
"}",
"else",
"{",
"stringBuffer",
".",
"append",
"(",
"\"Static\"",
")",
";",
"}",
"stringBuffer",
".",
"append",
"(",
"\"]\"",
")",
";",
"if",
"(",
"throwable",
"!=",
"null",
")",
"{",
"SibTr",
".",
"event",
"(",
"traceComponent",
",",
"stringBuffer",
".",
"toString",
"(",
")",
",",
"new",
"Object",
"[",
"]",
"{",
"\"Exception caught: \"",
",",
"throwable",
"}",
")",
";",
"}",
"else",
"{",
"SibTr",
".",
"event",
"(",
"traceComponent",
",",
"stringBuffer",
".",
"toString",
"(",
")",
")",
";",
"}",
"if",
"(",
"usePrintWriterForTrace",
")",
"{",
"java",
".",
"io",
".",
"PrintWriter",
"printWriter",
"=",
"traceFactory",
".",
"getPrintWriter",
"(",
")",
";",
"if",
"(",
"printWriter",
"!=",
"null",
")",
"{",
"printWriter",
".",
"print",
"(",
"new",
"java",
".",
"util",
".",
"Date",
"(",
")",
"+",
"\" E \"",
")",
";",
"printWriter",
".",
"print",
"(",
"sourceClass",
".",
"getName",
"(",
")",
")",
";",
"printWriter",
".",
"print",
"(",
"\".\"",
")",
";",
"printWriter",
".",
"println",
"(",
"stringBuffer",
".",
"toString",
"(",
")",
")",
";",
"if",
"(",
"throwable",
"!=",
"null",
")",
"{",
"throwable",
".",
"printStackTrace",
"(",
"printWriter",
")",
";",
"}",
"printWriter",
".",
"flush",
"(",
")",
";",
"}",
"}",
"}"
] | Internal implementation of event tracing.
@param source The class instance which called this method
@param sourceClass The type of class which called this method
@param methodName The method where the event took place
@param throwable The exception to trace | [
"Internal",
"implementation",
"of",
"event",
"tracing",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/utils/TraceImpl.java#L782-L824 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/utils/TraceImpl.java | TraceImpl.info | public final void info(Class sourceClass,
String methodName,
String messageIdentifier,
Object object) {
internalInfo(null,
sourceClass,
methodName,
messageIdentifier,
object);
} | java | public final void info(Class sourceClass,
String methodName,
String messageIdentifier,
Object object) {
internalInfo(null,
sourceClass,
methodName,
messageIdentifier,
object);
} | [
"public",
"final",
"void",
"info",
"(",
"Class",
"sourceClass",
",",
"String",
"methodName",
",",
"String",
"messageIdentifier",
",",
"Object",
"object",
")",
"{",
"internalInfo",
"(",
"null",
",",
"sourceClass",
",",
"methodName",
",",
"messageIdentifier",
",",
"object",
")",
";",
"}"
] | Method information tracing for static objects.
@param Class of the static object making the trace call.
@param String name of the method being entered.
@param String identifying the message.
@param Object to be inserted into the message. | [
"Method",
"information",
"tracing",
"for",
"static",
"objects",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/utils/TraceImpl.java#L834-L843 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/utils/TraceImpl.java | TraceImpl.warning | public final void warning(Class sourceClass,
String methodName,
String messageIdentifier,
Object object) {
internalWarning(null,
sourceClass,
methodName,
messageIdentifier,
object);
} | java | public final void warning(Class sourceClass,
String methodName,
String messageIdentifier,
Object object) {
internalWarning(null,
sourceClass,
methodName,
messageIdentifier,
object);
} | [
"public",
"final",
"void",
"warning",
"(",
"Class",
"sourceClass",
",",
"String",
"methodName",
",",
"String",
"messageIdentifier",
",",
"Object",
"object",
")",
"{",
"internalWarning",
"(",
"null",
",",
"sourceClass",
",",
"methodName",
",",
"messageIdentifier",
",",
"object",
")",
";",
"}"
] | Method warning tracing for static objects.
@param Class of the static object making the trace call.
@param String name of the method being entered.
@param String identifying the message.
@param Object to be inserted into the message. | [
"Method",
"warning",
"tracing",
"for",
"static",
"objects",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/utils/TraceImpl.java#L914-L923 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheConfig.java | CacheConfig.overrideCacheConfig | public void overrideCacheConfig(Properties properties) {
if (properties != null) {
FieldInitializer.initFromSystemProperties(this, properties);
}
processOffloadDirectory();
if (!this.enableServletSupport) {
this.disableTemplatesSupport = true;
}
} | java | public void overrideCacheConfig(Properties properties) {
if (properties != null) {
FieldInitializer.initFromSystemProperties(this, properties);
}
processOffloadDirectory();
if (!this.enableServletSupport) {
this.disableTemplatesSupport = true;
}
} | [
"public",
"void",
"overrideCacheConfig",
"(",
"Properties",
"properties",
")",
"{",
"if",
"(",
"properties",
"!=",
"null",
")",
"{",
"FieldInitializer",
".",
"initFromSystemProperties",
"(",
"this",
",",
"properties",
")",
";",
"}",
"processOffloadDirectory",
"(",
")",
";",
"if",
"(",
"!",
"this",
".",
"enableServletSupport",
")",
"{",
"this",
".",
"disableTemplatesSupport",
"=",
"true",
";",
"}",
"}"
] | used by com.ibm.ws.cache.spi.DistributedMapFactory | [
"used",
"by",
"com",
".",
"ibm",
".",
"ws",
".",
"cache",
".",
"spi",
".",
"DistributedMapFactory"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheConfig.java#L512-L520 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheConfig.java | CacheConfig.determineCacheProvider | public void determineCacheProvider() {
this.defaultProvider = true;
if (cacheProviderName.equals("")) {
cacheProviderName = CacheConfig.CACHE_PROVIDER_DYNACACHE;
}
if (!cacheProviderName.equals(CACHE_PROVIDER_DYNACACHE)) {
defaultProvider = false;
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Alternate CacheProvider " + cacheProviderName + " set for " + cacheName);
}
}
} | java | public void determineCacheProvider() {
this.defaultProvider = true;
if (cacheProviderName.equals("")) {
cacheProviderName = CacheConfig.CACHE_PROVIDER_DYNACACHE;
}
if (!cacheProviderName.equals(CACHE_PROVIDER_DYNACACHE)) {
defaultProvider = false;
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Alternate CacheProvider " + cacheProviderName + " set for " + cacheName);
}
}
} | [
"public",
"void",
"determineCacheProvider",
"(",
")",
"{",
"this",
".",
"defaultProvider",
"=",
"true",
";",
"if",
"(",
"cacheProviderName",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",
"cacheProviderName",
"=",
"CacheConfig",
".",
"CACHE_PROVIDER_DYNACACHE",
";",
"}",
"if",
"(",
"!",
"cacheProviderName",
".",
"equals",
"(",
"CACHE_PROVIDER_DYNACACHE",
")",
")",
"{",
"defaultProvider",
"=",
"false",
";",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Alternate CacheProvider \"",
"+",
"cacheProviderName",
"+",
"\" set for \"",
"+",
"cacheName",
")",
";",
"}",
"}",
"}"
] | Determines if default cache provider is being used and sets flag accordingly. | [
"Determines",
"if",
"default",
"cache",
"provider",
"is",
"being",
"used",
"and",
"sets",
"flag",
"accordingly",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheConfig.java#L893-L904 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheConfig.java | CacheConfig.resetProvider | public void resetProvider(String cacheName) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Reverting to the default Dynacache cache provider");
}
this.cacheProviderName = CACHE_PROVIDER_DYNACACHE;
this.enableCacheReplication = false;
this.defaultProvider = true;
this.cacheName = cacheName;
} | java | public void resetProvider(String cacheName) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Reverting to the default Dynacache cache provider");
}
this.cacheProviderName = CACHE_PROVIDER_DYNACACHE;
this.enableCacheReplication = false;
this.defaultProvider = true;
this.cacheName = cacheName;
} | [
"public",
"void",
"resetProvider",
"(",
"String",
"cacheName",
")",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Reverting to the default Dynacache cache provider\"",
")",
";",
"}",
"this",
".",
"cacheProviderName",
"=",
"CACHE_PROVIDER_DYNACACHE",
";",
"this",
".",
"enableCacheReplication",
"=",
"false",
";",
"this",
".",
"defaultProvider",
"=",
"true",
";",
"this",
".",
"cacheName",
"=",
"cacheName",
";",
"}"
] | only called when the alternate cache provider could not create the cache.. we need to then revert to the default | [
"only",
"called",
"when",
"the",
"alternate",
"cache",
"provider",
"could",
"not",
"create",
"the",
"cache",
"..",
"we",
"need",
"to",
"then",
"revert",
"to",
"the",
"default"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheConfig.java#L913-L921 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheConfig.java | CacheConfig.restoreDynacacheProviderDefaults | void restoreDynacacheProviderDefaults() { // restore commonConfig to Dynacache defaults
if (restoreDynacacheDefaults) {
if (cacheProviderName != CacheConfig.CACHE_PROVIDER_DYNACACHE) {
cacheProviderName = CacheConfig.CACHE_PROVIDER_DYNACACHE;
enableCacheReplication = false;
if (tc.isDebugEnabled()) {
Tr.debug(tc, "OVERRIDING Object Grid default for " + cacheName);
}
}
}
} | java | void restoreDynacacheProviderDefaults() { // restore commonConfig to Dynacache defaults
if (restoreDynacacheDefaults) {
if (cacheProviderName != CacheConfig.CACHE_PROVIDER_DYNACACHE) {
cacheProviderName = CacheConfig.CACHE_PROVIDER_DYNACACHE;
enableCacheReplication = false;
if (tc.isDebugEnabled()) {
Tr.debug(tc, "OVERRIDING Object Grid default for " + cacheName);
}
}
}
} | [
"void",
"restoreDynacacheProviderDefaults",
"(",
")",
"{",
"// restore commonConfig to Dynacache defaults",
"if",
"(",
"restoreDynacacheDefaults",
")",
"{",
"if",
"(",
"cacheProviderName",
"!=",
"CacheConfig",
".",
"CACHE_PROVIDER_DYNACACHE",
")",
"{",
"cacheProviderName",
"=",
"CacheConfig",
".",
"CACHE_PROVIDER_DYNACACHE",
";",
"enableCacheReplication",
"=",
"false",
";",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"OVERRIDING Object Grid default for \"",
"+",
"cacheName",
")",
";",
"}",
"}",
"}",
"}"
] | This method reverts the common configuration template for all cache instances to use Dynaache defaults. This
method only comes into play when ObjectGrid is configured as the cache provider for the default cache. | [
"This",
"method",
"reverts",
"the",
"common",
"configuration",
"template",
"for",
"all",
"cache",
"instances",
"to",
"use",
"Dynaache",
"defaults",
".",
"This",
"method",
"only",
"comes",
"into",
"play",
"when",
"ObjectGrid",
"is",
"configured",
"as",
"the",
"cache",
"provider",
"for",
"the",
"default",
"cache",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheConfig.java#L927-L937 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/CustomLogProperties.java | CustomLogProperties.pluginId | public String pluginId() {
if (tc.isEntryEnabled())
Tr.entry(tc, "pluginId", this);
if (tc.isEntryEnabled())
Tr.exit(tc, "pluginId", _pluginId);
return _pluginId;
} | java | public String pluginId() {
if (tc.isEntryEnabled())
Tr.entry(tc, "pluginId", this);
if (tc.isEntryEnabled())
Tr.exit(tc, "pluginId", _pluginId);
return _pluginId;
} | [
"public",
"String",
"pluginId",
"(",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"pluginId\"",
",",
"this",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"pluginId\"",
",",
"_pluginId",
")",
";",
"return",
"_pluginId",
";",
"}"
] | Returns the pluginId associated with this type of log
@return int eclipse plugin id | [
"Returns",
"the",
"pluginId",
"associated",
"with",
"this",
"type",
"of",
"log"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/CustomLogProperties.java#L165-L171 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/CustomLogProperties.java | CustomLogProperties.properties | public Properties properties() {
if (tc.isEntryEnabled())
Tr.entry(tc, "propertis", this);
if (tc.isEntryEnabled())
Tr.exit(tc, "properties", _props);
return _props;
} | java | public Properties properties() {
if (tc.isEntryEnabled())
Tr.entry(tc, "propertis", this);
if (tc.isEntryEnabled())
Tr.exit(tc, "properties", _props);
return _props;
} | [
"public",
"Properties",
"properties",
"(",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"propertis\"",
",",
"this",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"properties\"",
",",
"_props",
")",
";",
"return",
"_props",
";",
"}"
] | Returns the set of properties associated with this log implementation
@return Properties custom properties associated with this log implementation | [
"Returns",
"the",
"set",
"of",
"properties",
"associated",
"with",
"this",
"log",
"implementation"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/CustomLogProperties.java#L181-L187 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/CustomLogProperties.java | CustomLogProperties.resourceFactory | public ResourceFactory resourceFactory() {
if (tc.isEntryEnabled())
Tr.entry(tc, "resourceFactory", this);
if (tc.isEntryEnabled())
Tr.exit(tc, "resourceFactory", _resourceFactory);
return _resourceFactory;
} | java | public ResourceFactory resourceFactory() {
if (tc.isEntryEnabled())
Tr.entry(tc, "resourceFactory", this);
if (tc.isEntryEnabled())
Tr.exit(tc, "resourceFactory", _resourceFactory);
return _resourceFactory;
} | [
"public",
"ResourceFactory",
"resourceFactory",
"(",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"resourceFactory\"",
",",
"this",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"resourceFactory\"",
",",
"_resourceFactory",
")",
";",
"return",
"_resourceFactory",
";",
"}"
] | Returns the Resource Factory associated with this log
implementation
@return ResourceFactory associated with this log
implementation | [
"Returns",
"the",
"Resource",
"Factory",
"associated",
"with",
"this",
"log",
"implementation"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/CustomLogProperties.java#L267-L273 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/WebContainer.java | WebContainer.loadCipherToBit | protected void loadCipherToBit() {
boolean keySizeFromCipherMap =
Boolean.valueOf(WebContainer.getWebContainerProperties().getProperty("com.ibm.ws.webcontainer.keysizefromciphermap", "true")).booleanValue();
//721610
if (keySizeFromCipherMap) {
this.getKeySizefromCipherMap("toLoad"); // this will load the Map with values
} else {
Properties cipherToBitProps = new Properties();
// load the ssl cipher suite bit sizes property file
try {
String fileName = System.getProperty("server.root") + File.separator + "properties" + File.separator + "sslbitsizes.properties";
cipherToBitProps.load(new FileInputStream(fileName));
} catch (Exception ex) {
logger.logp(Level.SEVERE, CLASS_NAME, "loadCipherToBit", "failed.to.load.sslbitsizes.properties ", ex); /* 283348.1 */
com.ibm.wsspi.webcontainer.util.FFDCWrapper.processException(ex, CLASS_NAME + ".loadCipherToBit", "825", this);
}
// put the properties into a hash map for unsynch. reference
_cipherToBit.putAll(cipherToBitProps);
}
} | java | protected void loadCipherToBit() {
boolean keySizeFromCipherMap =
Boolean.valueOf(WebContainer.getWebContainerProperties().getProperty("com.ibm.ws.webcontainer.keysizefromciphermap", "true")).booleanValue();
//721610
if (keySizeFromCipherMap) {
this.getKeySizefromCipherMap("toLoad"); // this will load the Map with values
} else {
Properties cipherToBitProps = new Properties();
// load the ssl cipher suite bit sizes property file
try {
String fileName = System.getProperty("server.root") + File.separator + "properties" + File.separator + "sslbitsizes.properties";
cipherToBitProps.load(new FileInputStream(fileName));
} catch (Exception ex) {
logger.logp(Level.SEVERE, CLASS_NAME, "loadCipherToBit", "failed.to.load.sslbitsizes.properties ", ex); /* 283348.1 */
com.ibm.wsspi.webcontainer.util.FFDCWrapper.processException(ex, CLASS_NAME + ".loadCipherToBit", "825", this);
}
// put the properties into a hash map for unsynch. reference
_cipherToBit.putAll(cipherToBitProps);
}
} | [
"protected",
"void",
"loadCipherToBit",
"(",
")",
"{",
"boolean",
"keySizeFromCipherMap",
"=",
"Boolean",
".",
"valueOf",
"(",
"WebContainer",
".",
"getWebContainerProperties",
"(",
")",
".",
"getProperty",
"(",
"\"com.ibm.ws.webcontainer.keysizefromciphermap\"",
",",
"\"true\"",
")",
")",
".",
"booleanValue",
"(",
")",
";",
"//721610",
"if",
"(",
"keySizeFromCipherMap",
")",
"{",
"this",
".",
"getKeySizefromCipherMap",
"(",
"\"toLoad\"",
")",
";",
"// this will load the Map with values",
"}",
"else",
"{",
"Properties",
"cipherToBitProps",
"=",
"new",
"Properties",
"(",
")",
";",
"// load the ssl cipher suite bit sizes property file",
"try",
"{",
"String",
"fileName",
"=",
"System",
".",
"getProperty",
"(",
"\"server.root\"",
")",
"+",
"File",
".",
"separator",
"+",
"\"properties\"",
"+",
"File",
".",
"separator",
"+",
"\"sslbitsizes.properties\"",
";",
"cipherToBitProps",
".",
"load",
"(",
"new",
"FileInputStream",
"(",
"fileName",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"logger",
".",
"logp",
"(",
"Level",
".",
"SEVERE",
",",
"CLASS_NAME",
",",
"\"loadCipherToBit\"",
",",
"\"failed.to.load.sslbitsizes.properties \"",
",",
"ex",
")",
";",
"/* 283348.1 */",
"com",
".",
"ibm",
".",
"wsspi",
".",
"webcontainer",
".",
"util",
".",
"FFDCWrapper",
".",
"processException",
"(",
"ex",
",",
"CLASS_NAME",
"+",
"\".loadCipherToBit\"",
",",
"\"825\"",
",",
"this",
")",
";",
"}",
"// put the properties into a hash map for unsynch. reference",
"_cipherToBit",
".",
"putAll",
"(",
"cipherToBitProps",
")",
";",
"}",
"}"
] | 112102 - added method below to fill the cipher to bit size table | [
"112102",
"-",
"added",
"method",
"below",
"to",
"fill",
"the",
"cipher",
"to",
"bit",
"size",
"table"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/WebContainer.java#L396-L418 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/WebContainer.java | WebContainer.getVirtualHost | public VirtualHost getVirtualHost(String targetHost) throws WebAppHostNotFoundException {
Iterator i = requestMapper.targetMappings();
while (i.hasNext()) {
RequestProcessor rp = (RequestProcessor) i.next();
if (rp instanceof VirtualHost) {
VirtualHost vHost = (VirtualHost) rp;
if (targetHost.equalsIgnoreCase(vHost.getName()))
return vHost;
}
}
return null;
} | java | public VirtualHost getVirtualHost(String targetHost) throws WebAppHostNotFoundException {
Iterator i = requestMapper.targetMappings();
while (i.hasNext()) {
RequestProcessor rp = (RequestProcessor) i.next();
if (rp instanceof VirtualHost) {
VirtualHost vHost = (VirtualHost) rp;
if (targetHost.equalsIgnoreCase(vHost.getName()))
return vHost;
}
}
return null;
} | [
"public",
"VirtualHost",
"getVirtualHost",
"(",
"String",
"targetHost",
")",
"throws",
"WebAppHostNotFoundException",
"{",
"Iterator",
"i",
"=",
"requestMapper",
".",
"targetMappings",
"(",
")",
";",
"while",
"(",
"i",
".",
"hasNext",
"(",
")",
")",
"{",
"RequestProcessor",
"rp",
"=",
"(",
"RequestProcessor",
")",
"i",
".",
"next",
"(",
")",
";",
"if",
"(",
"rp",
"instanceof",
"VirtualHost",
")",
"{",
"VirtualHost",
"vHost",
"=",
"(",
"VirtualHost",
")",
"rp",
";",
"if",
"(",
"targetHost",
".",
"equalsIgnoreCase",
"(",
"vHost",
".",
"getName",
"(",
")",
")",
")",
"return",
"vHost",
";",
"}",
"}",
"return",
"null",
";",
"}"
] | Method getVirtualHost. Returns null if the input name does not
match any configured host.
@param targetHost
@return VirtualHost
This method is not to be used in any request processing as it
is not optimized for performance
@throws WebAppHostNotFoundException | [
"Method",
"getVirtualHost",
".",
"Returns",
"null",
"if",
"the",
"input",
"name",
"does",
"not",
"match",
"any",
"configured",
"host",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/WebContainer.java#L562-L575 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/WebContainer.java | WebContainer.removeExtraPathInfo | private PathInfoHelper removeExtraPathInfo(String pathInfo) {
if (pathInfo == null)
return null;
int semicolon = pathInfo.indexOf(';');
if (semicolon != -1) {
String tmpPathInfo = pathInfo.substring(0, semicolon);
String extraPathInfo = pathInfo.substring(semicolon);
return new PathInfoHelper(tmpPathInfo, extraPathInfo);
}
return new PathInfoHelper(pathInfo, null);
} | java | private PathInfoHelper removeExtraPathInfo(String pathInfo) {
if (pathInfo == null)
return null;
int semicolon = pathInfo.indexOf(';');
if (semicolon != -1) {
String tmpPathInfo = pathInfo.substring(0, semicolon);
String extraPathInfo = pathInfo.substring(semicolon);
return new PathInfoHelper(tmpPathInfo, extraPathInfo);
}
return new PathInfoHelper(pathInfo, null);
} | [
"private",
"PathInfoHelper",
"removeExtraPathInfo",
"(",
"String",
"pathInfo",
")",
"{",
"if",
"(",
"pathInfo",
"==",
"null",
")",
"return",
"null",
";",
"int",
"semicolon",
"=",
"pathInfo",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"semicolon",
"!=",
"-",
"1",
")",
"{",
"String",
"tmpPathInfo",
"=",
"pathInfo",
".",
"substring",
"(",
"0",
",",
"semicolon",
")",
";",
"String",
"extraPathInfo",
"=",
"pathInfo",
".",
"substring",
"(",
"semicolon",
")",
";",
"return",
"new",
"PathInfoHelper",
"(",
"tmpPathInfo",
",",
"extraPathInfo",
")",
";",
"}",
"return",
"new",
"PathInfoHelper",
"(",
"pathInfo",
",",
"null",
")",
";",
"}"
] | begin 272738 Duplicate CacheServletWrappers when url-rewriting is enabled WAS.webcontainer | [
"begin",
"272738",
"Duplicate",
"CacheServletWrappers",
"when",
"url",
"-",
"rewriting",
"is",
"enabled",
"WAS",
".",
"webcontainer"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/WebContainer.java#L1512-L1524 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/WebContainer.java | WebContainer.sendAppUnavailableException | public static void sendAppUnavailableException(HttpServletRequest req, HttpServletResponse res) throws IOException {
if ((req instanceof SRTServletRequest) && (res instanceof SRTServletResponse)) {
IRequest ireq = ((SRTServletRequest) req).getIRequest();
IResponse ires = ((SRTServletResponse) res).getIResponse();
sendUnavailableException(ireq, ires);
}
} | java | public static void sendAppUnavailableException(HttpServletRequest req, HttpServletResponse res) throws IOException {
if ((req instanceof SRTServletRequest) && (res instanceof SRTServletResponse)) {
IRequest ireq = ((SRTServletRequest) req).getIRequest();
IResponse ires = ((SRTServletResponse) res).getIResponse();
sendUnavailableException(ireq, ires);
}
} | [
"public",
"static",
"void",
"sendAppUnavailableException",
"(",
"HttpServletRequest",
"req",
",",
"HttpServletResponse",
"res",
")",
"throws",
"IOException",
"{",
"if",
"(",
"(",
"req",
"instanceof",
"SRTServletRequest",
")",
"&&",
"(",
"res",
"instanceof",
"SRTServletResponse",
")",
")",
"{",
"IRequest",
"ireq",
"=",
"(",
"(",
"SRTServletRequest",
")",
"req",
")",
".",
"getIRequest",
"(",
")",
";",
"IResponse",
"ires",
"=",
"(",
"(",
"SRTServletResponse",
")",
"res",
")",
".",
"getIResponse",
"(",
")",
";",
"sendUnavailableException",
"(",
"ireq",
",",
"ires",
")",
";",
"}",
"}"
] | and throw a NPE because we couldn't get the application's configuration | [
"and",
"throw",
"a",
"NPE",
"because",
"we",
"couldn",
"t",
"get",
"the",
"application",
"s",
"configuration"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/WebContainer.java#L1570-L1577 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/WebContainer.java | WebContainer.sendUnavailableException | protected static void sendUnavailableException(IRequest req, IResponse res) throws IOException {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) //306998.15
logger.logp(Level.FINE, CLASS_NAME, "sendUnavailableException", "Inside sendUnavailableException");
res.addHeader("Content-Type", "text/html");
res.setStatusCode(503);
//Translated to SRVE0095I: Servlet has become temporarily unavailable for service: {0}
String formattedMessage = nls.getFormattedMessage("Servlet.has.become.temporarily.unavailable.for.service:.{0}", new Object[] { truncateURI(req.getRequestURI()) },
"Servlet has become temporarily unavailable for service");
String output = "<H1>"
+ formattedMessage
+ "</H1><BR>";
byte[] outBytes = output.getBytes();
res.getOutputStream().write(outBytes, 0, outBytes.length);
logger.logp(Level.SEVERE, CLASS_NAME, "sendUnavailableException", formattedMessage );
} | java | protected static void sendUnavailableException(IRequest req, IResponse res) throws IOException {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) //306998.15
logger.logp(Level.FINE, CLASS_NAME, "sendUnavailableException", "Inside sendUnavailableException");
res.addHeader("Content-Type", "text/html");
res.setStatusCode(503);
//Translated to SRVE0095I: Servlet has become temporarily unavailable for service: {0}
String formattedMessage = nls.getFormattedMessage("Servlet.has.become.temporarily.unavailable.for.service:.{0}", new Object[] { truncateURI(req.getRequestURI()) },
"Servlet has become temporarily unavailable for service");
String output = "<H1>"
+ formattedMessage
+ "</H1><BR>";
byte[] outBytes = output.getBytes();
res.getOutputStream().write(outBytes, 0, outBytes.length);
logger.logp(Level.SEVERE, CLASS_NAME, "sendUnavailableException", formattedMessage );
} | [
"protected",
"static",
"void",
"sendUnavailableException",
"(",
"IRequest",
"req",
",",
"IResponse",
"res",
")",
"throws",
"IOException",
"{",
"if",
"(",
"com",
".",
"ibm",
".",
"ejs",
".",
"ras",
".",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"//306998.15",
"logger",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"CLASS_NAME",
",",
"\"sendUnavailableException\"",
",",
"\"Inside sendUnavailableException\"",
")",
";",
"res",
".",
"addHeader",
"(",
"\"Content-Type\"",
",",
"\"text/html\"",
")",
";",
"res",
".",
"setStatusCode",
"(",
"503",
")",
";",
"//Translated to SRVE0095I: Servlet has become temporarily unavailable for service: {0}",
"String",
"formattedMessage",
"=",
"nls",
".",
"getFormattedMessage",
"(",
"\"Servlet.has.become.temporarily.unavailable.for.service:.{0}\"",
",",
"new",
"Object",
"[",
"]",
"{",
"truncateURI",
"(",
"req",
".",
"getRequestURI",
"(",
")",
")",
"}",
",",
"\"Servlet has become temporarily unavailable for service\"",
")",
";",
"String",
"output",
"=",
"\"<H1>\"",
"+",
"formattedMessage",
"+",
"\"</H1><BR>\"",
";",
"byte",
"[",
"]",
"outBytes",
"=",
"output",
".",
"getBytes",
"(",
")",
";",
"res",
".",
"getOutputStream",
"(",
")",
".",
"write",
"(",
"outBytes",
",",
"0",
",",
"outBytes",
".",
"length",
")",
";",
"logger",
".",
"logp",
"(",
"Level",
".",
"SEVERE",
",",
"CLASS_NAME",
",",
"\"sendUnavailableException\"",
",",
"formattedMessage",
")",
";",
"}"
] | 582053 change it to protected from private | [
"582053",
"change",
"it",
"to",
"protected",
"from",
"private"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/WebContainer.java#L1581-L1599 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.mp.jwt_fat/fat/src/com/ibm/ws/security/mp/jwt/fat/MPJwtNoMpJwtConfig.java | MPJwtNoMpJwtConfig.MPJwtNoMpJwtConfig_notInWebXML_notInApp | @Test
public void MPJwtNoMpJwtConfig_notInWebXML_notInApp() throws Exception {
genericLoginConfigVariationTest(
MpJwtFatConstants.LOGINCONFIG_NOT_IN_WEB_XML_SERVLET_NOT_IN_APP_ROOT_CONTEXT,
MpJwtFatConstants.LOGINCONFIG_NOT_IN_WEB_XML_SERVLET_NOT_IN_APP,
MpJwtFatConstants.MPJWT_APP_CLASS_NO_LOGIN_CONFIG,
ExpectedResult.BAD);
} | java | @Test
public void MPJwtNoMpJwtConfig_notInWebXML_notInApp() throws Exception {
genericLoginConfigVariationTest(
MpJwtFatConstants.LOGINCONFIG_NOT_IN_WEB_XML_SERVLET_NOT_IN_APP_ROOT_CONTEXT,
MpJwtFatConstants.LOGINCONFIG_NOT_IN_WEB_XML_SERVLET_NOT_IN_APP,
MpJwtFatConstants.MPJWT_APP_CLASS_NO_LOGIN_CONFIG,
ExpectedResult.BAD);
} | [
"@",
"Test",
"public",
"void",
"MPJwtNoMpJwtConfig_notInWebXML_notInApp",
"(",
")",
"throws",
"Exception",
"{",
"genericLoginConfigVariationTest",
"(",
"MpJwtFatConstants",
".",
"LOGINCONFIG_NOT_IN_WEB_XML_SERVLET_NOT_IN_APP_ROOT_CONTEXT",
",",
"MpJwtFatConstants",
".",
"LOGINCONFIG_NOT_IN_WEB_XML_SERVLET_NOT_IN_APP",
",",
"MpJwtFatConstants",
".",
"MPJWT_APP_CLASS_NO_LOGIN_CONFIG",
",",
"ExpectedResult",
".",
"BAD",
")",
";",
"}"
] | login-config does NOT exist in web.xml
login-config does NOT exist in the app
the mpJwt feature is NOT enabled
We should receive a 401 status in an exception
@throws Exception | [
"login",
"-",
"config",
"does",
"NOT",
"exist",
"in",
"web",
".",
"xml",
"login",
"-",
"config",
"does",
"NOT",
"exist",
"in",
"the",
"app",
"the",
"mpJwt",
"feature",
"is",
"NOT",
"enabled",
"We",
"should",
"receive",
"a",
"401",
"status",
"in",
"an",
"exception"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.mp.jwt_fat/fat/src/com/ibm/ws/security/mp/jwt/fat/MPJwtNoMpJwtConfig.java#L53-L62 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.mp.jwt_fat/fat/src/com/ibm/ws/security/mp/jwt/fat/MPJwtNoMpJwtConfig.java | MPJwtNoMpJwtConfig.MPJwtNoMpJwtConfig_notInWebXML_basicInApp | @Test
public void MPJwtNoMpJwtConfig_notInWebXML_basicInApp() throws Exception {
genericLoginConfigVariationTest(
MpJwtFatConstants.LOGINCONFIG_NOT_IN_WEB_XML_SERVLET_BASIC_IN_APP_ROOT_CONTEXT,
MpJwtFatConstants.LOGINCONFIG_NOT_IN_WEB_XML_SERVLET_BASIC_IN_APP,
MpJwtFatConstants.MPJWT_APP_CLASS_LOGIN_CONFIG_BASIC,
ExpectedResult.BAD);
} | java | @Test
public void MPJwtNoMpJwtConfig_notInWebXML_basicInApp() throws Exception {
genericLoginConfigVariationTest(
MpJwtFatConstants.LOGINCONFIG_NOT_IN_WEB_XML_SERVLET_BASIC_IN_APP_ROOT_CONTEXT,
MpJwtFatConstants.LOGINCONFIG_NOT_IN_WEB_XML_SERVLET_BASIC_IN_APP,
MpJwtFatConstants.MPJWT_APP_CLASS_LOGIN_CONFIG_BASIC,
ExpectedResult.BAD);
} | [
"@",
"Test",
"public",
"void",
"MPJwtNoMpJwtConfig_notInWebXML_basicInApp",
"(",
")",
"throws",
"Exception",
"{",
"genericLoginConfigVariationTest",
"(",
"MpJwtFatConstants",
".",
"LOGINCONFIG_NOT_IN_WEB_XML_SERVLET_BASIC_IN_APP_ROOT_CONTEXT",
",",
"MpJwtFatConstants",
".",
"LOGINCONFIG_NOT_IN_WEB_XML_SERVLET_BASIC_IN_APP",
",",
"MpJwtFatConstants",
".",
"MPJWT_APP_CLASS_LOGIN_CONFIG_BASIC",
",",
"ExpectedResult",
".",
"BAD",
")",
";",
"}"
] | login-config does NOT exist in web.xml
login-config does exist in the app, but is set to BASIC
the mpJwt feature is NOT enabled
We should receive a 401 status in an exception
@throws Exception | [
"login",
"-",
"config",
"does",
"NOT",
"exist",
"in",
"web",
".",
"xml",
"login",
"-",
"config",
"does",
"exist",
"in",
"the",
"app",
"but",
"is",
"set",
"to",
"BASIC",
"the",
"mpJwt",
"feature",
"is",
"NOT",
"enabled",
"We",
"should",
"receive",
"a",
"401",
"status",
"in",
"an",
"exception"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.mp.jwt_fat/fat/src/com/ibm/ws/security/mp/jwt/fat/MPJwtNoMpJwtConfig.java#L73-L82 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.mp.jwt_fat/fat/src/com/ibm/ws/security/mp/jwt/fat/MPJwtNoMpJwtConfig.java | MPJwtNoMpJwtConfig.MPJwtNoMpJwtConfig_formLoginInWebXML_notInApp | @Test
public void MPJwtNoMpJwtConfig_formLoginInWebXML_notInApp() throws Exception {
genericLoginConfigFormLoginVariationTest(
MpJwtFatConstants.LOGINCONFIG_FORM_LOGIN_IN_WEB_XML_SERVLET_NOT_IN_APP_ROOT_CONTEXT,
MpJwtFatConstants.LOGINCONFIG_FORM_LOGIN_IN_WEB_XML_SERVLET_NOT_IN_APP,
MpJwtFatConstants.MPJWT_APP_CLASS_LOGIN_CONFIG_FORMLOGININWEBXML_NOTINAPP,
UseJWTToken.NO);
} | java | @Test
public void MPJwtNoMpJwtConfig_formLoginInWebXML_notInApp() throws Exception {
genericLoginConfigFormLoginVariationTest(
MpJwtFatConstants.LOGINCONFIG_FORM_LOGIN_IN_WEB_XML_SERVLET_NOT_IN_APP_ROOT_CONTEXT,
MpJwtFatConstants.LOGINCONFIG_FORM_LOGIN_IN_WEB_XML_SERVLET_NOT_IN_APP,
MpJwtFatConstants.MPJWT_APP_CLASS_LOGIN_CONFIG_FORMLOGININWEBXML_NOTINAPP,
UseJWTToken.NO);
} | [
"@",
"Test",
"public",
"void",
"MPJwtNoMpJwtConfig_formLoginInWebXML_notInApp",
"(",
")",
"throws",
"Exception",
"{",
"genericLoginConfigFormLoginVariationTest",
"(",
"MpJwtFatConstants",
".",
"LOGINCONFIG_FORM_LOGIN_IN_WEB_XML_SERVLET_NOT_IN_APP_ROOT_CONTEXT",
",",
"MpJwtFatConstants",
".",
"LOGINCONFIG_FORM_LOGIN_IN_WEB_XML_SERVLET_NOT_IN_APP",
",",
"MpJwtFatConstants",
".",
"MPJWT_APP_CLASS_LOGIN_CONFIG_FORMLOGININWEBXML_NOTINAPP",
",",
"UseJWTToken",
".",
"NO",
")",
";",
"}"
] | login-config does exist in web.xml, but is set to FORM_LOGIN
login-config does NOT exist in the app
the mpJwt feature is NOT enabled
We should use FORM_LOGIN
@throws Exception | [
"login",
"-",
"config",
"does",
"exist",
"in",
"web",
".",
"xml",
"but",
"is",
"set",
"to",
"FORM_LOGIN",
"login",
"-",
"config",
"does",
"NOT",
"exist",
"in",
"the",
"app",
"the",
"mpJwt",
"feature",
"is",
"NOT",
"enabled",
"We",
"should",
"use",
"FORM_LOGIN"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.mp.jwt_fat/fat/src/com/ibm/ws/security/mp/jwt/fat/MPJwtNoMpJwtConfig.java#L113-L122 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.mp.jwt_fat/fat/src/com/ibm/ws/security/mp/jwt/fat/MPJwtNoMpJwtConfig.java | MPJwtNoMpJwtConfig.MPJwtNoMpJwtConfig_formLoginInWebXML_basicInApp | @Test
public void MPJwtNoMpJwtConfig_formLoginInWebXML_basicInApp() throws Exception {
genericLoginConfigFormLoginVariationTest(
MpJwtFatConstants.LOGINCONFIG_FORM_LOGIN_IN_WEB_XML_SERVLET_BASIC_IN_APP_ROOT_CONTEXT,
MpJwtFatConstants.LOGINCONFIG_FORM_LOGIN_IN_WEB_XML_SERVLET_BASIC_IN_APP,
MpJwtFatConstants.MPJWT_APP_CLASS_LOGIN_CONFIG_FORMLOGININWEBXML_BASICINAPP,
UseJWTToken.NO);
} | java | @Test
public void MPJwtNoMpJwtConfig_formLoginInWebXML_basicInApp() throws Exception {
genericLoginConfigFormLoginVariationTest(
MpJwtFatConstants.LOGINCONFIG_FORM_LOGIN_IN_WEB_XML_SERVLET_BASIC_IN_APP_ROOT_CONTEXT,
MpJwtFatConstants.LOGINCONFIG_FORM_LOGIN_IN_WEB_XML_SERVLET_BASIC_IN_APP,
MpJwtFatConstants.MPJWT_APP_CLASS_LOGIN_CONFIG_FORMLOGININWEBXML_BASICINAPP,
UseJWTToken.NO);
} | [
"@",
"Test",
"public",
"void",
"MPJwtNoMpJwtConfig_formLoginInWebXML_basicInApp",
"(",
")",
"throws",
"Exception",
"{",
"genericLoginConfigFormLoginVariationTest",
"(",
"MpJwtFatConstants",
".",
"LOGINCONFIG_FORM_LOGIN_IN_WEB_XML_SERVLET_BASIC_IN_APP_ROOT_CONTEXT",
",",
"MpJwtFatConstants",
".",
"LOGINCONFIG_FORM_LOGIN_IN_WEB_XML_SERVLET_BASIC_IN_APP",
",",
"MpJwtFatConstants",
".",
"MPJWT_APP_CLASS_LOGIN_CONFIG_FORMLOGININWEBXML_BASICINAPP",
",",
"UseJWTToken",
".",
"NO",
")",
";",
"}"
] | login-config does exist in web.xml, but is set to FORM_LOGIN
login-config does NOT exist in the app, but is set to BASIC
the mpJwt feature is NOT enabled
We should use FORM_LOGIN
@throws Exception | [
"login",
"-",
"config",
"does",
"exist",
"in",
"web",
".",
"xml",
"but",
"is",
"set",
"to",
"FORM_LOGIN",
"login",
"-",
"config",
"does",
"NOT",
"exist",
"in",
"the",
"app",
"but",
"is",
"set",
"to",
"BASIC",
"the",
"mpJwt",
"feature",
"is",
"NOT",
"enabled",
"We",
"should",
"use",
"FORM_LOGIN"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.mp.jwt_fat/fat/src/com/ibm/ws/security/mp/jwt/fat/MPJwtNoMpJwtConfig.java#L133-L142 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.mp.jwt_fat/fat/src/com/ibm/ws/security/mp/jwt/fat/MPJwtNoMpJwtConfig.java | MPJwtNoMpJwtConfig.MPJwtNoMpJwtConfig_formLoginInWebXML_mpJwtInApp | @Test
public void MPJwtNoMpJwtConfig_formLoginInWebXML_mpJwtInApp() throws Exception {
genericLoginConfigFormLoginVariationTest(
MpJwtFatConstants.LOGINCONFIG_FORM_LOGIN_IN_WEB_XML_SERVLET_MP_JWT_IN_APP_ROOT_CONTEXT,
MpJwtFatConstants.LOGINCONFIG_FORM_LOGIN_IN_WEB_XML_SERVLET_MP_JWT_IN_APP,
MpJwtFatConstants.MPJWT_APP_CLASS_LOGIN_CONFIG_FORMLOGININWEBXML_MPJWTINAPP,
UseJWTToken.NO);
} | java | @Test
public void MPJwtNoMpJwtConfig_formLoginInWebXML_mpJwtInApp() throws Exception {
genericLoginConfigFormLoginVariationTest(
MpJwtFatConstants.LOGINCONFIG_FORM_LOGIN_IN_WEB_XML_SERVLET_MP_JWT_IN_APP_ROOT_CONTEXT,
MpJwtFatConstants.LOGINCONFIG_FORM_LOGIN_IN_WEB_XML_SERVLET_MP_JWT_IN_APP,
MpJwtFatConstants.MPJWT_APP_CLASS_LOGIN_CONFIG_FORMLOGININWEBXML_MPJWTINAPP,
UseJWTToken.NO);
} | [
"@",
"Test",
"public",
"void",
"MPJwtNoMpJwtConfig_formLoginInWebXML_mpJwtInApp",
"(",
")",
"throws",
"Exception",
"{",
"genericLoginConfigFormLoginVariationTest",
"(",
"MpJwtFatConstants",
".",
"LOGINCONFIG_FORM_LOGIN_IN_WEB_XML_SERVLET_MP_JWT_IN_APP_ROOT_CONTEXT",
",",
"MpJwtFatConstants",
".",
"LOGINCONFIG_FORM_LOGIN_IN_WEB_XML_SERVLET_MP_JWT_IN_APP",
",",
"MpJwtFatConstants",
".",
"MPJWT_APP_CLASS_LOGIN_CONFIG_FORMLOGININWEBXML_MPJWTINAPP",
",",
"UseJWTToken",
".",
"NO",
")",
";",
"}"
] | login-config does exist in web.xml, but is set to FORM_LOGIN
login-config does exist in the app and is set to MP-JWT
the mpJwt feature is NOT enabled
We should use FORM_LOGIN
@throws Exception | [
"login",
"-",
"config",
"does",
"exist",
"in",
"web",
".",
"xml",
"but",
"is",
"set",
"to",
"FORM_LOGIN",
"login",
"-",
"config",
"does",
"exist",
"in",
"the",
"app",
"and",
"is",
"set",
"to",
"MP",
"-",
"JWT",
"the",
"mpJwt",
"feature",
"is",
"NOT",
"enabled",
"We",
"should",
"use",
"FORM_LOGIN"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.mp.jwt_fat/fat/src/com/ibm/ws/security/mp/jwt/fat/MPJwtNoMpJwtConfig.java#L153-L162 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.mp.jwt_fat/fat/src/com/ibm/ws/security/mp/jwt/fat/MPJwtNoMpJwtConfig.java | MPJwtNoMpJwtConfig.MPJwtNoMpJwtConfig_mpJwtInWebXML_notInApp | @Test
public void MPJwtNoMpJwtConfig_mpJwtInWebXML_notInApp() throws Exception {
genericLoginConfigVariationTest(
MpJwtFatConstants.LOGINCONFIG_MP_JWT_IN_WEB_XML_SERVLET_NOT_IN_APP_ROOT_CONTEXT,
MpJwtFatConstants.LOGINCONFIG_MP_JWT_IN_WEB_XML_SERVLET_NOT_IN_APP,
MpJwtFatConstants.MPJWT_APP_CLASS_LOGIN_CONFIG_MPJWTINWEBXML_NOTINAPP,
ExpectedResult.BAD);
} | java | @Test
public void MPJwtNoMpJwtConfig_mpJwtInWebXML_notInApp() throws Exception {
genericLoginConfigVariationTest(
MpJwtFatConstants.LOGINCONFIG_MP_JWT_IN_WEB_XML_SERVLET_NOT_IN_APP_ROOT_CONTEXT,
MpJwtFatConstants.LOGINCONFIG_MP_JWT_IN_WEB_XML_SERVLET_NOT_IN_APP,
MpJwtFatConstants.MPJWT_APP_CLASS_LOGIN_CONFIG_MPJWTINWEBXML_NOTINAPP,
ExpectedResult.BAD);
} | [
"@",
"Test",
"public",
"void",
"MPJwtNoMpJwtConfig_mpJwtInWebXML_notInApp",
"(",
")",
"throws",
"Exception",
"{",
"genericLoginConfigVariationTest",
"(",
"MpJwtFatConstants",
".",
"LOGINCONFIG_MP_JWT_IN_WEB_XML_SERVLET_NOT_IN_APP_ROOT_CONTEXT",
",",
"MpJwtFatConstants",
".",
"LOGINCONFIG_MP_JWT_IN_WEB_XML_SERVLET_NOT_IN_APP",
",",
"MpJwtFatConstants",
".",
"MPJWT_APP_CLASS_LOGIN_CONFIG_MPJWTINWEBXML_NOTINAPP",
",",
"ExpectedResult",
".",
"BAD",
")",
";",
"}"
] | login-config does exist in web.xml, and is set to MP-JWT
login-config does NOT exist in the app
the mpJwt feature is NOT enabled
We should receive a 401 status in an exception
@throws Exception | [
"login",
"-",
"config",
"does",
"exist",
"in",
"web",
".",
"xml",
"and",
"is",
"set",
"to",
"MP",
"-",
"JWT",
"login",
"-",
"config",
"does",
"NOT",
"exist",
"in",
"the",
"app",
"the",
"mpJwt",
"feature",
"is",
"NOT",
"enabled",
"We",
"should",
"receive",
"a",
"401",
"status",
"in",
"an",
"exception"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.mp.jwt_fat/fat/src/com/ibm/ws/security/mp/jwt/fat/MPJwtNoMpJwtConfig.java#L173-L182 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.mp.jwt_fat/fat/src/com/ibm/ws/security/mp/jwt/fat/MPJwtNoMpJwtConfig.java | MPJwtNoMpJwtConfig.MPJwtNoMpJwtConfig_mpJwtInWebXML_basicInApp | @Test
public void MPJwtNoMpJwtConfig_mpJwtInWebXML_basicInApp() throws Exception {
genericLoginConfigVariationTest(
MpJwtFatConstants.LOGINCONFIG_MP_JWT_IN_WEB_XML_SERVLET_BASIC_IN_APP_ROOT_CONTEXT,
MpJwtFatConstants.LOGINCONFIG_MP_JWT_IN_WEB_XML_SERVLET_BASIC_IN_APP,
MpJwtFatConstants.MPJWT_APP_CLASS_LOGIN_CONFIG_MPJWTINWEBXML_BASICINAPP,
ExpectedResult.BAD);
} | java | @Test
public void MPJwtNoMpJwtConfig_mpJwtInWebXML_basicInApp() throws Exception {
genericLoginConfigVariationTest(
MpJwtFatConstants.LOGINCONFIG_MP_JWT_IN_WEB_XML_SERVLET_BASIC_IN_APP_ROOT_CONTEXT,
MpJwtFatConstants.LOGINCONFIG_MP_JWT_IN_WEB_XML_SERVLET_BASIC_IN_APP,
MpJwtFatConstants.MPJWT_APP_CLASS_LOGIN_CONFIG_MPJWTINWEBXML_BASICINAPP,
ExpectedResult.BAD);
} | [
"@",
"Test",
"public",
"void",
"MPJwtNoMpJwtConfig_mpJwtInWebXML_basicInApp",
"(",
")",
"throws",
"Exception",
"{",
"genericLoginConfigVariationTest",
"(",
"MpJwtFatConstants",
".",
"LOGINCONFIG_MP_JWT_IN_WEB_XML_SERVLET_BASIC_IN_APP_ROOT_CONTEXT",
",",
"MpJwtFatConstants",
".",
"LOGINCONFIG_MP_JWT_IN_WEB_XML_SERVLET_BASIC_IN_APP",
",",
"MpJwtFatConstants",
".",
"MPJWT_APP_CLASS_LOGIN_CONFIG_MPJWTINWEBXML_BASICINAPP",
",",
"ExpectedResult",
".",
"BAD",
")",
";",
"}"
] | login-config does exist in web.xml, and is set to MP-JWT
login-config does exist in the app, but is set to BASIC
the mpJwt feature is NOT enabled
We should receive a 401 status in an exception
@throws Exception | [
"login",
"-",
"config",
"does",
"exist",
"in",
"web",
".",
"xml",
"and",
"is",
"set",
"to",
"MP",
"-",
"JWT",
"login",
"-",
"config",
"does",
"exist",
"in",
"the",
"app",
"but",
"is",
"set",
"to",
"BASIC",
"the",
"mpJwt",
"feature",
"is",
"NOT",
"enabled",
"We",
"should",
"receive",
"a",
"401",
"status",
"in",
"an",
"exception"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.mp.jwt_fat/fat/src/com/ibm/ws/security/mp/jwt/fat/MPJwtNoMpJwtConfig.java#L194-L202 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.mp.jwt_fat/fat/src/com/ibm/ws/security/mp/jwt/fat/MPJwtNoMpJwtConfig.java | MPJwtNoMpJwtConfig.MPJwtNoMpJwtConfig_mpJwtInWebXML_mpJwtInApp | @Mode(TestMode.LITE)
@Test
public void MPJwtNoMpJwtConfig_mpJwtInWebXML_mpJwtInApp() throws Exception {
genericLoginConfigVariationTest(
MpJwtFatConstants.LOGINCONFIG_MP_JWT_IN_WEB_XML_SERVLET_MP_JWT_IN_APP_ROOT_CONTEXT,
MpJwtFatConstants.LOGINCONFIG_MP_JWT_IN_WEB_XML_SERVLET_MP_JWT_IN_APP,
MpJwtFatConstants.MPJWT_APP_CLASS_LOGIN_CONFIG_MPJWTINWEBXML_MPJWTINAPP,
ExpectedResult.BAD);
} | java | @Mode(TestMode.LITE)
@Test
public void MPJwtNoMpJwtConfig_mpJwtInWebXML_mpJwtInApp() throws Exception {
genericLoginConfigVariationTest(
MpJwtFatConstants.LOGINCONFIG_MP_JWT_IN_WEB_XML_SERVLET_MP_JWT_IN_APP_ROOT_CONTEXT,
MpJwtFatConstants.LOGINCONFIG_MP_JWT_IN_WEB_XML_SERVLET_MP_JWT_IN_APP,
MpJwtFatConstants.MPJWT_APP_CLASS_LOGIN_CONFIG_MPJWTINWEBXML_MPJWTINAPP,
ExpectedResult.BAD);
} | [
"@",
"Mode",
"(",
"TestMode",
".",
"LITE",
")",
"@",
"Test",
"public",
"void",
"MPJwtNoMpJwtConfig_mpJwtInWebXML_mpJwtInApp",
"(",
")",
"throws",
"Exception",
"{",
"genericLoginConfigVariationTest",
"(",
"MpJwtFatConstants",
".",
"LOGINCONFIG_MP_JWT_IN_WEB_XML_SERVLET_MP_JWT_IN_APP_ROOT_CONTEXT",
",",
"MpJwtFatConstants",
".",
"LOGINCONFIG_MP_JWT_IN_WEB_XML_SERVLET_MP_JWT_IN_APP",
",",
"MpJwtFatConstants",
".",
"MPJWT_APP_CLASS_LOGIN_CONFIG_MPJWTINWEBXML_MPJWTINAPP",
",",
"ExpectedResult",
".",
"BAD",
")",
";",
"}"
] | login-config does exist in web.xml, and is set to MP-JWT
login-config does exist in the app, and is set to MP-JWT
the mpJwt feature is NOT enabled
We should receive a 401 status in an exception
@throws Exception | [
"login",
"-",
"config",
"does",
"exist",
"in",
"web",
".",
"xml",
"and",
"is",
"set",
"to",
"MP",
"-",
"JWT",
"login",
"-",
"config",
"does",
"exist",
"in",
"the",
"app",
"and",
"is",
"set",
"to",
"MP",
"-",
"JWT",
"the",
"mpJwt",
"feature",
"is",
"NOT",
"enabled",
"We",
"should",
"receive",
"a",
"401",
"status",
"in",
"an",
"exception"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.mp.jwt_fat/fat/src/com/ibm/ws/security/mp/jwt/fat/MPJwtNoMpJwtConfig.java#L213-L222 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsTopicImpl.java | JmsTopicImpl.setTopicName | @Override
public void setTopicName(String tName) throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "setTopicName", tName);
setDestDiscrim(tName);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "setTopicName");
} | java | @Override
public void setTopicName(String tName) throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "setTopicName", tName);
setDestDiscrim(tName);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "setTopicName");
} | [
"@",
"Override",
"public",
"void",
"setTopicName",
"(",
"String",
"tName",
")",
"throws",
"JMSException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"setTopicName\"",
",",
"tName",
")",
";",
"setDestDiscrim",
"(",
"tName",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"setTopicName\"",
")",
";",
"}"
] | Set the topicName.
@param tName The name of the topic
@throws JMSException If setDestDiscrim throws one.
@see JmsDestinationImpl#setDestDiscrim | [
"Set",
"the",
"topicName",
"."
] | 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/JmsTopicImpl.java#L90-L97 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsTopicImpl.java | JmsTopicImpl.getTopicSpace | @Override
public String getTopicSpace() throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "getTopicSpace");
String result = getDestName();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "getTopicSpace", result);
return result;
} | java | @Override
public String getTopicSpace() throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "getTopicSpace");
String result = getDestName();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "getTopicSpace", result);
return result;
} | [
"@",
"Override",
"public",
"String",
"getTopicSpace",
"(",
")",
"throws",
"JMSException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"getTopicSpace\"",
")",
";",
"String",
"result",
"=",
"getDestName",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"getTopicSpace\"",
",",
"result",
")",
";",
"return",
"result",
";",
"}"
] | Get the topicSpace.
@return the topicSpace
@see JmsDestinationImpl#getDestName | [
"Get",
"the",
"topicSpace",
"."
] | 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/JmsTopicImpl.java#L105-L113 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsTopicImpl.java | JmsTopicImpl.setTopicSpace | @Override
public void setTopicSpace(String tSpace) throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "setTopicSpace", tSpace);
setDestName(tSpace);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "setTopicSpace");
} | java | @Override
public void setTopicSpace(String tSpace) throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "setTopicSpace", tSpace);
setDestName(tSpace);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "setTopicSpace");
} | [
"@",
"Override",
"public",
"void",
"setTopicSpace",
"(",
"String",
"tSpace",
")",
"throws",
"JMSException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"setTopicSpace\"",
",",
"tSpace",
")",
";",
"setDestName",
"(",
"tSpace",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"setTopicSpace\"",
")",
";",
"}"
] | Set the topicSpace
@param tSpace
@throws JMSException
@see JmsDestinationImpl#setDestName | [
"Set",
"the",
"topicSpace"
] | 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/JmsTopicImpl.java#L122-L129 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/jfapchannel/server/impl/ServerConnectionManagerImpl.java | ServerConnectionManagerImpl.initialise | public static void initialise(AcceptListenerFactory _acceptListenerFactory) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "initalise");
acceptListenerFactory = _acceptListenerFactory;
// Create the maintainer of the configuration.
Framework framework = Framework.getInstance();
if (framework == null) {
state = State.INITIALISATION_FAILED;
} else {
state = State.INITIALISED;
// Extract the chain reference.
connectionTracker = new OutboundConnectionTracker(framework);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "initalise");
} | java | public static void initialise(AcceptListenerFactory _acceptListenerFactory) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "initalise");
acceptListenerFactory = _acceptListenerFactory;
// Create the maintainer of the configuration.
Framework framework = Framework.getInstance();
if (framework == null) {
state = State.INITIALISATION_FAILED;
} else {
state = State.INITIALISED;
// Extract the chain reference.
connectionTracker = new OutboundConnectionTracker(framework);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "initalise");
} | [
"public",
"static",
"void",
"initialise",
"(",
"AcceptListenerFactory",
"_acceptListenerFactory",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"initalise\"",
")",
";",
"acceptListenerFactory",
"=",
"_acceptListenerFactory",
";",
"// Create the maintainer of the configuration.",
"Framework",
"framework",
"=",
"Framework",
".",
"getInstance",
"(",
")",
";",
"if",
"(",
"framework",
"==",
"null",
")",
"{",
"state",
"=",
"State",
".",
"INITIALISATION_FAILED",
";",
"}",
"else",
"{",
"state",
"=",
"State",
".",
"INITIALISED",
";",
"// Extract the chain reference.",
"connectionTracker",
"=",
"new",
"OutboundConnectionTracker",
"(",
"framework",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"initalise\"",
")",
";",
"}"
] | Initialises the server connection manager by getting hold of the framework.
@param _acceptListenerFactory
@see com.ibm.ws.sib.jfapchannel.ServerConnectionManager#initialise(com.ibm.ws.sib.jfapchannel.AcceptListenerFactory) | [
"Initialises",
"the",
"server",
"connection",
"manager",
"by",
"getting",
"hold",
"of",
"the",
"framework",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/jfapchannel/server/impl/ServerConnectionManagerImpl.java#L131-L150 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/jfapchannel/server/impl/ServerConnectionManagerImpl.java | ServerConnectionManagerImpl.initialiseAcceptListenerFactory | public static void initialiseAcceptListenerFactory(AcceptListenerFactory _acceptListenerFactory) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "initialiseAcceptListenerFactory", _acceptListenerFactory);
acceptListenerFactory = _acceptListenerFactory;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "initialiseAcceptListenerFactory");
} | java | public static void initialiseAcceptListenerFactory(AcceptListenerFactory _acceptListenerFactory) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "initialiseAcceptListenerFactory", _acceptListenerFactory);
acceptListenerFactory = _acceptListenerFactory;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "initialiseAcceptListenerFactory");
} | [
"public",
"static",
"void",
"initialiseAcceptListenerFactory",
"(",
"AcceptListenerFactory",
"_acceptListenerFactory",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"initialiseAcceptListenerFactory\"",
",",
"_acceptListenerFactory",
")",
";",
"acceptListenerFactory",
"=",
"_acceptListenerFactory",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"initialiseAcceptListenerFactory\"",
")",
";",
"}"
] | Set the AcceptListenerFactory.
@param _acceptListenerFactory | [
"Set",
"the",
"AcceptListenerFactory",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/jfapchannel/server/impl/ServerConnectionManagerImpl.java#L157-L165 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/jfapchannel/server/impl/ServerConnectionManagerImpl.java | ServerConnectionManagerImpl.getActiveOutboundMEtoMEConversations | @Override
public List getActiveOutboundMEtoMEConversations() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "getActiveOutboundMEtoMEConversations");
List convs = null;
if (connectionTracker != null) {
convs = connectionTracker.getAllOutboundConversations();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "getActiveOutboundMEtoMEConversations", convs);
return convs;
} | java | @Override
public List getActiveOutboundMEtoMEConversations() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "getActiveOutboundMEtoMEConversations");
List convs = null;
if (connectionTracker != null) {
convs = connectionTracker.getAllOutboundConversations();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "getActiveOutboundMEtoMEConversations", convs);
return convs;
} | [
"@",
"Override",
"public",
"List",
"getActiveOutboundMEtoMEConversations",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"getActiveOutboundMEtoMEConversations\"",
")",
";",
"List",
"convs",
"=",
"null",
";",
"if",
"(",
"connectionTracker",
"!=",
"null",
")",
"{",
"convs",
"=",
"connectionTracker",
".",
"getAllOutboundConversations",
"(",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"getActiveOutboundMEtoMEConversations\"",
",",
"convs",
")",
";",
"return",
"convs",
";",
"}"
] | Obtains a list of active outbound ME to ME conversations in this JVM.
@return a list of Conversations | [
"Obtains",
"a",
"list",
"of",
"active",
"outbound",
"ME",
"to",
"ME",
"conversations",
"in",
"this",
"JVM",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/jfapchannel/server/impl/ServerConnectionManagerImpl.java#L247-L260 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.anno/src/com/ibm/ws/anno/info/internal/InfoStoreImpl.java | InfoStoreImpl.open | @Override
public void open() throws InfoStoreException {
String methodName = "open";
try {
getClassSource().open();
} catch (ClassSource_Exception e) {
// defect 84235:we are generating multiple Warning/Error messages for each error due to each level reporting them.
// Disable the following warning and defer message generation to a higher level.
// CWWKC0026W
//Tr.warning(tc, "ANNO_INFOSTORE_OPEN1_EXCEPTION", getHashText(), getClassSource().getHashText());
String eMsg = "[ " + getHashText() + " ] Failed to open class source ";
throw InfoStoreException.wrap(tc, CLASS_NAME, methodName, eMsg, e);
}
} | java | @Override
public void open() throws InfoStoreException {
String methodName = "open";
try {
getClassSource().open();
} catch (ClassSource_Exception e) {
// defect 84235:we are generating multiple Warning/Error messages for each error due to each level reporting them.
// Disable the following warning and defer message generation to a higher level.
// CWWKC0026W
//Tr.warning(tc, "ANNO_INFOSTORE_OPEN1_EXCEPTION", getHashText(), getClassSource().getHashText());
String eMsg = "[ " + getHashText() + " ] Failed to open class source ";
throw InfoStoreException.wrap(tc, CLASS_NAME, methodName, eMsg, e);
}
} | [
"@",
"Override",
"public",
"void",
"open",
"(",
")",
"throws",
"InfoStoreException",
"{",
"String",
"methodName",
"=",
"\"open\"",
";",
"try",
"{",
"getClassSource",
"(",
")",
".",
"open",
"(",
")",
";",
"}",
"catch",
"(",
"ClassSource_Exception",
"e",
")",
"{",
"// defect 84235:we are generating multiple Warning/Error messages for each error due to each level reporting them.",
"// Disable the following warning and defer message generation to a higher level.",
"// CWWKC0026W",
"//Tr.warning(tc, \"ANNO_INFOSTORE_OPEN1_EXCEPTION\", getHashText(), getClassSource().getHashText());",
"String",
"eMsg",
"=",
"\"[ \"",
"+",
"getHashText",
"(",
")",
"+",
"\" ] Failed to open class source \"",
";",
"throw",
"InfoStoreException",
".",
"wrap",
"(",
"tc",
",",
"CLASS_NAME",
",",
"methodName",
",",
"eMsg",
",",
"e",
")",
";",
"}",
"}"
] | Open the InfoStore for processing. Primarily, this will open the ClassSources attached to this
InfoStore which will then allow classes to be accessed.
@throws InfoStoreException | [
"Open",
"the",
"InfoStore",
"for",
"processing",
".",
"Primarily",
"this",
"will",
"open",
"the",
"ClassSources",
"attached",
"to",
"this",
"InfoStore",
"which",
"will",
"then",
"allow",
"classes",
"to",
"be",
"accessed",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.anno/src/com/ibm/ws/anno/info/internal/InfoStoreImpl.java#L86-L100 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.anno/src/com/ibm/ws/anno/info/internal/InfoStoreImpl.java | InfoStoreImpl.scanClass | public void scanClass(String className) throws InfoStoreException {
Object[] logParms;
if (tc.isDebugEnabled()) {
logParms = new Object[] { getHashText(), className };
Tr.debug(tc, MessageFormat.format("[ {0} ] Class [ {1} ] ENTER", logParms));
} else {
logParms = null;
}
ClassInfoImpl classInfo = getNonDelayedClassInfo(className);
if (classInfo != null) {
if (logParms != null) {
Tr.debug(tc, MessageFormat.format("[ {0} ] Class [ {1} ] RETURN Already loaded", logParms));
}
return;
}
scanNewClass(className); // throws AnnotationScannerException
if (logParms != null) {
Tr.debug(tc, MessageFormat.format("[ {0} ] Class [ {1} ] RETURN New load", logParms));
}
} | java | public void scanClass(String className) throws InfoStoreException {
Object[] logParms;
if (tc.isDebugEnabled()) {
logParms = new Object[] { getHashText(), className };
Tr.debug(tc, MessageFormat.format("[ {0} ] Class [ {1} ] ENTER", logParms));
} else {
logParms = null;
}
ClassInfoImpl classInfo = getNonDelayedClassInfo(className);
if (classInfo != null) {
if (logParms != null) {
Tr.debug(tc, MessageFormat.format("[ {0} ] Class [ {1} ] RETURN Already loaded", logParms));
}
return;
}
scanNewClass(className); // throws AnnotationScannerException
if (logParms != null) {
Tr.debug(tc, MessageFormat.format("[ {0} ] Class [ {1} ] RETURN New load", logParms));
}
} | [
"public",
"void",
"scanClass",
"(",
"String",
"className",
")",
"throws",
"InfoStoreException",
"{",
"Object",
"[",
"]",
"logParms",
";",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"logParms",
"=",
"new",
"Object",
"[",
"]",
"{",
"getHashText",
"(",
")",
",",
"className",
"}",
";",
"Tr",
".",
"debug",
"(",
"tc",
",",
"MessageFormat",
".",
"format",
"(",
"\"[ {0} ] Class [ {1} ] ENTER\"",
",",
"logParms",
")",
")",
";",
"}",
"else",
"{",
"logParms",
"=",
"null",
";",
"}",
"ClassInfoImpl",
"classInfo",
"=",
"getNonDelayedClassInfo",
"(",
"className",
")",
";",
"if",
"(",
"classInfo",
"!=",
"null",
")",
"{",
"if",
"(",
"logParms",
"!=",
"null",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"MessageFormat",
".",
"format",
"(",
"\"[ {0} ] Class [ {1} ] RETURN Already loaded\"",
",",
"logParms",
")",
")",
";",
"}",
"return",
";",
"}",
"scanNewClass",
"(",
"className",
")",
";",
"// throws AnnotationScannerException",
"if",
"(",
"logParms",
"!=",
"null",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"MessageFormat",
".",
"format",
"(",
"\"[ {0} ] Class [ {1} ] RETURN New load\"",
",",
"logParms",
")",
")",
";",
"}",
"}"
] | Visitor helpers ... | [
"Visitor",
"helpers",
"..."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.anno/src/com/ibm/ws/anno/info/internal/InfoStoreImpl.java#L126-L150 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.anno/src/com/ibm/ws/anno/info/internal/InfoStoreImpl.java | InfoStoreImpl.getPackageInfo | @Override
public PackageInfoImpl getPackageInfo(String name) {
return getClassInfoCache().getPackageInfo(name, ClassInfoCache.DO_NOT_FORCE_PACKAGE);
} | java | @Override
public PackageInfoImpl getPackageInfo(String name) {
return getClassInfoCache().getPackageInfo(name, ClassInfoCache.DO_NOT_FORCE_PACKAGE);
} | [
"@",
"Override",
"public",
"PackageInfoImpl",
"getPackageInfo",
"(",
"String",
"name",
")",
"{",
"return",
"getClassInfoCache",
"(",
")",
".",
"getPackageInfo",
"(",
"name",
",",
"ClassInfoCache",
".",
"DO_NOT_FORCE_PACKAGE",
")",
";",
"}"
] | a package info, even if an error occurrs. | [
"a",
"package",
"info",
"even",
"if",
"an",
"error",
"occurrs",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.anno/src/com/ibm/ws/anno/info/internal/InfoStoreImpl.java#L325-L328 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.management.security/src/com/ibm/ws/management/security/internal/AbstractManagementRole.java | AbstractManagementRole.updateBindings | private void updateBindings(Map<String, Object> props) {
// Process the user element
processProps(props, CFG_KEY_USER, users);
// Process the user-access-id element
processProps(props, CFG_KEY_USER_ACCESSID, users);
// Process the group element
processProps(props, CFG_KEY_GROUP, groups);
// Process the group-access-id element
processProps(props, CFG_KEY_GROUP_ACCESSID, groups);
} | java | private void updateBindings(Map<String, Object> props) {
// Process the user element
processProps(props, CFG_KEY_USER, users);
// Process the user-access-id element
processProps(props, CFG_KEY_USER_ACCESSID, users);
// Process the group element
processProps(props, CFG_KEY_GROUP, groups);
// Process the group-access-id element
processProps(props, CFG_KEY_GROUP_ACCESSID, groups);
} | [
"private",
"void",
"updateBindings",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"props",
")",
"{",
"// Process the user element",
"processProps",
"(",
"props",
",",
"CFG_KEY_USER",
",",
"users",
")",
";",
"// Process the user-access-id element",
"processProps",
"(",
"props",
",",
"CFG_KEY_USER_ACCESSID",
",",
"users",
")",
";",
"// Process the group element",
"processProps",
"(",
"props",
",",
"CFG_KEY_GROUP",
",",
"groups",
")",
";",
"// Process the group-access-id element",
"processProps",
"(",
"props",
",",
"CFG_KEY_GROUP_ACCESSID",
",",
"groups",
")",
";",
"}"
] | Update the binding sets based on the properties from the configuration.
@param props | [
"Update",
"the",
"binding",
"sets",
"based",
"on",
"the",
"properties",
"from",
"the",
"configuration",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.management.security/src/com/ibm/ws/management/security/internal/AbstractManagementRole.java#L66-L76 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/io/async/AsyncChannelFuture.java | AsyncChannelFuture.cancel | public void cancel(Exception reason) {
// IMPROVEMENT: need to rework how syncs on the future.complete() work. We really should be
// syncing here, so we don't do the channel.cancel if the request is processing
// future.complete() on another thread at the same time. Should just do a quick
// sync, check the future.complete flag, then process only if !complete. That will
// also mean we can remove a bunch of redundant checks for complete, but we need to check all
// the paths carefully.
if (this.channel == null) {
return;
}
synchronized (this.completedSemaphore) {
if (!this.completed) {
try {
// this ends up calling future.completed()
this.channel.cancel(this, reason);
} catch (Exception e) {
// Simply swallow the exception
} // end try
} else {
if (this.channel.readFuture != null) {
this.channel.readFuture.setCancelInProgress(0);
}
if (this.channel.writeFuture != null) {
this.channel.writeFuture.setCancelInProgress(0);
}
}
}
} | java | public void cancel(Exception reason) {
// IMPROVEMENT: need to rework how syncs on the future.complete() work. We really should be
// syncing here, so we don't do the channel.cancel if the request is processing
// future.complete() on another thread at the same time. Should just do a quick
// sync, check the future.complete flag, then process only if !complete. That will
// also mean we can remove a bunch of redundant checks for complete, but we need to check all
// the paths carefully.
if (this.channel == null) {
return;
}
synchronized (this.completedSemaphore) {
if (!this.completed) {
try {
// this ends up calling future.completed()
this.channel.cancel(this, reason);
} catch (Exception e) {
// Simply swallow the exception
} // end try
} else {
if (this.channel.readFuture != null) {
this.channel.readFuture.setCancelInProgress(0);
}
if (this.channel.writeFuture != null) {
this.channel.writeFuture.setCancelInProgress(0);
}
}
}
} | [
"public",
"void",
"cancel",
"(",
"Exception",
"reason",
")",
"{",
"// IMPROVEMENT: need to rework how syncs on the future.complete() work. We really should be",
"// syncing here, so we don't do the channel.cancel if the request is processing",
"// future.complete() on another thread at the same time. Should just do a quick",
"// sync, check the future.complete flag, then process only if !complete. That will",
"// also mean we can remove a bunch of redundant checks for complete, but we need to check all",
"// the paths carefully.",
"if",
"(",
"this",
".",
"channel",
"==",
"null",
")",
"{",
"return",
";",
"}",
"synchronized",
"(",
"this",
".",
"completedSemaphore",
")",
"{",
"if",
"(",
"!",
"this",
".",
"completed",
")",
"{",
"try",
"{",
"// this ends up calling future.completed()",
"this",
".",
"channel",
".",
"cancel",
"(",
"this",
",",
"reason",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"// Simply swallow the exception",
"}",
"// end try",
"}",
"else",
"{",
"if",
"(",
"this",
".",
"channel",
".",
"readFuture",
"!=",
"null",
")",
"{",
"this",
".",
"channel",
".",
"readFuture",
".",
"setCancelInProgress",
"(",
"0",
")",
";",
"}",
"if",
"(",
"this",
".",
"channel",
".",
"writeFuture",
"!=",
"null",
")",
"{",
"this",
".",
"channel",
".",
"writeFuture",
".",
"setCancelInProgress",
"(",
"0",
")",
";",
"}",
"}",
"}",
"}"
] | Attempts to cancel the operation represented by the AsyncFuture.
Cancellation will not succeed if the operation is already complete.
@param reason the object that will be thrown when the future results are retrieved. | [
"Attempts",
"to",
"cancel",
"the",
"operation",
"represented",
"by",
"the",
"AsyncFuture",
".",
"Cancellation",
"will",
"not",
"succeed",
"if",
"the",
"operation",
"is",
"already",
"complete",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/io/async/AsyncChannelFuture.java#L81-L109 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/io/async/AsyncChannelFuture.java | AsyncChannelFuture.fireCompletionActions | protected void fireCompletionActions() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "fireCompletionActions");
}
if (this.firstListener != null) {
ICompletionListener listenerToInvoke = this.firstListener;
// reset listener so it can't be inadvertently be called on the next request
this.firstListener = null;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "invoking callback for channel id: " + this.channel.channelIdentifier);
}
invokeCallback(listenerToInvoke, this, this.firstListenerState);
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "no listener found for event, future: " + this);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "fireCompletionActions");
}
} | java | protected void fireCompletionActions() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "fireCompletionActions");
}
if (this.firstListener != null) {
ICompletionListener listenerToInvoke = this.firstListener;
// reset listener so it can't be inadvertently be called on the next request
this.firstListener = null;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "invoking callback for channel id: " + this.channel.channelIdentifier);
}
invokeCallback(listenerToInvoke, this, this.firstListenerState);
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "no listener found for event, future: " + this);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "fireCompletionActions");
}
} | [
"protected",
"void",
"fireCompletionActions",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"fireCompletionActions\"",
")",
";",
"}",
"if",
"(",
"this",
".",
"firstListener",
"!=",
"null",
")",
"{",
"ICompletionListener",
"listenerToInvoke",
"=",
"this",
".",
"firstListener",
";",
"// reset listener so it can't be inadvertently be called on the next request",
"this",
".",
"firstListener",
"=",
"null",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"invoking callback for channel id: \"",
"+",
"this",
".",
"channel",
".",
"channelIdentifier",
")",
";",
"}",
"invokeCallback",
"(",
"listenerToInvoke",
",",
"this",
",",
"this",
".",
"firstListenerState",
")",
";",
"}",
"else",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"no listener found for event, future: \"",
"+",
"this",
")",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"fireCompletionActions\"",
")",
";",
"}",
"}"
] | Impl Assumes we are holding the completed sem lock | [
"Impl",
"Assumes",
"we",
"are",
"holding",
"the",
"completed",
"sem",
"lock"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/io/async/AsyncChannelFuture.java#L120-L140 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/io/async/AsyncChannelFuture.java | AsyncChannelFuture.throwException | protected void throwException() throws InterruptedException, IOException {
if (this.exception instanceof IOException) {
throw (IOException) this.exception;
}
if (this.exception instanceof InterruptedException) {
throw (InterruptedException) this.exception;
}
if (this.exception instanceof RuntimeException) {
throw (RuntimeException) this.exception;
}
throw new RuntimeException(this.exception);
} | java | protected void throwException() throws InterruptedException, IOException {
if (this.exception instanceof IOException) {
throw (IOException) this.exception;
}
if (this.exception instanceof InterruptedException) {
throw (InterruptedException) this.exception;
}
if (this.exception instanceof RuntimeException) {
throw (RuntimeException) this.exception;
}
throw new RuntimeException(this.exception);
} | [
"protected",
"void",
"throwException",
"(",
")",
"throws",
"InterruptedException",
",",
"IOException",
"{",
"if",
"(",
"this",
".",
"exception",
"instanceof",
"IOException",
")",
"{",
"throw",
"(",
"IOException",
")",
"this",
".",
"exception",
";",
"}",
"if",
"(",
"this",
".",
"exception",
"instanceof",
"InterruptedException",
")",
"{",
"throw",
"(",
"InterruptedException",
")",
"this",
".",
"exception",
";",
"}",
"if",
"(",
"this",
".",
"exception",
"instanceof",
"RuntimeException",
")",
"{",
"throw",
"(",
"RuntimeException",
")",
"this",
".",
"exception",
";",
"}",
"throw",
"new",
"RuntimeException",
"(",
"this",
".",
"exception",
")",
";",
"}"
] | Throws the receiver's exception in its correct class.
This assumes that the exception is not null.
@throws InterruptedException
@throws IOException | [
"Throws",
"the",
"receiver",
"s",
"exception",
"in",
"its",
"correct",
"class",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/io/async/AsyncChannelFuture.java#L150-L162 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/matchspace/utils/TraceImpl.java | TraceImpl.internalBytes | private void internalBytes(Object source, Class sourceClass, byte[] data, int start, int count)
{
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append(sourceClass.getName());
stringBuffer.append(" [");
if (source != null)
{
stringBuffer.append(source);
}
else
{
stringBuffer.append("Static");
}
stringBuffer.append("]");
stringBuffer.append(ls);
if (data != null)
{
if (count > 0)
{
stringBuffer.append(formatBytes(data, start, count, true));
}
else
{
stringBuffer.append(formatBytes(data, start, data.length, true));
}
}
else
{
stringBuffer.append("data is null");
}
Tr.debug(traceComponent, stringBuffer.toString());
if (usePrintWriterForTrace)
{
if (printWriter != null)
{
printWriter.print(new java.util.Date()+" B ");
printWriter.println(stringBuffer.toString());
printWriter.flush();
}
}
} | java | private void internalBytes(Object source, Class sourceClass, byte[] data, int start, int count)
{
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append(sourceClass.getName());
stringBuffer.append(" [");
if (source != null)
{
stringBuffer.append(source);
}
else
{
stringBuffer.append("Static");
}
stringBuffer.append("]");
stringBuffer.append(ls);
if (data != null)
{
if (count > 0)
{
stringBuffer.append(formatBytes(data, start, count, true));
}
else
{
stringBuffer.append(formatBytes(data, start, data.length, true));
}
}
else
{
stringBuffer.append("data is null");
}
Tr.debug(traceComponent, stringBuffer.toString());
if (usePrintWriterForTrace)
{
if (printWriter != null)
{
printWriter.print(new java.util.Date()+" B ");
printWriter.println(stringBuffer.toString());
printWriter.flush();
}
}
} | [
"private",
"void",
"internalBytes",
"(",
"Object",
"source",
",",
"Class",
"sourceClass",
",",
"byte",
"[",
"]",
"data",
",",
"int",
"start",
",",
"int",
"count",
")",
"{",
"StringBuffer",
"stringBuffer",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"stringBuffer",
".",
"append",
"(",
"sourceClass",
".",
"getName",
"(",
")",
")",
";",
"stringBuffer",
".",
"append",
"(",
"\" [\"",
")",
";",
"if",
"(",
"source",
"!=",
"null",
")",
"{",
"stringBuffer",
".",
"append",
"(",
"source",
")",
";",
"}",
"else",
"{",
"stringBuffer",
".",
"append",
"(",
"\"Static\"",
")",
";",
"}",
"stringBuffer",
".",
"append",
"(",
"\"]\"",
")",
";",
"stringBuffer",
".",
"append",
"(",
"ls",
")",
";",
"if",
"(",
"data",
"!=",
"null",
")",
"{",
"if",
"(",
"count",
">",
"0",
")",
"{",
"stringBuffer",
".",
"append",
"(",
"formatBytes",
"(",
"data",
",",
"start",
",",
"count",
",",
"true",
")",
")",
";",
"}",
"else",
"{",
"stringBuffer",
".",
"append",
"(",
"formatBytes",
"(",
"data",
",",
"start",
",",
"data",
".",
"length",
",",
"true",
")",
")",
";",
"}",
"}",
"else",
"{",
"stringBuffer",
".",
"append",
"(",
"\"data is null\"",
")",
";",
"}",
"Tr",
".",
"debug",
"(",
"traceComponent",
",",
"stringBuffer",
".",
"toString",
"(",
")",
")",
";",
"if",
"(",
"usePrintWriterForTrace",
")",
"{",
"if",
"(",
"printWriter",
"!=",
"null",
")",
"{",
"printWriter",
".",
"print",
"(",
"new",
"java",
".",
"util",
".",
"Date",
"(",
")",
"+",
"\" B \"",
")",
";",
"printWriter",
".",
"println",
"(",
"stringBuffer",
".",
"toString",
"(",
")",
")",
";",
"printWriter",
".",
"flush",
"(",
")",
";",
"}",
"}",
"}"
] | Internal implementation of byte data trace.
@param source
@param sourceClass
@param data
@param start
@param count | [
"Internal",
"implementation",
"of",
"byte",
"data",
"trace",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/matchspace/utils/TraceImpl.java#L198-L244 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.client/src/com/ibm/ws/security/client/internal/jaas/JAASClientConfigurationImpl.java | JAASClientConfigurationImpl.createAppConfigurationEntry | public AppConfigurationEntry createAppConfigurationEntry(JAASLoginModuleConfig loginModule, String loginContextEntryName) {
String loginModuleClassName = loginModule.getClassName();
LoginModuleControlFlag controlFlag = loginModule.getControlFlag();
Map<String, Object> options = new HashMap<String, Object>();
options.putAll(loginModule.getOptions());
if (JaasLoginConfigConstants.APPLICATION_WSLOGIN.equals(loginContextEntryName)) {
options.put(WAS_IGNORE_CLIENT_CONTAINER_DD, true);
}
else {
options.put(WAS_IGNORE_CLIENT_CONTAINER_DD, false);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "loginModuleClassName: " + loginModuleClassName + " options: " + options.toString() + " controlFlag: " + controlFlag.toString());
}
AppConfigurationEntry loginModuleEntry = new AppConfigurationEntry(loginModuleClassName, controlFlag, options);
return loginModuleEntry;
} | java | public AppConfigurationEntry createAppConfigurationEntry(JAASLoginModuleConfig loginModule, String loginContextEntryName) {
String loginModuleClassName = loginModule.getClassName();
LoginModuleControlFlag controlFlag = loginModule.getControlFlag();
Map<String, Object> options = new HashMap<String, Object>();
options.putAll(loginModule.getOptions());
if (JaasLoginConfigConstants.APPLICATION_WSLOGIN.equals(loginContextEntryName)) {
options.put(WAS_IGNORE_CLIENT_CONTAINER_DD, true);
}
else {
options.put(WAS_IGNORE_CLIENT_CONTAINER_DD, false);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "loginModuleClassName: " + loginModuleClassName + " options: " + options.toString() + " controlFlag: " + controlFlag.toString());
}
AppConfigurationEntry loginModuleEntry = new AppConfigurationEntry(loginModuleClassName, controlFlag, options);
return loginModuleEntry;
} | [
"public",
"AppConfigurationEntry",
"createAppConfigurationEntry",
"(",
"JAASLoginModuleConfig",
"loginModule",
",",
"String",
"loginContextEntryName",
")",
"{",
"String",
"loginModuleClassName",
"=",
"loginModule",
".",
"getClassName",
"(",
")",
";",
"LoginModuleControlFlag",
"controlFlag",
"=",
"loginModule",
".",
"getControlFlag",
"(",
")",
";",
"Map",
"<",
"String",
",",
"Object",
">",
"options",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"options",
".",
"putAll",
"(",
"loginModule",
".",
"getOptions",
"(",
")",
")",
";",
"if",
"(",
"JaasLoginConfigConstants",
".",
"APPLICATION_WSLOGIN",
".",
"equals",
"(",
"loginContextEntryName",
")",
")",
"{",
"options",
".",
"put",
"(",
"WAS_IGNORE_CLIENT_CONTAINER_DD",
",",
"true",
")",
";",
"}",
"else",
"{",
"options",
".",
"put",
"(",
"WAS_IGNORE_CLIENT_CONTAINER_DD",
",",
"false",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"loginModuleClassName: \"",
"+",
"loginModuleClassName",
"+",
"\" options: \"",
"+",
"options",
".",
"toString",
"(",
")",
"+",
"\" controlFlag: \"",
"+",
"controlFlag",
".",
"toString",
"(",
")",
")",
";",
"}",
"AppConfigurationEntry",
"loginModuleEntry",
"=",
"new",
"AppConfigurationEntry",
"(",
"loginModuleClassName",
",",
"controlFlag",
",",
"options",
")",
";",
"return",
"loginModuleEntry",
";",
"}"
] | Create an AppConfigurationEntry object for the given JAAS login module
@param loginModule the JAAS login module
@param loginContextEntryName the JAAS login context entry name referencing the login module
@return the AppConfigurationEntry object
@throws IllegalArgumentException if loginModuleName is null, if LoginModuleName has a length of 0, if controlFlag is not either REQUIRED, REQUISITE, SUFFICIENT or OPTIONAL,
or if options is null. | [
"Create",
"an",
"AppConfigurationEntry",
"object",
"for",
"the",
"given",
"JAAS",
"login",
"module"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.client/src/com/ibm/ws/security/client/internal/jaas/JAASClientConfigurationImpl.java#L122-L139 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.anno/src/com/ibm/ws/anno/info/internal/NonDelayedClassInfo.java | NonDelayedClassInfo.getAnnotations | @Override
public List<AnnotationInfoImpl> getAnnotations() {
if (annotations != null) {
return annotations;
}
// Several cases where superclasses contribute no annotations. In
// each of these cases case, simply re-use the declared annotations
// collection.
//
// (One case: All of the inheritable superclass annotations is
// overridden by the immediate class, is not detected.)
ClassInfoImpl useSuperClass = getSuperclass(); // Null for 'java.lang.Object'; null for interfaces.
if (useSuperClass == null) {
annotations = declaredAnnotations;
return annotations;
}
// Retrieve *all* annotations of the superclass. The effect
// is to recurse across annotations of all superclasses.
List<AnnotationInfoImpl> superAnnos = useSuperClass.getAnnotations();
if (superAnnos.isEmpty()) {
annotations = declaredAnnotations;
return annotations;
}
Map<String, AnnotationInfoImpl> allAnnotations =
new HashMap<String, AnnotationInfoImpl>(superAnnos.size() + declaredAnnotations.size(), 1.0f);
boolean sawInherited = false;
for (AnnotationInfoImpl superAnno : superAnnos) {
if (sawInherited = superAnno.isInherited()) {
allAnnotations.put(superAnno.getAnnotationClassName(), superAnno);
}
}
if (!sawInherited) {
annotations = declaredAnnotations;
return annotations;
}
// Make sure to add the declared annotations *after* adding the super class
// annotations. The immediate declared annotations have precedence.
// We could test the number of overwritten annotations against the
// number of inherited annotations. That case seems infrequent, and
// is not implemented.
for (AnnotationInfoImpl declaredAnno : declaredAnnotations) {
AnnotationInfoImpl overwrittenAnno = allAnnotations.put(declaredAnno.getAnnotationClassName(), declaredAnno);
if (overwrittenAnno != null) {
// NO-OP: But maybe we want to log this
}
}
annotations = new ArrayList<AnnotationInfoImpl>(allAnnotations.values());
return annotations;
} | java | @Override
public List<AnnotationInfoImpl> getAnnotations() {
if (annotations != null) {
return annotations;
}
// Several cases where superclasses contribute no annotations. In
// each of these cases case, simply re-use the declared annotations
// collection.
//
// (One case: All of the inheritable superclass annotations is
// overridden by the immediate class, is not detected.)
ClassInfoImpl useSuperClass = getSuperclass(); // Null for 'java.lang.Object'; null for interfaces.
if (useSuperClass == null) {
annotations = declaredAnnotations;
return annotations;
}
// Retrieve *all* annotations of the superclass. The effect
// is to recurse across annotations of all superclasses.
List<AnnotationInfoImpl> superAnnos = useSuperClass.getAnnotations();
if (superAnnos.isEmpty()) {
annotations = declaredAnnotations;
return annotations;
}
Map<String, AnnotationInfoImpl> allAnnotations =
new HashMap<String, AnnotationInfoImpl>(superAnnos.size() + declaredAnnotations.size(), 1.0f);
boolean sawInherited = false;
for (AnnotationInfoImpl superAnno : superAnnos) {
if (sawInherited = superAnno.isInherited()) {
allAnnotations.put(superAnno.getAnnotationClassName(), superAnno);
}
}
if (!sawInherited) {
annotations = declaredAnnotations;
return annotations;
}
// Make sure to add the declared annotations *after* adding the super class
// annotations. The immediate declared annotations have precedence.
// We could test the number of overwritten annotations against the
// number of inherited annotations. That case seems infrequent, and
// is not implemented.
for (AnnotationInfoImpl declaredAnno : declaredAnnotations) {
AnnotationInfoImpl overwrittenAnno = allAnnotations.put(declaredAnno.getAnnotationClassName(), declaredAnno);
if (overwrittenAnno != null) {
// NO-OP: But maybe we want to log this
}
}
annotations = new ArrayList<AnnotationInfoImpl>(allAnnotations.values());
return annotations;
} | [
"@",
"Override",
"public",
"List",
"<",
"AnnotationInfoImpl",
">",
"getAnnotations",
"(",
")",
"{",
"if",
"(",
"annotations",
"!=",
"null",
")",
"{",
"return",
"annotations",
";",
"}",
"// Several cases where superclasses contribute no annotations. In",
"// each of these cases case, simply re-use the declared annotations",
"// collection.",
"//",
"// (One case: All of the inheritable superclass annotations is",
"// overridden by the immediate class, is not detected.)",
"ClassInfoImpl",
"useSuperClass",
"=",
"getSuperclass",
"(",
")",
";",
"// Null for 'java.lang.Object'; null for interfaces. ",
"if",
"(",
"useSuperClass",
"==",
"null",
")",
"{",
"annotations",
"=",
"declaredAnnotations",
";",
"return",
"annotations",
";",
"}",
"// Retrieve *all* annotations of the superclass. The effect",
"// is to recurse across annotations of all superclasses.",
"List",
"<",
"AnnotationInfoImpl",
">",
"superAnnos",
"=",
"useSuperClass",
".",
"getAnnotations",
"(",
")",
";",
"if",
"(",
"superAnnos",
".",
"isEmpty",
"(",
")",
")",
"{",
"annotations",
"=",
"declaredAnnotations",
";",
"return",
"annotations",
";",
"}",
"Map",
"<",
"String",
",",
"AnnotationInfoImpl",
">",
"allAnnotations",
"=",
"new",
"HashMap",
"<",
"String",
",",
"AnnotationInfoImpl",
">",
"(",
"superAnnos",
".",
"size",
"(",
")",
"+",
"declaredAnnotations",
".",
"size",
"(",
")",
",",
"1.0f",
")",
";",
"boolean",
"sawInherited",
"=",
"false",
";",
"for",
"(",
"AnnotationInfoImpl",
"superAnno",
":",
"superAnnos",
")",
"{",
"if",
"(",
"sawInherited",
"=",
"superAnno",
".",
"isInherited",
"(",
")",
")",
"{",
"allAnnotations",
".",
"put",
"(",
"superAnno",
".",
"getAnnotationClassName",
"(",
")",
",",
"superAnno",
")",
";",
"}",
"}",
"if",
"(",
"!",
"sawInherited",
")",
"{",
"annotations",
"=",
"declaredAnnotations",
";",
"return",
"annotations",
";",
"}",
"// Make sure to add the declared annotations *after* adding the super class",
"// annotations. The immediate declared annotations have precedence.",
"// We could test the number of overwritten annotations against the",
"// number of inherited annotations. That case seems infrequent, and",
"// is not implemented.",
"for",
"(",
"AnnotationInfoImpl",
"declaredAnno",
":",
"declaredAnnotations",
")",
"{",
"AnnotationInfoImpl",
"overwrittenAnno",
"=",
"allAnnotations",
".",
"put",
"(",
"declaredAnno",
".",
"getAnnotationClassName",
"(",
")",
",",
"declaredAnno",
")",
";",
"if",
"(",
"overwrittenAnno",
"!=",
"null",
")",
"{",
"// NO-OP: But maybe we want to log this",
"}",
"}",
"annotations",
"=",
"new",
"ArrayList",
"<",
"AnnotationInfoImpl",
">",
"(",
"allAnnotations",
".",
"values",
"(",
")",
")",
";",
"return",
"annotations",
";",
"}"
] | declared + inherited | [
"declared",
"+",
"inherited"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.anno/src/com/ibm/ws/anno/info/internal/NonDelayedClassInfo.java#L368-L427 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/BifurcatedConsumerSessionImpl.java | BifurcatedConsumerSessionImpl.checkNotClosed | private void checkNotClosed() throws SISessionUnavailableException
{
if (tc.isEntryEnabled())
SibTr.entry(tc, "checkNotClosed");
// Check that the consumer session isn't closed
_consumerSession.checkNotClosed();
// Now check that this consumer hasn't closed.
synchronized (this)
{
if(_closed)
{
SISessionUnavailableException e =
new SISessionUnavailableException(
nls.getFormattedMessage(
"CONSUMER_CLOSED_ERROR_CWSIP0177",
new Object[] { _localConsumerPoint.getConsumerManager().getDestination().getName(),
_localConsumerPoint.getConsumerManager().getMessageProcessor().getMessagingEngineName()},
null));
if (tc.isEntryEnabled())
SibTr.exit(tc, "checkNotClosed", "consumer closed");
throw e;
}
}
if (tc.isEntryEnabled())
SibTr.exit(tc, "checkNotClosed");
} | java | private void checkNotClosed() throws SISessionUnavailableException
{
if (tc.isEntryEnabled())
SibTr.entry(tc, "checkNotClosed");
// Check that the consumer session isn't closed
_consumerSession.checkNotClosed();
// Now check that this consumer hasn't closed.
synchronized (this)
{
if(_closed)
{
SISessionUnavailableException e =
new SISessionUnavailableException(
nls.getFormattedMessage(
"CONSUMER_CLOSED_ERROR_CWSIP0177",
new Object[] { _localConsumerPoint.getConsumerManager().getDestination().getName(),
_localConsumerPoint.getConsumerManager().getMessageProcessor().getMessagingEngineName()},
null));
if (tc.isEntryEnabled())
SibTr.exit(tc, "checkNotClosed", "consumer closed");
throw e;
}
}
if (tc.isEntryEnabled())
SibTr.exit(tc, "checkNotClosed");
} | [
"private",
"void",
"checkNotClosed",
"(",
")",
"throws",
"SISessionUnavailableException",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"checkNotClosed\"",
")",
";",
"// Check that the consumer session isn't closed",
"_consumerSession",
".",
"checkNotClosed",
"(",
")",
";",
"// Now check that this consumer hasn't closed.",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"_closed",
")",
"{",
"SISessionUnavailableException",
"e",
"=",
"new",
"SISessionUnavailableException",
"(",
"nls",
".",
"getFormattedMessage",
"(",
"\"CONSUMER_CLOSED_ERROR_CWSIP0177\"",
",",
"new",
"Object",
"[",
"]",
"{",
"_localConsumerPoint",
".",
"getConsumerManager",
"(",
")",
".",
"getDestination",
"(",
")",
".",
"getName",
"(",
")",
",",
"_localConsumerPoint",
".",
"getConsumerManager",
"(",
")",
".",
"getMessageProcessor",
"(",
")",
".",
"getMessagingEngineName",
"(",
")",
"}",
",",
"null",
")",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"checkNotClosed\"",
",",
"\"consumer closed\"",
")",
";",
"throw",
"e",
";",
"}",
"}",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"checkNotClosed\"",
")",
";",
"}"
] | First check is to make sure that the original Consumer
hasn't been closed. Then check that this bifurcated consumer
session is not closed.
@throws SIObjectClosedException | [
"First",
"check",
"is",
"to",
"make",
"sure",
"that",
"the",
"original",
"Consumer",
"hasn",
"t",
"been",
"closed",
".",
"Then",
"check",
"that",
"this",
"bifurcated",
"consumer",
"session",
"is",
"not",
"closed",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/BifurcatedConsumerSessionImpl.java#L319-L349 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.session.cache/src/com/ibm/ws/session/store/cache/CacheSession.java | CacheSession.getSwappableData | @Override
public Map<Object, Object> getSwappableData() {
if (mSwappableData == null) {
mSwappableData = new ConcurrentHashMap<Object, Object>();
if (isNew()) {
//if this is a new session, then we have the updated app data
populatedAppData = true;
}
}
return mSwappableData;
} | java | @Override
public Map<Object, Object> getSwappableData() {
if (mSwappableData == null) {
mSwappableData = new ConcurrentHashMap<Object, Object>();
if (isNew()) {
//if this is a new session, then we have the updated app data
populatedAppData = true;
}
}
return mSwappableData;
} | [
"@",
"Override",
"public",
"Map",
"<",
"Object",
",",
"Object",
">",
"getSwappableData",
"(",
")",
"{",
"if",
"(",
"mSwappableData",
"==",
"null",
")",
"{",
"mSwappableData",
"=",
"new",
"ConcurrentHashMap",
"<",
"Object",
",",
"Object",
">",
"(",
")",
";",
"if",
"(",
"isNew",
"(",
")",
")",
"{",
"//if this is a new session, then we have the updated app data",
"populatedAppData",
"=",
"true",
";",
"}",
"}",
"return",
"mSwappableData",
";",
"}"
] | This method is copied from DatabaseSession.getSwappableData.
@see com.ibm.ws.session.store.common.BackedSession#getSwappableData() | [
"This",
"method",
"is",
"copied",
"from",
"DatabaseSession",
".",
"getSwappableData",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.session.cache/src/com/ibm/ws/session/store/cache/CacheSession.java#L100-L110 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.session.cache/src/com/ibm/ws/session/store/cache/CacheSession.java | CacheSession.getSwappableListeners | @Override
public boolean getSwappableListeners(short requestedListener) {
short thisListenerFlag = getListenerFlag();
boolean rc = false;
// check session's listenrCnt to see if it has any of the type we want
// input listener is either BINDING or ACTIVATION, so if the session has both, its a match
if (thisListenerFlag == requestedListener || thisListenerFlag == HTTP_SESSION_BINDING_AND_ACTIVATION_LISTENER) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "loading data because we have listener match for " + requestedListener);
rc = true;
if (!populatedAppData) {
try {
getSessions().getIStore().setThreadContext();
getMultiRowAppData();
} finally {
getSessions().getIStore().unsetThreadContext();
}
}
}
return rc;
} | java | @Override
public boolean getSwappableListeners(short requestedListener) {
short thisListenerFlag = getListenerFlag();
boolean rc = false;
// check session's listenrCnt to see if it has any of the type we want
// input listener is either BINDING or ACTIVATION, so if the session has both, its a match
if (thisListenerFlag == requestedListener || thisListenerFlag == HTTP_SESSION_BINDING_AND_ACTIVATION_LISTENER) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "loading data because we have listener match for " + requestedListener);
rc = true;
if (!populatedAppData) {
try {
getSessions().getIStore().setThreadContext();
getMultiRowAppData();
} finally {
getSessions().getIStore().unsetThreadContext();
}
}
}
return rc;
} | [
"@",
"Override",
"public",
"boolean",
"getSwappableListeners",
"(",
"short",
"requestedListener",
")",
"{",
"short",
"thisListenerFlag",
"=",
"getListenerFlag",
"(",
")",
";",
"boolean",
"rc",
"=",
"false",
";",
"// check session's listenrCnt to see if it has any of the type we want",
"// input listener is either BINDING or ACTIVATION, so if the session has both, its a match",
"if",
"(",
"thisListenerFlag",
"==",
"requestedListener",
"||",
"thisListenerFlag",
"==",
"HTTP_SESSION_BINDING_AND_ACTIVATION_LISTENER",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"loading data because we have listener match for \"",
"+",
"requestedListener",
")",
";",
"rc",
"=",
"true",
";",
"if",
"(",
"!",
"populatedAppData",
")",
"{",
"try",
"{",
"getSessions",
"(",
")",
".",
"getIStore",
"(",
")",
".",
"setThreadContext",
"(",
")",
";",
"getMultiRowAppData",
"(",
")",
";",
"}",
"finally",
"{",
"getSessions",
"(",
")",
".",
"getIStore",
"(",
")",
".",
"unsetThreadContext",
"(",
")",
";",
"}",
"}",
"}",
"return",
"rc",
";",
"}"
] | Copied from DatabaseSession.getSwappableListeners.
Get the swappable listeners
Called to load session attributes if the session contains Activation or Binding listeners
Note, we always load ALL attributes here since we can't tell which are listeners until they
are loaded.
@see com.ibm.ws.session.store.common.BackedSession#getSwappableListeners(short) | [
"Copied",
"from",
"DatabaseSession",
".",
"getSwappableListeners",
".",
"Get",
"the",
"swappable",
"listeners",
"Called",
"to",
"load",
"session",
"attributes",
"if",
"the",
"session",
"contains",
"Activation",
"or",
"Binding",
"listeners",
"Note",
"we",
"always",
"load",
"ALL",
"attributes",
"here",
"since",
"we",
"can",
"t",
"tell",
"which",
"are",
"listeners",
"until",
"they",
"are",
"loaded",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.session.cache/src/com/ibm/ws/session/store/cache/CacheSession.java#L121-L142 | train |
OpenLiberty/open-liberty | dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/RegisteredResources.java | RegisteredResources.enlistResource | public boolean enlistResource(XAResource xaRes) throws RollbackException, SystemException, IllegalStateException {
if (tc.isEntryEnabled())
Tr.entry(tc, "enlistResource", xaRes);
// Determine if we are attempting to enlist a second resource within a transaction
// that can't support 2PC anyway.
if (_disableTwoPhase && (_resourceObjects.size() > 0)) {
final String msg = "Unable to enlist a second resource within the transaction. Two phase support is disabled " +
"as the recovery log was not available at transaction start";
final IllegalStateException ise = new IllegalStateException(msg);
if (tc.isEntryEnabled())
Tr.exit(tc, "enlistResource (SPI)", ise);
throw ise;
}
// Create the resource wrapper and see if it already exists in the table
OnePhaseResourceImpl jtaRes = new OnePhaseResourceImpl((OnePhaseXAResource) xaRes, _txServiceXid);
boolean register = true;
// See if any other resource has been enlisted
// Allow 1PC and 2PC to be enlisted, it will be rejected at prepare time if LPS is not enabled
// Reject multiple 1PC enlistments
if (_onePhaseResourceEnlisted != null) {
if (_onePhaseResourceEnlisted.equals(jtaRes)) {
register = false;
jtaRes = _onePhaseResourceEnlisted;
} else {
Tr.error(tc, "WTRN0062_ILLEGAL_ENLIST_FOR_MULTIPLE_1PC_RESOURCES");
final String msg = "Illegal attempt to enlist multiple 1PC XAResources";
final IllegalStateException ise = new IllegalStateException(msg);
// FFDC in TransactionImpl
if (tc.isEntryEnabled())
Tr.exit(tc, "enlistResource (SPI)", ise);
throw ise;
}
}
//
// start association of Resource object and register if first time with JTA
// and record that a 1PC resource has now been registered with the transaction.
//
try {
this.startRes(jtaRes);
if (register) {
jtaRes.setResourceStatus(StatefulResource.REGISTERED);
// This is 1PC then we need to insert at element 0
// of the list so we can ensure it is processed last
// at completion time.
_resourceObjects.add(0, jtaRes);
// Check and update LPS enablement state for the application - LIDB1673.22
checkLPSEnablement();
if (tc.isEventEnabled())
Tr.event(tc, "(SPI) RESOURCE registered with Transaction. TX: " + _transaction.getLocalTID() + ", Resource: " + jtaRes);
_onePhaseResourceEnlisted = jtaRes;
}
} catch (RollbackException rbe) {
FFDCFilter.processException(rbe, "com.ibm.tx.jta.impl.RegisteredResources.enlistResource", "480", this);
if (tc.isEntryEnabled())
Tr.exit(tc, "enlistResource", rbe);
throw rbe;
} catch (SystemException se) {
FFDCFilter.processException(se, "com.ibm.tx.jta.impl.RegisteredResources.enlistResource", "487", this);
if (tc.isEntryEnabled())
Tr.exit(tc, "enlistResource", se);
throw se;
}
if (tc.isEntryEnabled())
Tr.exit(tc, "enlistResource", Boolean.TRUE);
return true;
} | java | public boolean enlistResource(XAResource xaRes) throws RollbackException, SystemException, IllegalStateException {
if (tc.isEntryEnabled())
Tr.entry(tc, "enlistResource", xaRes);
// Determine if we are attempting to enlist a second resource within a transaction
// that can't support 2PC anyway.
if (_disableTwoPhase && (_resourceObjects.size() > 0)) {
final String msg = "Unable to enlist a second resource within the transaction. Two phase support is disabled " +
"as the recovery log was not available at transaction start";
final IllegalStateException ise = new IllegalStateException(msg);
if (tc.isEntryEnabled())
Tr.exit(tc, "enlistResource (SPI)", ise);
throw ise;
}
// Create the resource wrapper and see if it already exists in the table
OnePhaseResourceImpl jtaRes = new OnePhaseResourceImpl((OnePhaseXAResource) xaRes, _txServiceXid);
boolean register = true;
// See if any other resource has been enlisted
// Allow 1PC and 2PC to be enlisted, it will be rejected at prepare time if LPS is not enabled
// Reject multiple 1PC enlistments
if (_onePhaseResourceEnlisted != null) {
if (_onePhaseResourceEnlisted.equals(jtaRes)) {
register = false;
jtaRes = _onePhaseResourceEnlisted;
} else {
Tr.error(tc, "WTRN0062_ILLEGAL_ENLIST_FOR_MULTIPLE_1PC_RESOURCES");
final String msg = "Illegal attempt to enlist multiple 1PC XAResources";
final IllegalStateException ise = new IllegalStateException(msg);
// FFDC in TransactionImpl
if (tc.isEntryEnabled())
Tr.exit(tc, "enlistResource (SPI)", ise);
throw ise;
}
}
//
// start association of Resource object and register if first time with JTA
// and record that a 1PC resource has now been registered with the transaction.
//
try {
this.startRes(jtaRes);
if (register) {
jtaRes.setResourceStatus(StatefulResource.REGISTERED);
// This is 1PC then we need to insert at element 0
// of the list so we can ensure it is processed last
// at completion time.
_resourceObjects.add(0, jtaRes);
// Check and update LPS enablement state for the application - LIDB1673.22
checkLPSEnablement();
if (tc.isEventEnabled())
Tr.event(tc, "(SPI) RESOURCE registered with Transaction. TX: " + _transaction.getLocalTID() + ", Resource: " + jtaRes);
_onePhaseResourceEnlisted = jtaRes;
}
} catch (RollbackException rbe) {
FFDCFilter.processException(rbe, "com.ibm.tx.jta.impl.RegisteredResources.enlistResource", "480", this);
if (tc.isEntryEnabled())
Tr.exit(tc, "enlistResource", rbe);
throw rbe;
} catch (SystemException se) {
FFDCFilter.processException(se, "com.ibm.tx.jta.impl.RegisteredResources.enlistResource", "487", this);
if (tc.isEntryEnabled())
Tr.exit(tc, "enlistResource", se);
throw se;
}
if (tc.isEntryEnabled())
Tr.exit(tc, "enlistResource", Boolean.TRUE);
return true;
} | [
"public",
"boolean",
"enlistResource",
"(",
"XAResource",
"xaRes",
")",
"throws",
"RollbackException",
",",
"SystemException",
",",
"IllegalStateException",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"enlistResource\"",
",",
"xaRes",
")",
";",
"// Determine if we are attempting to enlist a second resource within a transaction",
"// that can't support 2PC anyway.",
"if",
"(",
"_disableTwoPhase",
"&&",
"(",
"_resourceObjects",
".",
"size",
"(",
")",
">",
"0",
")",
")",
"{",
"final",
"String",
"msg",
"=",
"\"Unable to enlist a second resource within the transaction. Two phase support is disabled \"",
"+",
"\"as the recovery log was not available at transaction start\"",
";",
"final",
"IllegalStateException",
"ise",
"=",
"new",
"IllegalStateException",
"(",
"msg",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"enlistResource (SPI)\"",
",",
"ise",
")",
";",
"throw",
"ise",
";",
"}",
"// Create the resource wrapper and see if it already exists in the table",
"OnePhaseResourceImpl",
"jtaRes",
"=",
"new",
"OnePhaseResourceImpl",
"(",
"(",
"OnePhaseXAResource",
")",
"xaRes",
",",
"_txServiceXid",
")",
";",
"boolean",
"register",
"=",
"true",
";",
"// See if any other resource has been enlisted",
"// Allow 1PC and 2PC to be enlisted, it will be rejected at prepare time if LPS is not enabled",
"// Reject multiple 1PC enlistments",
"if",
"(",
"_onePhaseResourceEnlisted",
"!=",
"null",
")",
"{",
"if",
"(",
"_onePhaseResourceEnlisted",
".",
"equals",
"(",
"jtaRes",
")",
")",
"{",
"register",
"=",
"false",
";",
"jtaRes",
"=",
"_onePhaseResourceEnlisted",
";",
"}",
"else",
"{",
"Tr",
".",
"error",
"(",
"tc",
",",
"\"WTRN0062_ILLEGAL_ENLIST_FOR_MULTIPLE_1PC_RESOURCES\"",
")",
";",
"final",
"String",
"msg",
"=",
"\"Illegal attempt to enlist multiple 1PC XAResources\"",
";",
"final",
"IllegalStateException",
"ise",
"=",
"new",
"IllegalStateException",
"(",
"msg",
")",
";",
"// FFDC in TransactionImpl",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"enlistResource (SPI)\"",
",",
"ise",
")",
";",
"throw",
"ise",
";",
"}",
"}",
"//",
"// start association of Resource object and register if first time with JTA",
"// and record that a 1PC resource has now been registered with the transaction.",
"//",
"try",
"{",
"this",
".",
"startRes",
"(",
"jtaRes",
")",
";",
"if",
"(",
"register",
")",
"{",
"jtaRes",
".",
"setResourceStatus",
"(",
"StatefulResource",
".",
"REGISTERED",
")",
";",
"// This is 1PC then we need to insert at element 0",
"// of the list so we can ensure it is processed last",
"// at completion time.",
"_resourceObjects",
".",
"add",
"(",
"0",
",",
"jtaRes",
")",
";",
"// Check and update LPS enablement state for the application - LIDB1673.22",
"checkLPSEnablement",
"(",
")",
";",
"if",
"(",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"Tr",
".",
"event",
"(",
"tc",
",",
"\"(SPI) RESOURCE registered with Transaction. TX: \"",
"+",
"_transaction",
".",
"getLocalTID",
"(",
")",
"+",
"\", Resource: \"",
"+",
"jtaRes",
")",
";",
"_onePhaseResourceEnlisted",
"=",
"jtaRes",
";",
"}",
"}",
"catch",
"(",
"RollbackException",
"rbe",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"rbe",
",",
"\"com.ibm.tx.jta.impl.RegisteredResources.enlistResource\"",
",",
"\"480\"",
",",
"this",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"enlistResource\"",
",",
"rbe",
")",
";",
"throw",
"rbe",
";",
"}",
"catch",
"(",
"SystemException",
"se",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"se",
",",
"\"com.ibm.tx.jta.impl.RegisteredResources.enlistResource\"",
",",
"\"487\"",
",",
"this",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"enlistResource\"",
",",
"se",
")",
";",
"throw",
"se",
";",
"}",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"enlistResource\"",
",",
"Boolean",
".",
"TRUE",
")",
";",
"return",
"true",
";",
"}"
] | Attempts to add a one-Phase XA Resource to this unit of work.
@param xaRes The XAResource to add to this unit of work
@return true if the resource was added, false if not.
@throws RollbackException if enlistment fails
@throws SystemException if unexpected error occurs | [
"Attempts",
"to",
"add",
"a",
"one",
"-",
"Phase",
"XA",
"Resource",
"to",
"this",
"unit",
"of",
"work",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/RegisteredResources.java#L247-L321 | train |
OpenLiberty/open-liberty | dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/RegisteredResources.java | RegisteredResources.delistResource | protected boolean delistResource(XAResource xaRes, int flag) throws SystemException {
if (tc.isEntryEnabled())
Tr.entry(tc, "delistResource", new Object[] { xaRes, Util.printFlag(flag) });
// get resource manager instance
JTAResourceBase jtaRes = (JTAResourceBase) getResourceTable().get(xaRes);
if (jtaRes == null && _onePhaseResourceEnlisted != null) {
if (_onePhaseResourceEnlisted.XAResource().equals(xaRes))
jtaRes = _onePhaseResourceEnlisted;
}
if (jtaRes == null) {
Tr.error(tc, "WTRN0065_XARESOURCE_NOT_KNOWN", xaRes);
if (tc.isEntryEnabled())
Tr.exit(tc, "delistResource", Boolean.FALSE);
return false;
}
// try to end transaction association using specified flag.
try {
jtaRes.end(flag);
} catch (XAException xae) {
_errorCode = xae.errorCode; // Save locally for FFDC
FFDCFilter.processException(xae, "com.ibm.tx.jta.impl.RegisteredResources.delistResource", "711", this);
if (tc.isDebugEnabled())
Tr.debug(tc, "XAException: error code " + XAReturnCodeHelper.convertXACode(_errorCode), xae);
Throwable toThrow = null;
if (_errorCode >= XAException.XA_RBBASE &&
_errorCode <= XAException.XA_RBEND) {
if (tc.isEventEnabled())
Tr.event(tc, "Transaction branch has been marked rollback-only by the RM");
} else if (_errorCode == XAException.XAER_RMFAIL) {
if (tc.isEventEnabled())
Tr.event(tc, "RM has failed");
// Resource has rolled back
jtaRes.setResourceStatus(StatefulResource.ROLLEDBACK);
jtaRes.destroy();
} else // XAER_RMERR, XAER_INVAL, XAER_PROTO, XAER_NOTA
{
Tr.error(tc, "WTRN0079_END_FAILED", new Object[] { XAReturnCodeHelper.convertXACode(_errorCode), xae });
toThrow = new SystemException("XAResource end association error:" + XAReturnCodeHelper.convertXACode(_errorCode)).initCause(xae);
}
// Mark transaction as rollback only.
try {
_transaction.setRollbackOnly();
if (tc.isEventEnabled())
Tr.event(tc, "Transaction marked as rollback only.");
} catch (IllegalStateException e) {
FFDCFilter.processException(e, "com.ibm.tx.jta.impl.RegisteredResources.delistResource", "742", this);
toThrow = new SystemException(e.getLocalizedMessage()).initCause(e);
}
if (toThrow != null) {
if (tc.isEntryEnabled())
Tr.exit(tc, "delistResource", toThrow);
throw (SystemException) toThrow;
}
}
if (tc.isEntryEnabled())
Tr.exit(tc, "delistResource", Boolean.TRUE);
return true;
} | java | protected boolean delistResource(XAResource xaRes, int flag) throws SystemException {
if (tc.isEntryEnabled())
Tr.entry(tc, "delistResource", new Object[] { xaRes, Util.printFlag(flag) });
// get resource manager instance
JTAResourceBase jtaRes = (JTAResourceBase) getResourceTable().get(xaRes);
if (jtaRes == null && _onePhaseResourceEnlisted != null) {
if (_onePhaseResourceEnlisted.XAResource().equals(xaRes))
jtaRes = _onePhaseResourceEnlisted;
}
if (jtaRes == null) {
Tr.error(tc, "WTRN0065_XARESOURCE_NOT_KNOWN", xaRes);
if (tc.isEntryEnabled())
Tr.exit(tc, "delistResource", Boolean.FALSE);
return false;
}
// try to end transaction association using specified flag.
try {
jtaRes.end(flag);
} catch (XAException xae) {
_errorCode = xae.errorCode; // Save locally for FFDC
FFDCFilter.processException(xae, "com.ibm.tx.jta.impl.RegisteredResources.delistResource", "711", this);
if (tc.isDebugEnabled())
Tr.debug(tc, "XAException: error code " + XAReturnCodeHelper.convertXACode(_errorCode), xae);
Throwable toThrow = null;
if (_errorCode >= XAException.XA_RBBASE &&
_errorCode <= XAException.XA_RBEND) {
if (tc.isEventEnabled())
Tr.event(tc, "Transaction branch has been marked rollback-only by the RM");
} else if (_errorCode == XAException.XAER_RMFAIL) {
if (tc.isEventEnabled())
Tr.event(tc, "RM has failed");
// Resource has rolled back
jtaRes.setResourceStatus(StatefulResource.ROLLEDBACK);
jtaRes.destroy();
} else // XAER_RMERR, XAER_INVAL, XAER_PROTO, XAER_NOTA
{
Tr.error(tc, "WTRN0079_END_FAILED", new Object[] { XAReturnCodeHelper.convertXACode(_errorCode), xae });
toThrow = new SystemException("XAResource end association error:" + XAReturnCodeHelper.convertXACode(_errorCode)).initCause(xae);
}
// Mark transaction as rollback only.
try {
_transaction.setRollbackOnly();
if (tc.isEventEnabled())
Tr.event(tc, "Transaction marked as rollback only.");
} catch (IllegalStateException e) {
FFDCFilter.processException(e, "com.ibm.tx.jta.impl.RegisteredResources.delistResource", "742", this);
toThrow = new SystemException(e.getLocalizedMessage()).initCause(e);
}
if (toThrow != null) {
if (tc.isEntryEnabled())
Tr.exit(tc, "delistResource", toThrow);
throw (SystemException) toThrow;
}
}
if (tc.isEntryEnabled())
Tr.exit(tc, "delistResource", Boolean.TRUE);
return true;
} | [
"protected",
"boolean",
"delistResource",
"(",
"XAResource",
"xaRes",
",",
"int",
"flag",
")",
"throws",
"SystemException",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"delistResource\"",
",",
"new",
"Object",
"[",
"]",
"{",
"xaRes",
",",
"Util",
".",
"printFlag",
"(",
"flag",
")",
"}",
")",
";",
"// get resource manager instance",
"JTAResourceBase",
"jtaRes",
"=",
"(",
"JTAResourceBase",
")",
"getResourceTable",
"(",
")",
".",
"get",
"(",
"xaRes",
")",
";",
"if",
"(",
"jtaRes",
"==",
"null",
"&&",
"_onePhaseResourceEnlisted",
"!=",
"null",
")",
"{",
"if",
"(",
"_onePhaseResourceEnlisted",
".",
"XAResource",
"(",
")",
".",
"equals",
"(",
"xaRes",
")",
")",
"jtaRes",
"=",
"_onePhaseResourceEnlisted",
";",
"}",
"if",
"(",
"jtaRes",
"==",
"null",
")",
"{",
"Tr",
".",
"error",
"(",
"tc",
",",
"\"WTRN0065_XARESOURCE_NOT_KNOWN\"",
",",
"xaRes",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"delistResource\"",
",",
"Boolean",
".",
"FALSE",
")",
";",
"return",
"false",
";",
"}",
"// try to end transaction association using specified flag.",
"try",
"{",
"jtaRes",
".",
"end",
"(",
"flag",
")",
";",
"}",
"catch",
"(",
"XAException",
"xae",
")",
"{",
"_errorCode",
"=",
"xae",
".",
"errorCode",
";",
"// Save locally for FFDC",
"FFDCFilter",
".",
"processException",
"(",
"xae",
",",
"\"com.ibm.tx.jta.impl.RegisteredResources.delistResource\"",
",",
"\"711\"",
",",
"this",
")",
";",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"XAException: error code \"",
"+",
"XAReturnCodeHelper",
".",
"convertXACode",
"(",
"_errorCode",
")",
",",
"xae",
")",
";",
"Throwable",
"toThrow",
"=",
"null",
";",
"if",
"(",
"_errorCode",
">=",
"XAException",
".",
"XA_RBBASE",
"&&",
"_errorCode",
"<=",
"XAException",
".",
"XA_RBEND",
")",
"{",
"if",
"(",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"Tr",
".",
"event",
"(",
"tc",
",",
"\"Transaction branch has been marked rollback-only by the RM\"",
")",
";",
"}",
"else",
"if",
"(",
"_errorCode",
"==",
"XAException",
".",
"XAER_RMFAIL",
")",
"{",
"if",
"(",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"Tr",
".",
"event",
"(",
"tc",
",",
"\"RM has failed\"",
")",
";",
"// Resource has rolled back",
"jtaRes",
".",
"setResourceStatus",
"(",
"StatefulResource",
".",
"ROLLEDBACK",
")",
";",
"jtaRes",
".",
"destroy",
"(",
")",
";",
"}",
"else",
"// XAER_RMERR, XAER_INVAL, XAER_PROTO, XAER_NOTA",
"{",
"Tr",
".",
"error",
"(",
"tc",
",",
"\"WTRN0079_END_FAILED\"",
",",
"new",
"Object",
"[",
"]",
"{",
"XAReturnCodeHelper",
".",
"convertXACode",
"(",
"_errorCode",
")",
",",
"xae",
"}",
")",
";",
"toThrow",
"=",
"new",
"SystemException",
"(",
"\"XAResource end association error:\"",
"+",
"XAReturnCodeHelper",
".",
"convertXACode",
"(",
"_errorCode",
")",
")",
".",
"initCause",
"(",
"xae",
")",
";",
"}",
"// Mark transaction as rollback only.",
"try",
"{",
"_transaction",
".",
"setRollbackOnly",
"(",
")",
";",
"if",
"(",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"Tr",
".",
"event",
"(",
"tc",
",",
"\"Transaction marked as rollback only.\"",
")",
";",
"}",
"catch",
"(",
"IllegalStateException",
"e",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"\"com.ibm.tx.jta.impl.RegisteredResources.delistResource\"",
",",
"\"742\"",
",",
"this",
")",
";",
"toThrow",
"=",
"new",
"SystemException",
"(",
"e",
".",
"getLocalizedMessage",
"(",
")",
")",
".",
"initCause",
"(",
"e",
")",
";",
"}",
"if",
"(",
"toThrow",
"!=",
"null",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"delistResource\"",
",",
"toThrow",
")",
";",
"throw",
"(",
"SystemException",
")",
"toThrow",
";",
"}",
"}",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"delistResource\"",
",",
"Boolean",
".",
"TRUE",
")",
";",
"return",
"true",
";",
"}"
] | Delist the specified resource from the transaction.
@param xaRes the XAResource to delist.
@param flag the XA flags to pass to the resource.
TMSUSPEND, TMFAIL or TMSUCCESS flag to xa_end
@throws SystemException if the resource is not successfully
disassociated from the transaction branch. | [
"Delist",
"the",
"specified",
"resource",
"from",
"the",
"transaction",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/RegisteredResources.java#L557-L622 | train |
OpenLiberty/open-liberty | dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/RegisteredResources.java | RegisteredResources.generateNewBranch | protected Xid generateNewBranch() {
if (tc.isEntryEnabled())
Tr.entry(tc, "generateNewBranch");
// Create a new Xid branch
final XidImpl result = new XidImpl(_txServiceXid, ++_branchCount);
if (tc.isEntryEnabled())
Tr.exit(tc, "generateNewBranch", result);
return result;
} | java | protected Xid generateNewBranch() {
if (tc.isEntryEnabled())
Tr.entry(tc, "generateNewBranch");
// Create a new Xid branch
final XidImpl result = new XidImpl(_txServiceXid, ++_branchCount);
if (tc.isEntryEnabled())
Tr.exit(tc, "generateNewBranch", result);
return result;
} | [
"protected",
"Xid",
"generateNewBranch",
"(",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"generateNewBranch\"",
")",
";",
"// Create a new Xid branch",
"final",
"XidImpl",
"result",
"=",
"new",
"XidImpl",
"(",
"_txServiceXid",
",",
"++",
"_branchCount",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"generateNewBranch\"",
",",
"result",
")",
";",
"return",
"result",
";",
"}"
] | Generates a new XidImpl to represent a new branch of this
transaction.
@return A new XidImpl representing a new branch of this transaction. | [
"Generates",
"a",
"new",
"XidImpl",
"to",
"represent",
"a",
"new",
"branch",
"of",
"this",
"transaction",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/RegisteredResources.java#L630-L640 | train |
OpenLiberty/open-liberty | dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/RegisteredResources.java | RegisteredResources.startRes | protected void startRes(JTAResource resource) throws RollbackException, SystemException {
if (tc.isEntryEnabled())
Tr.entry(tc, "startRes", new Object[] { this, resource });
try {
resource.start();
} catch (XAException xae) {
_errorCode = xae.errorCode; // Save locally for FFDC
FFDCFilter.processException(xae, "com.ibm.tx.jta.impl.RegisteredResources.startRes", "1053", this);
if (tc.isDebugEnabled())
Tr.debug(tc, "XAException: error code " + XAReturnCodeHelper.convertXACode(_errorCode), xae);
final Throwable toThrow;
//
// the XAResource object is doing work outside global
// transaction. This means that XAResource is doing local
// transaction. Local transaction has to be completed before
// start global transaction or XA transaction.
//
if (_errorCode == XAException.XAER_OUTSIDE) {
toThrow = new RollbackException("XAResource working outside transaction").initCause(xae);
if (tc.isEventEnabled())
Tr.event(tc, "XAResource is doing work outside of the transaction.", toThrow);
throw (RollbackException) toThrow;
} else if (_errorCode >= XAException.XA_RBBASE &&
_errorCode <= XAException.XA_RBEND) {
if (tc.isEventEnabled())
Tr.event(tc, "Transaction branch has been marked rollback-only by the RM");
//
// Transaction branch has been rolled back, so we
// mark transaction as rollback only.
//
try {
_transaction.setRollbackOnly();
} catch (IllegalStateException e) {
FFDCFilter.processException(e, "com.ibm.tx.jta.impl.RegisteredResources.startRes", "1085", this);
if (tc.isEventEnabled())
Tr.event(tc, "Exception caught marking Transaction rollback only", e);
throw (SystemException) new SystemException(e.getLocalizedMessage()).initCause(e);
}
toThrow = new RollbackException("Transaction has been marked as rollback only.").initCause(xae);
if (tc.isEventEnabled())
Tr.event(tc, "Marked transaction as rollback only.", toThrow);
throw (RollbackException) toThrow;
}
//
// Any other error is a protocol violation or the RM is broken, and we throw
// SystemException.
//
else // XAER_RMERR, XAER_RMFAIL, XAER_INVAL, XAER_PROTO, XAER_DUPID
{
Tr.error(tc, "WTRN0078_START_FAILED", new Object[] { XAReturnCodeHelper.convertXACode(_errorCode), xae });
throw (SystemException) new SystemException("XAResource start association error:" + XAReturnCodeHelper.convertXACode(_errorCode)).initCause(xae);
}
} finally {
if (tc.isEntryEnabled())
Tr.exit(tc, "startRes");
}
} | java | protected void startRes(JTAResource resource) throws RollbackException, SystemException {
if (tc.isEntryEnabled())
Tr.entry(tc, "startRes", new Object[] { this, resource });
try {
resource.start();
} catch (XAException xae) {
_errorCode = xae.errorCode; // Save locally for FFDC
FFDCFilter.processException(xae, "com.ibm.tx.jta.impl.RegisteredResources.startRes", "1053", this);
if (tc.isDebugEnabled())
Tr.debug(tc, "XAException: error code " + XAReturnCodeHelper.convertXACode(_errorCode), xae);
final Throwable toThrow;
//
// the XAResource object is doing work outside global
// transaction. This means that XAResource is doing local
// transaction. Local transaction has to be completed before
// start global transaction or XA transaction.
//
if (_errorCode == XAException.XAER_OUTSIDE) {
toThrow = new RollbackException("XAResource working outside transaction").initCause(xae);
if (tc.isEventEnabled())
Tr.event(tc, "XAResource is doing work outside of the transaction.", toThrow);
throw (RollbackException) toThrow;
} else if (_errorCode >= XAException.XA_RBBASE &&
_errorCode <= XAException.XA_RBEND) {
if (tc.isEventEnabled())
Tr.event(tc, "Transaction branch has been marked rollback-only by the RM");
//
// Transaction branch has been rolled back, so we
// mark transaction as rollback only.
//
try {
_transaction.setRollbackOnly();
} catch (IllegalStateException e) {
FFDCFilter.processException(e, "com.ibm.tx.jta.impl.RegisteredResources.startRes", "1085", this);
if (tc.isEventEnabled())
Tr.event(tc, "Exception caught marking Transaction rollback only", e);
throw (SystemException) new SystemException(e.getLocalizedMessage()).initCause(e);
}
toThrow = new RollbackException("Transaction has been marked as rollback only.").initCause(xae);
if (tc.isEventEnabled())
Tr.event(tc, "Marked transaction as rollback only.", toThrow);
throw (RollbackException) toThrow;
}
//
// Any other error is a protocol violation or the RM is broken, and we throw
// SystemException.
//
else // XAER_RMERR, XAER_RMFAIL, XAER_INVAL, XAER_PROTO, XAER_DUPID
{
Tr.error(tc, "WTRN0078_START_FAILED", new Object[] { XAReturnCodeHelper.convertXACode(_errorCode), xae });
throw (SystemException) new SystemException("XAResource start association error:" + XAReturnCodeHelper.convertXACode(_errorCode)).initCause(xae);
}
} finally {
if (tc.isEntryEnabled())
Tr.exit(tc, "startRes");
}
} | [
"protected",
"void",
"startRes",
"(",
"JTAResource",
"resource",
")",
"throws",
"RollbackException",
",",
"SystemException",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"startRes\"",
",",
"new",
"Object",
"[",
"]",
"{",
"this",
",",
"resource",
"}",
")",
";",
"try",
"{",
"resource",
".",
"start",
"(",
")",
";",
"}",
"catch",
"(",
"XAException",
"xae",
")",
"{",
"_errorCode",
"=",
"xae",
".",
"errorCode",
";",
"// Save locally for FFDC",
"FFDCFilter",
".",
"processException",
"(",
"xae",
",",
"\"com.ibm.tx.jta.impl.RegisteredResources.startRes\"",
",",
"\"1053\"",
",",
"this",
")",
";",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"XAException: error code \"",
"+",
"XAReturnCodeHelper",
".",
"convertXACode",
"(",
"_errorCode",
")",
",",
"xae",
")",
";",
"final",
"Throwable",
"toThrow",
";",
"//",
"// the XAResource object is doing work outside global",
"// transaction. This means that XAResource is doing local",
"// transaction. Local transaction has to be completed before",
"// start global transaction or XA transaction.",
"//",
"if",
"(",
"_errorCode",
"==",
"XAException",
".",
"XAER_OUTSIDE",
")",
"{",
"toThrow",
"=",
"new",
"RollbackException",
"(",
"\"XAResource working outside transaction\"",
")",
".",
"initCause",
"(",
"xae",
")",
";",
"if",
"(",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"Tr",
".",
"event",
"(",
"tc",
",",
"\"XAResource is doing work outside of the transaction.\"",
",",
"toThrow",
")",
";",
"throw",
"(",
"RollbackException",
")",
"toThrow",
";",
"}",
"else",
"if",
"(",
"_errorCode",
">=",
"XAException",
".",
"XA_RBBASE",
"&&",
"_errorCode",
"<=",
"XAException",
".",
"XA_RBEND",
")",
"{",
"if",
"(",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"Tr",
".",
"event",
"(",
"tc",
",",
"\"Transaction branch has been marked rollback-only by the RM\"",
")",
";",
"//",
"// Transaction branch has been rolled back, so we",
"// mark transaction as rollback only.",
"//",
"try",
"{",
"_transaction",
".",
"setRollbackOnly",
"(",
")",
";",
"}",
"catch",
"(",
"IllegalStateException",
"e",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"\"com.ibm.tx.jta.impl.RegisteredResources.startRes\"",
",",
"\"1085\"",
",",
"this",
")",
";",
"if",
"(",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"Tr",
".",
"event",
"(",
"tc",
",",
"\"Exception caught marking Transaction rollback only\"",
",",
"e",
")",
";",
"throw",
"(",
"SystemException",
")",
"new",
"SystemException",
"(",
"e",
".",
"getLocalizedMessage",
"(",
")",
")",
".",
"initCause",
"(",
"e",
")",
";",
"}",
"toThrow",
"=",
"new",
"RollbackException",
"(",
"\"Transaction has been marked as rollback only.\"",
")",
".",
"initCause",
"(",
"xae",
")",
";",
"if",
"(",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"Tr",
".",
"event",
"(",
"tc",
",",
"\"Marked transaction as rollback only.\"",
",",
"toThrow",
")",
";",
"throw",
"(",
"RollbackException",
")",
"toThrow",
";",
"}",
"//",
"// Any other error is a protocol violation or the RM is broken, and we throw",
"// SystemException.",
"//",
"else",
"// XAER_RMERR, XAER_RMFAIL, XAER_INVAL, XAER_PROTO, XAER_DUPID",
"{",
"Tr",
".",
"error",
"(",
"tc",
",",
"\"WTRN0078_START_FAILED\"",
",",
"new",
"Object",
"[",
"]",
"{",
"XAReturnCodeHelper",
".",
"convertXACode",
"(",
"_errorCode",
")",
",",
"xae",
"}",
")",
";",
"throw",
"(",
"SystemException",
")",
"new",
"SystemException",
"(",
"\"XAResource start association error:\"",
"+",
"XAReturnCodeHelper",
".",
"convertXACode",
"(",
"_errorCode",
")",
")",
".",
"initCause",
"(",
"xae",
")",
";",
"}",
"}",
"finally",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"startRes\"",
")",
";",
"}",
"}"
] | Starts association of the resource with the current transaction and if required
adds a reference to a Resource object to the list in the registered state.
This method is intended to be used for registering local resources.
@param resource
@return | [
"Starts",
"association",
"of",
"the",
"resource",
"with",
"the",
"current",
"transaction",
"and",
"if",
"required",
"adds",
"a",
"reference",
"to",
"a",
"Resource",
"object",
"to",
"the",
"list",
"in",
"the",
"registered",
"state",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/RegisteredResources.java#L830-L889 | train |
OpenLiberty/open-liberty | dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/RegisteredResources.java | RegisteredResources.numRegistered | public int numRegistered() {
final int result = _resourceObjects.size();
if (tc.isDebugEnabled())
Tr.debug(tc, "numRegistered", result);
return result;
} | java | public int numRegistered() {
final int result = _resourceObjects.size();
if (tc.isDebugEnabled())
Tr.debug(tc, "numRegistered", result);
return result;
} | [
"public",
"int",
"numRegistered",
"(",
")",
"{",
"final",
"int",
"result",
"=",
"_resourceObjects",
".",
"size",
"(",
")",
";",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"numRegistered\"",
",",
"result",
")",
";",
"return",
"result",
";",
"}"
] | Returns the number of Resources currently in the list.
@return The number of registered Resources. | [
"Returns",
"the",
"number",
"of",
"Resources",
"currently",
"in",
"the",
"list",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/RegisteredResources.java#L896-L902 | train |
OpenLiberty/open-liberty | dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/RegisteredResources.java | RegisteredResources.distributeEnd | public boolean distributeEnd(int flags) {
if (tc.isEntryEnabled())
Tr.entry(tc, "distributeEnd", Util.printFlag(flags));
boolean result = true;
for (int i = _resourceObjects.size(); --i >= 0;) {
final JTAResource resource = _resourceObjects.get(i);
if (!sendEnd(resource, flags)) {
result = false;
}
}
if (_sameRMResource != null) {
if (!sendEnd(_sameRMResource, flags)) {
result = false;
}
}
if (tc.isEntryEnabled())
Tr.exit(tc, "distributeEnd", result);
return result;
} | java | public boolean distributeEnd(int flags) {
if (tc.isEntryEnabled())
Tr.entry(tc, "distributeEnd", Util.printFlag(flags));
boolean result = true;
for (int i = _resourceObjects.size(); --i >= 0;) {
final JTAResource resource = _resourceObjects.get(i);
if (!sendEnd(resource, flags)) {
result = false;
}
}
if (_sameRMResource != null) {
if (!sendEnd(_sameRMResource, flags)) {
result = false;
}
}
if (tc.isEntryEnabled())
Tr.exit(tc, "distributeEnd", result);
return result;
} | [
"public",
"boolean",
"distributeEnd",
"(",
"int",
"flags",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"distributeEnd\"",
",",
"Util",
".",
"printFlag",
"(",
"flags",
")",
")",
";",
"boolean",
"result",
"=",
"true",
";",
"for",
"(",
"int",
"i",
"=",
"_resourceObjects",
".",
"size",
"(",
")",
";",
"--",
"i",
">=",
"0",
";",
")",
"{",
"final",
"JTAResource",
"resource",
"=",
"_resourceObjects",
".",
"get",
"(",
"i",
")",
";",
"if",
"(",
"!",
"sendEnd",
"(",
"resource",
",",
"flags",
")",
")",
"{",
"result",
"=",
"false",
";",
"}",
"}",
"if",
"(",
"_sameRMResource",
"!=",
"null",
")",
"{",
"if",
"(",
"!",
"sendEnd",
"(",
"_sameRMResource",
",",
"flags",
")",
")",
"{",
"result",
"=",
"false",
";",
"}",
"}",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"distributeEnd\"",
",",
"result",
")",
";",
"return",
"result",
";",
"}"
] | Send end to all registered resources
@param flags
@return whether we managed to successfully end all the resources | [
"Send",
"end",
"to",
"all",
"registered",
"resources"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/RegisteredResources.java#L911-L934 | train |
OpenLiberty/open-liberty | dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/RegisteredResources.java | RegisteredResources.updateHeuristicState | private void updateHeuristicState(boolean commit) throws SystemException {
if (tc.isEntryEnabled())
Tr.entry(tc, "updateHeuristicState", commit);
if (_transaction.isSubordinate()) {
// Get the current transaction state. Need to do this in case we are
// in recovery and have already logged a heuristic
final TransactionState ts = _transaction.getTransactionState();
final int state = ts.getState();
if (commit) {
if (state != TransactionState.STATE_HEURISTIC_ON_COMMIT)
ts.setState(TransactionState.STATE_HEURISTIC_ON_COMMIT);
} else {
// if state is ACTIVE, then this is called via
// rollbackResources, so do not change state
if (state != TransactionState.STATE_HEURISTIC_ON_ROLLBACK
&& state != TransactionState.STATE_ACTIVE)
ts.setState(TransactionState.STATE_HEURISTIC_ON_ROLLBACK);
}
}
if (tc.isEntryEnabled())
Tr.exit(tc, "updateHeuristicState");
} | java | private void updateHeuristicState(boolean commit) throws SystemException {
if (tc.isEntryEnabled())
Tr.entry(tc, "updateHeuristicState", commit);
if (_transaction.isSubordinate()) {
// Get the current transaction state. Need to do this in case we are
// in recovery and have already logged a heuristic
final TransactionState ts = _transaction.getTransactionState();
final int state = ts.getState();
if (commit) {
if (state != TransactionState.STATE_HEURISTIC_ON_COMMIT)
ts.setState(TransactionState.STATE_HEURISTIC_ON_COMMIT);
} else {
// if state is ACTIVE, then this is called via
// rollbackResources, so do not change state
if (state != TransactionState.STATE_HEURISTIC_ON_ROLLBACK
&& state != TransactionState.STATE_ACTIVE)
ts.setState(TransactionState.STATE_HEURISTIC_ON_ROLLBACK);
}
}
if (tc.isEntryEnabled())
Tr.exit(tc, "updateHeuristicState");
} | [
"private",
"void",
"updateHeuristicState",
"(",
"boolean",
"commit",
")",
"throws",
"SystemException",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"updateHeuristicState\"",
",",
"commit",
")",
";",
"if",
"(",
"_transaction",
".",
"isSubordinate",
"(",
")",
")",
"{",
"// Get the current transaction state. Need to do this in case we are",
"// in recovery and have already logged a heuristic",
"final",
"TransactionState",
"ts",
"=",
"_transaction",
".",
"getTransactionState",
"(",
")",
";",
"final",
"int",
"state",
"=",
"ts",
".",
"getState",
"(",
")",
";",
"if",
"(",
"commit",
")",
"{",
"if",
"(",
"state",
"!=",
"TransactionState",
".",
"STATE_HEURISTIC_ON_COMMIT",
")",
"ts",
".",
"setState",
"(",
"TransactionState",
".",
"STATE_HEURISTIC_ON_COMMIT",
")",
";",
"}",
"else",
"{",
"// if state is ACTIVE, then this is called via",
"// rollbackResources, so do not change state",
"if",
"(",
"state",
"!=",
"TransactionState",
".",
"STATE_HEURISTIC_ON_ROLLBACK",
"&&",
"state",
"!=",
"TransactionState",
".",
"STATE_ACTIVE",
")",
"ts",
".",
"setState",
"(",
"TransactionState",
".",
"STATE_HEURISTIC_ON_ROLLBACK",
")",
";",
"}",
"}",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"updateHeuristicState\"",
")",
";",
"}"
] | Possibly update the heuristic state of the transaction.
This is only required if this is a subordinate.
If we are a subordinate we need to update the state and log it for recovery.
@param commit - true if requested to commit, else false | [
"Possibly",
"update",
"the",
"heuristic",
"state",
"of",
"the",
"transaction",
".",
"This",
"is",
"only",
"required",
"if",
"this",
"is",
"a",
"subordinate",
".",
"If",
"we",
"are",
"a",
"subordinate",
"we",
"need",
"to",
"update",
"the",
"state",
"and",
"log",
"it",
"for",
"recovery",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/RegisteredResources.java#L1768-L1791 | train |
OpenLiberty/open-liberty | dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/RegisteredResources.java | RegisteredResources.distributeForget | public boolean distributeForget() throws SystemException {
if (tc.isEntryEnabled())
Tr.entry(tc, "distributeForget", this);
boolean retryRequired = false; // indicates whether retry necessary
final int resourceCount = _resourceObjects.size();
// Browse through the participants, processing them as appropriate
for (int i = 0; i < resourceCount; i++) {
final JTAResource currResource = _resourceObjects.get(i);
switch (currResource.getResourceStatus()) {
case StatefulResource.HEURISTIC_COMMIT:
case StatefulResource.HEURISTIC_ROLLBACK:
case StatefulResource.HEURISTIC_MIXED:
case StatefulResource.HEURISTIC_HAZARD:
if (forgetResource(currResource)) {
retryRequired = true;
_retryRequired = true;
}
break;
default: // do nothing
break;
} // end switch
} // end for
if (_systemException != null) {
final Throwable toThrow = new SystemException().initCause(_systemException);
if (tc.isEntryEnabled())
Tr.exit(tc, "distributeForget", toThrow);
throw (SystemException) toThrow;
}
if (tc.isEntryEnabled())
Tr.exit(tc, "distributeForget", retryRequired);
return retryRequired;
} | java | public boolean distributeForget() throws SystemException {
if (tc.isEntryEnabled())
Tr.entry(tc, "distributeForget", this);
boolean retryRequired = false; // indicates whether retry necessary
final int resourceCount = _resourceObjects.size();
// Browse through the participants, processing them as appropriate
for (int i = 0; i < resourceCount; i++) {
final JTAResource currResource = _resourceObjects.get(i);
switch (currResource.getResourceStatus()) {
case StatefulResource.HEURISTIC_COMMIT:
case StatefulResource.HEURISTIC_ROLLBACK:
case StatefulResource.HEURISTIC_MIXED:
case StatefulResource.HEURISTIC_HAZARD:
if (forgetResource(currResource)) {
retryRequired = true;
_retryRequired = true;
}
break;
default: // do nothing
break;
} // end switch
} // end for
if (_systemException != null) {
final Throwable toThrow = new SystemException().initCause(_systemException);
if (tc.isEntryEnabled())
Tr.exit(tc, "distributeForget", toThrow);
throw (SystemException) toThrow;
}
if (tc.isEntryEnabled())
Tr.exit(tc, "distributeForget", retryRequired);
return retryRequired;
} | [
"public",
"boolean",
"distributeForget",
"(",
")",
"throws",
"SystemException",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"distributeForget\"",
",",
"this",
")",
";",
"boolean",
"retryRequired",
"=",
"false",
";",
"// indicates whether retry necessary",
"final",
"int",
"resourceCount",
"=",
"_resourceObjects",
".",
"size",
"(",
")",
";",
"// Browse through the participants, processing them as appropriate",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"resourceCount",
";",
"i",
"++",
")",
"{",
"final",
"JTAResource",
"currResource",
"=",
"_resourceObjects",
".",
"get",
"(",
"i",
")",
";",
"switch",
"(",
"currResource",
".",
"getResourceStatus",
"(",
")",
")",
"{",
"case",
"StatefulResource",
".",
"HEURISTIC_COMMIT",
":",
"case",
"StatefulResource",
".",
"HEURISTIC_ROLLBACK",
":",
"case",
"StatefulResource",
".",
"HEURISTIC_MIXED",
":",
"case",
"StatefulResource",
".",
"HEURISTIC_HAZARD",
":",
"if",
"(",
"forgetResource",
"(",
"currResource",
")",
")",
"{",
"retryRequired",
"=",
"true",
";",
"_retryRequired",
"=",
"true",
";",
"}",
"break",
";",
"default",
":",
"// do nothing",
"break",
";",
"}",
"// end switch",
"}",
"// end for",
"if",
"(",
"_systemException",
"!=",
"null",
")",
"{",
"final",
"Throwable",
"toThrow",
"=",
"new",
"SystemException",
"(",
")",
".",
"initCause",
"(",
"_systemException",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"distributeForget\"",
",",
"toThrow",
")",
";",
"throw",
"(",
"SystemException",
")",
"toThrow",
";",
"}",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"distributeForget\"",
",",
"retryRequired",
")",
";",
"return",
"retryRequired",
";",
"}"
] | Distributes forget messages to all Resources in
the appropriate state. Called during retry and mainline.
@return boolean value to indicate whether retries are necessary. | [
"Distributes",
"forget",
"messages",
"to",
"all",
"Resources",
"in",
"the",
"appropriate",
"state",
".",
"Called",
"during",
"retry",
"and",
"mainline",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/RegisteredResources.java#L1799-L1838 | train |
OpenLiberty/open-liberty | dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/RegisteredResources.java | RegisteredResources.forgetResource | protected boolean forgetResource(JTAResource resource) {
if (tc.isEntryEnabled())
Tr.entry(tc, "forgetResource", resource);
boolean result = false; // indicates whether retry necessary
boolean auditing = false;
try {
boolean informResource = true;
auditing = _transaction.auditSendForget(resource);
if (xaFlowCallbackEnabled) {
informResource = XAFlowCallbackControl.beforeXAFlow(XAFlowCallback.FORGET,
XAFlowCallback.FORGET_NORMAL);
}
if (informResource) {
resource.forget();
}
// Set the state of the Resource to completed after a successful forget.
resource.setResourceStatus(StatefulResource.COMPLETED);
if (auditing)
_transaction.auditForgetResponse(XAResource.XA_OK, resource);
if (xaFlowCallbackEnabled) {
XAFlowCallbackControl.afterXAFlow(XAFlowCallback.FORGET,
XAFlowCallback.AFTER_SUCCESS);
}
} catch (XAException xae) {
_errorCode = xae.errorCode; // Save locally for FFDC
FFDCFilter.processException(xae, "com.ibm.tx.jta.impl.RegisteredResources.forgetResource", "2859", this);
if (tc.isDebugEnabled())
Tr.debug(tc, "XAException: error code " + XAReturnCodeHelper.convertXACode(_errorCode), xae);
if (auditing)
_transaction.auditForgetResponse(_errorCode, resource);
if (xaFlowCallbackEnabled) {
XAFlowCallbackControl.afterXAFlow(XAFlowCallback.FORGET,
XAFlowCallback.AFTER_FAIL);
}
if (_errorCode == XAException.XAER_RMERR) {
// An internal error has occured within
// the resource manager and it was unable
// to forget the transaction.
//
// Retry the forget flow.
result = true;
addToFailedResources(resource);
} else if (_errorCode == XAException.XAER_RMFAIL) {
// The resource manager is unavailable.
// Set the resource's state to failed so that
// we will attempt to reconnect to the resource
// manager upon retrying.
resource.setState(JTAResource.FAILED);
// Retry the forget flow.
result = true;
addToFailedResources(resource);
} else if (_errorCode == XAException.XAER_NOTA) {
// The resource manager had no knowledge
// of this transaction. Perform some cleanup
// and return normally.
resource.setResourceStatus(StatefulResource.COMPLETED);
resource.destroy();
} else // XAER_INVAL, XAER_PROTO
{
if (!auditing)
Tr.error(tc, "WTRN0054_XA_FORGET_ERROR", new Object[] { XAReturnCodeHelper.convertXACode(_errorCode), xae });
resource.setResourceStatus(StatefulResource.COMPLETED);
// An internal logic error has occured.
_systemException = xae;
}
} catch (Throwable t) {
// treat like RMERR
FFDCFilter.processException(t, "com.ibm.tx.jta.impl.RegisteredResources.forgetResource", "2935", this);
if (tc.isDebugEnabled())
Tr.debug(tc, "RuntimeException", t);
if (xaFlowCallbackEnabled) {
XAFlowCallbackControl.afterXAFlow(XAFlowCallback.FORGET,
XAFlowCallback.AFTER_FAIL);
}
// An internal error has occured within
// the resource manager and it was unable
// to forget the transaction.
//
// Retry the forget flow.
result = true;
addToFailedResources(resource);
}
if (tc.isEntryEnabled())
Tr.exit(tc, "forgetResource", result);
return result;
} | java | protected boolean forgetResource(JTAResource resource) {
if (tc.isEntryEnabled())
Tr.entry(tc, "forgetResource", resource);
boolean result = false; // indicates whether retry necessary
boolean auditing = false;
try {
boolean informResource = true;
auditing = _transaction.auditSendForget(resource);
if (xaFlowCallbackEnabled) {
informResource = XAFlowCallbackControl.beforeXAFlow(XAFlowCallback.FORGET,
XAFlowCallback.FORGET_NORMAL);
}
if (informResource) {
resource.forget();
}
// Set the state of the Resource to completed after a successful forget.
resource.setResourceStatus(StatefulResource.COMPLETED);
if (auditing)
_transaction.auditForgetResponse(XAResource.XA_OK, resource);
if (xaFlowCallbackEnabled) {
XAFlowCallbackControl.afterXAFlow(XAFlowCallback.FORGET,
XAFlowCallback.AFTER_SUCCESS);
}
} catch (XAException xae) {
_errorCode = xae.errorCode; // Save locally for FFDC
FFDCFilter.processException(xae, "com.ibm.tx.jta.impl.RegisteredResources.forgetResource", "2859", this);
if (tc.isDebugEnabled())
Tr.debug(tc, "XAException: error code " + XAReturnCodeHelper.convertXACode(_errorCode), xae);
if (auditing)
_transaction.auditForgetResponse(_errorCode, resource);
if (xaFlowCallbackEnabled) {
XAFlowCallbackControl.afterXAFlow(XAFlowCallback.FORGET,
XAFlowCallback.AFTER_FAIL);
}
if (_errorCode == XAException.XAER_RMERR) {
// An internal error has occured within
// the resource manager and it was unable
// to forget the transaction.
//
// Retry the forget flow.
result = true;
addToFailedResources(resource);
} else if (_errorCode == XAException.XAER_RMFAIL) {
// The resource manager is unavailable.
// Set the resource's state to failed so that
// we will attempt to reconnect to the resource
// manager upon retrying.
resource.setState(JTAResource.FAILED);
// Retry the forget flow.
result = true;
addToFailedResources(resource);
} else if (_errorCode == XAException.XAER_NOTA) {
// The resource manager had no knowledge
// of this transaction. Perform some cleanup
// and return normally.
resource.setResourceStatus(StatefulResource.COMPLETED);
resource.destroy();
} else // XAER_INVAL, XAER_PROTO
{
if (!auditing)
Tr.error(tc, "WTRN0054_XA_FORGET_ERROR", new Object[] { XAReturnCodeHelper.convertXACode(_errorCode), xae });
resource.setResourceStatus(StatefulResource.COMPLETED);
// An internal logic error has occured.
_systemException = xae;
}
} catch (Throwable t) {
// treat like RMERR
FFDCFilter.processException(t, "com.ibm.tx.jta.impl.RegisteredResources.forgetResource", "2935", this);
if (tc.isDebugEnabled())
Tr.debug(tc, "RuntimeException", t);
if (xaFlowCallbackEnabled) {
XAFlowCallbackControl.afterXAFlow(XAFlowCallback.FORGET,
XAFlowCallback.AFTER_FAIL);
}
// An internal error has occured within
// the resource manager and it was unable
// to forget the transaction.
//
// Retry the forget flow.
result = true;
addToFailedResources(resource);
}
if (tc.isEntryEnabled())
Tr.exit(tc, "forgetResource", result);
return result;
} | [
"protected",
"boolean",
"forgetResource",
"(",
"JTAResource",
"resource",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"forgetResource\"",
",",
"resource",
")",
";",
"boolean",
"result",
"=",
"false",
";",
"// indicates whether retry necessary",
"boolean",
"auditing",
"=",
"false",
";",
"try",
"{",
"boolean",
"informResource",
"=",
"true",
";",
"auditing",
"=",
"_transaction",
".",
"auditSendForget",
"(",
"resource",
")",
";",
"if",
"(",
"xaFlowCallbackEnabled",
")",
"{",
"informResource",
"=",
"XAFlowCallbackControl",
".",
"beforeXAFlow",
"(",
"XAFlowCallback",
".",
"FORGET",
",",
"XAFlowCallback",
".",
"FORGET_NORMAL",
")",
";",
"}",
"if",
"(",
"informResource",
")",
"{",
"resource",
".",
"forget",
"(",
")",
";",
"}",
"// Set the state of the Resource to completed after a successful forget.",
"resource",
".",
"setResourceStatus",
"(",
"StatefulResource",
".",
"COMPLETED",
")",
";",
"if",
"(",
"auditing",
")",
"_transaction",
".",
"auditForgetResponse",
"(",
"XAResource",
".",
"XA_OK",
",",
"resource",
")",
";",
"if",
"(",
"xaFlowCallbackEnabled",
")",
"{",
"XAFlowCallbackControl",
".",
"afterXAFlow",
"(",
"XAFlowCallback",
".",
"FORGET",
",",
"XAFlowCallback",
".",
"AFTER_SUCCESS",
")",
";",
"}",
"}",
"catch",
"(",
"XAException",
"xae",
")",
"{",
"_errorCode",
"=",
"xae",
".",
"errorCode",
";",
"// Save locally for FFDC",
"FFDCFilter",
".",
"processException",
"(",
"xae",
",",
"\"com.ibm.tx.jta.impl.RegisteredResources.forgetResource\"",
",",
"\"2859\"",
",",
"this",
")",
";",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"XAException: error code \"",
"+",
"XAReturnCodeHelper",
".",
"convertXACode",
"(",
"_errorCode",
")",
",",
"xae",
")",
";",
"if",
"(",
"auditing",
")",
"_transaction",
".",
"auditForgetResponse",
"(",
"_errorCode",
",",
"resource",
")",
";",
"if",
"(",
"xaFlowCallbackEnabled",
")",
"{",
"XAFlowCallbackControl",
".",
"afterXAFlow",
"(",
"XAFlowCallback",
".",
"FORGET",
",",
"XAFlowCallback",
".",
"AFTER_FAIL",
")",
";",
"}",
"if",
"(",
"_errorCode",
"==",
"XAException",
".",
"XAER_RMERR",
")",
"{",
"// An internal error has occured within",
"// the resource manager and it was unable",
"// to forget the transaction.",
"//",
"// Retry the forget flow.",
"result",
"=",
"true",
";",
"addToFailedResources",
"(",
"resource",
")",
";",
"}",
"else",
"if",
"(",
"_errorCode",
"==",
"XAException",
".",
"XAER_RMFAIL",
")",
"{",
"// The resource manager is unavailable.",
"// Set the resource's state to failed so that",
"// we will attempt to reconnect to the resource",
"// manager upon retrying.",
"resource",
".",
"setState",
"(",
"JTAResource",
".",
"FAILED",
")",
";",
"// Retry the forget flow.",
"result",
"=",
"true",
";",
"addToFailedResources",
"(",
"resource",
")",
";",
"}",
"else",
"if",
"(",
"_errorCode",
"==",
"XAException",
".",
"XAER_NOTA",
")",
"{",
"// The resource manager had no knowledge",
"// of this transaction. Perform some cleanup",
"// and return normally.",
"resource",
".",
"setResourceStatus",
"(",
"StatefulResource",
".",
"COMPLETED",
")",
";",
"resource",
".",
"destroy",
"(",
")",
";",
"}",
"else",
"// XAER_INVAL, XAER_PROTO",
"{",
"if",
"(",
"!",
"auditing",
")",
"Tr",
".",
"error",
"(",
"tc",
",",
"\"WTRN0054_XA_FORGET_ERROR\"",
",",
"new",
"Object",
"[",
"]",
"{",
"XAReturnCodeHelper",
".",
"convertXACode",
"(",
"_errorCode",
")",
",",
"xae",
"}",
")",
";",
"resource",
".",
"setResourceStatus",
"(",
"StatefulResource",
".",
"COMPLETED",
")",
";",
"// An internal logic error has occured.",
"_systemException",
"=",
"xae",
";",
"}",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"// treat like RMERR",
"FFDCFilter",
".",
"processException",
"(",
"t",
",",
"\"com.ibm.tx.jta.impl.RegisteredResources.forgetResource\"",
",",
"\"2935\"",
",",
"this",
")",
";",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"RuntimeException\"",
",",
"t",
")",
";",
"if",
"(",
"xaFlowCallbackEnabled",
")",
"{",
"XAFlowCallbackControl",
".",
"afterXAFlow",
"(",
"XAFlowCallback",
".",
"FORGET",
",",
"XAFlowCallback",
".",
"AFTER_FAIL",
")",
";",
"}",
"// An internal error has occured within",
"// the resource manager and it was unable",
"// to forget the transaction.",
"//",
"// Retry the forget flow.",
"result",
"=",
"true",
";",
"addToFailedResources",
"(",
"resource",
")",
";",
"}",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"forgetResource\"",
",",
"result",
")",
";",
"return",
"result",
";",
"}"
] | Distribute forget flow to given resource.
Used internally when resource indicates a heuristic condition.
May result in retries if resource cannot be contacted.
@param resource - the resource to issue forget to
@param index - the index of this resource in the arrays
@return boolean to indicate whether retries are necessary | [
"Distribute",
"forget",
"flow",
"to",
"given",
"resource",
".",
"Used",
"internally",
"when",
"resource",
"indicates",
"a",
"heuristic",
"condition",
".",
"May",
"result",
"in",
"retries",
"if",
"resource",
"cannot",
"be",
"contacted",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/RegisteredResources.java#L1850-L1949 | train |
OpenLiberty/open-liberty | dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/RegisteredResources.java | RegisteredResources.distributeCommit | public void distributeCommit()
throws SystemException, HeuristicHazardException, HeuristicMixedException, HeuristicRollbackException {
if (tc.isEntryEnabled())
Tr.entry(tc, "distributeCommit");
final TransactionState ts = _transaction.getTransactionState();
ts.setCommittingStateUnlogged();
// Shuffle resources around according to commit priority order
_retryRequired = sortResources();
if (!_retryRequired) {
_outcome = true;
_retryRequired = distributeOutcome();
} else {
updateHeuristicOutcome(StatefulResource.HEURISTIC_HAZARD);
}
if (_systemException != null) {
final Throwable toThrow = new SystemException().initCause(_systemException);
if (tc.isEntryEnabled())
Tr.exit(tc, "distributeCommit", toThrow);
throw (SystemException) toThrow;
}
// check for heuristics ... as we will move forget processing to TransactionImpl later
if (HeuristicOutcome.isHeuristic(_heuristicOutcome)) {
switch (_heuristicOutcome) {
case StatefulResource.HEURISTIC_COMMIT:
break;
case StatefulResource.HEURISTIC_ROLLBACK:
if (tc.isEntryEnabled())
Tr.exit(tc, "distributeCommit", "HeuristicRollbackException");
throw new HeuristicRollbackException();
case StatefulResource.HEURISTIC_HAZARD:
if (tc.isEntryEnabled())
Tr.exit(tc, "distributeCommit", "HeuristicHazardException");
throw new HeuristicHazardException();
default:
if (tc.isEntryEnabled())
Tr.exit(tc, "distributeCommit", "HeuristicMixedException");
throw new HeuristicMixedException();
}
}
if (tc.isEntryEnabled())
Tr.exit(tc, "distributeCommit");
} | java | public void distributeCommit()
throws SystemException, HeuristicHazardException, HeuristicMixedException, HeuristicRollbackException {
if (tc.isEntryEnabled())
Tr.entry(tc, "distributeCommit");
final TransactionState ts = _transaction.getTransactionState();
ts.setCommittingStateUnlogged();
// Shuffle resources around according to commit priority order
_retryRequired = sortResources();
if (!_retryRequired) {
_outcome = true;
_retryRequired = distributeOutcome();
} else {
updateHeuristicOutcome(StatefulResource.HEURISTIC_HAZARD);
}
if (_systemException != null) {
final Throwable toThrow = new SystemException().initCause(_systemException);
if (tc.isEntryEnabled())
Tr.exit(tc, "distributeCommit", toThrow);
throw (SystemException) toThrow;
}
// check for heuristics ... as we will move forget processing to TransactionImpl later
if (HeuristicOutcome.isHeuristic(_heuristicOutcome)) {
switch (_heuristicOutcome) {
case StatefulResource.HEURISTIC_COMMIT:
break;
case StatefulResource.HEURISTIC_ROLLBACK:
if (tc.isEntryEnabled())
Tr.exit(tc, "distributeCommit", "HeuristicRollbackException");
throw new HeuristicRollbackException();
case StatefulResource.HEURISTIC_HAZARD:
if (tc.isEntryEnabled())
Tr.exit(tc, "distributeCommit", "HeuristicHazardException");
throw new HeuristicHazardException();
default:
if (tc.isEntryEnabled())
Tr.exit(tc, "distributeCommit", "HeuristicMixedException");
throw new HeuristicMixedException();
}
}
if (tc.isEntryEnabled())
Tr.exit(tc, "distributeCommit");
} | [
"public",
"void",
"distributeCommit",
"(",
")",
"throws",
"SystemException",
",",
"HeuristicHazardException",
",",
"HeuristicMixedException",
",",
"HeuristicRollbackException",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"distributeCommit\"",
")",
";",
"final",
"TransactionState",
"ts",
"=",
"_transaction",
".",
"getTransactionState",
"(",
")",
";",
"ts",
".",
"setCommittingStateUnlogged",
"(",
")",
";",
"// Shuffle resources around according to commit priority order",
"_retryRequired",
"=",
"sortResources",
"(",
")",
";",
"if",
"(",
"!",
"_retryRequired",
")",
"{",
"_outcome",
"=",
"true",
";",
"_retryRequired",
"=",
"distributeOutcome",
"(",
")",
";",
"}",
"else",
"{",
"updateHeuristicOutcome",
"(",
"StatefulResource",
".",
"HEURISTIC_HAZARD",
")",
";",
"}",
"if",
"(",
"_systemException",
"!=",
"null",
")",
"{",
"final",
"Throwable",
"toThrow",
"=",
"new",
"SystemException",
"(",
")",
".",
"initCause",
"(",
"_systemException",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"distributeCommit\"",
",",
"toThrow",
")",
";",
"throw",
"(",
"SystemException",
")",
"toThrow",
";",
"}",
"// check for heuristics ... as we will move forget processing to TransactionImpl later",
"if",
"(",
"HeuristicOutcome",
".",
"isHeuristic",
"(",
"_heuristicOutcome",
")",
")",
"{",
"switch",
"(",
"_heuristicOutcome",
")",
"{",
"case",
"StatefulResource",
".",
"HEURISTIC_COMMIT",
":",
"break",
";",
"case",
"StatefulResource",
".",
"HEURISTIC_ROLLBACK",
":",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"distributeCommit\"",
",",
"\"HeuristicRollbackException\"",
")",
";",
"throw",
"new",
"HeuristicRollbackException",
"(",
")",
";",
"case",
"StatefulResource",
".",
"HEURISTIC_HAZARD",
":",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"distributeCommit\"",
",",
"\"HeuristicHazardException\"",
")",
";",
"throw",
"new",
"HeuristicHazardException",
"(",
")",
";",
"default",
":",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"distributeCommit\"",
",",
"\"HeuristicMixedException\"",
")",
";",
"throw",
"new",
"HeuristicMixedException",
"(",
")",
";",
"}",
"}",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"distributeCommit\"",
")",
";",
"}"
] | Distributes commit messages to all Resources in the registered state. | [
"Distributes",
"commit",
"messages",
"to",
"all",
"Resources",
"in",
"the",
"registered",
"state",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/RegisteredResources.java#L1955-L2004 | train |
OpenLiberty/open-liberty | dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/RegisteredResources.java | RegisteredResources.destroyResources | public void destroyResources() {
if (tc.isEntryEnabled())
Tr.entry(tc, "destroyResources");
// Browse through the participants, processing them as appropriate
final ArrayList<JTAResource> resources = getResourceObjects();
for (JTAResource resource : resources) {
destroyResource(resource);
}
if (_sameRMResource != null) {
destroyResource(_sameRMResource);
}
if (tc.isEntryEnabled())
Tr.exit(tc, "destroyResources");
} | java | public void destroyResources() {
if (tc.isEntryEnabled())
Tr.entry(tc, "destroyResources");
// Browse through the participants, processing them as appropriate
final ArrayList<JTAResource> resources = getResourceObjects();
for (JTAResource resource : resources) {
destroyResource(resource);
}
if (_sameRMResource != null) {
destroyResource(_sameRMResource);
}
if (tc.isEntryEnabled())
Tr.exit(tc, "destroyResources");
} | [
"public",
"void",
"destroyResources",
"(",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"destroyResources\"",
")",
";",
"// Browse through the participants, processing them as appropriate",
"final",
"ArrayList",
"<",
"JTAResource",
">",
"resources",
"=",
"getResourceObjects",
"(",
")",
";",
"for",
"(",
"JTAResource",
"resource",
":",
"resources",
")",
"{",
"destroyResource",
"(",
"resource",
")",
";",
"}",
"if",
"(",
"_sameRMResource",
"!=",
"null",
")",
"{",
"destroyResource",
"(",
"_sameRMResource",
")",
";",
"}",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"destroyResources\"",
")",
";",
"}"
] | Cleanup resources that have not yet been completed.
A utility function called when transaction completion has been
abandonned either when retries have been exhausted or the operator
has cancelled the transaction. | [
"Cleanup",
"resources",
"that",
"have",
"not",
"yet",
"been",
"completed",
".",
"A",
"utility",
"function",
"called",
"when",
"transaction",
"completion",
"has",
"been",
"abandonned",
"either",
"when",
"retries",
"have",
"been",
"exhausted",
"or",
"the",
"operator",
"has",
"cancelled",
"the",
"transaction",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/RegisteredResources.java#L2436-L2452 | train |
OpenLiberty/open-liberty | dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/RegisteredResources.java | RegisteredResources.compare | @Override
public int compare(JTAResource o1, JTAResource o2) {
if (tc.isEntryEnabled())
Tr.entry(tc, "compare", new Object[] { o1, o2, this });
int result = 0;
int p1 = o1.getPriority();
int p2 = o2.getPriority();
if (p1 < p2)
result = 1;
else if (p1 > p2)
result = -1;
if (tc.isEntryEnabled())
Tr.exit(tc, "compare", result);
return result;
} | java | @Override
public int compare(JTAResource o1, JTAResource o2) {
if (tc.isEntryEnabled())
Tr.entry(tc, "compare", new Object[] { o1, o2, this });
int result = 0;
int p1 = o1.getPriority();
int p2 = o2.getPriority();
if (p1 < p2)
result = 1;
else if (p1 > p2)
result = -1;
if (tc.isEntryEnabled())
Tr.exit(tc, "compare", result);
return result;
} | [
"@",
"Override",
"public",
"int",
"compare",
"(",
"JTAResource",
"o1",
",",
"JTAResource",
"o2",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"compare\"",
",",
"new",
"Object",
"[",
"]",
"{",
"o1",
",",
"o2",
",",
"this",
"}",
")",
";",
"int",
"result",
"=",
"0",
";",
"int",
"p1",
"=",
"o1",
".",
"getPriority",
"(",
")",
";",
"int",
"p2",
"=",
"o2",
".",
"getPriority",
"(",
")",
";",
"if",
"(",
"p1",
"<",
"p2",
")",
"result",
"=",
"1",
";",
"else",
"if",
"(",
"p1",
">",
"p2",
")",
"result",
"=",
"-",
"1",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"compare\"",
",",
"result",
")",
";",
"return",
"result",
";",
"}"
] | Comparator returning 0 should leave elements in list alone, preserving original order. | [
"Comparator",
"returning",
"0",
"should",
"leave",
"elements",
"in",
"list",
"alone",
"preserving",
"original",
"order",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/RegisteredResources.java#L2631-L2645 | train |
OpenLiberty/open-liberty | dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/RegisteredResources.java | RegisteredResources.sortResources | protected boolean sortResources() {
if (tc.isEntryEnabled())
Tr.entry(tc, "sortResources", _resourceObjects.toArray());
if (!_sorted) {
final int resourceCount = _resourceObjects.size();
if (_gotPriorityResourcesEnlisted) {
if (resourceCount > 1)
Collections.sort(_resourceObjects, this);
}
_sorted = true;
}
if (tc.isEntryEnabled())
Tr.exit(tc, "sortResources", _resourceObjects.toArray());
return false;
} | java | protected boolean sortResources() {
if (tc.isEntryEnabled())
Tr.entry(tc, "sortResources", _resourceObjects.toArray());
if (!_sorted) {
final int resourceCount = _resourceObjects.size();
if (_gotPriorityResourcesEnlisted) {
if (resourceCount > 1)
Collections.sort(_resourceObjects, this);
}
_sorted = true;
}
if (tc.isEntryEnabled())
Tr.exit(tc, "sortResources", _resourceObjects.toArray());
return false;
} | [
"protected",
"boolean",
"sortResources",
"(",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"sortResources\"",
",",
"_resourceObjects",
".",
"toArray",
"(",
")",
")",
";",
"if",
"(",
"!",
"_sorted",
")",
"{",
"final",
"int",
"resourceCount",
"=",
"_resourceObjects",
".",
"size",
"(",
")",
";",
"if",
"(",
"_gotPriorityResourcesEnlisted",
")",
"{",
"if",
"(",
"resourceCount",
">",
"1",
")",
"Collections",
".",
"sort",
"(",
"_resourceObjects",
",",
"this",
")",
";",
"}",
"_sorted",
"=",
"true",
";",
"}",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"sortResources\"",
",",
"_resourceObjects",
".",
"toArray",
"(",
")",
")",
";",
"return",
"false",
";",
"}"
] | Shuffle commitInLastPhase resources to the end of the list preserving their ordering
or reorder resources based on commitPriority in descending order for commit phase. | [
"Shuffle",
"commitInLastPhase",
"resources",
"to",
"the",
"end",
"of",
"the",
"list",
"preserving",
"their",
"ordering",
"or",
"reorder",
"resources",
"based",
"on",
"commitPriority",
"in",
"descending",
"order",
"for",
"commit",
"phase",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/RegisteredResources.java#L2651-L2668 | train |
OpenLiberty/open-liberty | dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/RegisteredResources.java | RegisteredResources.sortPreparePriorityResources | protected void sortPreparePriorityResources() {
if (tc.isEntryEnabled())
Tr.entry(tc, "sortPreparePriorityResources", _resourceObjects.toArray());
Collections.sort(_resourceObjects, prepareComparator);
if (tc.isEntryEnabled())
Tr.exit(tc, "sortPreparePriorityResources", _resourceObjects.toArray());
return;
} | java | protected void sortPreparePriorityResources() {
if (tc.isEntryEnabled())
Tr.entry(tc, "sortPreparePriorityResources", _resourceObjects.toArray());
Collections.sort(_resourceObjects, prepareComparator);
if (tc.isEntryEnabled())
Tr.exit(tc, "sortPreparePriorityResources", _resourceObjects.toArray());
return;
} | [
"protected",
"void",
"sortPreparePriorityResources",
"(",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"sortPreparePriorityResources\"",
",",
"_resourceObjects",
".",
"toArray",
"(",
")",
")",
";",
"Collections",
".",
"sort",
"(",
"_resourceObjects",
",",
"prepareComparator",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"sortPreparePriorityResources\"",
",",
"_resourceObjects",
".",
"toArray",
"(",
")",
")",
";",
"return",
";",
"}"
] | Reorder resources based on commitPriority in asccending order for prepare phase. | [
"Reorder",
"resources",
"based",
"on",
"commitPriority",
"in",
"asccending",
"order",
"for",
"prepare",
"phase",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/RegisteredResources.java#L2695-L2704 | train |
OpenLiberty/open-liberty | dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/RegisteredResources.java | RegisteredResources.isLastAgentEnlisted | public boolean isLastAgentEnlisted() {
final boolean lastAgentEnlisted = (_onePhaseResourceEnlisted != null);
if (tc.isDebugEnabled())
Tr.debug(tc, "isLastAgentEnlisted", lastAgentEnlisted);
return lastAgentEnlisted;
} | java | public boolean isLastAgentEnlisted() {
final boolean lastAgentEnlisted = (_onePhaseResourceEnlisted != null);
if (tc.isDebugEnabled())
Tr.debug(tc, "isLastAgentEnlisted", lastAgentEnlisted);
return lastAgentEnlisted;
} | [
"public",
"boolean",
"isLastAgentEnlisted",
"(",
")",
"{",
"final",
"boolean",
"lastAgentEnlisted",
"=",
"(",
"_onePhaseResourceEnlisted",
"!=",
"null",
")",
";",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"isLastAgentEnlisted\"",
",",
"lastAgentEnlisted",
")",
";",
"return",
"lastAgentEnlisted",
";",
"}"
] | Informs the caller if a 1PC resource is enlisted in this unit of work. | [
"Informs",
"the",
"caller",
"if",
"a",
"1PC",
"resource",
"is",
"enlisted",
"in",
"this",
"unit",
"of",
"work",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/RegisteredResources.java#L2812-L2818 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/ControlCreateDurableImpl.java | ControlCreateDurableImpl.getDurableSelectorNamespaceMap | public Map<String,String> getDurableSelectorNamespaceMap() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getDurableSelectorNamespaceMap");
Map<String,String> map = null;
if (jmo.getChoiceField(ControlAccess.BODY_CREATEDURABLE_NAMESPACEMAP) == ControlAccess.IS_BODY_CREATEDURABLE_NAMESPACEMAP_MAP) {
List<String> names = (List<String>)jmo.getField(ControlAccess.BODY_CREATEDURABLE_NAMESPACEMAP_MAP_NAME);
List<Object> values = (List<Object>)jmo.getField(ControlAccess.BODY_CREATEDURABLE_NAMESPACEMAP_MAP_VALUE);
map = (Map<String,String>)(Map<String,?>)new JsMsgMap(names, values);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getDurableSelectorNamespaceMap", map);
return map;
} | java | public Map<String,String> getDurableSelectorNamespaceMap() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getDurableSelectorNamespaceMap");
Map<String,String> map = null;
if (jmo.getChoiceField(ControlAccess.BODY_CREATEDURABLE_NAMESPACEMAP) == ControlAccess.IS_BODY_CREATEDURABLE_NAMESPACEMAP_MAP) {
List<String> names = (List<String>)jmo.getField(ControlAccess.BODY_CREATEDURABLE_NAMESPACEMAP_MAP_NAME);
List<Object> values = (List<Object>)jmo.getField(ControlAccess.BODY_CREATEDURABLE_NAMESPACEMAP_MAP_VALUE);
map = (Map<String,String>)(Map<String,?>)new JsMsgMap(names, values);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getDurableSelectorNamespaceMap", map);
return map;
} | [
"public",
"Map",
"<",
"String",
",",
"String",
">",
"getDurableSelectorNamespaceMap",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"getDurableSelectorNamespaceMap\"",
")",
";",
"Map",
"<",
"String",
",",
"String",
">",
"map",
"=",
"null",
";",
"if",
"(",
"jmo",
".",
"getChoiceField",
"(",
"ControlAccess",
".",
"BODY_CREATEDURABLE_NAMESPACEMAP",
")",
"==",
"ControlAccess",
".",
"IS_BODY_CREATEDURABLE_NAMESPACEMAP_MAP",
")",
"{",
"List",
"<",
"String",
">",
"names",
"=",
"(",
"List",
"<",
"String",
">",
")",
"jmo",
".",
"getField",
"(",
"ControlAccess",
".",
"BODY_CREATEDURABLE_NAMESPACEMAP_MAP_NAME",
")",
";",
"List",
"<",
"Object",
">",
"values",
"=",
"(",
"List",
"<",
"Object",
">",
")",
"jmo",
".",
"getField",
"(",
"ControlAccess",
".",
"BODY_CREATEDURABLE_NAMESPACEMAP_MAP_VALUE",
")",
";",
"map",
"=",
"(",
"Map",
"<",
"String",
",",
"String",
">",
")",
"(",
"Map",
"<",
"String",
",",
"?",
">",
")",
"new",
"JsMsgMap",
"(",
"names",
",",
"values",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"getDurableSelectorNamespaceMap\"",
",",
"map",
")",
";",
"return",
"map",
";",
"}"
] | Get the map of prefixes to namespace URLs that are associated with the selector.
@return the map of namespace prefixes | [
"Get",
"the",
"map",
"of",
"prefixes",
"to",
"namespace",
"URLs",
"that",
"are",
"associated",
"with",
"the",
"selector",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/ControlCreateDurableImpl.java#L158-L168 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/ControlCreateDurableImpl.java | ControlCreateDurableImpl.setDurableSelectorNamespaceMap | public void setDurableSelectorNamespaceMap(Map<String,String> namespaceMap) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setDurableSelectorNamespaceMap", namespaceMap);
if (namespaceMap == null) {
jmo.setChoiceField(ControlAccess.BODY_CREATEDURABLE_NAMESPACEMAP, ControlAccess.IS_BODY_CREATEDURABLE_NAMESPACEMAP_UNSET);
}
else {
List<String> names = new ArrayList<String>();
List<String> values = new ArrayList<String>();
Set<Map.Entry<String,String>> es = namespaceMap.entrySet();
for (Map.Entry<String,String> entry : es) {
names.add(entry.getKey());
values.add(entry.getValue());
}
jmo.setField(ControlAccess.BODY_CREATEDURABLE_NAMESPACEMAP_MAP_NAME, names);
jmo.setField(ControlAccess.BODY_CREATEDURABLE_NAMESPACEMAP_MAP_VALUE, values);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setDurableSelectorNamespaceMap");
} | java | public void setDurableSelectorNamespaceMap(Map<String,String> namespaceMap) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setDurableSelectorNamespaceMap", namespaceMap);
if (namespaceMap == null) {
jmo.setChoiceField(ControlAccess.BODY_CREATEDURABLE_NAMESPACEMAP, ControlAccess.IS_BODY_CREATEDURABLE_NAMESPACEMAP_UNSET);
}
else {
List<String> names = new ArrayList<String>();
List<String> values = new ArrayList<String>();
Set<Map.Entry<String,String>> es = namespaceMap.entrySet();
for (Map.Entry<String,String> entry : es) {
names.add(entry.getKey());
values.add(entry.getValue());
}
jmo.setField(ControlAccess.BODY_CREATEDURABLE_NAMESPACEMAP_MAP_NAME, names);
jmo.setField(ControlAccess.BODY_CREATEDURABLE_NAMESPACEMAP_MAP_VALUE, values);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setDurableSelectorNamespaceMap");
} | [
"public",
"void",
"setDurableSelectorNamespaceMap",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"namespaceMap",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"setDurableSelectorNamespaceMap\"",
",",
"namespaceMap",
")",
";",
"if",
"(",
"namespaceMap",
"==",
"null",
")",
"{",
"jmo",
".",
"setChoiceField",
"(",
"ControlAccess",
".",
"BODY_CREATEDURABLE_NAMESPACEMAP",
",",
"ControlAccess",
".",
"IS_BODY_CREATEDURABLE_NAMESPACEMAP_UNSET",
")",
";",
"}",
"else",
"{",
"List",
"<",
"String",
">",
"names",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"List",
"<",
"String",
">",
"values",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"Set",
"<",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
">",
"es",
"=",
"namespaceMap",
".",
"entrySet",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
"entry",
":",
"es",
")",
"{",
"names",
".",
"add",
"(",
"entry",
".",
"getKey",
"(",
")",
")",
";",
"values",
".",
"add",
"(",
"entry",
".",
"getValue",
"(",
")",
")",
";",
"}",
"jmo",
".",
"setField",
"(",
"ControlAccess",
".",
"BODY_CREATEDURABLE_NAMESPACEMAP_MAP_NAME",
",",
"names",
")",
";",
"jmo",
".",
"setField",
"(",
"ControlAccess",
".",
"BODY_CREATEDURABLE_NAMESPACEMAP_MAP_VALUE",
",",
"values",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"setDurableSelectorNamespaceMap\"",
")",
";",
"}"
] | Sets a map of prefixes to namespace URLs that are associated with the selector.
@param namespaceMap | [
"Sets",
"a",
"map",
"of",
"prefixes",
"to",
"namespace",
"URLs",
"that",
"are",
"associated",
"with",
"the",
"selector",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/ControlCreateDurableImpl.java#L287-L304 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/RLSAccessFile.java | RLSAccessFile.close | public void close() throws IOException
{
if (tc.isEntryEnabled()) Tr.entry(tc, "close", new Object[]{this, _file});
// By locking on the class rather than the object, and removing
// the inner lock on the class, this seems to resolve the problems
// reported in d347231 that file handles were not being released properly
// synchronized(this)
synchronized(RLSAccessFile.class)
{
_useCount--;
if (tc.isDebugEnabled()) Tr.debug(tc, "remaining file use count", new Integer(_useCount));
// Check for 0 usage and close the actual file.
// One needs to be aware that close() can be called both directly by the user on
// file.close(), and also indirectly by the JVM. The JVM will call close() on a
// filechannel.close() and also recursively call filechanel.close() and hence close()
// on a file.close(). For this reason, filechannel.close() has been removed from
// LogFileHandle calls - but it is still in CoordinationLock just in case the behaviour
// of the JVM changes wrt lock releases. This behaviour can make interesting trace
// reading because one can get the use count dropping to -1 either because of two
// serial calls (filechannel.close() + file.close()) or two recursive calls (ie
// file.close() calling filechannel.close() calling file.close()).
// Trace an innocious exception to help debug any recursion problems.
if (tc.isDebugEnabled() && (_useCount <= 0))
{
Tr.debug(tc, "call stack", new Exception("Dummy traceback"));
}
if (_useCount == 0)
{
super.close();
// Outer lock is now on class, so no need to lock here (d347231)
// synchronized(RLSAccessFile.class)
// {
_accessFiles.remove(_file);
// }
}
}
if (tc.isEntryEnabled()) Tr.exit(tc, "close");
} | java | public void close() throws IOException
{
if (tc.isEntryEnabled()) Tr.entry(tc, "close", new Object[]{this, _file});
// By locking on the class rather than the object, and removing
// the inner lock on the class, this seems to resolve the problems
// reported in d347231 that file handles were not being released properly
// synchronized(this)
synchronized(RLSAccessFile.class)
{
_useCount--;
if (tc.isDebugEnabled()) Tr.debug(tc, "remaining file use count", new Integer(_useCount));
// Check for 0 usage and close the actual file.
// One needs to be aware that close() can be called both directly by the user on
// file.close(), and also indirectly by the JVM. The JVM will call close() on a
// filechannel.close() and also recursively call filechanel.close() and hence close()
// on a file.close(). For this reason, filechannel.close() has been removed from
// LogFileHandle calls - but it is still in CoordinationLock just in case the behaviour
// of the JVM changes wrt lock releases. This behaviour can make interesting trace
// reading because one can get the use count dropping to -1 either because of two
// serial calls (filechannel.close() + file.close()) or two recursive calls (ie
// file.close() calling filechannel.close() calling file.close()).
// Trace an innocious exception to help debug any recursion problems.
if (tc.isDebugEnabled() && (_useCount <= 0))
{
Tr.debug(tc, "call stack", new Exception("Dummy traceback"));
}
if (_useCount == 0)
{
super.close();
// Outer lock is now on class, so no need to lock here (d347231)
// synchronized(RLSAccessFile.class)
// {
_accessFiles.remove(_file);
// }
}
}
if (tc.isEntryEnabled()) Tr.exit(tc, "close");
} | [
"public",
"void",
"close",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"close\"",
",",
"new",
"Object",
"[",
"]",
"{",
"this",
",",
"_file",
"}",
")",
";",
"// By locking on the class rather than the object, and removing",
"// the inner lock on the class, this seems to resolve the problems",
"// reported in d347231 that file handles were not being released properly",
"// synchronized(this) ",
"synchronized",
"(",
"RLSAccessFile",
".",
"class",
")",
"{",
"_useCount",
"--",
";",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"remaining file use count\"",
",",
"new",
"Integer",
"(",
"_useCount",
")",
")",
";",
"// Check for 0 usage and close the actual file. ",
"// One needs to be aware that close() can be called both directly by the user on",
"// file.close(), and also indirectly by the JVM. The JVM will call close() on a",
"// filechannel.close() and also recursively call filechanel.close() and hence close()",
"// on a file.close(). For this reason, filechannel.close() has been removed from",
"// LogFileHandle calls - but it is still in CoordinationLock just in case the behaviour",
"// of the JVM changes wrt lock releases. This behaviour can make interesting trace",
"// reading because one can get the use count dropping to -1 either because of two",
"// serial calls (filechannel.close() + file.close()) or two recursive calls (ie",
"// file.close() calling filechannel.close() calling file.close()).",
"// Trace an innocious exception to help debug any recursion problems.",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
"&&",
"(",
"_useCount",
"<=",
"0",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"call stack\"",
",",
"new",
"Exception",
"(",
"\"Dummy traceback\"",
")",
")",
";",
"}",
"if",
"(",
"_useCount",
"==",
"0",
")",
"{",
"super",
".",
"close",
"(",
")",
";",
"// Outer lock is now on class, so no need to lock here (d347231)",
"// synchronized(RLSAccessFile.class) ",
"// { ",
"_accessFiles",
".",
"remove",
"(",
"_file",
")",
";",
"// }",
"}",
"}",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"close\"",
")",
";",
"}"
] | The logic in close needs to account for recursive calls. See notes below. | [
"The",
"logic",
"in",
"close",
"needs",
"to",
"account",
"for",
"recursive",
"calls",
".",
"See",
"notes",
"below",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/RLSAccessFile.java#L86-L127 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/server/NLS.java | NLS.getInteger | public int getInteger(String key) throws MissingResourceException {
String result = getString(key);
try {
return Integer.parseInt(result);
} catch (NumberFormatException nfe) {
if (tc.isEventEnabled()) {
Tr.event(tc, "Unable to parse " + result + " as Integer.");
}
// DGH20040823: Begin fix for defect 218797 - Source provided by Tom Musta
// String msg = messages.getString("NLS.integerParseError",
// "Unable to parse as integer.");
String msg = getMessages().getString("NLS.integerParseError",
"Unable to parse as integer.");
// DGH20040823: End fix for defect 218797 - Source provided by Tom Musta
throw new MissingResourceException(msg, bundleName, key);
}
} | java | public int getInteger(String key) throws MissingResourceException {
String result = getString(key);
try {
return Integer.parseInt(result);
} catch (NumberFormatException nfe) {
if (tc.isEventEnabled()) {
Tr.event(tc, "Unable to parse " + result + " as Integer.");
}
// DGH20040823: Begin fix for defect 218797 - Source provided by Tom Musta
// String msg = messages.getString("NLS.integerParseError",
// "Unable to parse as integer.");
String msg = getMessages().getString("NLS.integerParseError",
"Unable to parse as integer.");
// DGH20040823: End fix for defect 218797 - Source provided by Tom Musta
throw new MissingResourceException(msg, bundleName, key);
}
} | [
"public",
"int",
"getInteger",
"(",
"String",
"key",
")",
"throws",
"MissingResourceException",
"{",
"String",
"result",
"=",
"getString",
"(",
"key",
")",
";",
"try",
"{",
"return",
"Integer",
".",
"parseInt",
"(",
"result",
")",
";",
"}",
"catch",
"(",
"NumberFormatException",
"nfe",
")",
"{",
"if",
"(",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"event",
"(",
"tc",
",",
"\"Unable to parse \"",
"+",
"result",
"+",
"\" as Integer.\"",
")",
";",
"}",
"// DGH20040823: Begin fix for defect 218797 - Source provided by Tom Musta",
"// String msg = messages.getString(\"NLS.integerParseError\",",
"// \"Unable to parse as integer.\");",
"String",
"msg",
"=",
"getMessages",
"(",
")",
".",
"getString",
"(",
"\"NLS.integerParseError\"",
",",
"\"Unable to parse as integer.\"",
")",
";",
"// DGH20040823: End fix for defect 218797 - Source provided by Tom Musta",
"throw",
"new",
"MissingResourceException",
"(",
"msg",
",",
"bundleName",
",",
"key",
")",
";",
"}",
"}"
] | Not sure why this is here. Looks like it is a replacement for
Integer.getInteger. | [
"Not",
"sure",
"why",
"this",
"is",
"here",
".",
"Looks",
"like",
"it",
"is",
"a",
"replacement",
"for",
"Integer",
".",
"getInteger",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/server/NLS.java#L408-L424 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/io/MPIO.java | MPIO.stop | public void stop()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "stop");
// Lock exclusively for start operations
mpioLockManager.lockExclusive();
started = false;
mpioLockManager.unlockExclusive();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "stop");
} | java | public void stop()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "stop");
// Lock exclusively for start operations
mpioLockManager.lockExclusive();
started = false;
mpioLockManager.unlockExclusive();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "stop");
} | [
"public",
"void",
"stop",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"stop\"",
")",
";",
"// Lock exclusively for start operations",
"mpioLockManager",
".",
"lockExclusive",
"(",
")",
";",
"started",
"=",
"false",
";",
"mpioLockManager",
".",
"unlockExclusive",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"stop\"",
")",
";",
"}"
] | Method to stop MPIO from processing any new messages.
This will take an exclusive lock on the lock manager and change
the started flag to false. | [
"Method",
"to",
"stop",
"MPIO",
"from",
"processing",
"any",
"new",
"messages",
".",
"This",
"will",
"take",
"an",
"exclusive",
"lock",
"on",
"the",
"lock",
"manager",
"and",
"change",
"the",
"started",
"flag",
"to",
"false",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/io/MPIO.java#L133-L145 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/io/MPIO.java | MPIO.receiveMessage | public void receiveMessage(MEConnection conn, AbstractMessage aMessage)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "receiveMessage", new Object[] {conn,
aMessage,
"verboseMsg IN : " + aMessage.toVerboseString()});
// Minimal comms trace of the message we've received
if (TraceComponent.isAnyTracingEnabled()) {
MECommsTrc.traceMessage(tc,
_messageProcessor,
aMessage.getGuaranteedSourceMessagingEngineUUID(),
MECommsTrc.OP_RECV,
conn,
aMessage);
}
// Take a read lock to ensure that we can't be stopped while processing a
// message
mpioLockManager.lock();
try
{
if (started)
{
//pass the message on to the RMR
_remoteMessageReciever.receiveMessage(aMessage);
}
else if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
SibTr.debug(tc, "Ignoring message as in stopped state");
}
}
catch(Throwable e)
{
// Anything going wrong in Processor (or below, e.g. MsgStore) shouldn't
// bring the ME-ME connection down. To get an exception through to here
// we must have gone wrong somewhere, i.e. an APAR-kind of event. But even
// so, that's no reason to knobble all ME-to-ME communication, so we swallow
// any exception here, after spitting out an FFDC.
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.io.MPIO.receiveMessage",
"1:228:1.32",
new Object[] {this, aMessage, conn, _messageProcessor.getMessagingEngineName()});
if (e instanceof Exception)
SibTr.exception(tc, (Exception)e);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Exception occurred when processing a message " + e);
// We're not allowed to swallow this exception - let it work its way back to
// Comms
if(e instanceof ThreadDeath)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "receiveMessage", e);
throw (ThreadDeath)e;
}
}
finally
{
mpioLockManager.unlock();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "receiveMessage");
} | java | public void receiveMessage(MEConnection conn, AbstractMessage aMessage)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "receiveMessage", new Object[] {conn,
aMessage,
"verboseMsg IN : " + aMessage.toVerboseString()});
// Minimal comms trace of the message we've received
if (TraceComponent.isAnyTracingEnabled()) {
MECommsTrc.traceMessage(tc,
_messageProcessor,
aMessage.getGuaranteedSourceMessagingEngineUUID(),
MECommsTrc.OP_RECV,
conn,
aMessage);
}
// Take a read lock to ensure that we can't be stopped while processing a
// message
mpioLockManager.lock();
try
{
if (started)
{
//pass the message on to the RMR
_remoteMessageReciever.receiveMessage(aMessage);
}
else if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
SibTr.debug(tc, "Ignoring message as in stopped state");
}
}
catch(Throwable e)
{
// Anything going wrong in Processor (or below, e.g. MsgStore) shouldn't
// bring the ME-ME connection down. To get an exception through to here
// we must have gone wrong somewhere, i.e. an APAR-kind of event. But even
// so, that's no reason to knobble all ME-to-ME communication, so we swallow
// any exception here, after spitting out an FFDC.
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.io.MPIO.receiveMessage",
"1:228:1.32",
new Object[] {this, aMessage, conn, _messageProcessor.getMessagingEngineName()});
if (e instanceof Exception)
SibTr.exception(tc, (Exception)e);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Exception occurred when processing a message " + e);
// We're not allowed to swallow this exception - let it work its way back to
// Comms
if(e instanceof ThreadDeath)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "receiveMessage", e);
throw (ThreadDeath)e;
}
}
finally
{
mpioLockManager.unlock();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "receiveMessage");
} | [
"public",
"void",
"receiveMessage",
"(",
"MEConnection",
"conn",
",",
"AbstractMessage",
"aMessage",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"receiveMessage\"",
",",
"new",
"Object",
"[",
"]",
"{",
"conn",
",",
"aMessage",
",",
"\"verboseMsg IN : \"",
"+",
"aMessage",
".",
"toVerboseString",
"(",
")",
"}",
")",
";",
"// Minimal comms trace of the message we've received",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
")",
"{",
"MECommsTrc",
".",
"traceMessage",
"(",
"tc",
",",
"_messageProcessor",
",",
"aMessage",
".",
"getGuaranteedSourceMessagingEngineUUID",
"(",
")",
",",
"MECommsTrc",
".",
"OP_RECV",
",",
"conn",
",",
"aMessage",
")",
";",
"}",
"// Take a read lock to ensure that we can't be stopped while processing a",
"// message",
"mpioLockManager",
".",
"lock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"started",
")",
"{",
"//pass the message on to the RMR",
"_remoteMessageReciever",
".",
"receiveMessage",
"(",
"aMessage",
")",
";",
"}",
"else",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"Ignoring message as in stopped state\"",
")",
";",
"}",
"}",
"catch",
"(",
"Throwable",
"e",
")",
"{",
"// Anything going wrong in Processor (or below, e.g. MsgStore) shouldn't",
"// bring the ME-ME connection down. To get an exception through to here",
"// we must have gone wrong somewhere, i.e. an APAR-kind of event. But even",
"// so, that's no reason to knobble all ME-to-ME communication, so we swallow",
"// any exception here, after spitting out an FFDC.",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"\"com.ibm.ws.sib.processor.io.MPIO.receiveMessage\"",
",",
"\"1:228:1.32\"",
",",
"new",
"Object",
"[",
"]",
"{",
"this",
",",
"aMessage",
",",
"conn",
",",
"_messageProcessor",
".",
"getMessagingEngineName",
"(",
")",
"}",
")",
";",
"if",
"(",
"e",
"instanceof",
"Exception",
")",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"(",
"Exception",
")",
"e",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"Exception occurred when processing a message \"",
"+",
"e",
")",
";",
"// We're not allowed to swallow this exception - let it work its way back to",
"// Comms",
"if",
"(",
"e",
"instanceof",
"ThreadDeath",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"receiveMessage\"",
",",
"e",
")",
";",
"throw",
"(",
"ThreadDeath",
")",
"e",
";",
"}",
"}",
"finally",
"{",
"mpioLockManager",
".",
"unlock",
"(",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"receiveMessage\"",
")",
";",
"}"
] | Receive a new Control message from an ME-ME connection.
@param conn The physical connection on which the message was received.
@param msg The ControlMessage received. | [
"Receive",
"a",
"new",
"Control",
"message",
"from",
"an",
"ME",
"-",
"ME",
"connection",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/io/MPIO.java#L153-L221 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/io/MPIO.java | MPIO.getOrCreateNewMPConnection | public MPConnection getOrCreateNewMPConnection(SIBUuid8 remoteUuid,
MEConnection conn)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getOrCreateNewMPConnection", new Object[] {remoteUuid, conn });
MPConnection mpConn;
synchronized(_mpConnectionsByMEConnection)
{
//look up the connection in the cache
mpConn = _mpConnectionsByMEConnection.get(conn);
//if it is not in the cache
if(mpConn == null)
{
//make sure we know the cellule
if(remoteUuid == null)
{
remoteUuid = new SIBUuid8(conn.getMessagingEngine().getUuid());
}
//create a new MPConnection for this MEConnection
mpConn = new MPConnection(this,conn,remoteUuid);
//put it in the cache
_mpConnectionsByMEConnection.put(conn, mpConn);
_mpConnectionsByMEUuid.put(remoteUuid, mpConn);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getOrCreateNewMPConnection", mpConn);
//return the MPConnection
return mpConn;
} | java | public MPConnection getOrCreateNewMPConnection(SIBUuid8 remoteUuid,
MEConnection conn)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getOrCreateNewMPConnection", new Object[] {remoteUuid, conn });
MPConnection mpConn;
synchronized(_mpConnectionsByMEConnection)
{
//look up the connection in the cache
mpConn = _mpConnectionsByMEConnection.get(conn);
//if it is not in the cache
if(mpConn == null)
{
//make sure we know the cellule
if(remoteUuid == null)
{
remoteUuid = new SIBUuid8(conn.getMessagingEngine().getUuid());
}
//create a new MPConnection for this MEConnection
mpConn = new MPConnection(this,conn,remoteUuid);
//put it in the cache
_mpConnectionsByMEConnection.put(conn, mpConn);
_mpConnectionsByMEUuid.put(remoteUuid, mpConn);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getOrCreateNewMPConnection", mpConn);
//return the MPConnection
return mpConn;
} | [
"public",
"MPConnection",
"getOrCreateNewMPConnection",
"(",
"SIBUuid8",
"remoteUuid",
",",
"MEConnection",
"conn",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"getOrCreateNewMPConnection\"",
",",
"new",
"Object",
"[",
"]",
"{",
"remoteUuid",
",",
"conn",
"}",
")",
";",
"MPConnection",
"mpConn",
";",
"synchronized",
"(",
"_mpConnectionsByMEConnection",
")",
"{",
"//look up the connection in the cache",
"mpConn",
"=",
"_mpConnectionsByMEConnection",
".",
"get",
"(",
"conn",
")",
";",
"//if it is not in the cache",
"if",
"(",
"mpConn",
"==",
"null",
")",
"{",
"//make sure we know the cellule",
"if",
"(",
"remoteUuid",
"==",
"null",
")",
"{",
"remoteUuid",
"=",
"new",
"SIBUuid8",
"(",
"conn",
".",
"getMessagingEngine",
"(",
")",
".",
"getUuid",
"(",
")",
")",
";",
"}",
"//create a new MPConnection for this MEConnection",
"mpConn",
"=",
"new",
"MPConnection",
"(",
"this",
",",
"conn",
",",
"remoteUuid",
")",
";",
"//put it in the cache",
"_mpConnectionsByMEConnection",
".",
"put",
"(",
"conn",
",",
"mpConn",
")",
";",
"_mpConnectionsByMEUuid",
".",
"put",
"(",
"remoteUuid",
",",
"mpConn",
")",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"getOrCreateNewMPConnection\"",
",",
"mpConn",
")",
";",
"//return the MPConnection",
"return",
"mpConn",
";",
"}"
] | Get a MPConnection from the cache and if there isn't one, create a new one and
put it in the cache.
@param cellule The cellule to find a MPConnection for (optional)
@param conn The MEConnection to find a MPConnection for
@return the MPConnection | [
"Get",
"a",
"MPConnection",
"from",
"the",
"cache",
"and",
"if",
"there",
"isn",
"t",
"one",
"create",
"a",
"new",
"one",
"and",
"put",
"it",
"in",
"the",
"cache",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/io/MPIO.java#L231-L264 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/io/MPIO.java | MPIO.removeConnection | public MPConnection removeConnection(MEConnection conn)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "removeConnection", new Object[] { conn });
MPConnection mpConn;
synchronized(_mpConnectionsByMEConnection)
{
//remove the MPConnection from the 'by MEConnection' cache
mpConn = _mpConnectionsByMEConnection.remove(conn);
if(mpConn != null)
{
//remove it from the 'by cellule' cache also
_mpConnectionsByMEUuid.remove(mpConn.getRemoteMEUuid());
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "removeConnection", mpConn);
return mpConn;
} | java | public MPConnection removeConnection(MEConnection conn)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "removeConnection", new Object[] { conn });
MPConnection mpConn;
synchronized(_mpConnectionsByMEConnection)
{
//remove the MPConnection from the 'by MEConnection' cache
mpConn = _mpConnectionsByMEConnection.remove(conn);
if(mpConn != null)
{
//remove it from the 'by cellule' cache also
_mpConnectionsByMEUuid.remove(mpConn.getRemoteMEUuid());
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "removeConnection", mpConn);
return mpConn;
} | [
"public",
"MPConnection",
"removeConnection",
"(",
"MEConnection",
"conn",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"removeConnection\"",
",",
"new",
"Object",
"[",
"]",
"{",
"conn",
"}",
")",
";",
"MPConnection",
"mpConn",
";",
"synchronized",
"(",
"_mpConnectionsByMEConnection",
")",
"{",
"//remove the MPConnection from the 'by MEConnection' cache",
"mpConn",
"=",
"_mpConnectionsByMEConnection",
".",
"remove",
"(",
"conn",
")",
";",
"if",
"(",
"mpConn",
"!=",
"null",
")",
"{",
"//remove it from the 'by cellule' cache also",
"_mpConnectionsByMEUuid",
".",
"remove",
"(",
"mpConn",
".",
"getRemoteMEUuid",
"(",
")",
")",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"removeConnection\"",
",",
"mpConn",
")",
";",
"return",
"mpConn",
";",
"}"
] | remove a MPConnection from the cache
@param conn The MEConnection of the MPConnection to be removed
@return The MPConnection which removed | [
"remove",
"a",
"MPConnection",
"from",
"the",
"cache"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/io/MPIO.java#L383-L404 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/io/MPIO.java | MPIO.error | public void error(MEConnection conn, Throwable ex)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "error", new Object[] { this, conn, ex});
// This one goes straight to the CEL
_commsErrorListener.error(conn, ex);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "error");
} | java | public void error(MEConnection conn, Throwable ex)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "error", new Object[] { this, conn, ex});
// This one goes straight to the CEL
_commsErrorListener.error(conn, ex);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "error");
} | [
"public",
"void",
"error",
"(",
"MEConnection",
"conn",
",",
"Throwable",
"ex",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"error\"",
",",
"new",
"Object",
"[",
"]",
"{",
"this",
",",
"conn",
",",
"ex",
"}",
")",
";",
"// This one goes straight to the CEL",
"_commsErrorListener",
".",
"error",
"(",
"conn",
",",
"ex",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"error\"",
")",
";",
"}"
] | Indicates an error has occurred on a connection.
@param conn The connection on which the error occurred.
@param ex The code indicating the type of error (TBD). | [
"Indicates",
"an",
"error",
"has",
"occurred",
"on",
"a",
"connection",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/io/MPIO.java#L412-L422 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/io/MPIO.java | MPIO.changeConnection | public void changeConnection(MEConnection downConn, MEConnection upConn)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "changeConnection", new Object[] { this, downConn, upConn} );
if(downConn != null)
{
//remove the connection which has gone down
removeConnection(downConn);
}
// The new connection will be created when needed
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "changeConnection");
} | java | public void changeConnection(MEConnection downConn, MEConnection upConn)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "changeConnection", new Object[] { this, downConn, upConn} );
if(downConn != null)
{
//remove the connection which has gone down
removeConnection(downConn);
}
// The new connection will be created when needed
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "changeConnection");
} | [
"public",
"void",
"changeConnection",
"(",
"MEConnection",
"downConn",
",",
"MEConnection",
"upConn",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"changeConnection\"",
",",
"new",
"Object",
"[",
"]",
"{",
"this",
",",
"downConn",
",",
"upConn",
"}",
")",
";",
"if",
"(",
"downConn",
"!=",
"null",
")",
"{",
"//remove the connection which has gone down",
"removeConnection",
"(",
"downConn",
")",
";",
"}",
"// The new connection will be created when needed",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"changeConnection\"",
")",
";",
"}"
] | Indiciates a failed connection, a newly created connection, or a
connection swap. If upConn is null, then connection "downConn"
has been removed from the system. If downConn is null, then
connection "upConn" has been added to the system. Otherwise,
"downConn" has been removed and replaced by "upConn".
@param downConn A connection which has been removed from the system,
or null.
@param upConn A connection which has been added to the system, or
null. | [
"Indiciates",
"a",
"failed",
"connection",
"a",
"newly",
"created",
"connection",
"or",
"a",
"connection",
"swap",
".",
"If",
"upConn",
"is",
"null",
"then",
"connection",
"downConn",
"has",
"been",
"removed",
"from",
"the",
"system",
".",
"If",
"downConn",
"is",
"null",
"then",
"connection",
"upConn",
"has",
"been",
"added",
"to",
"the",
"system",
".",
"Otherwise",
"downConn",
"has",
"been",
"removed",
"and",
"replaced",
"by",
"upConn",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/io/MPIO.java#L478-L493 | train |
Subsets and Splits