repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1 value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1 value |
|---|---|---|---|---|---|---|---|---|---|---|---|
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSMessageData.java | JSMessageData.ownership | private Object ownership(Object val, boolean forceShared) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
JmfTr.entry(this, tc, "ownership", new Object[] { val, Boolean.valueOf(forceShared) });
if (val instanceof JSMessageData) {
((JSMessageData) val).setParent(compatibilityWrapperOrSelf);
if (forceShared) {
((JSMessageData) val).sharedContents = true;
}
}
else if (val instanceof JMFEncapsulation) {
((JMFEncapsulation) val).setContainingMessageData(compatibilityWrapperOrSelf);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
JmfTr.exit(this, tc, "ownership", val);
return val;
} | java | private Object ownership(Object val, boolean forceShared) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
JmfTr.entry(this, tc, "ownership", new Object[] { val, Boolean.valueOf(forceShared) });
if (val instanceof JSMessageData) {
((JSMessageData) val).setParent(compatibilityWrapperOrSelf);
if (forceShared) {
((JSMessageData) val).sharedContents = true;
}
}
else if (val instanceof JMFEncapsulation) {
((JMFEncapsulation) val).setContainingMessageData(compatibilityWrapperOrSelf);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
JmfTr.exit(this, tc, "ownership", val);
return val;
} | [
"private",
"Object",
"ownership",
"(",
"Object",
"val",
",",
"boolean",
"forceShared",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"JmfTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"ownership\"",
",",
"new",
"Object",
"[",
"]",
"{",
"val",
",",
"Boolean",
".",
"valueOf",
"(",
"forceShared",
")",
"}",
")",
";",
"if",
"(",
"val",
"instanceof",
"JSMessageData",
")",
"{",
"(",
"(",
"JSMessageData",
")",
"val",
")",
".",
"setParent",
"(",
"compatibilityWrapperOrSelf",
")",
";",
"if",
"(",
"forceShared",
")",
"{",
"(",
"(",
"JSMessageData",
")",
"val",
")",
".",
"sharedContents",
"=",
"true",
";",
"}",
"}",
"else",
"if",
"(",
"val",
"instanceof",
"JMFEncapsulation",
")",
"{",
"(",
"(",
"JMFEncapsulation",
")",
"val",
")",
".",
"setContainingMessageData",
"(",
"compatibilityWrapperOrSelf",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"JmfTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"ownership\"",
",",
"val",
")",
";",
"return",
"val",
";",
"}"
] | this new instance, and it logically belongs in the locking scope of this.master. | [
"this",
"new",
"instance",
"and",
"it",
"logically",
"belongs",
"in",
"the",
"locking",
"scope",
"of",
"this",
".",
"master",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSMessageData.java#L418-L436 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSMessageData.java | JSMessageData.checkPrimitiveType | private void checkPrimitiveType(int accessor, int typeCode) throws JMFUninitializedAccessException, JMFSchemaViolationException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
JmfTr.entry(this, tc, "checkPrimitiveType", new Object[] { Integer.valueOf(accessor), Integer.valueOf(typeCode) });
JSField field = getFieldDef(accessor, true);
if (field == null) {
JMFUninitializedAccessException e = new JMFUninitializedAccessException("Value at accessor " + accessor + " should not be present");
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
JmfTr.exit(this, tc, "checkPrimitiveType", e);
throw e;
}
if (field instanceof JSPrimitive) {
if (((JSPrimitive) field).getTypeCode() != typeCode) {
JMFSchemaViolationException e = new JMFSchemaViolationException("Value at accessor " + accessor + " is incorrect type");
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
JmfTr.exit(this, tc, "checkPrimitiveType", e);
throw e;
}
else {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
JmfTr.exit(this, tc, "checkPrimitiveType");
return;
}
}
else if (field instanceof JSEnum && (typeCode == JMFPrimitiveType.INT)) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
JmfTr.exit(this, tc, "checkPrimitiveType");
return;
}
else {
JMFSchemaViolationException e = new JMFSchemaViolationException("Value at accessor " + accessor + " is incorrect");
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
JmfTr.exit(this, tc, "checkPrimitiveType", e);
throw e;
}
} | java | private void checkPrimitiveType(int accessor, int typeCode) throws JMFUninitializedAccessException, JMFSchemaViolationException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
JmfTr.entry(this, tc, "checkPrimitiveType", new Object[] { Integer.valueOf(accessor), Integer.valueOf(typeCode) });
JSField field = getFieldDef(accessor, true);
if (field == null) {
JMFUninitializedAccessException e = new JMFUninitializedAccessException("Value at accessor " + accessor + " should not be present");
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
JmfTr.exit(this, tc, "checkPrimitiveType", e);
throw e;
}
if (field instanceof JSPrimitive) {
if (((JSPrimitive) field).getTypeCode() != typeCode) {
JMFSchemaViolationException e = new JMFSchemaViolationException("Value at accessor " + accessor + " is incorrect type");
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
JmfTr.exit(this, tc, "checkPrimitiveType", e);
throw e;
}
else {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
JmfTr.exit(this, tc, "checkPrimitiveType");
return;
}
}
else if (field instanceof JSEnum && (typeCode == JMFPrimitiveType.INT)) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
JmfTr.exit(this, tc, "checkPrimitiveType");
return;
}
else {
JMFSchemaViolationException e = new JMFSchemaViolationException("Value at accessor " + accessor + " is incorrect");
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
JmfTr.exit(this, tc, "checkPrimitiveType", e);
throw e;
}
} | [
"private",
"void",
"checkPrimitiveType",
"(",
"int",
"accessor",
",",
"int",
"typeCode",
")",
"throws",
"JMFUninitializedAccessException",
",",
"JMFSchemaViolationException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"JmfTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"checkPrimitiveType\"",
",",
"new",
"Object",
"[",
"]",
"{",
"Integer",
".",
"valueOf",
"(",
"accessor",
")",
",",
"Integer",
".",
"valueOf",
"(",
"typeCode",
")",
"}",
")",
";",
"JSField",
"field",
"=",
"getFieldDef",
"(",
"accessor",
",",
"true",
")",
";",
"if",
"(",
"field",
"==",
"null",
")",
"{",
"JMFUninitializedAccessException",
"e",
"=",
"new",
"JMFUninitializedAccessException",
"(",
"\"Value at accessor \"",
"+",
"accessor",
"+",
"\" should not be present\"",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"JmfTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"checkPrimitiveType\"",
",",
"e",
")",
";",
"throw",
"e",
";",
"}",
"if",
"(",
"field",
"instanceof",
"JSPrimitive",
")",
"{",
"if",
"(",
"(",
"(",
"JSPrimitive",
")",
"field",
")",
".",
"getTypeCode",
"(",
")",
"!=",
"typeCode",
")",
"{",
"JMFSchemaViolationException",
"e",
"=",
"new",
"JMFSchemaViolationException",
"(",
"\"Value at accessor \"",
"+",
"accessor",
"+",
"\" is incorrect type\"",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"JmfTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"checkPrimitiveType\"",
",",
"e",
")",
";",
"throw",
"e",
";",
"}",
"else",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"JmfTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"checkPrimitiveType\"",
")",
";",
"return",
";",
"}",
"}",
"else",
"if",
"(",
"field",
"instanceof",
"JSEnum",
"&&",
"(",
"typeCode",
"==",
"JMFPrimitiveType",
".",
"INT",
")",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"JmfTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"checkPrimitiveType\"",
")",
";",
"return",
";",
"}",
"else",
"{",
"JMFSchemaViolationException",
"e",
"=",
"new",
"JMFSchemaViolationException",
"(",
"\"Value at accessor \"",
"+",
"accessor",
"+",
"\" is incorrect\"",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"JmfTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"checkPrimitiveType\"",
",",
"e",
")",
";",
"throw",
"e",
";",
"}",
"}"
] | already hold the lock. | [
"already",
"hold",
"the",
"lock",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSMessageData.java#L929-L966 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSMessageData.java | JSMessageData.lazyCopy | void lazyCopy(JSMessageData original) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
JmfTr.entry(this, tc, "lazyCopy", new Object[] { original });
synchronized (getMessageLockArtefact()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
JmfTr.debug(this, tc, "lazyCopy locked dest ", new Object[] { getMessageLockArtefact() });
// This is the only occasion that we reach out and lock another message instance
// but we work on the assumption that lazy copying is happening as part of
// instantiation of a new message instance, so the potential for deadlocking
// is nil, since no other thread knows about this instance and can not therefore
// be concurrently supplying 'this' as the 'original' argument in another thread.
synchronized (original.getMessageLockArtefact()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
JmfTr.debug(this, tc, "lazyCopy locked source ", new Object[] { original.getMessageLockArtefact() });
// Copy common fields
indirect = original.indirect;
// If the message is assembled (i.e. we have a contents buffer) we share both the
// buffer and the cache between original and copy.
// If the message is unassembled (no contents buffer) we just share the cache.
// In either case if a change later needs to be made to the shared portion we
// will need to copy it before changing, so the shared flags is set to
// indicate sharing exists between unrelated parts.
if (original.contents == null) {
contents = null;
original.sharedCache = true;
sharedCache = true;
cache = original.cache;
}
else {
original.sharedContents = true;
sharedContents = true;
contents = original.contents;
original.sharedCache = true;
sharedCache = true;
cache = original.cache;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
JmfTr.debug(this, tc, "lazyCopy unlocking source ", new Object[] { original.getMessageLockArtefact() });
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
JmfTr.debug(this, tc, "lazyCopy unlocking dest ", new Object[] { getMessageLockArtefact() });
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
JmfTr.exit(this, tc, "lazyCopy");
} | java | void lazyCopy(JSMessageData original) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
JmfTr.entry(this, tc, "lazyCopy", new Object[] { original });
synchronized (getMessageLockArtefact()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
JmfTr.debug(this, tc, "lazyCopy locked dest ", new Object[] { getMessageLockArtefact() });
// This is the only occasion that we reach out and lock another message instance
// but we work on the assumption that lazy copying is happening as part of
// instantiation of a new message instance, so the potential for deadlocking
// is nil, since no other thread knows about this instance and can not therefore
// be concurrently supplying 'this' as the 'original' argument in another thread.
synchronized (original.getMessageLockArtefact()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
JmfTr.debug(this, tc, "lazyCopy locked source ", new Object[] { original.getMessageLockArtefact() });
// Copy common fields
indirect = original.indirect;
// If the message is assembled (i.e. we have a contents buffer) we share both the
// buffer and the cache between original and copy.
// If the message is unassembled (no contents buffer) we just share the cache.
// In either case if a change later needs to be made to the shared portion we
// will need to copy it before changing, so the shared flags is set to
// indicate sharing exists between unrelated parts.
if (original.contents == null) {
contents = null;
original.sharedCache = true;
sharedCache = true;
cache = original.cache;
}
else {
original.sharedContents = true;
sharedContents = true;
contents = original.contents;
original.sharedCache = true;
sharedCache = true;
cache = original.cache;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
JmfTr.debug(this, tc, "lazyCopy unlocking source ", new Object[] { original.getMessageLockArtefact() });
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
JmfTr.debug(this, tc, "lazyCopy unlocking dest ", new Object[] { getMessageLockArtefact() });
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
JmfTr.exit(this, tc, "lazyCopy");
} | [
"void",
"lazyCopy",
"(",
"JSMessageData",
"original",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"JmfTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"lazyCopy\"",
",",
"new",
"Object",
"[",
"]",
"{",
"original",
"}",
")",
";",
"synchronized",
"(",
"getMessageLockArtefact",
"(",
")",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"JmfTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"lazyCopy locked dest \"",
",",
"new",
"Object",
"[",
"]",
"{",
"getMessageLockArtefact",
"(",
")",
"}",
")",
";",
"// This is the only occasion that we reach out and lock another message instance",
"// but we work on the assumption that lazy copying is happening as part of",
"// instantiation of a new message instance, so the potential for deadlocking",
"// is nil, since no other thread knows about this instance and can not therefore",
"// be concurrently supplying 'this' as the 'original' argument in another thread.",
"synchronized",
"(",
"original",
".",
"getMessageLockArtefact",
"(",
")",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"JmfTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"lazyCopy locked source \"",
",",
"new",
"Object",
"[",
"]",
"{",
"original",
".",
"getMessageLockArtefact",
"(",
")",
"}",
")",
";",
"// Copy common fields",
"indirect",
"=",
"original",
".",
"indirect",
";",
"// If the message is assembled (i.e. we have a contents buffer) we share both the",
"// buffer and the cache between original and copy.",
"// If the message is unassembled (no contents buffer) we just share the cache.",
"// In either case if a change later needs to be made to the shared portion we",
"// will need to copy it before changing, so the shared flags is set to",
"// indicate sharing exists between unrelated parts.",
"if",
"(",
"original",
".",
"contents",
"==",
"null",
")",
"{",
"contents",
"=",
"null",
";",
"original",
".",
"sharedCache",
"=",
"true",
";",
"sharedCache",
"=",
"true",
";",
"cache",
"=",
"original",
".",
"cache",
";",
"}",
"else",
"{",
"original",
".",
"sharedContents",
"=",
"true",
";",
"sharedContents",
"=",
"true",
";",
"contents",
"=",
"original",
".",
"contents",
";",
"original",
".",
"sharedCache",
"=",
"true",
";",
"sharedCache",
"=",
"true",
";",
"cache",
"=",
"original",
".",
"cache",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"JmfTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"lazyCopy unlocking source \"",
",",
"new",
"Object",
"[",
"]",
"{",
"original",
".",
"getMessageLockArtefact",
"(",
")",
"}",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"JmfTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"lazyCopy unlocking dest \"",
",",
"new",
"Object",
"[",
"]",
"{",
"getMessageLockArtefact",
"(",
")",
"}",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"JmfTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"lazyCopy\"",
")",
";",
"}"
] | setting up the sharing state. | [
"setting",
"up",
"the",
"sharing",
"state",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSMessageData.java#L1264-L1315 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.config.1.1/src/com/ibm/ws/microprofile/config/archaius/composite/CompositeConfig.java | CompositeConfig.getKeySet | public Set<String> getKeySet() {
HashSet<String> result = new HashSet<>();
for (PollingDynamicConfig config : children) {
Iterator<String> iter = config.getKeys();
while (iter.hasNext()) {
String key = iter.next();
result.add(key);
}
}
return result;
} | java | public Set<String> getKeySet() {
HashSet<String> result = new HashSet<>();
for (PollingDynamicConfig config : children) {
Iterator<String> iter = config.getKeys();
while (iter.hasNext()) {
String key = iter.next();
result.add(key);
}
}
return result;
} | [
"public",
"Set",
"<",
"String",
">",
"getKeySet",
"(",
")",
"{",
"HashSet",
"<",
"String",
">",
"result",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"for",
"(",
"PollingDynamicConfig",
"config",
":",
"children",
")",
"{",
"Iterator",
"<",
"String",
">",
"iter",
"=",
"config",
".",
"getKeys",
"(",
")",
";",
"while",
"(",
"iter",
".",
"hasNext",
"(",
")",
")",
"{",
"String",
"key",
"=",
"iter",
".",
"next",
"(",
")",
";",
"result",
".",
"add",
"(",
"key",
")",
";",
"}",
"}",
"return",
"result",
";",
"}"
] | Return a set of all unique keys tracked by any child of this composite.
This can be an expensive operations as it requires iterating through all of
the children.
TODO: Cache keys | [
"Return",
"a",
"set",
"of",
"all",
"unique",
"keys",
"tracked",
"by",
"any",
"child",
"of",
"this",
"composite",
".",
"This",
"can",
"be",
"an",
"expensive",
"operations",
"as",
"it",
"requires",
"iterating",
"through",
"all",
"of",
"the",
"children",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.config.1.1/src/com/ibm/ws/microprofile/config/archaius/composite/CompositeConfig.java#L122-L134 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/transactions/impl/MSDelegatingXAResource.java | MSDelegatingXAResource.isAutoCommit | public final boolean isAutoCommit()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(this, tc, "isAutoCommit");
SibTr.exit(this, tc, "isAutoCommit", "return=false");
}
return false;
} | java | public final boolean isAutoCommit()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(this, tc, "isAutoCommit");
SibTr.exit(this, tc, "isAutoCommit", "return=false");
}
return false;
} | [
"public",
"final",
"boolean",
"isAutoCommit",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"isAutoCommit\"",
")",
";",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"isAutoCommit\"",
",",
"\"return=false\"",
")",
";",
"}",
"return",
"false",
";",
"}"
] | We don't need to delegate this method as
we know the answer! | [
"We",
"don",
"t",
"need",
"to",
"delegate",
"this",
"method",
"as",
"we",
"know",
"the",
"answer!"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/transactions/impl/MSDelegatingXAResource.java#L150-L158 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/transactions/impl/MSDelegatingXAResource.java | MSDelegatingXAResource.incrementCurrentSize | public void incrementCurrentSize() throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "incrementCurrentSize");
if (_currentTran != null)
{
_currentTran.incrementCurrentSize();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "incrementCurrentSize");
} | java | public void incrementCurrentSize() throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "incrementCurrentSize");
if (_currentTran != null)
{
_currentTran.incrementCurrentSize();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "incrementCurrentSize");
} | [
"public",
"void",
"incrementCurrentSize",
"(",
")",
"throws",
"SIResourceException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"incrementCurrentSize\"",
")",
";",
"if",
"(",
"_currentTran",
"!=",
"null",
")",
"{",
"_currentTran",
".",
"incrementCurrentSize",
"(",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"incrementCurrentSize\"",
")",
";",
"}"
] | Feature 199334.1 | [
"Feature",
"199334",
".",
"1"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/transactions/impl/MSDelegatingXAResource.java#L191-L201 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/transactions/impl/MSDelegatingXAResource.java | MSDelegatingXAResource.isAlive | public boolean isAlive()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "isAlive");
boolean retval = false;
if (_currentTran != null)
{
retval = _currentTran.isAlive();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "isAlive", "return="+retval);
return retval;
} | java | public boolean isAlive()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "isAlive");
boolean retval = false;
if (_currentTran != null)
{
retval = _currentTran.isAlive();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "isAlive", "return="+retval);
return retval;
} | [
"public",
"boolean",
"isAlive",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"isAlive\"",
")",
";",
"boolean",
"retval",
"=",
"false",
";",
"if",
"(",
"_currentTran",
"!=",
"null",
")",
"{",
"retval",
"=",
"_currentTran",
".",
"isAlive",
"(",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"isAlive\"",
",",
"\"return=\"",
"+",
"retval",
")",
";",
"return",
"retval",
";",
"}"
] | Defect 186657.4 | [
"Defect",
"186657",
".",
"4"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/transactions/impl/MSDelegatingXAResource.java#L204-L217 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/transactions/impl/MSDelegatingXAResource.java | MSDelegatingXAResource.end | public void end(Xid xid, int flags) throws XAException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "end", new Object[]{"XID="+xid, _manager.xaFlagsToString(flags)});
try
{
_manager.end(new PersistentTranId(xid), flags);
// Reset our instance variables.
_currentTran = null;
_currentPtid = null;
}
catch (XidUnknownException xue)
{
com.ibm.ws.ffdc.FFDCFilter.processException(xue, "com.ibm.ws.sib.msgstore.transactions.MSDelegatingXAResource.end", "1:375:1.51.1.7", this);
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.event(this, tc, "Cannot dis-associate from this Xid. It is unknown!", xue);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "end");
XAException xaException = new XAException(XAException.XAER_NOTA);
xaException.initCause(xue);
throw xaException;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "end");
} | java | public void end(Xid xid, int flags) throws XAException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "end", new Object[]{"XID="+xid, _manager.xaFlagsToString(flags)});
try
{
_manager.end(new PersistentTranId(xid), flags);
// Reset our instance variables.
_currentTran = null;
_currentPtid = null;
}
catch (XidUnknownException xue)
{
com.ibm.ws.ffdc.FFDCFilter.processException(xue, "com.ibm.ws.sib.msgstore.transactions.MSDelegatingXAResource.end", "1:375:1.51.1.7", this);
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.event(this, tc, "Cannot dis-associate from this Xid. It is unknown!", xue);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "end");
XAException xaException = new XAException(XAException.XAER_NOTA);
xaException.initCause(xue);
throw xaException;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "end");
} | [
"public",
"void",
"end",
"(",
"Xid",
"xid",
",",
"int",
"flags",
")",
"throws",
"XAException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"end\"",
",",
"new",
"Object",
"[",
"]",
"{",
"\"XID=\"",
"+",
"xid",
",",
"_manager",
".",
"xaFlagsToString",
"(",
"flags",
")",
"}",
")",
";",
"try",
"{",
"_manager",
".",
"end",
"(",
"new",
"PersistentTranId",
"(",
"xid",
")",
",",
"flags",
")",
";",
"// Reset our instance variables.",
"_currentTran",
"=",
"null",
";",
"_currentPtid",
"=",
"null",
";",
"}",
"catch",
"(",
"XidUnknownException",
"xue",
")",
"{",
"com",
".",
"ibm",
".",
"ws",
".",
"ffdc",
".",
"FFDCFilter",
".",
"processException",
"(",
"xue",
",",
"\"com.ibm.ws.sib.msgstore.transactions.MSDelegatingXAResource.end\"",
",",
"\"1:375:1.51.1.7\"",
",",
"this",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"SibTr",
".",
"event",
"(",
"this",
",",
"tc",
",",
"\"Cannot dis-associate from this Xid. It is unknown!\"",
",",
"xue",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"end\"",
")",
";",
"XAException",
"xaException",
"=",
"new",
"XAException",
"(",
"XAException",
".",
"XAER_NOTA",
")",
";",
"xaException",
".",
"initCause",
"(",
"xue",
")",
";",
"throw",
"xaException",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"end\"",
")",
";",
"}"
] | Ends the association that this resource has with the passed transaction
branch. Either temporarily via a TMSUSPEND or permanently via TMSUCCESS or
TMFAIL.
@param xid The identifier of the global transaction to dis-associate from. This must
match a value previously passed on a call to start.
@param flags Completion flag
<BR>TMSUCCESS - Transaction completed successfully.
<BR>TMFAIL - Transaction completed unsuccessfully.
<BR>TMSUSPEND - Suspend a previously begun Transaction.
@exception XAException
Thrown if the XID is unknown or if this XAResource is
nor currently associated with an XID. | [
"Ends",
"the",
"association",
"that",
"this",
"resource",
"has",
"with",
"the",
"passed",
"transaction",
"branch",
".",
"Either",
"temporarily",
"via",
"a",
"TMSUSPEND",
"or",
"permanently",
"via",
"TMSUCCESS",
"or",
"TMFAIL",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/transactions/impl/MSDelegatingXAResource.java#L315-L338 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/transactions/impl/MSDelegatingXAResource.java | MSDelegatingXAResource.recover | public Xid[] recover(int recoveryId) throws XAException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "recover", "Recovery ID="+recoveryId);
Xid[] list = _manager.recover();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "recover", "return="+Arrays.toString(list));
return list;
} | java | public Xid[] recover(int recoveryId) throws XAException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "recover", "Recovery ID="+recoveryId);
Xid[] list = _manager.recover();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "recover", "return="+Arrays.toString(list));
return list;
} | [
"public",
"Xid",
"[",
"]",
"recover",
"(",
"int",
"recoveryId",
")",
"throws",
"XAException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"recover\"",
",",
"\"Recovery ID=\"",
"+",
"recoveryId",
")",
";",
"Xid",
"[",
"]",
"list",
"=",
"_manager",
".",
"recover",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"recover\"",
",",
"\"return=\"",
"+",
"Arrays",
".",
"toString",
"(",
"list",
")",
")",
";",
"return",
"list",
";",
"}"
] | Used at transaction recovery time to retrieve the list on indoubt XIDs known
to the MessageStore instance associated with this MSDelegatingXAResource.
@param recoveryId The recovery id of the RM to return indoubt XIDs from
@return The list of indoubt XIDs currently known by the MessageStore associated with this XAResource
@exception XAException
Thrown if an unexpected error occurs. | [
"Used",
"at",
"transaction",
"recovery",
"time",
"to",
"retrieve",
"the",
"list",
"on",
"indoubt",
"XIDs",
"known",
"to",
"the",
"MessageStore",
"instance",
"associated",
"with",
"this",
"MSDelegatingXAResource",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/transactions/impl/MSDelegatingXAResource.java#L625-L633 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/transport/iiop/asn1/util/ASN1Dump.java | ASN1Dump.dumpAsString | public static String dumpAsString(
Object obj)
{
if (obj instanceof DERObject)
{
return _dumpAsString("", (DERObject) obj);
}
else if (obj instanceof DEREncodable)
{
return _dumpAsString("", ((DEREncodable) obj).getDERObject());
}
return "unknown object type " + obj.toString();
} | java | public static String dumpAsString(
Object obj)
{
if (obj instanceof DERObject)
{
return _dumpAsString("", (DERObject) obj);
}
else if (obj instanceof DEREncodable)
{
return _dumpAsString("", ((DEREncodable) obj).getDERObject());
}
return "unknown object type " + obj.toString();
} | [
"public",
"static",
"String",
"dumpAsString",
"(",
"Object",
"obj",
")",
"{",
"if",
"(",
"obj",
"instanceof",
"DERObject",
")",
"{",
"return",
"_dumpAsString",
"(",
"\"\"",
",",
"(",
"DERObject",
")",
"obj",
")",
";",
"}",
"else",
"if",
"(",
"obj",
"instanceof",
"DEREncodable",
")",
"{",
"return",
"_dumpAsString",
"(",
"\"\"",
",",
"(",
"(",
"DEREncodable",
")",
"obj",
")",
".",
"getDERObject",
"(",
")",
")",
";",
"}",
"return",
"\"unknown object type \"",
"+",
"obj",
".",
"toString",
"(",
")",
";",
"}"
] | dump out a DER object as a formatted string
@param obj the DERObject to be dumped out. | [
"dump",
"out",
"a",
"DER",
"object",
"as",
"a",
"formatted",
"string"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/transport/iiop/asn1/util/ASN1Dump.java#L322-L335 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.mp.jwt_fat/fat/src/com/ibm/ws/security/mp/jwt/fat/utils/MpJwtAppSetupUtils.java | MpJwtAppSetupUtils.deployMicroProfileLoginConfigFormLoginInWebXmlBasicInApp | public void deployMicroProfileLoginConfigFormLoginInWebXmlBasicInApp(LibertyServer server) throws Exception {
List<String> classList = createAppClassListBuildAppNames("CommonMicroProfileMarker_FormLoginInWeb_BasicInApp", "MicroProfileLoginConfigFormLoginInWebXmlBasicInApp");
ShrinkHelper.exportAppToServer(server, genericCreateArchiveWithJsps(MpJwtFatConstants.LOGINCONFIG_FORM_LOGIN_IN_WEB_XML_SERVLET_BASIC_IN_APP_ROOT_CONTEXT, classList));
server.addInstalledAppForValidation(MpJwtFatConstants.LOGINCONFIG_FORM_LOGIN_IN_WEB_XML_SERVLET_BASIC_IN_APP_ROOT_CONTEXT);
} | java | public void deployMicroProfileLoginConfigFormLoginInWebXmlBasicInApp(LibertyServer server) throws Exception {
List<String> classList = createAppClassListBuildAppNames("CommonMicroProfileMarker_FormLoginInWeb_BasicInApp", "MicroProfileLoginConfigFormLoginInWebXmlBasicInApp");
ShrinkHelper.exportAppToServer(server, genericCreateArchiveWithJsps(MpJwtFatConstants.LOGINCONFIG_FORM_LOGIN_IN_WEB_XML_SERVLET_BASIC_IN_APP_ROOT_CONTEXT, classList));
server.addInstalledAppForValidation(MpJwtFatConstants.LOGINCONFIG_FORM_LOGIN_IN_WEB_XML_SERVLET_BASIC_IN_APP_ROOT_CONTEXT);
} | [
"public",
"void",
"deployMicroProfileLoginConfigFormLoginInWebXmlBasicInApp",
"(",
"LibertyServer",
"server",
")",
"throws",
"Exception",
"{",
"List",
"<",
"String",
">",
"classList",
"=",
"createAppClassListBuildAppNames",
"(",
"\"CommonMicroProfileMarker_FormLoginInWeb_BasicInApp\"",
",",
"\"MicroProfileLoginConfigFormLoginInWebXmlBasicInApp\"",
")",
";",
"ShrinkHelper",
".",
"exportAppToServer",
"(",
"server",
",",
"genericCreateArchiveWithJsps",
"(",
"MpJwtFatConstants",
".",
"LOGINCONFIG_FORM_LOGIN_IN_WEB_XML_SERVLET_BASIC_IN_APP_ROOT_CONTEXT",
",",
"classList",
")",
")",
";",
"server",
".",
"addInstalledAppForValidation",
"(",
"MpJwtFatConstants",
".",
"LOGINCONFIG_FORM_LOGIN_IN_WEB_XML_SERVLET_BASIC_IN_APP_ROOT_CONTEXT",
")",
";",
"}"
] | create app with loginConfig set to Form Login in WEB.xml, and Basic in the App
@param server
@throws Exception | [
"create",
"app",
"with",
"loginConfig",
"set",
"to",
"Form",
"Login",
"in",
"WEB",
".",
"xml",
"and",
"Basic",
"in",
"the",
"App"
] | 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/utils/MpJwtAppSetupUtils.java#L75-L79 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.mp.jwt_fat/fat/src/com/ibm/ws/security/mp/jwt/fat/utils/MpJwtAppSetupUtils.java | MpJwtAppSetupUtils.genericCreateArchiveWithPems | protected WebArchive genericCreateArchiveWithPems(String sourceWarName, String baseWarName, List<String> classList) throws Exception {
try {
String warName = baseWarName + ".war";
WebArchive newWar = ShrinkWrap.create(WebArchive.class, warName);
addDefaultFileAssetsForAppsToWar(sourceWarName, newWar);
addPemFilesForAppsToWar(warName, newWar);
for (String theClass : classList) {
newWar.addClass(theClass);
}
return newWar;
} catch (Exception e) {
Log.error(thisClass, "genericCreateArchive", e);
throw e;
}
} | java | protected WebArchive genericCreateArchiveWithPems(String sourceWarName, String baseWarName, List<String> classList) throws Exception {
try {
String warName = baseWarName + ".war";
WebArchive newWar = ShrinkWrap.create(WebArchive.class, warName);
addDefaultFileAssetsForAppsToWar(sourceWarName, newWar);
addPemFilesForAppsToWar(warName, newWar);
for (String theClass : classList) {
newWar.addClass(theClass);
}
return newWar;
} catch (Exception e) {
Log.error(thisClass, "genericCreateArchive", e);
throw e;
}
} | [
"protected",
"WebArchive",
"genericCreateArchiveWithPems",
"(",
"String",
"sourceWarName",
",",
"String",
"baseWarName",
",",
"List",
"<",
"String",
">",
"classList",
")",
"throws",
"Exception",
"{",
"try",
"{",
"String",
"warName",
"=",
"baseWarName",
"+",
"\".war\"",
";",
"WebArchive",
"newWar",
"=",
"ShrinkWrap",
".",
"create",
"(",
"WebArchive",
".",
"class",
",",
"warName",
")",
";",
"addDefaultFileAssetsForAppsToWar",
"(",
"sourceWarName",
",",
"newWar",
")",
";",
"addPemFilesForAppsToWar",
"(",
"warName",
",",
"newWar",
")",
";",
"for",
"(",
"String",
"theClass",
":",
"classList",
")",
"{",
"newWar",
".",
"addClass",
"(",
"theClass",
")",
";",
"}",
"return",
"newWar",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"Log",
".",
"error",
"(",
"thisClass",
",",
"\"genericCreateArchive\"",
",",
"e",
")",
";",
"throw",
"e",
";",
"}",
"}"
] | Create a test war using files from the source war and the classList. Add a default list of pem files
@param sourceWarName - the source war to get xml files from
@param baseWarName - the base name of the war file to create
@param classList - the list of classes to add to the war
@return - return a war built from the specified built class files, xml's and pem files
@throws Exception | [
"Create",
"a",
"test",
"war",
"using",
"files",
"from",
"the",
"source",
"war",
"and",
"the",
"classList",
".",
"Add",
"a",
"default",
"list",
"of",
"pem",
"files"
] | 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/utils/MpJwtAppSetupUtils.java#L176-L190 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.mp.jwt_fat/fat/src/com/ibm/ws/security/mp/jwt/fat/utils/MpJwtAppSetupUtils.java | MpJwtAppSetupUtils.genericCreateArchiveWithPemsAndMPConfig | protected WebArchive genericCreateArchiveWithPemsAndMPConfig(String sourceWarName, String baseWarName, List<String> classList, String mpConfig,
String fileContent) throws Exception {
try {
WebArchive newWar = genericCreateArchiveWithPems(sourceWarName, baseWarName, classList);
newWar.add(new StringAsset(fileContent), mpConfig);
return newWar;
} catch (Exception e) {
Log.error(thisClass, "genericCreateArchive", e);
throw e;
}
} | java | protected WebArchive genericCreateArchiveWithPemsAndMPConfig(String sourceWarName, String baseWarName, List<String> classList, String mpConfig,
String fileContent) throws Exception {
try {
WebArchive newWar = genericCreateArchiveWithPems(sourceWarName, baseWarName, classList);
newWar.add(new StringAsset(fileContent), mpConfig);
return newWar;
} catch (Exception e) {
Log.error(thisClass, "genericCreateArchive", e);
throw e;
}
} | [
"protected",
"WebArchive",
"genericCreateArchiveWithPemsAndMPConfig",
"(",
"String",
"sourceWarName",
",",
"String",
"baseWarName",
",",
"List",
"<",
"String",
">",
"classList",
",",
"String",
"mpConfig",
",",
"String",
"fileContent",
")",
"throws",
"Exception",
"{",
"try",
"{",
"WebArchive",
"newWar",
"=",
"genericCreateArchiveWithPems",
"(",
"sourceWarName",
",",
"baseWarName",
",",
"classList",
")",
";",
"newWar",
".",
"add",
"(",
"new",
"StringAsset",
"(",
"fileContent",
")",
",",
"mpConfig",
")",
";",
"return",
"newWar",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"Log",
".",
"error",
"(",
"thisClass",
",",
"\"genericCreateArchive\"",
",",
"e",
")",
";",
"throw",
"e",
";",
"}",
"}"
] | Create a test war using files from the source war and the classList. Add a default list of pem files.
Also add a microprofile-config.properties file with the content passed to this method
@param sourceWarName - the source war to get xml files from
@param baseWarName - the base name of the war file to create
@param classList - the list of classes to add to the war
@param mpConfig - the path the the microprofile-config.properties file
@param fileContent - the content of the microprofile-config.properties file
@return - return a war built from the specified built class files, xml's and pem files
@throws Exception | [
"Create",
"a",
"test",
"war",
"using",
"files",
"from",
"the",
"source",
"war",
"and",
"the",
"classList",
".",
"Add",
"a",
"default",
"list",
"of",
"pem",
"files",
".",
"Also",
"add",
"a",
"microprofile",
"-",
"config",
".",
"properties",
"file",
"with",
"the",
"content",
"passed",
"to",
"this",
"method"
] | 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/utils/MpJwtAppSetupUtils.java#L204-L214 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.mp.jwt_fat/fat/src/com/ibm/ws/security/mp/jwt/fat/utils/MpJwtAppSetupUtils.java | MpJwtAppSetupUtils.createAppClassListBuildAppNames | public List<String> createAppClassListBuildAppNames(String app1, String app2, String app3) throws Exception {
List<String> classList = createAppClassListBuildAppNames(app1, app2);
classList.add("com.ibm.ws.jaxrs.fat.microProfileApp." + app2 + ".MicroProfileApp" + app3);
return classList;
} | java | public List<String> createAppClassListBuildAppNames(String app1, String app2, String app3) throws Exception {
List<String> classList = createAppClassListBuildAppNames(app1, app2);
classList.add("com.ibm.ws.jaxrs.fat.microProfileApp." + app2 + ".MicroProfileApp" + app3);
return classList;
} | [
"public",
"List",
"<",
"String",
">",
"createAppClassListBuildAppNames",
"(",
"String",
"app1",
",",
"String",
"app2",
",",
"String",
"app3",
")",
"throws",
"Exception",
"{",
"List",
"<",
"String",
">",
"classList",
"=",
"createAppClassListBuildAppNames",
"(",
"app1",
",",
"app2",
")",
";",
"classList",
".",
"add",
"(",
"\"com.ibm.ws.jaxrs.fat.microProfileApp.\"",
"+",
"app2",
"+",
"\".MicroProfileApp\"",
"+",
"app3",
")",
";",
"return",
"classList",
";",
"}"
] | All of the test apps following the same naming convention. We can build the class names
@param app1 - test app 1
@param app2 - test app 2
@param app3 - test app 3 if it exists
@return
@throws Exception | [
"All",
"of",
"the",
"test",
"apps",
"following",
"the",
"same",
"naming",
"convention",
".",
"We",
"can",
"build",
"the",
"class",
"names"
] | 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/utils/MpJwtAppSetupUtils.java#L294-L300 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer/src/com/ibm/websphere/servlet/response/StoredResponse.java | StoredResponse.getOutputBufferAsString | public String getOutputBufferAsString() throws IOException
{
byte[] buffer = getOutputBuffer();
if (buffer != null)
return new String(buffer, this.getCharacterEncoding());
else
return null;
} | java | public String getOutputBufferAsString() throws IOException
{
byte[] buffer = getOutputBuffer();
if (buffer != null)
return new String(buffer, this.getCharacterEncoding());
else
return null;
} | [
"public",
"String",
"getOutputBufferAsString",
"(",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"buffer",
"=",
"getOutputBuffer",
"(",
")",
";",
"if",
"(",
"buffer",
"!=",
"null",
")",
"return",
"new",
"String",
"(",
"buffer",
",",
"this",
".",
"getCharacterEncoding",
"(",
")",
")",
";",
"else",
"return",
"null",
";",
"}"
] | Get the output from the response outputstream as a String.
This method should only be used to retrieve content that is known
to be text based. Using this method to retrieve binary data will
corrupt the response data. | [
"Get",
"the",
"output",
"from",
"the",
"response",
"outputstream",
"as",
"a",
"String",
".",
"This",
"method",
"should",
"only",
"be",
"used",
"to",
"retrieve",
"content",
"that",
"is",
"known",
"to",
"be",
"text",
"based",
".",
"Using",
"this",
"method",
"to",
"retrieve",
"binary",
"data",
"will",
"corrupt",
"the",
"response",
"data",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/websphere/servlet/response/StoredResponse.java#L727-L734 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer/src/com/ibm/websphere/servlet/response/StoredResponse.java | StoredResponse.transferResponse | public void transferResponse(HttpServletResponse target) throws IOException // never
// called
// for
// ARD.
// would
// be
// in
// trouble
// with
// a
// bunch
// of
// include
// warnings
{
_finish();
if (containsError())
{
// transfer error
String message = getErrorMessage();
int sc = getErrorStatusCode();
if (message == null)
{
target.sendError(sc);
}
else
{
target.sendError(sc, message);
}
}
else if (isRedirected())
{
// transfer cookies
Cookie[] cookies = getCookies();
for (int i = 0; i < cookies.length; i++)
{
target.addCookie(cookies[i]);
}
// transfer redirect
target.sendRedirect(getRedirectURI());
}
else
{
// transfer status code
if (getStatusMessage() == null)
{
target.setStatus(getStatusCode());
}
else
{
target.setStatus(getStatusCode(), getStatusMessage());
}
// transfer headers
_header.transferHeader(target);
// transfer cookies
Cookie[] cookies = getCookies();
for (int i = 0; i < cookies.length; i++)
{
target.addCookie(cookies[i]);
}
if (this.getOutputBuffer() != null)
{ // PM17019
// transfer data
ServletOutputStream out;
try
{
out = target.getOutputStream();
}
catch (IllegalStateException i)
{
while (!(target instanceof StoredResponse))
{
while (target instanceof HttpServletResponseWrapper)
{
target = ((HttpServletResponse) ((HttpServletResponseWrapper) target).getResponse());
}
while (target instanceof HttpServletResponseProxy)
{
target = ((HttpServletResponse) ((HttpServletResponseProxy) target).getProxiedHttpServletResponse());
}
while (target instanceof IncludedResponse)
{
target = ((IncludedResponse) target).getProxiedHttpServletResponse();
}
// PQ88880 begin
if (target instanceof SRTServletResponse)
{
target.getWriter().write(this.getOutputBufferAsString().toCharArray());
return;
}
// PQ88880 end
}
StoredResponse s = (StoredResponse) target;
out = s._outInternal;
}
out.write(this.getOutputBuffer());
}
}
} | java | public void transferResponse(HttpServletResponse target) throws IOException // never
// called
// for
// ARD.
// would
// be
// in
// trouble
// with
// a
// bunch
// of
// include
// warnings
{
_finish();
if (containsError())
{
// transfer error
String message = getErrorMessage();
int sc = getErrorStatusCode();
if (message == null)
{
target.sendError(sc);
}
else
{
target.sendError(sc, message);
}
}
else if (isRedirected())
{
// transfer cookies
Cookie[] cookies = getCookies();
for (int i = 0; i < cookies.length; i++)
{
target.addCookie(cookies[i]);
}
// transfer redirect
target.sendRedirect(getRedirectURI());
}
else
{
// transfer status code
if (getStatusMessage() == null)
{
target.setStatus(getStatusCode());
}
else
{
target.setStatus(getStatusCode(), getStatusMessage());
}
// transfer headers
_header.transferHeader(target);
// transfer cookies
Cookie[] cookies = getCookies();
for (int i = 0; i < cookies.length; i++)
{
target.addCookie(cookies[i]);
}
if (this.getOutputBuffer() != null)
{ // PM17019
// transfer data
ServletOutputStream out;
try
{
out = target.getOutputStream();
}
catch (IllegalStateException i)
{
while (!(target instanceof StoredResponse))
{
while (target instanceof HttpServletResponseWrapper)
{
target = ((HttpServletResponse) ((HttpServletResponseWrapper) target).getResponse());
}
while (target instanceof HttpServletResponseProxy)
{
target = ((HttpServletResponse) ((HttpServletResponseProxy) target).getProxiedHttpServletResponse());
}
while (target instanceof IncludedResponse)
{
target = ((IncludedResponse) target).getProxiedHttpServletResponse();
}
// PQ88880 begin
if (target instanceof SRTServletResponse)
{
target.getWriter().write(this.getOutputBufferAsString().toCharArray());
return;
}
// PQ88880 end
}
StoredResponse s = (StoredResponse) target;
out = s._outInternal;
}
out.write(this.getOutputBuffer());
}
}
} | [
"public",
"void",
"transferResponse",
"(",
"HttpServletResponse",
"target",
")",
"throws",
"IOException",
"// never",
"// called",
"// for",
"// ARD.",
"// would",
"// be",
"// in",
"// trouble",
"// with",
"// a",
"// bunch",
"// of",
"// include",
"// warnings",
"{",
"_finish",
"(",
")",
";",
"if",
"(",
"containsError",
"(",
")",
")",
"{",
"// transfer error",
"String",
"message",
"=",
"getErrorMessage",
"(",
")",
";",
"int",
"sc",
"=",
"getErrorStatusCode",
"(",
")",
";",
"if",
"(",
"message",
"==",
"null",
")",
"{",
"target",
".",
"sendError",
"(",
"sc",
")",
";",
"}",
"else",
"{",
"target",
".",
"sendError",
"(",
"sc",
",",
"message",
")",
";",
"}",
"}",
"else",
"if",
"(",
"isRedirected",
"(",
")",
")",
"{",
"// transfer cookies",
"Cookie",
"[",
"]",
"cookies",
"=",
"getCookies",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"cookies",
".",
"length",
";",
"i",
"++",
")",
"{",
"target",
".",
"addCookie",
"(",
"cookies",
"[",
"i",
"]",
")",
";",
"}",
"// transfer redirect",
"target",
".",
"sendRedirect",
"(",
"getRedirectURI",
"(",
")",
")",
";",
"}",
"else",
"{",
"// transfer status code",
"if",
"(",
"getStatusMessage",
"(",
")",
"==",
"null",
")",
"{",
"target",
".",
"setStatus",
"(",
"getStatusCode",
"(",
")",
")",
";",
"}",
"else",
"{",
"target",
".",
"setStatus",
"(",
"getStatusCode",
"(",
")",
",",
"getStatusMessage",
"(",
")",
")",
";",
"}",
"// transfer headers",
"_header",
".",
"transferHeader",
"(",
"target",
")",
";",
"// transfer cookies",
"Cookie",
"[",
"]",
"cookies",
"=",
"getCookies",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"cookies",
".",
"length",
";",
"i",
"++",
")",
"{",
"target",
".",
"addCookie",
"(",
"cookies",
"[",
"i",
"]",
")",
";",
"}",
"if",
"(",
"this",
".",
"getOutputBuffer",
"(",
")",
"!=",
"null",
")",
"{",
"// PM17019",
"// transfer data",
"ServletOutputStream",
"out",
";",
"try",
"{",
"out",
"=",
"target",
".",
"getOutputStream",
"(",
")",
";",
"}",
"catch",
"(",
"IllegalStateException",
"i",
")",
"{",
"while",
"(",
"!",
"(",
"target",
"instanceof",
"StoredResponse",
")",
")",
"{",
"while",
"(",
"target",
"instanceof",
"HttpServletResponseWrapper",
")",
"{",
"target",
"=",
"(",
"(",
"HttpServletResponse",
")",
"(",
"(",
"HttpServletResponseWrapper",
")",
"target",
")",
".",
"getResponse",
"(",
")",
")",
";",
"}",
"while",
"(",
"target",
"instanceof",
"HttpServletResponseProxy",
")",
"{",
"target",
"=",
"(",
"(",
"HttpServletResponse",
")",
"(",
"(",
"HttpServletResponseProxy",
")",
"target",
")",
".",
"getProxiedHttpServletResponse",
"(",
")",
")",
";",
"}",
"while",
"(",
"target",
"instanceof",
"IncludedResponse",
")",
"{",
"target",
"=",
"(",
"(",
"IncludedResponse",
")",
"target",
")",
".",
"getProxiedHttpServletResponse",
"(",
")",
";",
"}",
"// PQ88880 begin",
"if",
"(",
"target",
"instanceof",
"SRTServletResponse",
")",
"{",
"target",
".",
"getWriter",
"(",
")",
".",
"write",
"(",
"this",
".",
"getOutputBufferAsString",
"(",
")",
".",
"toCharArray",
"(",
")",
")",
";",
"return",
";",
"}",
"// PQ88880 end",
"}",
"StoredResponse",
"s",
"=",
"(",
"StoredResponse",
")",
"target",
";",
"out",
"=",
"s",
".",
"_outInternal",
";",
"}",
"out",
".",
"write",
"(",
"this",
".",
"getOutputBuffer",
"(",
")",
")",
";",
"}",
"}",
"}"
] | Copy the contents of this response to another HttpServletResponse. This
method is optimized to quickly transfer the contents of this response into
another response. This method is useful when this response is cached to
generate the same response later. | [
"Copy",
"the",
"contents",
"of",
"this",
"response",
"to",
"another",
"HttpServletResponse",
".",
"This",
"method",
"is",
"optimized",
"to",
"quickly",
"transfer",
"the",
"contents",
"of",
"this",
"response",
"into",
"another",
"response",
".",
"This",
"method",
"is",
"useful",
"when",
"this",
"response",
"is",
"cached",
"to",
"generate",
"the",
"same",
"response",
"later",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/websphere/servlet/response/StoredResponse.java#L1051-L1160 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/websphere/sib/Reliability.java | Reliability.getReliabilityByName | public final static Reliability getReliabilityByName(String name)
throws NullPointerException, IllegalArgumentException {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.info(tc, "Name = " + name);
if (name == null) {
throw new NullPointerException();
}
/* Look for the name in the nameSet, and return the corresponding */
/* Reliability from the indexSet. */
for (int i = 0; i <= MAX_INDEX + 1; i++) {
if (name.equals(nameSet[i])) {
return indexSet[i];
}
}
/* If the name didn't match, throw IllegalArgumentException */
throw new IllegalArgumentException();
} | java | public final static Reliability getReliabilityByName(String name)
throws NullPointerException, IllegalArgumentException {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.info(tc, "Name = " + name);
if (name == null) {
throw new NullPointerException();
}
/* Look for the name in the nameSet, and return the corresponding */
/* Reliability from the indexSet. */
for (int i = 0; i <= MAX_INDEX + 1; i++) {
if (name.equals(nameSet[i])) {
return indexSet[i];
}
}
/* If the name didn't match, throw IllegalArgumentException */
throw new IllegalArgumentException();
} | [
"public",
"final",
"static",
"Reliability",
"getReliabilityByName",
"(",
"String",
"name",
")",
"throws",
"NullPointerException",
",",
"IllegalArgumentException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"info",
"(",
"tc",
",",
"\"Name = \"",
"+",
"name",
")",
";",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
")",
";",
"}",
"/* Look for the name in the nameSet, and return the corresponding */",
"/* Reliability from the indexSet. */",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<=",
"MAX_INDEX",
"+",
"1",
";",
"i",
"++",
")",
"{",
"if",
"(",
"name",
".",
"equals",
"(",
"nameSet",
"[",
"i",
"]",
")",
")",
"{",
"return",
"indexSet",
"[",
"i",
"]",
";",
"}",
"}",
"/* If the name didn't match, throw IllegalArgumentException */",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"}"
] | Returns the corresponding Reliability for a given name.
This method should NOT be called by any code outside the SIBus.
It is only public so that it can be accessed by other SIBus components.
@param name The toString value of a Reliability constant.
@return The corresponding Reliability | [
"Returns",
"the",
"corresponding",
"Reliability",
"for",
"a",
"given",
"name",
".",
"This",
"method",
"should",
"NOT",
"be",
"called",
"by",
"any",
"code",
"outside",
"the",
"SIBus",
".",
"It",
"is",
"only",
"public",
"so",
"that",
"it",
"can",
"be",
"accessed",
"by",
"other",
"SIBus",
"components",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/websphere/sib/Reliability.java#L296-L316 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/websphere/sib/Reliability.java | Reliability.getReliabilityByIndex | public final static Reliability getReliabilityByIndex(int mpIndex) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.info(tc, "Index = " + mpIndex);
return indexSet[mpIndex + 1];
} | java | public final static Reliability getReliabilityByIndex(int mpIndex) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.info(tc, "Index = " + mpIndex);
return indexSet[mpIndex + 1];
} | [
"public",
"final",
"static",
"Reliability",
"getReliabilityByIndex",
"(",
"int",
"mpIndex",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"info",
"(",
"tc",
",",
"\"Index = \"",
"+",
"mpIndex",
")",
";",
"return",
"indexSet",
"[",
"mpIndex",
"+",
"1",
"]",
";",
"}"
] | Returns the corresponding Reliability for a given index.
This method should NOT be called by any code outside the SIBus.
It is only public so that it can be accessed by other SIBus components.
@param mpIndex The MP index for which an Reliability is required. MP use
-1 for NONE and start at 0 for real values.
@return The corresponding Reliability | [
"Returns",
"the",
"corresponding",
"Reliability",
"for",
"a",
"given",
"index",
".",
"This",
"method",
"should",
"NOT",
"be",
"called",
"by",
"any",
"code",
"outside",
"the",
"SIBus",
".",
"It",
"is",
"only",
"public",
"so",
"that",
"it",
"can",
"be",
"accessed",
"by",
"other",
"SIBus",
"components",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/websphere/sib/Reliability.java#L328-L332 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/websphere/sib/Reliability.java | Reliability.getReliability | public final static Reliability getReliability(Byte aValue) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.info(tc, "Value = " + aValue);
return set[aValue.intValue()];
} | java | public final static Reliability getReliability(Byte aValue) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.info(tc, "Value = " + aValue);
return set[aValue.intValue()];
} | [
"public",
"final",
"static",
"Reliability",
"getReliability",
"(",
"Byte",
"aValue",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"info",
"(",
"tc",
",",
"\"Value = \"",
"+",
"aValue",
")",
";",
"return",
"set",
"[",
"aValue",
".",
"intValue",
"(",
")",
"]",
";",
"}"
] | Returns the corresponding Reliability for a given Byte.
This method should NOT be called by any code outside the MFP component.
It is only public so that it can be accessed by sub-packages.
@param aValue The Byte for which an Reliability is required.
@return The corresponding Reliability | [
"Returns",
"the",
"corresponding",
"Reliability",
"for",
"a",
"given",
"Byte",
".",
"This",
"method",
"should",
"NOT",
"be",
"called",
"by",
"any",
"code",
"outside",
"the",
"MFP",
"component",
".",
"It",
"is",
"only",
"public",
"so",
"that",
"it",
"can",
"be",
"accessed",
"by",
"sub",
"-",
"packages",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/websphere/sib/Reliability.java#L354-L358 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/HpelPlainFormatter.java | HpelPlainFormatter.getHeader | @Override
public String[] getHeader() {
ArrayList<String> result = new ArrayList<String>();
if (customHeader.length > 0) {
for (CustomHeaderLine line: customHeader) {
String formattedLine = line.formatLine(headerProps);
if (formattedLine != null) {
result.add(formattedLine);
}
}
} else {
for (String prop: headerProps.stringPropertyNames()) {
result.add(prop + " = " + headerProps.getProperty(prop));
}
}
return result.toArray(new String[result.size()]);
} | java | @Override
public String[] getHeader() {
ArrayList<String> result = new ArrayList<String>();
if (customHeader.length > 0) {
for (CustomHeaderLine line: customHeader) {
String formattedLine = line.formatLine(headerProps);
if (formattedLine != null) {
result.add(formattedLine);
}
}
} else {
for (String prop: headerProps.stringPropertyNames()) {
result.add(prop + " = " + headerProps.getProperty(prop));
}
}
return result.toArray(new String[result.size()]);
} | [
"@",
"Override",
"public",
"String",
"[",
"]",
"getHeader",
"(",
")",
"{",
"ArrayList",
"<",
"String",
">",
"result",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"if",
"(",
"customHeader",
".",
"length",
">",
"0",
")",
"{",
"for",
"(",
"CustomHeaderLine",
"line",
":",
"customHeader",
")",
"{",
"String",
"formattedLine",
"=",
"line",
".",
"formatLine",
"(",
"headerProps",
")",
";",
"if",
"(",
"formattedLine",
"!=",
"null",
")",
"{",
"result",
".",
"add",
"(",
"formattedLine",
")",
";",
"}",
"}",
"}",
"else",
"{",
"for",
"(",
"String",
"prop",
":",
"headerProps",
".",
"stringPropertyNames",
"(",
")",
")",
"{",
"result",
".",
"add",
"(",
"prop",
"+",
"\" = \"",
"+",
"headerProps",
".",
"getProperty",
"(",
"prop",
")",
")",
";",
"}",
"}",
"return",
"result",
".",
"toArray",
"(",
"new",
"String",
"[",
"result",
".",
"size",
"(",
")",
"]",
")",
";",
"}"
] | Gets the file header information. Implementations of the HpelPlainFormatter class
will have a non-XML-based header.
@return the formatter's header as a String | [
"Gets",
"the",
"file",
"header",
"information",
".",
"Implementations",
"of",
"the",
"HpelPlainFormatter",
"class",
"will",
"have",
"a",
"non",
"-",
"XML",
"-",
"based",
"header",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/HpelPlainFormatter.java#L29-L47 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/HpelPlainFormatter.java | HpelPlainFormatter.createEventTimeStamp | protected void createEventTimeStamp(RepositoryLogRecord record, StringBuilder buffer) {
if (null == record) {
throw new IllegalArgumentException("Record cannot be null");
}
if (null == buffer) {
throw new IllegalArgumentException("Buffer cannot be null");
}
// Create the time stamp
buffer.append('[');
Date eventDate = new Date(record.getMillis());
// set the dateFormat object to the desired timeZone. Allows log output
// to be presented in different time zones.
dateFormat.setTimeZone(timeZone); // set the format to
// the desired
// time zone.
buffer.append(dateFormat.format(eventDate));
buffer.append("] ");
} | java | protected void createEventTimeStamp(RepositoryLogRecord record, StringBuilder buffer) {
if (null == record) {
throw new IllegalArgumentException("Record cannot be null");
}
if (null == buffer) {
throw new IllegalArgumentException("Buffer cannot be null");
}
// Create the time stamp
buffer.append('[');
Date eventDate = new Date(record.getMillis());
// set the dateFormat object to the desired timeZone. Allows log output
// to be presented in different time zones.
dateFormat.setTimeZone(timeZone); // set the format to
// the desired
// time zone.
buffer.append(dateFormat.format(eventDate));
buffer.append("] ");
} | [
"protected",
"void",
"createEventTimeStamp",
"(",
"RepositoryLogRecord",
"record",
",",
"StringBuilder",
"buffer",
")",
"{",
"if",
"(",
"null",
"==",
"record",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Record cannot be null\"",
")",
";",
"}",
"if",
"(",
"null",
"==",
"buffer",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Buffer cannot be null\"",
")",
";",
"}",
"// Create the time stamp",
"buffer",
".",
"append",
"(",
"'",
"'",
")",
";",
"Date",
"eventDate",
"=",
"new",
"Date",
"(",
"record",
".",
"getMillis",
"(",
")",
")",
";",
"// set the dateFormat object to the desired timeZone. Allows log output",
"// to be presented in different time zones.",
"dateFormat",
".",
"setTimeZone",
"(",
"timeZone",
")",
";",
"// set the format to",
"// the desired",
"// time zone.",
"buffer",
".",
"append",
"(",
"dateFormat",
".",
"format",
"(",
"eventDate",
")",
")",
";",
"buffer",
".",
"append",
"(",
"\"] \"",
")",
";",
"}"
] | Generates the time stamp for the RepositoryLogRecord event. The resulting time stamp is formatted
based on the formatter's locale and time zone.
@param record of the event.
@param buffer output buffer where converted timestamp is appended to. | [
"Generates",
"the",
"time",
"stamp",
"for",
"the",
"RepositoryLogRecord",
"event",
".",
"The",
"resulting",
"time",
"stamp",
"is",
"formatted",
"based",
"on",
"the",
"formatter",
"s",
"locale",
"and",
"time",
"zone",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/HpelPlainFormatter.java#L56-L73 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/HpelPlainFormatter.java | HpelPlainFormatter.mapLevelToType | protected static String mapLevelToType(RepositoryLogRecord logRecord) {
if (null == logRecord) {
return " Z ";
}
Level l = logRecord.getLevel();
if (null == l) {
return " Z ";
}
// In HPEL SystemOut and SystemErr are recorded in custom level but since we want
// them to be handled specially do it now before checking for custom levels
String s = logRecord.getLoggerName();
if (s != null) {
if (s.equals("SystemOut")) {
return " O ";
} else if (s.equals("SystemErr")) {
return " R ";
}
}
String id = customLevels.get(l);
if (id != null) {
return (" " + id + " ");
}
// Since we have used the static Level object throughout the logging framework
// object reference comparisons should work.
if (l == Level.SEVERE) {
return " E ";
}
if (l == Level.WARNING) {
return " W ";
}
if (l == Level.INFO) {
return " I ";
}
if (l == Level.CONFIG) {
return " C ";
}
if (l == Level.FINE) {
return " 1 ";
}
if (l == Level.FINER) {
// D198403 Start
// added check for Entry and Exit messages to return < or >
String message = logRecord.getRawMessage();
if (message != null) {
if (message.indexOf("Entry") != -1 || message.indexOf("ENTRY") != -1) {
return " > ";
}
if (message.indexOf("Exit") != -1 || message.indexOf("RETURN") != -1) {
return " < ";
}
}
return " 2 ";
// D198403 End
}
if (l == Level.FINEST) {
return " 3 ";
}
return " Z ";
} | java | protected static String mapLevelToType(RepositoryLogRecord logRecord) {
if (null == logRecord) {
return " Z ";
}
Level l = logRecord.getLevel();
if (null == l) {
return " Z ";
}
// In HPEL SystemOut and SystemErr are recorded in custom level but since we want
// them to be handled specially do it now before checking for custom levels
String s = logRecord.getLoggerName();
if (s != null) {
if (s.equals("SystemOut")) {
return " O ";
} else if (s.equals("SystemErr")) {
return " R ";
}
}
String id = customLevels.get(l);
if (id != null) {
return (" " + id + " ");
}
// Since we have used the static Level object throughout the logging framework
// object reference comparisons should work.
if (l == Level.SEVERE) {
return " E ";
}
if (l == Level.WARNING) {
return " W ";
}
if (l == Level.INFO) {
return " I ";
}
if (l == Level.CONFIG) {
return " C ";
}
if (l == Level.FINE) {
return " 1 ";
}
if (l == Level.FINER) {
// D198403 Start
// added check for Entry and Exit messages to return < or >
String message = logRecord.getRawMessage();
if (message != null) {
if (message.indexOf("Entry") != -1 || message.indexOf("ENTRY") != -1) {
return " > ";
}
if (message.indexOf("Exit") != -1 || message.indexOf("RETURN") != -1) {
return " < ";
}
}
return " 2 ";
// D198403 End
}
if (l == Level.FINEST) {
return " 3 ";
}
return " Z ";
} | [
"protected",
"static",
"String",
"mapLevelToType",
"(",
"RepositoryLogRecord",
"logRecord",
")",
"{",
"if",
"(",
"null",
"==",
"logRecord",
")",
"{",
"return",
"\" Z \"",
";",
"}",
"Level",
"l",
"=",
"logRecord",
".",
"getLevel",
"(",
")",
";",
"if",
"(",
"null",
"==",
"l",
")",
"{",
"return",
"\" Z \"",
";",
"}",
"// In HPEL SystemOut and SystemErr are recorded in custom level but since we want",
"// them to be handled specially do it now before checking for custom levels",
"String",
"s",
"=",
"logRecord",
".",
"getLoggerName",
"(",
")",
";",
"if",
"(",
"s",
"!=",
"null",
")",
"{",
"if",
"(",
"s",
".",
"equals",
"(",
"\"SystemOut\"",
")",
")",
"{",
"return",
"\" O \"",
";",
"}",
"else",
"if",
"(",
"s",
".",
"equals",
"(",
"\"SystemErr\"",
")",
")",
"{",
"return",
"\" R \"",
";",
"}",
"}",
"String",
"id",
"=",
"customLevels",
".",
"get",
"(",
"l",
")",
";",
"if",
"(",
"id",
"!=",
"null",
")",
"{",
"return",
"(",
"\" \"",
"+",
"id",
"+",
"\" \"",
")",
";",
"}",
"// Since we have used the static Level object throughout the logging framework",
"// object reference comparisons should work.",
"if",
"(",
"l",
"==",
"Level",
".",
"SEVERE",
")",
"{",
"return",
"\" E \"",
";",
"}",
"if",
"(",
"l",
"==",
"Level",
".",
"WARNING",
")",
"{",
"return",
"\" W \"",
";",
"}",
"if",
"(",
"l",
"==",
"Level",
".",
"INFO",
")",
"{",
"return",
"\" I \"",
";",
"}",
"if",
"(",
"l",
"==",
"Level",
".",
"CONFIG",
")",
"{",
"return",
"\" C \"",
";",
"}",
"if",
"(",
"l",
"==",
"Level",
".",
"FINE",
")",
"{",
"return",
"\" 1 \"",
";",
"}",
"if",
"(",
"l",
"==",
"Level",
".",
"FINER",
")",
"{",
"// D198403 Start",
"// added check for Entry and Exit messages to return < or >",
"String",
"message",
"=",
"logRecord",
".",
"getRawMessage",
"(",
")",
";",
"if",
"(",
"message",
"!=",
"null",
")",
"{",
"if",
"(",
"message",
".",
"indexOf",
"(",
"\"Entry\"",
")",
"!=",
"-",
"1",
"||",
"message",
".",
"indexOf",
"(",
"\"ENTRY\"",
")",
"!=",
"-",
"1",
")",
"{",
"return",
"\" > \"",
";",
"}",
"if",
"(",
"message",
".",
"indexOf",
"(",
"\"Exit\"",
")",
"!=",
"-",
"1",
"||",
"message",
".",
"indexOf",
"(",
"\"RETURN\"",
")",
"!=",
"-",
"1",
")",
"{",
"return",
"\" < \"",
";",
"}",
"}",
"return",
"\" 2 \"",
";",
"// D198403 End",
"}",
"if",
"(",
"l",
"==",
"Level",
".",
"FINEST",
")",
"{",
"return",
"\" 3 \"",
";",
"}",
"return",
"\" Z \"",
";",
"}"
] | Generates the short type string based off the RepositoryLogRecord's Level.
@param logRecord
@return String - The type. | [
"Generates",
"the",
"short",
"type",
"string",
"based",
"off",
"the",
"RepositoryLogRecord",
"s",
"Level",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/HpelPlainFormatter.java#L82-L140 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.social/src/com/ibm/ws/security/social/twitter/TwitterTokenServices.java | TwitterTokenServices.setCookies | protected void setCookies(HttpServletRequest request, HttpServletResponse response, String requestToken, String stateValue) {
ReferrerURLCookieHandler referrerURLCookieHandler = WebAppSecurityCollaboratorImpl.getGlobalWebAppSecurityConfig().createReferrerURLCookieHandler();
// Create cookie for request token
Cookie requestTokenCookie = referrerURLCookieHandler.createCookie(TwitterConstants.COOKIE_NAME_REQUEST_TOKEN, requestToken, request);
response.addCookie(requestTokenCookie);
// Set original request URL in cookie
String cookieName = ClientConstants.COOKIE_NAME_REQ_URL_PREFIX + stateValue.hashCode();
Cookie c = referrerURLCookieHandler.createCookie(cookieName, webUtils.getRequestUrlWithEncodedQueryString(request), request);
response.addCookie(c);
} | java | protected void setCookies(HttpServletRequest request, HttpServletResponse response, String requestToken, String stateValue) {
ReferrerURLCookieHandler referrerURLCookieHandler = WebAppSecurityCollaboratorImpl.getGlobalWebAppSecurityConfig().createReferrerURLCookieHandler();
// Create cookie for request token
Cookie requestTokenCookie = referrerURLCookieHandler.createCookie(TwitterConstants.COOKIE_NAME_REQUEST_TOKEN, requestToken, request);
response.addCookie(requestTokenCookie);
// Set original request URL in cookie
String cookieName = ClientConstants.COOKIE_NAME_REQ_URL_PREFIX + stateValue.hashCode();
Cookie c = referrerURLCookieHandler.createCookie(cookieName, webUtils.getRequestUrlWithEncodedQueryString(request), request);
response.addCookie(c);
} | [
"protected",
"void",
"setCookies",
"(",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
",",
"String",
"requestToken",
",",
"String",
"stateValue",
")",
"{",
"ReferrerURLCookieHandler",
"referrerURLCookieHandler",
"=",
"WebAppSecurityCollaboratorImpl",
".",
"getGlobalWebAppSecurityConfig",
"(",
")",
".",
"createReferrerURLCookieHandler",
"(",
")",
";",
"// Create cookie for request token",
"Cookie",
"requestTokenCookie",
"=",
"referrerURLCookieHandler",
".",
"createCookie",
"(",
"TwitterConstants",
".",
"COOKIE_NAME_REQUEST_TOKEN",
",",
"requestToken",
",",
"request",
")",
";",
"response",
".",
"addCookie",
"(",
"requestTokenCookie",
")",
";",
"// Set original request URL in cookie",
"String",
"cookieName",
"=",
"ClientConstants",
".",
"COOKIE_NAME_REQ_URL_PREFIX",
"+",
"stateValue",
".",
"hashCode",
"(",
")",
";",
"Cookie",
"c",
"=",
"referrerURLCookieHandler",
".",
"createCookie",
"(",
"cookieName",
",",
"webUtils",
".",
"getRequestUrlWithEncodedQueryString",
"(",
"request",
")",
",",
"request",
")",
";",
"response",
".",
"addCookie",
"(",
"c",
")",
";",
"}"
] | Sets cookies for the provided request token and the original request URL. These values can then be verified and used in
subsequent requests.
@param request
@param response
@param requestToken
@param stateValue | [
"Sets",
"cookies",
"for",
"the",
"provided",
"request",
"token",
"and",
"the",
"original",
"request",
"URL",
".",
"These",
"values",
"can",
"then",
"be",
"verified",
"and",
"used",
"in",
"subsequent",
"requests",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.social/src/com/ibm/ws/security/social/twitter/TwitterTokenServices.java#L188-L200 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/transport/iiop/security/ClientSecurityInterceptor.java | ClientSecurityInterceptor.setUnauthenticatedSubjectIfNeeded | private void setUnauthenticatedSubjectIfNeeded() {
if (LocationUtils.isServer()) {
com.ibm.ws.security.context.SubjectManager sm = new com.ibm.ws.security.context.SubjectManager();
Subject invokedSubject = sm.getInvocationSubject();
if (invokedSubject == null) {
Subject callerSubject = sm.getCallerSubject();
if (callerSubject == null) {
// create the unauthenticated subject and set as the invocation subject
UnauthenticatedSubjectService unAuthenticationService = SecurityServices.getUnauthenticatedSubjectService();
if (unAuthenticationService != null) {
sm.setInvocationSubject(unAuthenticationService.getUnauthenticatedSubject());
}
}
}
}
} | java | private void setUnauthenticatedSubjectIfNeeded() {
if (LocationUtils.isServer()) {
com.ibm.ws.security.context.SubjectManager sm = new com.ibm.ws.security.context.SubjectManager();
Subject invokedSubject = sm.getInvocationSubject();
if (invokedSubject == null) {
Subject callerSubject = sm.getCallerSubject();
if (callerSubject == null) {
// create the unauthenticated subject and set as the invocation subject
UnauthenticatedSubjectService unAuthenticationService = SecurityServices.getUnauthenticatedSubjectService();
if (unAuthenticationService != null) {
sm.setInvocationSubject(unAuthenticationService.getUnauthenticatedSubject());
}
}
}
}
} | [
"private",
"void",
"setUnauthenticatedSubjectIfNeeded",
"(",
")",
"{",
"if",
"(",
"LocationUtils",
".",
"isServer",
"(",
")",
")",
"{",
"com",
".",
"ibm",
".",
"ws",
".",
"security",
".",
"context",
".",
"SubjectManager",
"sm",
"=",
"new",
"com",
".",
"ibm",
".",
"ws",
".",
"security",
".",
"context",
".",
"SubjectManager",
"(",
")",
";",
"Subject",
"invokedSubject",
"=",
"sm",
".",
"getInvocationSubject",
"(",
")",
";",
"if",
"(",
"invokedSubject",
"==",
"null",
")",
"{",
"Subject",
"callerSubject",
"=",
"sm",
".",
"getCallerSubject",
"(",
")",
";",
"if",
"(",
"callerSubject",
"==",
"null",
")",
"{",
"// create the unauthenticated subject and set as the invocation subject",
"UnauthenticatedSubjectService",
"unAuthenticationService",
"=",
"SecurityServices",
".",
"getUnauthenticatedSubjectService",
"(",
")",
";",
"if",
"(",
"unAuthenticationService",
"!=",
"null",
")",
"{",
"sm",
".",
"setInvocationSubject",
"(",
"unAuthenticationService",
".",
"getUnauthenticatedSubject",
"(",
")",
")",
";",
"}",
"}",
"}",
"}",
"}"
] | Create un-authenticate subject if both caller and invoke subjects are null for client. We do not want
to do this for client container. | [
"Create",
"un",
"-",
"authenticate",
"subject",
"if",
"both",
"caller",
"and",
"invoke",
"subjects",
"are",
"null",
"for",
"client",
".",
"We",
"do",
"not",
"want",
"to",
"do",
"this",
"for",
"client",
"container",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/transport/iiop/security/ClientSecurityInterceptor.java#L190-L205 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jaxrs.2.0.common/src/org/apache/cxf/transport/http/HTTPConduit.java | HTTPConduit.updateClientPolicy | private void updateClientPolicy(Message m) {
if (!clientSidePolicyCalced) {
PolicyDataEngine policyEngine = bus.getExtension(PolicyDataEngine.class);
if (policyEngine != null && endpointInfo.getService() != null) {
clientSidePolicy = policyEngine.getClientEndpointPolicy(m,
endpointInfo,
this,
new ClientPolicyCalculator());
if (clientSidePolicy != null) {
clientSidePolicy.removePropertyChangeListener(this); //make sure we aren't added twice
clientSidePolicy.addPropertyChangeListener(this);
}
}
}
clientSidePolicyCalced = true;
} | java | private void updateClientPolicy(Message m) {
if (!clientSidePolicyCalced) {
PolicyDataEngine policyEngine = bus.getExtension(PolicyDataEngine.class);
if (policyEngine != null && endpointInfo.getService() != null) {
clientSidePolicy = policyEngine.getClientEndpointPolicy(m,
endpointInfo,
this,
new ClientPolicyCalculator());
if (clientSidePolicy != null) {
clientSidePolicy.removePropertyChangeListener(this); //make sure we aren't added twice
clientSidePolicy.addPropertyChangeListener(this);
}
}
}
clientSidePolicyCalced = true;
} | [
"private",
"void",
"updateClientPolicy",
"(",
"Message",
"m",
")",
"{",
"if",
"(",
"!",
"clientSidePolicyCalced",
")",
"{",
"PolicyDataEngine",
"policyEngine",
"=",
"bus",
".",
"getExtension",
"(",
"PolicyDataEngine",
".",
"class",
")",
";",
"if",
"(",
"policyEngine",
"!=",
"null",
"&&",
"endpointInfo",
".",
"getService",
"(",
")",
"!=",
"null",
")",
"{",
"clientSidePolicy",
"=",
"policyEngine",
".",
"getClientEndpointPolicy",
"(",
"m",
",",
"endpointInfo",
",",
"this",
",",
"new",
"ClientPolicyCalculator",
"(",
")",
")",
";",
"if",
"(",
"clientSidePolicy",
"!=",
"null",
")",
"{",
"clientSidePolicy",
".",
"removePropertyChangeListener",
"(",
"this",
")",
";",
"//make sure we aren't added twice",
"clientSidePolicy",
".",
"addPropertyChangeListener",
"(",
"this",
")",
";",
"}",
"}",
"}",
"clientSidePolicyCalced",
"=",
"true",
";",
"}"
] | updates the HTTPClientPolicy that is compatible with the assertions
included in the service, endpoint, operation and message policy subjects
if a PolicyDataEngine is installed
wsdl extensors are superseded by policies which in
turn are superseded by injection | [
"updates",
"the",
"HTTPClientPolicy",
"that",
"is",
"compatible",
"with",
"the",
"assertions",
"included",
"in",
"the",
"service",
"endpoint",
"operation",
"and",
"message",
"policy",
"subjects",
"if",
"a",
"PolicyDataEngine",
"is",
"installed"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxrs.2.0.common/src/org/apache/cxf/transport/http/HTTPConduit.java#L326-L341 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jaxrs.2.0.common/src/org/apache/cxf/transport/http/HTTPConduit.java | HTTPConduit.finalizeConfig | public void finalizeConfig() {
// See if not set by configuration, if there are defaults
// in order from the Endpoint, Service, or Bus.
configureConduitFromEndpointInfo(this, endpointInfo);
logConfig();
if (getClient().getDecoupledEndpoint() != null) {
this.endpointInfo.setProperty("org.apache.cxf.ws.addressing.replyto",
getClient().getDecoupledEndpoint());
}
} | java | public void finalizeConfig() {
// See if not set by configuration, if there are defaults
// in order from the Endpoint, Service, or Bus.
configureConduitFromEndpointInfo(this, endpointInfo);
logConfig();
if (getClient().getDecoupledEndpoint() != null) {
this.endpointInfo.setProperty("org.apache.cxf.ws.addressing.replyto",
getClient().getDecoupledEndpoint());
}
} | [
"public",
"void",
"finalizeConfig",
"(",
")",
"{",
"// See if not set by configuration, if there are defaults",
"// in order from the Endpoint, Service, or Bus.",
"configureConduitFromEndpointInfo",
"(",
"this",
",",
"endpointInfo",
")",
";",
"logConfig",
"(",
")",
";",
"if",
"(",
"getClient",
"(",
")",
".",
"getDecoupledEndpoint",
"(",
")",
"!=",
"null",
")",
"{",
"this",
".",
"endpointInfo",
".",
"setProperty",
"(",
"\"org.apache.cxf.ws.addressing.replyto\"",
",",
"getClient",
"(",
")",
".",
"getDecoupledEndpoint",
"(",
")",
")",
";",
"}",
"}"
] | This call gets called by the HTTPTransportFactory after it
causes an injection of the Spring configuration properties
of this Conduit. | [
"This",
"call",
"gets",
"called",
"by",
"the",
"HTTPTransportFactory",
"after",
"it",
"causes",
"an",
"injection",
"of",
"the",
"Spring",
"configuration",
"properties",
"of",
"this",
"Conduit",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxrs.2.0.common/src/org/apache/cxf/transport/http/HTTPConduit.java#L449-L460 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jaxrs.2.0.common/src/org/apache/cxf/transport/http/HTTPConduit.java | HTTPConduit.getEffectiveAuthPolicy | public AuthorizationPolicy getEffectiveAuthPolicy(Message message) {
AuthorizationPolicy authPolicy = getAuthorization();
AuthorizationPolicy newPolicy = message.get(AuthorizationPolicy.class);
AuthorizationPolicy effectivePolicy = newPolicy;
if (effectivePolicy == null) {
effectivePolicy = authPolicy;
}
if (effectivePolicy == null) {
effectivePolicy = new AuthorizationPolicy();
}
return effectivePolicy;
} | java | public AuthorizationPolicy getEffectiveAuthPolicy(Message message) {
AuthorizationPolicy authPolicy = getAuthorization();
AuthorizationPolicy newPolicy = message.get(AuthorizationPolicy.class);
AuthorizationPolicy effectivePolicy = newPolicy;
if (effectivePolicy == null) {
effectivePolicy = authPolicy;
}
if (effectivePolicy == null) {
effectivePolicy = new AuthorizationPolicy();
}
return effectivePolicy;
} | [
"public",
"AuthorizationPolicy",
"getEffectiveAuthPolicy",
"(",
"Message",
"message",
")",
"{",
"AuthorizationPolicy",
"authPolicy",
"=",
"getAuthorization",
"(",
")",
";",
"AuthorizationPolicy",
"newPolicy",
"=",
"message",
".",
"get",
"(",
"AuthorizationPolicy",
".",
"class",
")",
";",
"AuthorizationPolicy",
"effectivePolicy",
"=",
"newPolicy",
";",
"if",
"(",
"effectivePolicy",
"==",
"null",
")",
"{",
"effectivePolicy",
"=",
"authPolicy",
";",
"}",
"if",
"(",
"effectivePolicy",
"==",
"null",
")",
"{",
"effectivePolicy",
"=",
"new",
"AuthorizationPolicy",
"(",
")",
";",
"}",
"return",
"effectivePolicy",
";",
"}"
] | Determines effective auth policy from message, conduit and empty default
with priority from first to last
@param message
@return effective AthorizationPolicy | [
"Determines",
"effective",
"auth",
"policy",
"from",
"message",
"conduit",
"and",
"empty",
"default",
"with",
"priority",
"from",
"first",
"to",
"last"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxrs.2.0.common/src/org/apache/cxf/transport/http/HTTPConduit.java#L872-L883 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jaxrs.2.0.common/src/org/apache/cxf/transport/http/HTTPConduit.java | HTTPConduit.setClient | public void setClient(HTTPClientPolicy client) {
if (this.clientSidePolicy != null) {
this.clientSidePolicy.removePropertyChangeListener(this);
}
this.clientSidePolicyCalced = true;
this.clientSidePolicy = client;
clientSidePolicy.removePropertyChangeListener(this); //make sure we aren't added twice
clientSidePolicy.addPropertyChangeListener(this);
endpointInfo.setProperty("org.apache.cxf.ws.addressing.replyto", client.getDecoupledEndpoint());
} | java | public void setClient(HTTPClientPolicy client) {
if (this.clientSidePolicy != null) {
this.clientSidePolicy.removePropertyChangeListener(this);
}
this.clientSidePolicyCalced = true;
this.clientSidePolicy = client;
clientSidePolicy.removePropertyChangeListener(this); //make sure we aren't added twice
clientSidePolicy.addPropertyChangeListener(this);
endpointInfo.setProperty("org.apache.cxf.ws.addressing.replyto", client.getDecoupledEndpoint());
} | [
"public",
"void",
"setClient",
"(",
"HTTPClientPolicy",
"client",
")",
"{",
"if",
"(",
"this",
".",
"clientSidePolicy",
"!=",
"null",
")",
"{",
"this",
".",
"clientSidePolicy",
".",
"removePropertyChangeListener",
"(",
"this",
")",
";",
"}",
"this",
".",
"clientSidePolicyCalced",
"=",
"true",
";",
"this",
".",
"clientSidePolicy",
"=",
"client",
";",
"clientSidePolicy",
".",
"removePropertyChangeListener",
"(",
"this",
")",
";",
"//make sure we aren't added twice",
"clientSidePolicy",
".",
"addPropertyChangeListener",
"(",
"this",
")",
";",
"endpointInfo",
".",
"setProperty",
"(",
"\"org.apache.cxf.ws.addressing.replyto\"",
",",
"client",
".",
"getDecoupledEndpoint",
"(",
")",
")",
";",
"}"
] | This method sets the Client Side Policy for this HTTPConduit. Using this
method will override any HTTPClientPolicy set in configuration. | [
"This",
"method",
"sets",
"the",
"Client",
"Side",
"Policy",
"for",
"this",
"HTTPConduit",
".",
"Using",
"this",
"method",
"will",
"override",
"any",
"HTTPClientPolicy",
"set",
"in",
"configuration",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxrs.2.0.common/src/org/apache/cxf/transport/http/HTTPConduit.java#L932-L941 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jaxrs.2.0.common/src/org/apache/cxf/transport/http/HTTPConduit.java | HTTPConduit.setTlsClientParameters | public void setTlsClientParameters(TLSClientParameters params) {
this.tlsClientParameters = params;
if (this.tlsClientParameters != null) {
if (LOG.isLoggable(Level.FINE)) {
LOG.log(Level.FINE, "Conduit '" + getConduitName()
+ "' has been (re) configured for TLS "
+ "keyManagers " + Arrays.toString(tlsClientParameters.getKeyManagers())
+ "trustManagers " + Arrays.toString(tlsClientParameters.getTrustManagers())
+ "secureRandom " + tlsClientParameters.getSecureRandom());
}
CertificateConstraintsType constraints = params.getCertConstraints();
if (constraints != null) {
certConstraints = CertConstraintsJaxBUtils.createCertConstraints(constraints);
}
} else {
if (LOG.isLoggable(Level.FINE)) {
LOG.log(Level.FINE, "Conduit '" + getConduitName()
+ "' has been (re)configured for plain http.");
}
}
} | java | public void setTlsClientParameters(TLSClientParameters params) {
this.tlsClientParameters = params;
if (this.tlsClientParameters != null) {
if (LOG.isLoggable(Level.FINE)) {
LOG.log(Level.FINE, "Conduit '" + getConduitName()
+ "' has been (re) configured for TLS "
+ "keyManagers " + Arrays.toString(tlsClientParameters.getKeyManagers())
+ "trustManagers " + Arrays.toString(tlsClientParameters.getTrustManagers())
+ "secureRandom " + tlsClientParameters.getSecureRandom());
}
CertificateConstraintsType constraints = params.getCertConstraints();
if (constraints != null) {
certConstraints = CertConstraintsJaxBUtils.createCertConstraints(constraints);
}
} else {
if (LOG.isLoggable(Level.FINE)) {
LOG.log(Level.FINE, "Conduit '" + getConduitName()
+ "' has been (re)configured for plain http.");
}
}
} | [
"public",
"void",
"setTlsClientParameters",
"(",
"TLSClientParameters",
"params",
")",
"{",
"this",
".",
"tlsClientParameters",
"=",
"params",
";",
"if",
"(",
"this",
".",
"tlsClientParameters",
"!=",
"null",
")",
"{",
"if",
"(",
"LOG",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"FINE",
",",
"\"Conduit '\"",
"+",
"getConduitName",
"(",
")",
"+",
"\"' has been (re) configured for TLS \"",
"+",
"\"keyManagers \"",
"+",
"Arrays",
".",
"toString",
"(",
"tlsClientParameters",
".",
"getKeyManagers",
"(",
")",
")",
"+",
"\"trustManagers \"",
"+",
"Arrays",
".",
"toString",
"(",
"tlsClientParameters",
".",
"getTrustManagers",
"(",
")",
")",
"+",
"\"secureRandom \"",
"+",
"tlsClientParameters",
".",
"getSecureRandom",
"(",
")",
")",
";",
"}",
"CertificateConstraintsType",
"constraints",
"=",
"params",
".",
"getCertConstraints",
"(",
")",
";",
"if",
"(",
"constraints",
"!=",
"null",
")",
"{",
"certConstraints",
"=",
"CertConstraintsJaxBUtils",
".",
"createCertConstraints",
"(",
"constraints",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"LOG",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"FINE",
",",
"\"Conduit '\"",
"+",
"getConduitName",
"(",
")",
"+",
"\"' has been (re)configured for plain http.\"",
")",
";",
"}",
"}",
"}"
] | This method sets the TLS Client Parameters for this HTTPConduit.
Using this method overrides any TLS Client Parameters that is configured
for this HTTPConduit. | [
"This",
"method",
"sets",
"the",
"TLS",
"Client",
"Parameters",
"for",
"this",
"HTTPConduit",
".",
"Using",
"this",
"method",
"overrides",
"any",
"TLS",
"Client",
"Parameters",
"that",
"is",
"configured",
"for",
"this",
"HTTPConduit",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxrs.2.0.common/src/org/apache/cxf/transport/http/HTTPConduit.java#L975-L995 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jaxrs.2.0.common/src/org/apache/cxf/transport/http/HTTPConduit.java | HTTPConduit.extractLocation | protected String extractLocation(Map<String, List<String>> headers) throws MalformedURLException {
for (Map.Entry<String, List<String>> head : headers.entrySet()) {
if ("Location".equalsIgnoreCase(head.getKey())) {
List<String> locs = head.getValue();
if (locs != null && locs.size() > 0) {
String location = locs.get(0);
if (location != null) {
return location;
} else {
return null;
}
}
}
}
return null;
} | java | protected String extractLocation(Map<String, List<String>> headers) throws MalformedURLException {
for (Map.Entry<String, List<String>> head : headers.entrySet()) {
if ("Location".equalsIgnoreCase(head.getKey())) {
List<String> locs = head.getValue();
if (locs != null && locs.size() > 0) {
String location = locs.get(0);
if (location != null) {
return location;
} else {
return null;
}
}
}
}
return null;
} | [
"protected",
"String",
"extractLocation",
"(",
"Map",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"headers",
")",
"throws",
"MalformedURLException",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"head",
":",
"headers",
".",
"entrySet",
"(",
")",
")",
"{",
"if",
"(",
"\"Location\"",
".",
"equalsIgnoreCase",
"(",
"head",
".",
"getKey",
"(",
")",
")",
")",
"{",
"List",
"<",
"String",
">",
"locs",
"=",
"head",
".",
"getValue",
"(",
")",
";",
"if",
"(",
"locs",
"!=",
"null",
"&&",
"locs",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"String",
"location",
"=",
"locs",
".",
"get",
"(",
"0",
")",
";",
"if",
"(",
"location",
"!=",
"null",
")",
"{",
"return",
"location",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}",
"}",
"}",
"return",
"null",
";",
"}"
] | This method extracts the value of the "Location" Http
Response header.
@param headers The Http response headers.
@return The value of the "Location" header, null if non-existent.
@throws MalformedURLException | [
"This",
"method",
"extracts",
"the",
"value",
"of",
"the",
"Location",
"Http",
"Response",
"header",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxrs.2.0.common/src/org/apache/cxf/transport/http/HTTPConduit.java#L1045-L1060 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jaxrs.2.0.common/src/org/apache/cxf/transport/http/HTTPConduit.java | HTTPConduit.convertToAbsoluteUrlIfNeeded | private static String convertToAbsoluteUrlIfNeeded(String conduitName,
String lastURL,
String newURL,
Message message) throws IOException {
if (newURL != null && !newURL.startsWith("http")) {
if (MessageUtils.isTrue(message.getContextualProperty(AUTO_REDIRECT_ALLOW_REL_URI))) {
return URI.create(lastURL).resolve(newURL).toString();
} else {
String msg = "Relative Redirect detected on Conduit '"
+ conduitName + "' on '" + newURL + "'";
LOG.log(Level.INFO, msg);
throw new IOException(msg);
}
} else {
return newURL;
}
} | java | private static String convertToAbsoluteUrlIfNeeded(String conduitName,
String lastURL,
String newURL,
Message message) throws IOException {
if (newURL != null && !newURL.startsWith("http")) {
if (MessageUtils.isTrue(message.getContextualProperty(AUTO_REDIRECT_ALLOW_REL_URI))) {
return URI.create(lastURL).resolve(newURL).toString();
} else {
String msg = "Relative Redirect detected on Conduit '"
+ conduitName + "' on '" + newURL + "'";
LOG.log(Level.INFO, msg);
throw new IOException(msg);
}
} else {
return newURL;
}
} | [
"private",
"static",
"String",
"convertToAbsoluteUrlIfNeeded",
"(",
"String",
"conduitName",
",",
"String",
"lastURL",
",",
"String",
"newURL",
",",
"Message",
"message",
")",
"throws",
"IOException",
"{",
"if",
"(",
"newURL",
"!=",
"null",
"&&",
"!",
"newURL",
".",
"startsWith",
"(",
"\"http\"",
")",
")",
"{",
"if",
"(",
"MessageUtils",
".",
"isTrue",
"(",
"message",
".",
"getContextualProperty",
"(",
"AUTO_REDIRECT_ALLOW_REL_URI",
")",
")",
")",
"{",
"return",
"URI",
".",
"create",
"(",
"lastURL",
")",
".",
"resolve",
"(",
"newURL",
")",
".",
"toString",
"(",
")",
";",
"}",
"else",
"{",
"String",
"msg",
"=",
"\"Relative Redirect detected on Conduit '\"",
"+",
"conduitName",
"+",
"\"' on '\"",
"+",
"newURL",
"+",
"\"'\"",
";",
"LOG",
".",
"log",
"(",
"Level",
".",
"INFO",
",",
"msg",
")",
";",
"throw",
"new",
"IOException",
"(",
"msg",
")",
";",
"}",
"}",
"else",
"{",
"return",
"newURL",
";",
"}",
"}"
] | Relative Location values are also supported | [
"Relative",
"Location",
"values",
"are",
"also",
"supported"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxrs.2.0.common/src/org/apache/cxf/transport/http/HTTPConduit.java#L1909-L1927 | train |
OpenLiberty/open-liberty | dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/api/impl/JobOperatorImplSuspendTran.java | JobOperatorImplSuspendTran.resumeTran | private void resumeTran(Transaction tran) {
if (tran != null) {
try {
tranMgr.resume(tran);
} catch (Exception e) {
throw new BatchRuntimeException("Failed to resume transaction after JobOperator method", e);
}
}
} | java | private void resumeTran(Transaction tran) {
if (tran != null) {
try {
tranMgr.resume(tran);
} catch (Exception e) {
throw new BatchRuntimeException("Failed to resume transaction after JobOperator method", e);
}
}
} | [
"private",
"void",
"resumeTran",
"(",
"Transaction",
"tran",
")",
"{",
"if",
"(",
"tran",
"!=",
"null",
")",
"{",
"try",
"{",
"tranMgr",
".",
"resume",
"(",
"tran",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"BatchRuntimeException",
"(",
"\"Failed to resume transaction after JobOperator method\"",
",",
"e",
")",
";",
"}",
"}",
"}"
] | Resume the given tran. | [
"Resume",
"the",
"given",
"tran",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/api/impl/JobOperatorImplSuspendTran.java#L109-L117 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.org.apache.cxf.cxf.rt.frontend.jaxrs.3.2/src/org/apache/cxf/jaxrs/provider/ProviderFactory.java | ProviderFactory.addAndSortReaders | private void addAndSortReaders(List<ProviderInfo<MessageBodyReader<?>>> newReaders, boolean forceSort) {
Comparator<ProviderInfo<MessageBodyReader<?>>> comparator = null;
if (!customComparatorAvailable(MessageBodyReader.class)) {
comparator = new MessageBodyReaderComparator(readerMediaTypesMap);
}
messageReaders.addAndSortProviders(newReaders, comparator, forceSort);
} | java | private void addAndSortReaders(List<ProviderInfo<MessageBodyReader<?>>> newReaders, boolean forceSort) {
Comparator<ProviderInfo<MessageBodyReader<?>>> comparator = null;
if (!customComparatorAvailable(MessageBodyReader.class)) {
comparator = new MessageBodyReaderComparator(readerMediaTypesMap);
}
messageReaders.addAndSortProviders(newReaders, comparator, forceSort);
} | [
"private",
"void",
"addAndSortReaders",
"(",
"List",
"<",
"ProviderInfo",
"<",
"MessageBodyReader",
"<",
"?",
">",
">",
">",
"newReaders",
",",
"boolean",
"forceSort",
")",
"{",
"Comparator",
"<",
"ProviderInfo",
"<",
"MessageBodyReader",
"<",
"?",
">",
">",
">",
"comparator",
"=",
"null",
";",
"if",
"(",
"!",
"customComparatorAvailable",
"(",
"MessageBodyReader",
".",
"class",
")",
")",
"{",
"comparator",
"=",
"new",
"MessageBodyReaderComparator",
"(",
"readerMediaTypesMap",
")",
";",
"}",
"messageReaders",
".",
"addAndSortProviders",
"(",
"newReaders",
",",
"comparator",
",",
"forceSort",
")",
";",
"}"
] | Liberty code change start | [
"Liberty",
"code",
"change",
"start"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.org.apache.cxf.cxf.rt.frontend.jaxrs.3.2/src/org/apache/cxf/jaxrs/provider/ProviderFactory.java#L907-L914 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.org.apache.cxf.cxf.rt.frontend.jaxrs.3.2/src/org/apache/cxf/jaxrs/provider/ProviderFactory.java | ProviderFactory.getGenericInterfaces | private static Type[] getGenericInterfaces(Class<?> cls, Class<?> expectedClass,
Class<?> commonBaseCls) {
if (Object.class == cls) {
return emptyType;
}
Type[] cachedTypes = getTypes(cls, expectedClass, commonBaseCls);
if (cachedTypes != null)
return cachedTypes;
if (expectedClass != null) {
Type genericSuperType = cls.getGenericSuperclass();
if (genericSuperType instanceof ParameterizedType) {
Class<?> actualType = InjectionUtils.getActualType(genericSuperType);
if (actualType != null && actualType.isAssignableFrom(expectedClass)) {
Type[] tempTypes = new Type[] { genericSuperType };
putTypes(cls, expectedClass, commonBaseCls, tempTypes);
return tempTypes;
} else if (commonBaseCls != null && commonBaseCls != Object.class
&& commonBaseCls.isAssignableFrom(expectedClass)
&& commonBaseCls.isAssignableFrom(actualType)
|| expectedClass.isAssignableFrom(actualType)) {
putTypes(cls, expectedClass, commonBaseCls, emptyType);
return emptyType;
}
}
}
Type[] types = cls.getGenericInterfaces();
if (types.length > 0) {
putTypes(cls, expectedClass, commonBaseCls, types);
return types;
}
Type[] superGenericTypes = getGenericInterfaces(cls.getSuperclass(), expectedClass, commonBaseCls);
putTypes(cls, expectedClass, commonBaseCls, superGenericTypes);
return superGenericTypes;
} | java | private static Type[] getGenericInterfaces(Class<?> cls, Class<?> expectedClass,
Class<?> commonBaseCls) {
if (Object.class == cls) {
return emptyType;
}
Type[] cachedTypes = getTypes(cls, expectedClass, commonBaseCls);
if (cachedTypes != null)
return cachedTypes;
if (expectedClass != null) {
Type genericSuperType = cls.getGenericSuperclass();
if (genericSuperType instanceof ParameterizedType) {
Class<?> actualType = InjectionUtils.getActualType(genericSuperType);
if (actualType != null && actualType.isAssignableFrom(expectedClass)) {
Type[] tempTypes = new Type[] { genericSuperType };
putTypes(cls, expectedClass, commonBaseCls, tempTypes);
return tempTypes;
} else if (commonBaseCls != null && commonBaseCls != Object.class
&& commonBaseCls.isAssignableFrom(expectedClass)
&& commonBaseCls.isAssignableFrom(actualType)
|| expectedClass.isAssignableFrom(actualType)) {
putTypes(cls, expectedClass, commonBaseCls, emptyType);
return emptyType;
}
}
}
Type[] types = cls.getGenericInterfaces();
if (types.length > 0) {
putTypes(cls, expectedClass, commonBaseCls, types);
return types;
}
Type[] superGenericTypes = getGenericInterfaces(cls.getSuperclass(), expectedClass, commonBaseCls);
putTypes(cls, expectedClass, commonBaseCls, superGenericTypes);
return superGenericTypes;
} | [
"private",
"static",
"Type",
"[",
"]",
"getGenericInterfaces",
"(",
"Class",
"<",
"?",
">",
"cls",
",",
"Class",
"<",
"?",
">",
"expectedClass",
",",
"Class",
"<",
"?",
">",
"commonBaseCls",
")",
"{",
"if",
"(",
"Object",
".",
"class",
"==",
"cls",
")",
"{",
"return",
"emptyType",
";",
"}",
"Type",
"[",
"]",
"cachedTypes",
"=",
"getTypes",
"(",
"cls",
",",
"expectedClass",
",",
"commonBaseCls",
")",
";",
"if",
"(",
"cachedTypes",
"!=",
"null",
")",
"return",
"cachedTypes",
";",
"if",
"(",
"expectedClass",
"!=",
"null",
")",
"{",
"Type",
"genericSuperType",
"=",
"cls",
".",
"getGenericSuperclass",
"(",
")",
";",
"if",
"(",
"genericSuperType",
"instanceof",
"ParameterizedType",
")",
"{",
"Class",
"<",
"?",
">",
"actualType",
"=",
"InjectionUtils",
".",
"getActualType",
"(",
"genericSuperType",
")",
";",
"if",
"(",
"actualType",
"!=",
"null",
"&&",
"actualType",
".",
"isAssignableFrom",
"(",
"expectedClass",
")",
")",
"{",
"Type",
"[",
"]",
"tempTypes",
"=",
"new",
"Type",
"[",
"]",
"{",
"genericSuperType",
"}",
";",
"putTypes",
"(",
"cls",
",",
"expectedClass",
",",
"commonBaseCls",
",",
"tempTypes",
")",
";",
"return",
"tempTypes",
";",
"}",
"else",
"if",
"(",
"commonBaseCls",
"!=",
"null",
"&&",
"commonBaseCls",
"!=",
"Object",
".",
"class",
"&&",
"commonBaseCls",
".",
"isAssignableFrom",
"(",
"expectedClass",
")",
"&&",
"commonBaseCls",
".",
"isAssignableFrom",
"(",
"actualType",
")",
"||",
"expectedClass",
".",
"isAssignableFrom",
"(",
"actualType",
")",
")",
"{",
"putTypes",
"(",
"cls",
",",
"expectedClass",
",",
"commonBaseCls",
",",
"emptyType",
")",
";",
"return",
"emptyType",
";",
"}",
"}",
"}",
"Type",
"[",
"]",
"types",
"=",
"cls",
".",
"getGenericInterfaces",
"(",
")",
";",
"if",
"(",
"types",
".",
"length",
">",
"0",
")",
"{",
"putTypes",
"(",
"cls",
",",
"expectedClass",
",",
"commonBaseCls",
",",
"types",
")",
";",
"return",
"types",
";",
"}",
"Type",
"[",
"]",
"superGenericTypes",
"=",
"getGenericInterfaces",
"(",
"cls",
".",
"getSuperclass",
"(",
")",
",",
"expectedClass",
",",
"commonBaseCls",
")",
";",
"putTypes",
"(",
"cls",
",",
"expectedClass",
",",
"commonBaseCls",
",",
"superGenericTypes",
")",
";",
"return",
"superGenericTypes",
";",
"}"
] | Add the result to cache before return | [
"Add",
"the",
"result",
"to",
"cache",
"before",
"return"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.org.apache.cxf.cxf.rt.frontend.jaxrs.3.2/src/org/apache/cxf/jaxrs/provider/ProviderFactory.java#L1527-L1560 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.app.manager/src/com/ibm/ws/app/manager/internal/FutureCollectionCompletionListener.java | FutureCollectionCompletionListener.onCompletion | void onCompletion(Collection<ApplicationDependency> dependencies) {
if (!dependencies.isEmpty()) {
for (ApplicationDependency dependency : dependencies) {
dependency.onCompletion(this);
}
}
} | java | void onCompletion(Collection<ApplicationDependency> dependencies) {
if (!dependencies.isEmpty()) {
for (ApplicationDependency dependency : dependencies) {
dependency.onCompletion(this);
}
}
} | [
"void",
"onCompletion",
"(",
"Collection",
"<",
"ApplicationDependency",
">",
"dependencies",
")",
"{",
"if",
"(",
"!",
"dependencies",
".",
"isEmpty",
"(",
")",
")",
"{",
"for",
"(",
"ApplicationDependency",
"dependency",
":",
"dependencies",
")",
"{",
"dependency",
".",
"onCompletion",
"(",
"this",
")",
";",
"}",
"}",
"}"
] | "final Field Semantics". | [
"final",
"Field",
"Semantics",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.app.manager/src/com/ibm/ws/app/manager/internal/FutureCollectionCompletionListener.java#L49-L55 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer/src/com/ibm/ws/ejbcontainer/osgi/internal/naming/EJBJavaColonNamingHelper.java | EJBJavaColonNamingHelper.hasObjectWithPrefix | @Override
public boolean hasObjectWithPrefix(JavaColonNamespace namespace, String name) throws NamingException {
JavaColonNamespaceBindings<EJBBinding> bindings;
boolean result = false;
Lock readLock = null;
ComponentMetaData cmd = null;
try {
// This helper only provides support for java:global, java:app, and java:module
if (namespace == JavaColonNamespace.GLOBAL) {
// Called to ensure that the java:global code path
// is coming from a Java EE thread. If not this will reject this
// method call with the correct Java EE error message.
cmd = getComponentMetaData(namespace, name);
bindings = javaColonGlobalBindings;
readLock = javaColonLock.readLock();
readLock.lock();
} else if (namespace == JavaColonNamespace.APP) {
// Get the ComponentMetaData for the currently active component.
// There is no component name space if there is no active component.
cmd = getComponentMetaData(namespace, name);
bindings = getAppBindingMap(cmd.getModuleMetaData().getApplicationMetaData());
readLock = javaColonLock.readLock();
readLock.lock();
} else if (namespace == JavaColonNamespace.MODULE) {
cmd = getComponentMetaData(namespace, name);
bindings = getModuleBindingMap(cmd.getModuleMetaData());
} else {
bindings = null;
}
result = bindings != null && bindings.hasObjectWithPrefix(name);
} finally {
if (readLock != null) {
readLock.unlock();
}
}
return result;
} | java | @Override
public boolean hasObjectWithPrefix(JavaColonNamespace namespace, String name) throws NamingException {
JavaColonNamespaceBindings<EJBBinding> bindings;
boolean result = false;
Lock readLock = null;
ComponentMetaData cmd = null;
try {
// This helper only provides support for java:global, java:app, and java:module
if (namespace == JavaColonNamespace.GLOBAL) {
// Called to ensure that the java:global code path
// is coming from a Java EE thread. If not this will reject this
// method call with the correct Java EE error message.
cmd = getComponentMetaData(namespace, name);
bindings = javaColonGlobalBindings;
readLock = javaColonLock.readLock();
readLock.lock();
} else if (namespace == JavaColonNamespace.APP) {
// Get the ComponentMetaData for the currently active component.
// There is no component name space if there is no active component.
cmd = getComponentMetaData(namespace, name);
bindings = getAppBindingMap(cmd.getModuleMetaData().getApplicationMetaData());
readLock = javaColonLock.readLock();
readLock.lock();
} else if (namespace == JavaColonNamespace.MODULE) {
cmd = getComponentMetaData(namespace, name);
bindings = getModuleBindingMap(cmd.getModuleMetaData());
} else {
bindings = null;
}
result = bindings != null && bindings.hasObjectWithPrefix(name);
} finally {
if (readLock != null) {
readLock.unlock();
}
}
return result;
} | [
"@",
"Override",
"public",
"boolean",
"hasObjectWithPrefix",
"(",
"JavaColonNamespace",
"namespace",
",",
"String",
"name",
")",
"throws",
"NamingException",
"{",
"JavaColonNamespaceBindings",
"<",
"EJBBinding",
">",
"bindings",
";",
"boolean",
"result",
"=",
"false",
";",
"Lock",
"readLock",
"=",
"null",
";",
"ComponentMetaData",
"cmd",
"=",
"null",
";",
"try",
"{",
"// This helper only provides support for java:global, java:app, and java:module",
"if",
"(",
"namespace",
"==",
"JavaColonNamespace",
".",
"GLOBAL",
")",
"{",
"// Called to ensure that the java:global code path",
"// is coming from a Java EE thread. If not this will reject this",
"// method call with the correct Java EE error message.",
"cmd",
"=",
"getComponentMetaData",
"(",
"namespace",
",",
"name",
")",
";",
"bindings",
"=",
"javaColonGlobalBindings",
";",
"readLock",
"=",
"javaColonLock",
".",
"readLock",
"(",
")",
";",
"readLock",
".",
"lock",
"(",
")",
";",
"}",
"else",
"if",
"(",
"namespace",
"==",
"JavaColonNamespace",
".",
"APP",
")",
"{",
"// Get the ComponentMetaData for the currently active component.",
"// There is no component name space if there is no active component.",
"cmd",
"=",
"getComponentMetaData",
"(",
"namespace",
",",
"name",
")",
";",
"bindings",
"=",
"getAppBindingMap",
"(",
"cmd",
".",
"getModuleMetaData",
"(",
")",
".",
"getApplicationMetaData",
"(",
")",
")",
";",
"readLock",
"=",
"javaColonLock",
".",
"readLock",
"(",
")",
";",
"readLock",
".",
"lock",
"(",
")",
";",
"}",
"else",
"if",
"(",
"namespace",
"==",
"JavaColonNamespace",
".",
"MODULE",
")",
"{",
"cmd",
"=",
"getComponentMetaData",
"(",
"namespace",
",",
"name",
")",
";",
"bindings",
"=",
"getModuleBindingMap",
"(",
"cmd",
".",
"getModuleMetaData",
"(",
")",
")",
";",
"}",
"else",
"{",
"bindings",
"=",
"null",
";",
"}",
"result",
"=",
"bindings",
"!=",
"null",
"&&",
"bindings",
".",
"hasObjectWithPrefix",
"(",
"name",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"readLock",
"!=",
"null",
")",
"{",
"readLock",
".",
"unlock",
"(",
")",
";",
"}",
"}",
"return",
"result",
";",
"}"
] | can suppress warning - if cmd is null NamingException will be thrown by getComponentMetaData | [
"can",
"suppress",
"warning",
"-",
"if",
"cmd",
"is",
"null",
"NamingException",
"will",
"be",
"thrown",
"by",
"getComponentMetaData"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer/src/com/ibm/ws/ejbcontainer/osgi/internal/naming/EJBJavaColonNamingHelper.java#L295-L338 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer/src/com/ibm/ws/ejbcontainer/osgi/internal/naming/EJBJavaColonNamingHelper.java | EJBJavaColonNamingHelper.removeGlobalBindings | public void removeGlobalBindings(List<String> names) {
Lock writeLock = javaColonLock.writeLock();
writeLock.lock();
try {
for (String name : names) {
javaColonGlobalBindings.unbind(name);
}
} finally {
writeLock.unlock();
}
} | java | public void removeGlobalBindings(List<String> names) {
Lock writeLock = javaColonLock.writeLock();
writeLock.lock();
try {
for (String name : names) {
javaColonGlobalBindings.unbind(name);
}
} finally {
writeLock.unlock();
}
} | [
"public",
"void",
"removeGlobalBindings",
"(",
"List",
"<",
"String",
">",
"names",
")",
"{",
"Lock",
"writeLock",
"=",
"javaColonLock",
".",
"writeLock",
"(",
")",
";",
"writeLock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"for",
"(",
"String",
"name",
":",
"names",
")",
"{",
"javaColonGlobalBindings",
".",
"unbind",
"(",
"name",
")",
";",
"}",
"}",
"finally",
"{",
"writeLock",
".",
"unlock",
"(",
")",
";",
"}",
"}"
] | Remove names from the global mapping.
@param names List of names to remove. | [
"Remove",
"names",
"from",
"the",
"global",
"mapping",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer/src/com/ibm/ws/ejbcontainer/osgi/internal/naming/EJBJavaColonNamingHelper.java#L363-L374 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer/src/com/ibm/ws/ejbcontainer/osgi/internal/naming/EJBJavaColonNamingHelper.java | EJBJavaColonNamingHelper.getAppBindingMap | private JavaColonNamespaceBindings<EJBBinding> getAppBindingMap(ApplicationMetaData amd) {
@SuppressWarnings("unchecked")
JavaColonNamespaceBindings<EJBBinding> bindingMap = (JavaColonNamespaceBindings<EJBBinding>) amd.getMetaData(amdSlot);
if (bindingMap == null) {
bindingMap = new JavaColonNamespaceBindings<EJBBinding>(NamingConstants.JavaColonNamespace.APP, this);
amd.setMetaData(amdSlot, bindingMap);
}
return bindingMap;
} | java | private JavaColonNamespaceBindings<EJBBinding> getAppBindingMap(ApplicationMetaData amd) {
@SuppressWarnings("unchecked")
JavaColonNamespaceBindings<EJBBinding> bindingMap = (JavaColonNamespaceBindings<EJBBinding>) amd.getMetaData(amdSlot);
if (bindingMap == null) {
bindingMap = new JavaColonNamespaceBindings<EJBBinding>(NamingConstants.JavaColonNamespace.APP, this);
amd.setMetaData(amdSlot, bindingMap);
}
return bindingMap;
} | [
"private",
"JavaColonNamespaceBindings",
"<",
"EJBBinding",
">",
"getAppBindingMap",
"(",
"ApplicationMetaData",
"amd",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"JavaColonNamespaceBindings",
"<",
"EJBBinding",
">",
"bindingMap",
"=",
"(",
"JavaColonNamespaceBindings",
"<",
"EJBBinding",
">",
")",
"amd",
".",
"getMetaData",
"(",
"amdSlot",
")",
";",
"if",
"(",
"bindingMap",
"==",
"null",
")",
"{",
"bindingMap",
"=",
"new",
"JavaColonNamespaceBindings",
"<",
"EJBBinding",
">",
"(",
"NamingConstants",
".",
"JavaColonNamespace",
".",
"APP",
",",
"this",
")",
";",
"amd",
".",
"setMetaData",
"(",
"amdSlot",
",",
"bindingMap",
")",
";",
"}",
"return",
"bindingMap",
";",
"}"
] | Get the EJBBinding map from the application meta data. Initialize if it
is null.
@param amd
@return Map for the lookup names and binding object. | [
"Get",
"the",
"EJBBinding",
"map",
"from",
"the",
"application",
"meta",
"data",
".",
"Initialize",
"if",
"it",
"is",
"null",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer/src/com/ibm/ws/ejbcontainer/osgi/internal/naming/EJBJavaColonNamingHelper.java#L417-L425 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer/src/com/ibm/ws/ejbcontainer/osgi/internal/naming/EJBJavaColonNamingHelper.java | EJBJavaColonNamingHelper.getModuleBindingMap | private JavaColonNamespaceBindings<EJBBinding> getModuleBindingMap(ModuleMetaData mmd) {
@SuppressWarnings("unchecked")
JavaColonNamespaceBindings<EJBBinding> bindingMap = (JavaColonNamespaceBindings<EJBBinding>) mmd.getMetaData(mmdSlot);
if (bindingMap == null) {
bindingMap = new JavaColonNamespaceBindings<EJBBinding>(NamingConstants.JavaColonNamespace.MODULE, this);
mmd.setMetaData(mmdSlot, bindingMap);
}
return bindingMap;
} | java | private JavaColonNamespaceBindings<EJBBinding> getModuleBindingMap(ModuleMetaData mmd) {
@SuppressWarnings("unchecked")
JavaColonNamespaceBindings<EJBBinding> bindingMap = (JavaColonNamespaceBindings<EJBBinding>) mmd.getMetaData(mmdSlot);
if (bindingMap == null) {
bindingMap = new JavaColonNamespaceBindings<EJBBinding>(NamingConstants.JavaColonNamespace.MODULE, this);
mmd.setMetaData(mmdSlot, bindingMap);
}
return bindingMap;
} | [
"private",
"JavaColonNamespaceBindings",
"<",
"EJBBinding",
">",
"getModuleBindingMap",
"(",
"ModuleMetaData",
"mmd",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"JavaColonNamespaceBindings",
"<",
"EJBBinding",
">",
"bindingMap",
"=",
"(",
"JavaColonNamespaceBindings",
"<",
"EJBBinding",
">",
")",
"mmd",
".",
"getMetaData",
"(",
"mmdSlot",
")",
";",
"if",
"(",
"bindingMap",
"==",
"null",
")",
"{",
"bindingMap",
"=",
"new",
"JavaColonNamespaceBindings",
"<",
"EJBBinding",
">",
"(",
"NamingConstants",
".",
"JavaColonNamespace",
".",
"MODULE",
",",
"this",
")",
";",
"mmd",
".",
"setMetaData",
"(",
"mmdSlot",
",",
"bindingMap",
")",
";",
"}",
"return",
"bindingMap",
";",
"}"
] | Get the EJBBinding map from the module meta data. Initialize if it
is null.
@param mmd
@return Map for the lookup names and binding object. | [
"Get",
"the",
"EJBBinding",
"map",
"from",
"the",
"module",
"meta",
"data",
".",
"Initialize",
"if",
"it",
"is",
"null",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer/src/com/ibm/ws/ejbcontainer/osgi/internal/naming/EJBJavaColonNamingHelper.java#L434-L442 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer/src/com/ibm/ws/ejbcontainer/osgi/internal/naming/EJBJavaColonNamingHelper.java | EJBJavaColonNamingHelper.removeAppBindings | public void removeAppBindings(ModuleMetaData mmd, List<String> names) {
ApplicationMetaData amd = mmd.getApplicationMetaData();
Lock writeLock = javaColonLock.writeLock();
writeLock.lock();
try {
JavaColonNamespaceBindings<EJBBinding> bindings = getAppBindingMap(amd);
// getAppBindings returns a non-null value
for (String name : names) {
bindings.unbind(name);
}
} finally {
writeLock.unlock();
}
} | java | public void removeAppBindings(ModuleMetaData mmd, List<String> names) {
ApplicationMetaData amd = mmd.getApplicationMetaData();
Lock writeLock = javaColonLock.writeLock();
writeLock.lock();
try {
JavaColonNamespaceBindings<EJBBinding> bindings = getAppBindingMap(amd);
// getAppBindings returns a non-null value
for (String name : names) {
bindings.unbind(name);
}
} finally {
writeLock.unlock();
}
} | [
"public",
"void",
"removeAppBindings",
"(",
"ModuleMetaData",
"mmd",
",",
"List",
"<",
"String",
">",
"names",
")",
"{",
"ApplicationMetaData",
"amd",
"=",
"mmd",
".",
"getApplicationMetaData",
"(",
")",
";",
"Lock",
"writeLock",
"=",
"javaColonLock",
".",
"writeLock",
"(",
")",
";",
"writeLock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"JavaColonNamespaceBindings",
"<",
"EJBBinding",
">",
"bindings",
"=",
"getAppBindingMap",
"(",
"amd",
")",
";",
"// getAppBindings returns a non-null value",
"for",
"(",
"String",
"name",
":",
"names",
")",
"{",
"bindings",
".",
"unbind",
"(",
"name",
")",
";",
"}",
"}",
"finally",
"{",
"writeLock",
".",
"unlock",
"(",
")",
";",
"}",
"}"
] | Remove names from the application mapping. If all the bindings have
been removed for an application, remove the application mapping.
@param moduleMetaData Name of the application being used.
@param names List of names to remove. | [
"Remove",
"names",
"from",
"the",
"application",
"mapping",
".",
"If",
"all",
"the",
"bindings",
"have",
"been",
"removed",
"for",
"an",
"application",
"remove",
"the",
"application",
"mapping",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer/src/com/ibm/ws/ejbcontainer/osgi/internal/naming/EJBJavaColonNamingHelper.java#L451-L469 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer/src/com/ibm/ws/ejbcontainer/osgi/internal/naming/EJBJavaColonNamingHelper.java | EJBJavaColonNamingHelper.throwCannotInstanciateUnsupported | private void throwCannotInstanciateUnsupported(EJBBinding binding,
JavaColonNamespace jndiType,
String lookupName,
String messageId) throws NameNotFoundException {
J2EEName j2eeName = getJ2EEName(binding);
String jndiName = jndiType.toString() + "/" + lookupName;
String msgTxt = Tr.formatMessage(tc, messageId,
binding.interfaceName,
j2eeName.getComponent(),
j2eeName.getModule(),
j2eeName.getApplication(),
jndiName);
throw (new NameNotFoundException(msgTxt));
} | java | private void throwCannotInstanciateUnsupported(EJBBinding binding,
JavaColonNamespace jndiType,
String lookupName,
String messageId) throws NameNotFoundException {
J2EEName j2eeName = getJ2EEName(binding);
String jndiName = jndiType.toString() + "/" + lookupName;
String msgTxt = Tr.formatMessage(tc, messageId,
binding.interfaceName,
j2eeName.getComponent(),
j2eeName.getModule(),
j2eeName.getApplication(),
jndiName);
throw (new NameNotFoundException(msgTxt));
} | [
"private",
"void",
"throwCannotInstanciateUnsupported",
"(",
"EJBBinding",
"binding",
",",
"JavaColonNamespace",
"jndiType",
",",
"String",
"lookupName",
",",
"String",
"messageId",
")",
"throws",
"NameNotFoundException",
"{",
"J2EEName",
"j2eeName",
"=",
"getJ2EEName",
"(",
"binding",
")",
";",
"String",
"jndiName",
"=",
"jndiType",
".",
"toString",
"(",
")",
"+",
"\"/\"",
"+",
"lookupName",
";",
"String",
"msgTxt",
"=",
"Tr",
".",
"formatMessage",
"(",
"tc",
",",
"messageId",
",",
"binding",
".",
"interfaceName",
",",
"j2eeName",
".",
"getComponent",
"(",
")",
",",
"j2eeName",
".",
"getModule",
"(",
")",
",",
"j2eeName",
".",
"getApplication",
"(",
")",
",",
"jndiName",
")",
";",
"throw",
"(",
"new",
"NameNotFoundException",
"(",
"msgTxt",
")",
")",
";",
"}"
] | Internal method to throw a NameNotFoundException for unsupported
Home and Remote interfaces.
@param binding
@param jndiType
@param lookupName
@param cmd
@param messageId
@throws NameNotFoundException | [
"Internal",
"method",
"to",
"throw",
"a",
"NameNotFoundException",
"for",
"unsupported",
"Home",
"and",
"Remote",
"interfaces",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer/src/com/ibm/ws/ejbcontainer/osgi/internal/naming/EJBJavaColonNamingHelper.java#L566-L579 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jmx.connector.server.rest/src/com/ibm/ws/jmx/connector/server/rest/RESTAppListener.java | RESTAppListener.unsetVirtualHost | protected void unsetVirtualHost(VirtualHost vhost) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Unset vhost: ", vhost);
}
secureVirtualHost = null;
} | java | protected void unsetVirtualHost(VirtualHost vhost) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Unset vhost: ", vhost);
}
secureVirtualHost = null;
} | [
"protected",
"void",
"unsetVirtualHost",
"(",
"VirtualHost",
"vhost",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"event",
"(",
"tc",
",",
"\"Unset vhost: \"",
",",
"vhost",
")",
";",
"}",
"secureVirtualHost",
"=",
"null",
";",
"}"
] | Unset required VirtualHost. This will be called after deactivate | [
"Unset",
"required",
"VirtualHost",
".",
"This",
"will",
"be",
"called",
"after",
"deactivate"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jmx.connector.server.rest/src/com/ibm/ws/jmx/connector/server/rest/RESTAppListener.java#L153-L158 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jmx.connector.server.rest/src/com/ibm/ws/jmx/connector/server/rest/RESTAppListener.java | RESTAppListener.createJMXWorkAreaResourceIfChanged | private synchronized void createJMXWorkAreaResourceIfChanged(VirtualHost vhost) {
// Make sure our context root has been registered...
String contextRoot = registeredContextRoot;
if (contextRoot != null) {
// Make sure that we are dealing with the secure port before writing the file...
String newAppURLString = vhost.getUrlString(contextRoot, true);
if (newAppURLString.startsWith("https")) {
// If we are dealing with the secure port, woohoo!
String oldAppURL = appURL;
String newAppURL = processContextRootURL(newAppURLString);
if (oldAppURL == null || !oldAppURL.equals(newAppURL)) {
this.appURL = newAppURL;
if (restJMXAddressWorkareaFile == null) {
restJMXAddressWorkareaFile = createJMXWorkAreaResource(locationService);
} else {
createJmxAddressResource(restJMXAddressWorkareaFile);
}
if (restJMXAddressStateFile == null) {
restJMXAddressStateFile = createJMXStateResource(locationService);
} else {
createJmxAddressResource(restJMXAddressStateFile);
}
// Register or update a marker service with JMX host/port
Hashtable<String, Object> props = new Hashtable<String, Object>();
props.put("name", "JMXConnectorEndpoint");
props.put("jmxHost", vhost.getHostName(secureAlias));
props.put("jmxPort", vhost.getSecureHttpPort(secureAlias));
props.put("jmxAlias", secureAlias);
if (jmxEndpointRegistration == null)
jmxEndpointRegistration = bContext.registerService(Object.class, this, props);
else
jmxEndpointRegistration.setProperties(props);
}
}
}
} | java | private synchronized void createJMXWorkAreaResourceIfChanged(VirtualHost vhost) {
// Make sure our context root has been registered...
String contextRoot = registeredContextRoot;
if (contextRoot != null) {
// Make sure that we are dealing with the secure port before writing the file...
String newAppURLString = vhost.getUrlString(contextRoot, true);
if (newAppURLString.startsWith("https")) {
// If we are dealing with the secure port, woohoo!
String oldAppURL = appURL;
String newAppURL = processContextRootURL(newAppURLString);
if (oldAppURL == null || !oldAppURL.equals(newAppURL)) {
this.appURL = newAppURL;
if (restJMXAddressWorkareaFile == null) {
restJMXAddressWorkareaFile = createJMXWorkAreaResource(locationService);
} else {
createJmxAddressResource(restJMXAddressWorkareaFile);
}
if (restJMXAddressStateFile == null) {
restJMXAddressStateFile = createJMXStateResource(locationService);
} else {
createJmxAddressResource(restJMXAddressStateFile);
}
// Register or update a marker service with JMX host/port
Hashtable<String, Object> props = new Hashtable<String, Object>();
props.put("name", "JMXConnectorEndpoint");
props.put("jmxHost", vhost.getHostName(secureAlias));
props.put("jmxPort", vhost.getSecureHttpPort(secureAlias));
props.put("jmxAlias", secureAlias);
if (jmxEndpointRegistration == null)
jmxEndpointRegistration = bContext.registerService(Object.class, this, props);
else
jmxEndpointRegistration.setProperties(props);
}
}
}
} | [
"private",
"synchronized",
"void",
"createJMXWorkAreaResourceIfChanged",
"(",
"VirtualHost",
"vhost",
")",
"{",
"// Make sure our context root has been registered... ",
"String",
"contextRoot",
"=",
"registeredContextRoot",
";",
"if",
"(",
"contextRoot",
"!=",
"null",
")",
"{",
"// Make sure that we are dealing with the secure port before writing the file...",
"String",
"newAppURLString",
"=",
"vhost",
".",
"getUrlString",
"(",
"contextRoot",
",",
"true",
")",
";",
"if",
"(",
"newAppURLString",
".",
"startsWith",
"(",
"\"https\"",
")",
")",
"{",
"// If we are dealing with the secure port, woohoo!",
"String",
"oldAppURL",
"=",
"appURL",
";",
"String",
"newAppURL",
"=",
"processContextRootURL",
"(",
"newAppURLString",
")",
";",
"if",
"(",
"oldAppURL",
"==",
"null",
"||",
"!",
"oldAppURL",
".",
"equals",
"(",
"newAppURL",
")",
")",
"{",
"this",
".",
"appURL",
"=",
"newAppURL",
";",
"if",
"(",
"restJMXAddressWorkareaFile",
"==",
"null",
")",
"{",
"restJMXAddressWorkareaFile",
"=",
"createJMXWorkAreaResource",
"(",
"locationService",
")",
";",
"}",
"else",
"{",
"createJmxAddressResource",
"(",
"restJMXAddressWorkareaFile",
")",
";",
"}",
"if",
"(",
"restJMXAddressStateFile",
"==",
"null",
")",
"{",
"restJMXAddressStateFile",
"=",
"createJMXStateResource",
"(",
"locationService",
")",
";",
"}",
"else",
"{",
"createJmxAddressResource",
"(",
"restJMXAddressStateFile",
")",
";",
"}",
"// Register or update a marker service with JMX host/port",
"Hashtable",
"<",
"String",
",",
"Object",
">",
"props",
"=",
"new",
"Hashtable",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"props",
".",
"put",
"(",
"\"name\"",
",",
"\"JMXConnectorEndpoint\"",
")",
";",
"props",
".",
"put",
"(",
"\"jmxHost\"",
",",
"vhost",
".",
"getHostName",
"(",
"secureAlias",
")",
")",
";",
"props",
".",
"put",
"(",
"\"jmxPort\"",
",",
"vhost",
".",
"getSecureHttpPort",
"(",
"secureAlias",
")",
")",
";",
"props",
".",
"put",
"(",
"\"jmxAlias\"",
",",
"secureAlias",
")",
";",
"if",
"(",
"jmxEndpointRegistration",
"==",
"null",
")",
"jmxEndpointRegistration",
"=",
"bContext",
".",
"registerService",
"(",
"Object",
".",
"class",
",",
"this",
",",
"props",
")",
";",
"else",
"jmxEndpointRegistration",
".",
"setProperties",
"(",
"props",
")",
";",
"}",
"}",
"}",
"}"
] | Called to create the work area resource. Only re-generate the file
if this is the first time or something in the url has changed.
@param appPath standard url path received from the virtual host | [
"Called",
"to",
"create",
"the",
"work",
"area",
"resource",
".",
"Only",
"re",
"-",
"generate",
"the",
"file",
"if",
"this",
"is",
"the",
"first",
"time",
"or",
"something",
"in",
"the",
"url",
"has",
"changed",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jmx.connector.server.rest/src/com/ibm/ws/jmx/connector/server/rest/RESTAppListener.java#L166-L204 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jmx.connector.server.rest/src/com/ibm/ws/jmx/connector/server/rest/RESTAppListener.java | RESTAppListener.setLocationService | @Reference(service = WsLocationAdmin.class,
policy = ReferencePolicy.DYNAMIC,
cardinality = ReferenceCardinality.MANDATORY)
protected void setLocationService(WsLocationAdmin locationService) {
this.locationService = locationService;
if (restJMXAddressWorkareaFile == null) {
restJMXAddressWorkareaFile = createJMXWorkAreaResource(locationService);
}
if (restJMXAddressStateFile == null) {
restJMXAddressStateFile = createJMXStateResource(locationService);
}
} | java | @Reference(service = WsLocationAdmin.class,
policy = ReferencePolicy.DYNAMIC,
cardinality = ReferenceCardinality.MANDATORY)
protected void setLocationService(WsLocationAdmin locationService) {
this.locationService = locationService;
if (restJMXAddressWorkareaFile == null) {
restJMXAddressWorkareaFile = createJMXWorkAreaResource(locationService);
}
if (restJMXAddressStateFile == null) {
restJMXAddressStateFile = createJMXStateResource(locationService);
}
} | [
"@",
"Reference",
"(",
"service",
"=",
"WsLocationAdmin",
".",
"class",
",",
"policy",
"=",
"ReferencePolicy",
".",
"DYNAMIC",
",",
"cardinality",
"=",
"ReferenceCardinality",
".",
"MANDATORY",
")",
"protected",
"void",
"setLocationService",
"(",
"WsLocationAdmin",
"locationService",
")",
"{",
"this",
".",
"locationService",
"=",
"locationService",
";",
"if",
"(",
"restJMXAddressWorkareaFile",
"==",
"null",
")",
"{",
"restJMXAddressWorkareaFile",
"=",
"createJMXWorkAreaResource",
"(",
"locationService",
")",
";",
"}",
"if",
"(",
"restJMXAddressStateFile",
"==",
"null",
")",
"{",
"restJMXAddressStateFile",
"=",
"createJMXStateResource",
"(",
"locationService",
")",
";",
"}",
"}"
] | Set the dynamic reference to the WsLocationAdmin service.
If the service is replaced, the new service will be set before
the old is removed.
@param locationService | [
"Set",
"the",
"dynamic",
"reference",
"to",
"the",
"WsLocationAdmin",
"service",
".",
"If",
"the",
"service",
"is",
"replaced",
"the",
"new",
"service",
"will",
"be",
"set",
"before",
"the",
"old",
"is",
"removed",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jmx.connector.server.rest/src/com/ibm/ws/jmx/connector/server/rest/RESTAppListener.java#L234-L245 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jca/src/com/ibm/ws/jca/service/ConnectionFactoryService.java | ConnectionFactoryService.getConnectionFactoryInterfaceNames | public final List<String> getConnectionFactoryInterfaceNames() {
return cfInterfaceNames instanceof String ? Collections.singletonList((String) cfInterfaceNames) //
: cfInterfaceNames instanceof String[] ? Arrays.asList((String[]) cfInterfaceNames) //
: Collections.<String> emptyList();
} | java | public final List<String> getConnectionFactoryInterfaceNames() {
return cfInterfaceNames instanceof String ? Collections.singletonList((String) cfInterfaceNames) //
: cfInterfaceNames instanceof String[] ? Arrays.asList((String[]) cfInterfaceNames) //
: Collections.<String> emptyList();
} | [
"public",
"final",
"List",
"<",
"String",
">",
"getConnectionFactoryInterfaceNames",
"(",
")",
"{",
"return",
"cfInterfaceNames",
"instanceof",
"String",
"?",
"Collections",
".",
"singletonList",
"(",
"(",
"String",
")",
"cfInterfaceNames",
")",
"//",
":",
"cfInterfaceNames",
"instanceof",
"String",
"[",
"]",
"?",
"Arrays",
".",
"asList",
"(",
"(",
"String",
"[",
"]",
")",
"cfInterfaceNames",
")",
"//",
":",
"Collections",
".",
"<",
"String",
">",
"emptyList",
"(",
")",
";",
"}"
] | This method is provided for the connection factory validator.
@return list of fully qualified names of the connection factory interfaces that this resource factory creates. | [
"This",
"method",
"is",
"provided",
"for",
"the",
"connection",
"factory",
"validator",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca/src/com/ibm/ws/jca/service/ConnectionFactoryService.java#L216-L220 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jca/src/com/ibm/ws/jca/service/ConnectionFactoryService.java | ConnectionFactoryService.destroyConnectionFactories | private void destroyConnectionFactories(boolean destroyImmediately) {
lock.writeLock().lock();
try {
if (isInitialized.get()) {
// Mark all connection factories as disabled
isInitialized.set(false);
// Destroy the connection factories
conMgrSvc.deleteObserver(this);
conMgrSvc.destroyConnectionFactories();
conMgrSvc = null;
}
} finally {
lock.writeLock().unlock();
}
} | java | private void destroyConnectionFactories(boolean destroyImmediately) {
lock.writeLock().lock();
try {
if (isInitialized.get()) {
// Mark all connection factories as disabled
isInitialized.set(false);
// Destroy the connection factories
conMgrSvc.deleteObserver(this);
conMgrSvc.destroyConnectionFactories();
conMgrSvc = null;
}
} finally {
lock.writeLock().unlock();
}
} | [
"private",
"void",
"destroyConnectionFactories",
"(",
"boolean",
"destroyImmediately",
")",
"{",
"lock",
".",
"writeLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"isInitialized",
".",
"get",
"(",
")",
")",
"{",
"// Mark all connection factories as disabled",
"isInitialized",
".",
"set",
"(",
"false",
")",
";",
"// Destroy the connection factories",
"conMgrSvc",
".",
"deleteObserver",
"(",
"this",
")",
";",
"conMgrSvc",
".",
"destroyConnectionFactories",
"(",
")",
";",
"conMgrSvc",
"=",
"null",
";",
"}",
"}",
"finally",
"{",
"lock",
".",
"writeLock",
"(",
")",
".",
"unlock",
"(",
")",
";",
"}",
"}"
] | Utility method to destroy connection factory instances.
@param destroyImmediately indicates to immediately destroy instead of deferring to later. | [
"Utility",
"method",
"to",
"destroy",
"connection",
"factory",
"instances",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca/src/com/ibm/ws/jca/service/ConnectionFactoryService.java#L248-L265 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jca/src/com/ibm/ws/jca/service/ConnectionFactoryService.java | ConnectionFactoryService.getReauthenticationSupport | @Override
@Trivial
public boolean getReauthenticationSupport() {
return Boolean.TRUE.equals(bootstrapContextRef.getReference().getProperty(REAUTHENTICATION_SUPPORT));
} | java | @Override
@Trivial
public boolean getReauthenticationSupport() {
return Boolean.TRUE.equals(bootstrapContextRef.getReference().getProperty(REAUTHENTICATION_SUPPORT));
} | [
"@",
"Override",
"@",
"Trivial",
"public",
"boolean",
"getReauthenticationSupport",
"(",
")",
"{",
"return",
"Boolean",
".",
"TRUE",
".",
"equals",
"(",
"bootstrapContextRef",
".",
"getReference",
"(",
")",
".",
"getProperty",
"(",
"REAUTHENTICATION_SUPPORT",
")",
")",
";",
"}"
] | Indicates whether or not reauthentication of connections is enabled.
@return true if reauthentication of connections is enabled. Otherwise false. | [
"Indicates",
"whether",
"or",
"not",
"reauthentication",
"of",
"connections",
"is",
"enabled",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca/src/com/ibm/ws/jca/service/ConnectionFactoryService.java#L320-L324 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jca/src/com/ibm/ws/jca/service/ConnectionFactoryService.java | ConnectionFactoryService.getTransactionSupport | @Override
public TransactionSupportLevel getTransactionSupport() {
// If ManagedConnectionFactory implements TransactionSupport, that takes priority
TransactionSupportLevel transactionSupport = mcf instanceof TransactionSupport ? ((TransactionSupport) mcf).getTransactionSupport() : null;
// Otherwise get the value from the deployment descriptor
String prop = (String) bootstrapContextRef.getReference().getProperty(TRANSACTION_SUPPORT);
if (prop != null) {
TransactionSupportLevel ddTransactionSupport = TransactionSupportLevel.valueOf(prop);
if (transactionSupport == null)
transactionSupport = ddTransactionSupport;
else if (transactionSupport.ordinal() > ddTransactionSupport.ordinal())
throw new IllegalArgumentException(ManagedConnectionFactory.class.getName() + ':' + transactionSupport
+ ", " + Connector.class.getName() + ':' + ddTransactionSupport);
}
if (connectionFactoryTransactionSupport != null) {
if (connectionFactoryTransactionSupport.ordinal() > transactionSupport.ordinal())
throw new IllegalArgumentException(ManagedConnectionFactory.class.getName() + ':' + transactionSupport
+ ", " + Connector.class.getName() + ':' + connectionFactoryTransactionSupport);
else
transactionSupport = connectionFactoryTransactionSupport;
}
// Otherwise choose NoTransaction
return transactionSupport == null ? TransactionSupportLevel.NoTransaction : transactionSupport;
} | java | @Override
public TransactionSupportLevel getTransactionSupport() {
// If ManagedConnectionFactory implements TransactionSupport, that takes priority
TransactionSupportLevel transactionSupport = mcf instanceof TransactionSupport ? ((TransactionSupport) mcf).getTransactionSupport() : null;
// Otherwise get the value from the deployment descriptor
String prop = (String) bootstrapContextRef.getReference().getProperty(TRANSACTION_SUPPORT);
if (prop != null) {
TransactionSupportLevel ddTransactionSupport = TransactionSupportLevel.valueOf(prop);
if (transactionSupport == null)
transactionSupport = ddTransactionSupport;
else if (transactionSupport.ordinal() > ddTransactionSupport.ordinal())
throw new IllegalArgumentException(ManagedConnectionFactory.class.getName() + ':' + transactionSupport
+ ", " + Connector.class.getName() + ':' + ddTransactionSupport);
}
if (connectionFactoryTransactionSupport != null) {
if (connectionFactoryTransactionSupport.ordinal() > transactionSupport.ordinal())
throw new IllegalArgumentException(ManagedConnectionFactory.class.getName() + ':' + transactionSupport
+ ", " + Connector.class.getName() + ':' + connectionFactoryTransactionSupport);
else
transactionSupport = connectionFactoryTransactionSupport;
}
// Otherwise choose NoTransaction
return transactionSupport == null ? TransactionSupportLevel.NoTransaction : transactionSupport;
} | [
"@",
"Override",
"public",
"TransactionSupportLevel",
"getTransactionSupport",
"(",
")",
"{",
"// If ManagedConnectionFactory implements TransactionSupport, that takes priority",
"TransactionSupportLevel",
"transactionSupport",
"=",
"mcf",
"instanceof",
"TransactionSupport",
"?",
"(",
"(",
"TransactionSupport",
")",
"mcf",
")",
".",
"getTransactionSupport",
"(",
")",
":",
"null",
";",
"// Otherwise get the value from the deployment descriptor",
"String",
"prop",
"=",
"(",
"String",
")",
"bootstrapContextRef",
".",
"getReference",
"(",
")",
".",
"getProperty",
"(",
"TRANSACTION_SUPPORT",
")",
";",
"if",
"(",
"prop",
"!=",
"null",
")",
"{",
"TransactionSupportLevel",
"ddTransactionSupport",
"=",
"TransactionSupportLevel",
".",
"valueOf",
"(",
"prop",
")",
";",
"if",
"(",
"transactionSupport",
"==",
"null",
")",
"transactionSupport",
"=",
"ddTransactionSupport",
";",
"else",
"if",
"(",
"transactionSupport",
".",
"ordinal",
"(",
")",
">",
"ddTransactionSupport",
".",
"ordinal",
"(",
")",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"ManagedConnectionFactory",
".",
"class",
".",
"getName",
"(",
")",
"+",
"'",
"'",
"+",
"transactionSupport",
"+",
"\", \"",
"+",
"Connector",
".",
"class",
".",
"getName",
"(",
")",
"+",
"'",
"'",
"+",
"ddTransactionSupport",
")",
";",
"}",
"if",
"(",
"connectionFactoryTransactionSupport",
"!=",
"null",
")",
"{",
"if",
"(",
"connectionFactoryTransactionSupport",
".",
"ordinal",
"(",
")",
">",
"transactionSupport",
".",
"ordinal",
"(",
")",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"ManagedConnectionFactory",
".",
"class",
".",
"getName",
"(",
")",
"+",
"'",
"'",
"+",
"transactionSupport",
"+",
"\", \"",
"+",
"Connector",
".",
"class",
".",
"getName",
"(",
")",
"+",
"'",
"'",
"+",
"connectionFactoryTransactionSupport",
")",
";",
"else",
"transactionSupport",
"=",
"connectionFactoryTransactionSupport",
";",
"}",
"// Otherwise choose NoTransaction",
"return",
"transactionSupport",
"==",
"null",
"?",
"TransactionSupportLevel",
".",
"NoTransaction",
":",
"transactionSupport",
";",
"}"
] | Indicates the level of transaction support.
@return constant indicating the transaction support of the resource adapter. | [
"Indicates",
"the",
"level",
"of",
"transaction",
"support",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca/src/com/ibm/ws/jca/service/ConnectionFactoryService.java#L362-L388 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.container.service.compat/src/com/ibm/ws/util/LockFreeIndexedStack.java | LockFreeIndexedStack.clean | public StackNode<E> clean() {
do {
final StackNode<E> oldTop = top.get();
if (top.compareAndSet(oldTop, null))
return oldTop;
} while (true);
} | java | public StackNode<E> clean() {
do {
final StackNode<E> oldTop = top.get();
if (top.compareAndSet(oldTop, null))
return oldTop;
} while (true);
} | [
"public",
"StackNode",
"<",
"E",
">",
"clean",
"(",
")",
"{",
"do",
"{",
"final",
"StackNode",
"<",
"E",
">",
"oldTop",
"=",
"top",
".",
"get",
"(",
")",
";",
"if",
"(",
"top",
".",
"compareAndSet",
"(",
"oldTop",
",",
"null",
")",
")",
"return",
"oldTop",
";",
"}",
"while",
"(",
"true",
")",
";",
"}"
] | Remove all nodes from stack and return the old top node.
@return the old top node, which can be used to iterate over all cleaned
stack elements. | [
"Remove",
"all",
"nodes",
"from",
"stack",
"and",
"return",
"the",
"old",
"top",
"node",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.container.service.compat/src/com/ibm/ws/util/LockFreeIndexedStack.java#L42-L49 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.container.service.compat/src/com/ibm/ws/util/LockFreeIndexedStack.java | LockFreeIndexedStack.pop | public E pop() {
StackNode<E> oldTop, newTop;
while (true) {
oldTop = top.get();
if (oldTop == null)
return null;
newTop = oldTop.next;
if (top.compareAndSet(oldTop, newTop))
break;
}
return oldTop.data;
} | java | public E pop() {
StackNode<E> oldTop, newTop;
while (true) {
oldTop = top.get();
if (oldTop == null)
return null;
newTop = oldTop.next;
if (top.compareAndSet(oldTop, newTop))
break;
}
return oldTop.data;
} | [
"public",
"E",
"pop",
"(",
")",
"{",
"StackNode",
"<",
"E",
">",
"oldTop",
",",
"newTop",
";",
"while",
"(",
"true",
")",
"{",
"oldTop",
"=",
"top",
".",
"get",
"(",
")",
";",
"if",
"(",
"oldTop",
"==",
"null",
")",
"return",
"null",
";",
"newTop",
"=",
"oldTop",
".",
"next",
";",
"if",
"(",
"top",
".",
"compareAndSet",
"(",
"oldTop",
",",
"newTop",
")",
")",
"break",
";",
"}",
"return",
"oldTop",
".",
"data",
";",
"}"
] | Pop data from the Stack.
@return topmost element of the stack, or null if stack is empty. | [
"Pop",
"data",
"from",
"the",
"Stack",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.container.service.compat/src/com/ibm/ws/util/LockFreeIndexedStack.java#L76-L89 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.container.service.compat/src/com/ibm/ws/util/LockFreeIndexedStack.java | LockFreeIndexedStack.push | public void push(E d) {
StackNode<E> oldTop, newTop;
newTop = new StackNode<E>(d);
while (true) {
oldTop = top.get();
newTop.next = oldTop;
if (oldTop != null)
newTop.index = oldTop.index + 1;
else
newTop.index = 0;
if (top.compareAndSet(oldTop, newTop))
return;
}
} | java | public void push(E d) {
StackNode<E> oldTop, newTop;
newTop = new StackNode<E>(d);
while (true) {
oldTop = top.get();
newTop.next = oldTop;
if (oldTop != null)
newTop.index = oldTop.index + 1;
else
newTop.index = 0;
if (top.compareAndSet(oldTop, newTop))
return;
}
} | [
"public",
"void",
"push",
"(",
"E",
"d",
")",
"{",
"StackNode",
"<",
"E",
">",
"oldTop",
",",
"newTop",
";",
"newTop",
"=",
"new",
"StackNode",
"<",
"E",
">",
"(",
"d",
")",
";",
"while",
"(",
"true",
")",
"{",
"oldTop",
"=",
"top",
".",
"get",
"(",
")",
";",
"newTop",
".",
"next",
"=",
"oldTop",
";",
"if",
"(",
"oldTop",
"!=",
"null",
")",
"newTop",
".",
"index",
"=",
"oldTop",
".",
"index",
"+",
"1",
";",
"else",
"newTop",
".",
"index",
"=",
"0",
";",
"if",
"(",
"top",
".",
"compareAndSet",
"(",
"oldTop",
",",
"newTop",
")",
")",
"return",
";",
"}",
"}"
] | Push data onto Stack.
@param d
data to be pushed onto the stack. | [
"Push",
"data",
"onto",
"Stack",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.container.service.compat/src/com/ibm/ws/util/LockFreeIndexedStack.java#L125-L140 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.container.service.compat/src/com/ibm/ws/util/LockFreeIndexedStack.java | LockFreeIndexedStack.peek | public E peek() {
final StackNode<E> oldTop = top.get();
if (oldTop == null) {
return null;
} else {
return oldTop.data;
}
} | java | public E peek() {
final StackNode<E> oldTop = top.get();
if (oldTop == null) {
return null;
} else {
return oldTop.data;
}
} | [
"public",
"E",
"peek",
"(",
")",
"{",
"final",
"StackNode",
"<",
"E",
">",
"oldTop",
"=",
"top",
".",
"get",
"(",
")",
";",
"if",
"(",
"oldTop",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"return",
"oldTop",
".",
"data",
";",
"}",
"}"
] | Return copy of the top data on the Stack
@return copy of top of stack, or null if empty. | [
"Return",
"copy",
"of",
"the",
"top",
"data",
"on",
"the",
"Stack"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.container.service.compat/src/com/ibm/ws/util/LockFreeIndexedStack.java#L204-L211 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/ItemReference.java | ItemReference.setSizeRefsByMsgSize | public void setSizeRefsByMsgSize(boolean sizeByMsgSize)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setSizeRefsByMsgSize", Boolean.valueOf(sizeByMsgSize));
this._sizeRefsByMsgSize = sizeByMsgSize;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setSizeRefsByMsgSize");
} | java | public void setSizeRefsByMsgSize(boolean sizeByMsgSize)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setSizeRefsByMsgSize", Boolean.valueOf(sizeByMsgSize));
this._sizeRefsByMsgSize = sizeByMsgSize;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setSizeRefsByMsgSize");
} | [
"public",
"void",
"setSizeRefsByMsgSize",
"(",
"boolean",
"sizeByMsgSize",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"setSizeRefsByMsgSize\"",
",",
"Boolean",
".",
"valueOf",
"(",
"sizeByMsgSize",
")",
")",
";",
"this",
".",
"_sizeRefsByMsgSize",
"=",
"sizeByMsgSize",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"setSizeRefsByMsgSize\"",
")",
";",
"}"
] | PK57207 Called when adding this reference to a
reference stream when to specify that
sib.msgstore.jdbcSpillSizeRefsByMsgSize has been enabled | [
"PK57207",
"Called",
"when",
"adding",
"this",
"reference",
"to",
"a",
"reference",
"stream",
"when",
"to",
"specify",
"that",
"sib",
".",
"msgstore",
".",
"jdbcSpillSizeRefsByMsgSize",
"has",
"been",
"enabled"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/ItemReference.java#L181-L188 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/ItemReference.java | ItemReference.getInMemoryDataSize | public int getInMemoryDataSize()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getInMemoryDataSize");
int dataSize;
// If tuning has requested return the size of the message we reference,
// then delegate to the message. Otherwise call our parent to get a
// (small) default size.
if (_sizeRefsByMsgSize)
{
try
{
dataSize = getReferredItem().getInMemoryDataSize();
}
catch (SevereMessageStoreException e)
{
com.ibm.ws.ffdc.FFDCFilter.processException(e,"com.ibm.ws.sib.msgstore.ItemReference.getInMemoryDataSize","244",this);
// After FFDCing anything nasty, fall back to the standard answer
dataSize = super.getInMemoryDataSize();
}
}
else
{
dataSize = super.getInMemoryDataSize();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getInMemoryDataSize", dataSize);
return dataSize;
} | java | public int getInMemoryDataSize()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getInMemoryDataSize");
int dataSize;
// If tuning has requested return the size of the message we reference,
// then delegate to the message. Otherwise call our parent to get a
// (small) default size.
if (_sizeRefsByMsgSize)
{
try
{
dataSize = getReferredItem().getInMemoryDataSize();
}
catch (SevereMessageStoreException e)
{
com.ibm.ws.ffdc.FFDCFilter.processException(e,"com.ibm.ws.sib.msgstore.ItemReference.getInMemoryDataSize","244",this);
// After FFDCing anything nasty, fall back to the standard answer
dataSize = super.getInMemoryDataSize();
}
}
else
{
dataSize = super.getInMemoryDataSize();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getInMemoryDataSize", dataSize);
return dataSize;
} | [
"public",
"int",
"getInMemoryDataSize",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"getInMemoryDataSize\"",
")",
";",
"int",
"dataSize",
";",
"// If tuning has requested return the size of the message we reference,",
"// then delegate to the message. Otherwise call our parent to get a",
"// (small) default size.",
"if",
"(",
"_sizeRefsByMsgSize",
")",
"{",
"try",
"{",
"dataSize",
"=",
"getReferredItem",
"(",
")",
".",
"getInMemoryDataSize",
"(",
")",
";",
"}",
"catch",
"(",
"SevereMessageStoreException",
"e",
")",
"{",
"com",
".",
"ibm",
".",
"ws",
".",
"ffdc",
".",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"\"com.ibm.ws.sib.msgstore.ItemReference.getInMemoryDataSize\"",
",",
"\"244\"",
",",
"this",
")",
";",
"// After FFDCing anything nasty, fall back to the standard answer",
"dataSize",
"=",
"super",
".",
"getInMemoryDataSize",
"(",
")",
";",
"}",
"}",
"else",
"{",
"dataSize",
"=",
"super",
".",
"getInMemoryDataSize",
"(",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"getInMemoryDataSize\"",
",",
"dataSize",
")",
";",
"return",
"dataSize",
";",
"}"
] | PK57207 Returns an estimated size for this message reference | [
"PK57207",
"Returns",
"an",
"estimated",
"size",
"for",
"this",
"message",
"reference"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/ItemReference.java#L206-L234 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/transactions/impl/MSDelegatingLocalTransaction.java | MSDelegatingLocalTransaction.begin | public void begin() throws SIIncorrectCallException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "begin");
// Are we currently in use? do we have work
// we still need to commit?
if (_state == TransactionState.STATE_ACTIVE && _workList != null)
{
SIIncorrectCallException ice = new SIIncorrectCallException(nls.getFormattedMessage("TRAN_PROTOCOL_ERROR_SIMS1001", null, "TRAN_PROTOCOL_ERROR_SIMS1001"));
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.event(this, tc, "Cannot begin new LocalTran. Existing work needs completing first!", ice);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "begin");
throw ice;
}
synchronized(this)
{
_ptid = null;
}
_workList = null;
_size = 0;
_callbacks.clear();
_state = TransactionState.STATE_ACTIVE;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "begin");
} | java | public void begin() throws SIIncorrectCallException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "begin");
// Are we currently in use? do we have work
// we still need to commit?
if (_state == TransactionState.STATE_ACTIVE && _workList != null)
{
SIIncorrectCallException ice = new SIIncorrectCallException(nls.getFormattedMessage("TRAN_PROTOCOL_ERROR_SIMS1001", null, "TRAN_PROTOCOL_ERROR_SIMS1001"));
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.event(this, tc, "Cannot begin new LocalTran. Existing work needs completing first!", ice);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "begin");
throw ice;
}
synchronized(this)
{
_ptid = null;
}
_workList = null;
_size = 0;
_callbacks.clear();
_state = TransactionState.STATE_ACTIVE;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "begin");
} | [
"public",
"void",
"begin",
"(",
")",
"throws",
"SIIncorrectCallException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"begin\"",
")",
";",
"// Are we currently in use? do we have work",
"// we still need to commit?",
"if",
"(",
"_state",
"==",
"TransactionState",
".",
"STATE_ACTIVE",
"&&",
"_workList",
"!=",
"null",
")",
"{",
"SIIncorrectCallException",
"ice",
"=",
"new",
"SIIncorrectCallException",
"(",
"nls",
".",
"getFormattedMessage",
"(",
"\"TRAN_PROTOCOL_ERROR_SIMS1001\"",
",",
"null",
",",
"\"TRAN_PROTOCOL_ERROR_SIMS1001\"",
")",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"SibTr",
".",
"event",
"(",
"this",
",",
"tc",
",",
"\"Cannot begin new LocalTran. Existing work needs completing first!\"",
",",
"ice",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"begin\"",
")",
";",
"throw",
"ice",
";",
"}",
"synchronized",
"(",
"this",
")",
"{",
"_ptid",
"=",
"null",
";",
"}",
"_workList",
"=",
"null",
";",
"_size",
"=",
"0",
";",
"_callbacks",
".",
"clear",
"(",
")",
";",
"_state",
"=",
"TransactionState",
".",
"STATE_ACTIVE",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"begin\"",
")",
";",
"}"
] | Begin a new local transaction by readying this object for re-use by the
ItemStream interfaces.
@exception SIIncorrectCallException
Thrown if existing work has not been completed. | [
"Begin",
"a",
"new",
"local",
"transaction",
"by",
"readying",
"this",
"object",
"for",
"re",
"-",
"use",
"by",
"the",
"ItemStream",
"interfaces",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/transactions/impl/MSDelegatingLocalTransaction.java#L236-L263 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/transactions/impl/MSDelegatingLocalTransaction.java | MSDelegatingLocalTransaction.rollback | public void rollback() throws SIIncorrectCallException, SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "rollback");
if (_state != TransactionState.STATE_ACTIVE)
{
SIIncorrectCallException sie = new SIIncorrectCallException(nls.getFormattedMessage("CANNOT_ROLLBACK_COMPLETE_SIMS1005", new Object[]{}, null));
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.event(this, tc, "Cannot rollback Transaction. Transaction is complete or completing!", sie);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "rollback");
throw sie;
}
_state = TransactionState.STATE_ROLLINGBACK;
try
{
// We are rolling back all changes so we don't need
// to tell the persistence layer to do anything we
// just need to get the in memory model to back out
// its changes.
if (_workList != null)
{
_workList.rollback(this);
}
_state = TransactionState.STATE_ROLLEDBACK;
}
catch (Throwable t)
{
com.ibm.ws.ffdc.FFDCFilter.processException(t, "com.ibm.ws.sib.msgstore.transactions.MSDelegatingLocalTransaction.rollback", "1:539:1.51.1.14", this);
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.event(this, tc, "Exception caught during rollback phase of transaction!", t);
throw new SIResourceException(nls.getFormattedMessage("COMPLETION_EXCEPTION_SIMS1002", new Object[] {t}, null), t);
}
finally
{
// We always ensure that all afterCompletion
// callbacks are called even in the case of
// rollback.
// Defect 316887
try
{
if (_workList != null)
{
_workList.postComplete(this, false);
}
for (int i = 0; i < _callbacks.size(); i++)
{
TransactionCallback callback = (TransactionCallback) _callbacks.get(i);
callback.afterCompletion(this, false);
}
}
catch (Throwable t)
{
com.ibm.ws.ffdc.FFDCFilter.processException(t, "com.ibm.ws.sib.msgstore.transactions.MSDelegatingLocalTransaction.rollback", "1:565:1.51.1.14", this);
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.event(this, tc, "Exception caught during post rollback phase of transaction!", t);
// We aren't going to rethrow this exception as if
// a previous exception has been thrown outside the
// finally block it is likely to have more
// information about the root problem.
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "rollback");
}
} | java | public void rollback() throws SIIncorrectCallException, SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "rollback");
if (_state != TransactionState.STATE_ACTIVE)
{
SIIncorrectCallException sie = new SIIncorrectCallException(nls.getFormattedMessage("CANNOT_ROLLBACK_COMPLETE_SIMS1005", new Object[]{}, null));
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.event(this, tc, "Cannot rollback Transaction. Transaction is complete or completing!", sie);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "rollback");
throw sie;
}
_state = TransactionState.STATE_ROLLINGBACK;
try
{
// We are rolling back all changes so we don't need
// to tell the persistence layer to do anything we
// just need to get the in memory model to back out
// its changes.
if (_workList != null)
{
_workList.rollback(this);
}
_state = TransactionState.STATE_ROLLEDBACK;
}
catch (Throwable t)
{
com.ibm.ws.ffdc.FFDCFilter.processException(t, "com.ibm.ws.sib.msgstore.transactions.MSDelegatingLocalTransaction.rollback", "1:539:1.51.1.14", this);
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.event(this, tc, "Exception caught during rollback phase of transaction!", t);
throw new SIResourceException(nls.getFormattedMessage("COMPLETION_EXCEPTION_SIMS1002", new Object[] {t}, null), t);
}
finally
{
// We always ensure that all afterCompletion
// callbacks are called even in the case of
// rollback.
// Defect 316887
try
{
if (_workList != null)
{
_workList.postComplete(this, false);
}
for (int i = 0; i < _callbacks.size(); i++)
{
TransactionCallback callback = (TransactionCallback) _callbacks.get(i);
callback.afterCompletion(this, false);
}
}
catch (Throwable t)
{
com.ibm.ws.ffdc.FFDCFilter.processException(t, "com.ibm.ws.sib.msgstore.transactions.MSDelegatingLocalTransaction.rollback", "1:565:1.51.1.14", this);
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.event(this, tc, "Exception caught during post rollback phase of transaction!", t);
// We aren't going to rethrow this exception as if
// a previous exception has been thrown outside the
// finally block it is likely to have more
// information about the root problem.
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "rollback");
}
} | [
"public",
"void",
"rollback",
"(",
")",
"throws",
"SIIncorrectCallException",
",",
"SIResourceException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"rollback\"",
")",
";",
"if",
"(",
"_state",
"!=",
"TransactionState",
".",
"STATE_ACTIVE",
")",
"{",
"SIIncorrectCallException",
"sie",
"=",
"new",
"SIIncorrectCallException",
"(",
"nls",
".",
"getFormattedMessage",
"(",
"\"CANNOT_ROLLBACK_COMPLETE_SIMS1005\"",
",",
"new",
"Object",
"[",
"]",
"{",
"}",
",",
"null",
")",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"SibTr",
".",
"event",
"(",
"this",
",",
"tc",
",",
"\"Cannot rollback Transaction. Transaction is complete or completing!\"",
",",
"sie",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"rollback\"",
")",
";",
"throw",
"sie",
";",
"}",
"_state",
"=",
"TransactionState",
".",
"STATE_ROLLINGBACK",
";",
"try",
"{",
"// We are rolling back all changes so we don't need",
"// to tell the persistence layer to do anything we",
"// just need to get the in memory model to back out",
"// its changes.",
"if",
"(",
"_workList",
"!=",
"null",
")",
"{",
"_workList",
".",
"rollback",
"(",
"this",
")",
";",
"}",
"_state",
"=",
"TransactionState",
".",
"STATE_ROLLEDBACK",
";",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"com",
".",
"ibm",
".",
"ws",
".",
"ffdc",
".",
"FFDCFilter",
".",
"processException",
"(",
"t",
",",
"\"com.ibm.ws.sib.msgstore.transactions.MSDelegatingLocalTransaction.rollback\"",
",",
"\"1:539:1.51.1.14\"",
",",
"this",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"SibTr",
".",
"event",
"(",
"this",
",",
"tc",
",",
"\"Exception caught during rollback phase of transaction!\"",
",",
"t",
")",
";",
"throw",
"new",
"SIResourceException",
"(",
"nls",
".",
"getFormattedMessage",
"(",
"\"COMPLETION_EXCEPTION_SIMS1002\"",
",",
"new",
"Object",
"[",
"]",
"{",
"t",
"}",
",",
"null",
")",
",",
"t",
")",
";",
"}",
"finally",
"{",
"// We always ensure that all afterCompletion",
"// callbacks are called even in the case of",
"// rollback.",
"// Defect 316887",
"try",
"{",
"if",
"(",
"_workList",
"!=",
"null",
")",
"{",
"_workList",
".",
"postComplete",
"(",
"this",
",",
"false",
")",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"_callbacks",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"TransactionCallback",
"callback",
"=",
"(",
"TransactionCallback",
")",
"_callbacks",
".",
"get",
"(",
"i",
")",
";",
"callback",
".",
"afterCompletion",
"(",
"this",
",",
"false",
")",
";",
"}",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"com",
".",
"ibm",
".",
"ws",
".",
"ffdc",
".",
"FFDCFilter",
".",
"processException",
"(",
"t",
",",
"\"com.ibm.ws.sib.msgstore.transactions.MSDelegatingLocalTransaction.rollback\"",
",",
"\"1:565:1.51.1.14\"",
",",
"this",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"SibTr",
".",
"event",
"(",
"this",
",",
"tc",
",",
"\"Exception caught during post rollback phase of transaction!\"",
",",
"t",
")",
";",
"// We aren't going to rethrow this exception as if",
"// a previous exception has been thrown outside the",
"// finally block it is likely to have more",
"// information about the root problem.",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"rollback\"",
")",
";",
"}",
"}"
] | Rollback all work associated with this local transaction.
@exception SIIncorrectCallException
Thrown if this transaction has already been completed.
@exception SIResourceException
Thrown if an unknown MessageStore error occurs. | [
"Rollback",
"all",
"work",
"associated",
"with",
"this",
"local",
"transaction",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/transactions/impl/MSDelegatingLocalTransaction.java#L447-L512 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/InjectionEngineAccessor.java | InjectionEngineAccessor.setInjectionEngine | static void setInjectionEngine(InternalInjectionEngine ie)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "setInjectionEngine : " + ie);
svInstance = ie;
} | java | static void setInjectionEngine(InternalInjectionEngine ie)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "setInjectionEngine : " + ie);
svInstance = ie;
} | [
"static",
"void",
"setInjectionEngine",
"(",
"InternalInjectionEngine",
"ie",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"setInjectionEngine : \"",
"+",
"ie",
")",
";",
"svInstance",
"=",
"ie",
";",
"}"
] | F46994.2 | [
"F46994",
".",
"2"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/InjectionEngineAccessor.java#L70-L75 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/jitdeploy/CORBA_Utils.java | CORBA_Utils.isRemoteable | public static boolean isRemoteable(Class<?> valueClass, int rmicCompatible) {
// NOTE: This logic must be kept in sync with write_value.
return valueClass.isInterface() &&
valueClass != Serializable.class &&
valueClass != Externalizable.class &&
(isCORBAObject(valueClass, rmicCompatible) ||
Remote.class.isAssignableFrom(valueClass) ||
isAbstractInterface(valueClass, rmicCompatible));
} | java | public static boolean isRemoteable(Class<?> valueClass, int rmicCompatible) {
// NOTE: This logic must be kept in sync with write_value.
return valueClass.isInterface() &&
valueClass != Serializable.class &&
valueClass != Externalizable.class &&
(isCORBAObject(valueClass, rmicCompatible) ||
Remote.class.isAssignableFrom(valueClass) ||
isAbstractInterface(valueClass, rmicCompatible));
} | [
"public",
"static",
"boolean",
"isRemoteable",
"(",
"Class",
"<",
"?",
">",
"valueClass",
",",
"int",
"rmicCompatible",
")",
"{",
"// NOTE: This logic must be kept in sync with write_value.",
"return",
"valueClass",
".",
"isInterface",
"(",
")",
"&&",
"valueClass",
"!=",
"Serializable",
".",
"class",
"&&",
"valueClass",
"!=",
"Externalizable",
".",
"class",
"&&",
"(",
"isCORBAObject",
"(",
"valueClass",
",",
"rmicCompatible",
")",
"||",
"Remote",
".",
"class",
".",
"isAssignableFrom",
"(",
"valueClass",
")",
"||",
"isAbstractInterface",
"(",
"valueClass",
",",
"rmicCompatible",
")",
")",
";",
"}"
] | Determines whether a value of the specified type could be a remote
object reference. This should return true if read_Object or
read_abstract_interface is used for this type.
@param clazz class for a method parameter or return type
that needs to be read from an input stream
@param rmicCompatible rmic compatibility flags
@return true if a stub is needed | [
"Determines",
"whether",
"a",
"value",
"of",
"the",
"specified",
"type",
"could",
"be",
"a",
"remote",
"object",
"reference",
".",
"This",
"should",
"return",
"true",
"if",
"read_Object",
"or",
"read_abstract_interface",
"is",
"used",
"for",
"this",
"type",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/jitdeploy/CORBA_Utils.java#L268-L277 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.injection/src/com/ibm/ws/injectionengine/osgi/util/JNDIHelper.java | JNDIHelper.hasJNDIScheme | public static boolean hasJNDIScheme(String jndiName) {
int colonIndex = jndiName.indexOf(':');
int slashIndex = jndiName.indexOf('/');
return colonIndex != -1 && (slashIndex == -1 || colonIndex < slashIndex);
} | java | public static boolean hasJNDIScheme(String jndiName) {
int colonIndex = jndiName.indexOf(':');
int slashIndex = jndiName.indexOf('/');
return colonIndex != -1 && (slashIndex == -1 || colonIndex < slashIndex);
} | [
"public",
"static",
"boolean",
"hasJNDIScheme",
"(",
"String",
"jndiName",
")",
"{",
"int",
"colonIndex",
"=",
"jndiName",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"int",
"slashIndex",
"=",
"jndiName",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"return",
"colonIndex",
"!=",
"-",
"1",
"&&",
"(",
"slashIndex",
"==",
"-",
"1",
"||",
"colonIndex",
"<",
"slashIndex",
")",
";",
"}"
] | Return true if a JNDI name has a scheme. | [
"Return",
"true",
"if",
"a",
"JNDI",
"name",
"has",
"a",
"scheme",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.injection/src/com/ibm/ws/injectionengine/osgi/util/JNDIHelper.java#L20-L24 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/wsspi/http/channel/compression/GzipOutputHandler.java | GzipOutputHandler.writeHeader | private List<WsByteBuffer> writeHeader(List<WsByteBuffer> list) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Writing gzip header information");
}
WsByteBuffer hdr = HttpDispatcher.getBufferManager().allocateDirect(GZIP_Header.length);
hdr.put(GZIP_Header);
hdr.flip();
list.add(hdr);
this.haveWrittenHeader = true;
return list;
} | java | private List<WsByteBuffer> writeHeader(List<WsByteBuffer> list) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Writing gzip header information");
}
WsByteBuffer hdr = HttpDispatcher.getBufferManager().allocateDirect(GZIP_Header.length);
hdr.put(GZIP_Header);
hdr.flip();
list.add(hdr);
this.haveWrittenHeader = true;
return list;
} | [
"private",
"List",
"<",
"WsByteBuffer",
">",
"writeHeader",
"(",
"List",
"<",
"WsByteBuffer",
">",
"list",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Writing gzip header information\"",
")",
";",
"}",
"WsByteBuffer",
"hdr",
"=",
"HttpDispatcher",
".",
"getBufferManager",
"(",
")",
".",
"allocateDirect",
"(",
"GZIP_Header",
".",
"length",
")",
";",
"hdr",
".",
"put",
"(",
"GZIP_Header",
")",
";",
"hdr",
".",
"flip",
"(",
")",
";",
"list",
".",
"add",
"(",
"hdr",
")",
";",
"this",
".",
"haveWrittenHeader",
"=",
"true",
";",
"return",
"list",
";",
"}"
] | Write the gzip header onto the output list.
@param list
@return List<WsByteBuffer> | [
"Write",
"the",
"gzip",
"header",
"onto",
"the",
"output",
"list",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/wsspi/http/channel/compression/GzipOutputHandler.java#L78-L88 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/wsspi/http/channel/compression/GzipOutputHandler.java | GzipOutputHandler.makeBuffer | private WsByteBuffer makeBuffer(int len) {
WsByteBuffer buffer = HttpDispatcher.getBufferManager().allocateDirect(len);
buffer.put(this.buf, 0, len);
buffer.flip();
return buffer;
} | java | private WsByteBuffer makeBuffer(int len) {
WsByteBuffer buffer = HttpDispatcher.getBufferManager().allocateDirect(len);
buffer.put(this.buf, 0, len);
buffer.flip();
return buffer;
} | [
"private",
"WsByteBuffer",
"makeBuffer",
"(",
"int",
"len",
")",
"{",
"WsByteBuffer",
"buffer",
"=",
"HttpDispatcher",
".",
"getBufferManager",
"(",
")",
".",
"allocateDirect",
"(",
"len",
")",
";",
"buffer",
".",
"put",
"(",
"this",
".",
"buf",
",",
"0",
",",
"len",
")",
";",
"buffer",
".",
"flip",
"(",
")",
";",
"return",
"buffer",
";",
"}"
] | Create the output bytebuffer based on the output compressed storage.
@param len
@return WsByteBuffer | [
"Create",
"the",
"output",
"bytebuffer",
"based",
"on",
"the",
"output",
"compressed",
"storage",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/wsspi/http/channel/compression/GzipOutputHandler.java#L191-L196 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/wsspi/http/channel/compression/GzipOutputHandler.java | GzipOutputHandler.writeInt | private void writeInt(int value, byte[] data, int offset) {
int index = offset;
data[index++] = (byte) (value & 0xff);
data[index++] = (byte) ((value >> 8) & 0xff);
data[index++] = (byte) ((value >> 16) & 0xff);
data[index++] = (byte) ((value >> 24) & 0xff);
} | java | private void writeInt(int value, byte[] data, int offset) {
int index = offset;
data[index++] = (byte) (value & 0xff);
data[index++] = (byte) ((value >> 8) & 0xff);
data[index++] = (byte) ((value >> 16) & 0xff);
data[index++] = (byte) ((value >> 24) & 0xff);
} | [
"private",
"void",
"writeInt",
"(",
"int",
"value",
",",
"byte",
"[",
"]",
"data",
",",
"int",
"offset",
")",
"{",
"int",
"index",
"=",
"offset",
";",
"data",
"[",
"index",
"++",
"]",
"=",
"(",
"byte",
")",
"(",
"value",
"&",
"0xff",
")",
";",
"data",
"[",
"index",
"++",
"]",
"=",
"(",
"byte",
")",
"(",
"(",
"value",
">>",
"8",
")",
"&",
"0xff",
")",
";",
"data",
"[",
"index",
"++",
"]",
"=",
"(",
"byte",
")",
"(",
"(",
"value",
">>",
"16",
")",
"&",
"0xff",
")",
";",
"data",
"[",
"index",
"++",
"]",
"=",
"(",
"byte",
")",
"(",
"(",
"value",
">>",
"24",
")",
"&",
"0xff",
")",
";",
"}"
] | Write an integer into the output space, starting at the input offset.
@param value
@param data
@param offset | [
"Write",
"an",
"integer",
"into",
"the",
"output",
"space",
"starting",
"at",
"the",
"input",
"offset",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/wsspi/http/channel/compression/GzipOutputHandler.java#L287-L293 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.org.apache.cxf.cxf.rt.frontend.jaxrs.3.2/src/com/ibm/ws/jaxrs20/injection/AbstractParamInjectionBinding.java | AbstractParamInjectionBinding.getInjectedObjectFromCXF | protected Object getInjectedObjectFromCXF(Class<?> classType,
Type genericType,
Annotation[] memberAnnotations,
ParamInjectionMetadata paramInjectionMetadata) {
Parameter p = ResourceUtils.getParameter(0, memberAnnotations, classType);
Object injectedObject = null;
Message message = paramInjectionMetadata.getInMessage();
OperationResourceInfo ori = paramInjectionMetadata.getOperationResourceInfo();
BeanResourceInfo cri = ori.getClassResourceInfo();
MultivaluedMap<String, String> values = (MultivaluedMap<String, String>) message.get(URITemplate.TEMPLATE_PARAMETERS);
if (p.getType() == ParameterType.BEAN && cri instanceof ClassResourceInfo) {
injectedObject = JAXRSUtils.createBeanParamValue(message, classType, ori);
} else {
injectedObject = JAXRSUtils.createHttpParameterValue(p,
classType,
genericType,
memberAnnotations,
message,
values,
ori);
}
return injectedObject;
} | java | protected Object getInjectedObjectFromCXF(Class<?> classType,
Type genericType,
Annotation[] memberAnnotations,
ParamInjectionMetadata paramInjectionMetadata) {
Parameter p = ResourceUtils.getParameter(0, memberAnnotations, classType);
Object injectedObject = null;
Message message = paramInjectionMetadata.getInMessage();
OperationResourceInfo ori = paramInjectionMetadata.getOperationResourceInfo();
BeanResourceInfo cri = ori.getClassResourceInfo();
MultivaluedMap<String, String> values = (MultivaluedMap<String, String>) message.get(URITemplate.TEMPLATE_PARAMETERS);
if (p.getType() == ParameterType.BEAN && cri instanceof ClassResourceInfo) {
injectedObject = JAXRSUtils.createBeanParamValue(message, classType, ori);
} else {
injectedObject = JAXRSUtils.createHttpParameterValue(p,
classType,
genericType,
memberAnnotations,
message,
values,
ori);
}
return injectedObject;
} | [
"protected",
"Object",
"getInjectedObjectFromCXF",
"(",
"Class",
"<",
"?",
">",
"classType",
",",
"Type",
"genericType",
",",
"Annotation",
"[",
"]",
"memberAnnotations",
",",
"ParamInjectionMetadata",
"paramInjectionMetadata",
")",
"{",
"Parameter",
"p",
"=",
"ResourceUtils",
".",
"getParameter",
"(",
"0",
",",
"memberAnnotations",
",",
"classType",
")",
";",
"Object",
"injectedObject",
"=",
"null",
";",
"Message",
"message",
"=",
"paramInjectionMetadata",
".",
"getInMessage",
"(",
")",
";",
"OperationResourceInfo",
"ori",
"=",
"paramInjectionMetadata",
".",
"getOperationResourceInfo",
"(",
")",
";",
"BeanResourceInfo",
"cri",
"=",
"ori",
".",
"getClassResourceInfo",
"(",
")",
";",
"MultivaluedMap",
"<",
"String",
",",
"String",
">",
"values",
"=",
"(",
"MultivaluedMap",
"<",
"String",
",",
"String",
">",
")",
"message",
".",
"get",
"(",
"URITemplate",
".",
"TEMPLATE_PARAMETERS",
")",
";",
"if",
"(",
"p",
".",
"getType",
"(",
")",
"==",
"ParameterType",
".",
"BEAN",
"&&",
"cri",
"instanceof",
"ClassResourceInfo",
")",
"{",
"injectedObject",
"=",
"JAXRSUtils",
".",
"createBeanParamValue",
"(",
"message",
",",
"classType",
",",
"ori",
")",
";",
"}",
"else",
"{",
"injectedObject",
"=",
"JAXRSUtils",
".",
"createHttpParameterValue",
"(",
"p",
",",
"classType",
",",
"genericType",
",",
"memberAnnotations",
",",
"message",
",",
"values",
",",
"ori",
")",
";",
"}",
"return",
"injectedObject",
";",
"}"
] | real create the paramter object based CXF implementation
@param classType
@param genericType
@param memberAnnotations
@param paramInjectionMetadata
@return | [
"real",
"create",
"the",
"paramter",
"object",
"based",
"CXF",
"implementation"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.org.apache.cxf.cxf.rt.frontend.jaxrs.3.2/src/com/ibm/ws/jaxrs20/injection/AbstractParamInjectionBinding.java#L172-L195 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer.servlet.3.1/src/com/ibm/ws/webcontainer31/util/UpgradeOutputByteBufferUtil.java | UpgradeOutputByteBufferUtil.setBufferSize | private void setBufferSize(int size) {
this.amountToBuffer = size;
this.bbSize = (49152 < size) ? 32768 : 8192;
int numBuffers = (size / this.bbSize);
if (0 == size || 0 != (size % this.bbSize)) {
numBuffers++;
}
this._output = new WsByteBuffer[numBuffers];
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "setBufferSize=[" + size + "]; " + this);
}
} | java | private void setBufferSize(int size) {
this.amountToBuffer = size;
this.bbSize = (49152 < size) ? 32768 : 8192;
int numBuffers = (size / this.bbSize);
if (0 == size || 0 != (size % this.bbSize)) {
numBuffers++;
}
this._output = new WsByteBuffer[numBuffers];
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "setBufferSize=[" + size + "]; " + this);
}
} | [
"private",
"void",
"setBufferSize",
"(",
"int",
"size",
")",
"{",
"this",
".",
"amountToBuffer",
"=",
"size",
";",
"this",
".",
"bbSize",
"=",
"(",
"49152",
"<",
"size",
")",
"?",
"32768",
":",
"8192",
";",
"int",
"numBuffers",
"=",
"(",
"size",
"/",
"this",
".",
"bbSize",
")",
";",
"if",
"(",
"0",
"==",
"size",
"||",
"0",
"!=",
"(",
"size",
"%",
"this",
".",
"bbSize",
")",
")",
"{",
"numBuffers",
"++",
";",
"}",
"this",
".",
"_output",
"=",
"new",
"WsByteBuffer",
"[",
"numBuffers",
"]",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"setBufferSize=[\"",
"+",
"size",
"+",
"\"]; \"",
"+",
"this",
")",
";",
"}",
"}"
] | Set the amount of data to buffer internally before the stream itself
initiates a flush. A zero size means no buffer is done, each write
call will flush data.
@param size
@throws IllegalStateException if already writing data or closed | [
"Set",
"the",
"amount",
"of",
"data",
"to",
"buffer",
"internally",
"before",
"the",
"stream",
"itself",
"initiates",
"a",
"flush",
".",
"A",
"zero",
"size",
"means",
"no",
"buffer",
"is",
"done",
"each",
"write",
"call",
"will",
"flush",
"data",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.servlet.3.1/src/com/ibm/ws/webcontainer31/util/UpgradeOutputByteBufferUtil.java#L274-L286 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer.servlet.3.1/src/com/ibm/ws/webcontainer31/util/UpgradeOutputByteBufferUtil.java | UpgradeOutputByteBufferUtil.clear | private void clear() {
if (null != this._output) {
for (int i = 0; i < this._output.length; i++) {
if (null != this._output[i]) {
this._output[i].release();
this._output[i] = null;
}
}
}
this.outputIndex = 0;
this.bufferedCount = 0;
this.bytesWritten = 0L;
this.setWriteListenerCallBack(null);
} | java | private void clear() {
if (null != this._output) {
for (int i = 0; i < this._output.length; i++) {
if (null != this._output[i]) {
this._output[i].release();
this._output[i] = null;
}
}
}
this.outputIndex = 0;
this.bufferedCount = 0;
this.bytesWritten = 0L;
this.setWriteListenerCallBack(null);
} | [
"private",
"void",
"clear",
"(",
")",
"{",
"if",
"(",
"null",
"!=",
"this",
".",
"_output",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"_output",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"null",
"!=",
"this",
".",
"_output",
"[",
"i",
"]",
")",
"{",
"this",
".",
"_output",
"[",
"i",
"]",
".",
"release",
"(",
")",
";",
"this",
".",
"_output",
"[",
"i",
"]",
"=",
"null",
";",
"}",
"}",
"}",
"this",
".",
"outputIndex",
"=",
"0",
";",
"this",
".",
"bufferedCount",
"=",
"0",
";",
"this",
".",
"bytesWritten",
"=",
"0L",
";",
"this",
".",
"setWriteListenerCallBack",
"(",
"null",
")",
";",
"}"
] | Release any current buffer content in the stream. | [
"Release",
"any",
"current",
"buffer",
"content",
"in",
"the",
"stream",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.servlet.3.1/src/com/ibm/ws/webcontainer31/util/UpgradeOutputByteBufferUtil.java#L603-L616 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.concurrent.persistent/src/com/ibm/ws/concurrent/persistent/internal/ApplicationTracker.java | ApplicationTracker.addStartedApplication | @Reference(service = Application.class,
cardinality = ReferenceCardinality.MULTIPLE,
policy = ReferencePolicy.DYNAMIC,
target = "(application.state=STARTED)")
protected void addStartedApplication(ServiceReference<Application> ref) {
ExecutorService executor;
String appName = (String) ref.getProperty(NAME);
Set<Runnable> tasks;
lock.writeLock().lock();
try {
executor = this.executor;
appStates.put(appName, ApplicationState.STARTED);
tasks = deferredTasks.remove(appName);
} finally {
lock.writeLock().unlock();
}
if (tasks != null)
for (Runnable task : tasks)
executor.submit(task);
} | java | @Reference(service = Application.class,
cardinality = ReferenceCardinality.MULTIPLE,
policy = ReferencePolicy.DYNAMIC,
target = "(application.state=STARTED)")
protected void addStartedApplication(ServiceReference<Application> ref) {
ExecutorService executor;
String appName = (String) ref.getProperty(NAME);
Set<Runnable> tasks;
lock.writeLock().lock();
try {
executor = this.executor;
appStates.put(appName, ApplicationState.STARTED);
tasks = deferredTasks.remove(appName);
} finally {
lock.writeLock().unlock();
}
if (tasks != null)
for (Runnable task : tasks)
executor.submit(task);
} | [
"@",
"Reference",
"(",
"service",
"=",
"Application",
".",
"class",
",",
"cardinality",
"=",
"ReferenceCardinality",
".",
"MULTIPLE",
",",
"policy",
"=",
"ReferencePolicy",
".",
"DYNAMIC",
",",
"target",
"=",
"\"(application.state=STARTED)\"",
")",
"protected",
"void",
"addStartedApplication",
"(",
"ServiceReference",
"<",
"Application",
">",
"ref",
")",
"{",
"ExecutorService",
"executor",
";",
"String",
"appName",
"=",
"(",
"String",
")",
"ref",
".",
"getProperty",
"(",
"NAME",
")",
";",
"Set",
"<",
"Runnable",
">",
"tasks",
";",
"lock",
".",
"writeLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"executor",
"=",
"this",
".",
"executor",
";",
"appStates",
".",
"put",
"(",
"appName",
",",
"ApplicationState",
".",
"STARTED",
")",
";",
"tasks",
"=",
"deferredTasks",
".",
"remove",
"(",
"appName",
")",
";",
"}",
"finally",
"{",
"lock",
".",
"writeLock",
"(",
")",
".",
"unlock",
"(",
")",
";",
"}",
"if",
"(",
"tasks",
"!=",
"null",
")",
"for",
"(",
"Runnable",
"task",
":",
"tasks",
")",
"executor",
".",
"submit",
"(",
"task",
")",
";",
"}"
] | Declarative Services method for setting a started Application instance
@param ref reference to the service | [
"Declarative",
"Services",
"method",
"for",
"setting",
"a",
"started",
"Application",
"instance"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.concurrent.persistent/src/com/ibm/ws/concurrent/persistent/internal/ApplicationTracker.java#L73-L93 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.concurrent.persistent/src/com/ibm/ws/concurrent/persistent/internal/ApplicationTracker.java | ApplicationTracker.addStartingApplication | @Reference(service = Application.class,
cardinality = ReferenceCardinality.MULTIPLE,
policy = ReferencePolicy.DYNAMIC,
target = "(application.state=STARTING)")
protected void addStartingApplication(ServiceReference<Application> ref) {
String appName = (String) ref.getProperty(NAME);
lock.writeLock().lock();
try {
if (!appStates.containsKey(appName))
appStates.put(appName, ApplicationState.STARTING);
} finally {
lock.writeLock().unlock();
}
} | java | @Reference(service = Application.class,
cardinality = ReferenceCardinality.MULTIPLE,
policy = ReferencePolicy.DYNAMIC,
target = "(application.state=STARTING)")
protected void addStartingApplication(ServiceReference<Application> ref) {
String appName = (String) ref.getProperty(NAME);
lock.writeLock().lock();
try {
if (!appStates.containsKey(appName))
appStates.put(appName, ApplicationState.STARTING);
} finally {
lock.writeLock().unlock();
}
} | [
"@",
"Reference",
"(",
"service",
"=",
"Application",
".",
"class",
",",
"cardinality",
"=",
"ReferenceCardinality",
".",
"MULTIPLE",
",",
"policy",
"=",
"ReferencePolicy",
".",
"DYNAMIC",
",",
"target",
"=",
"\"(application.state=STARTING)\"",
")",
"protected",
"void",
"addStartingApplication",
"(",
"ServiceReference",
"<",
"Application",
">",
"ref",
")",
"{",
"String",
"appName",
"=",
"(",
"String",
")",
"ref",
".",
"getProperty",
"(",
"NAME",
")",
";",
"lock",
".",
"writeLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"!",
"appStates",
".",
"containsKey",
"(",
"appName",
")",
")",
"appStates",
".",
"put",
"(",
"appName",
",",
"ApplicationState",
".",
"STARTING",
")",
";",
"}",
"finally",
"{",
"lock",
".",
"writeLock",
"(",
")",
".",
"unlock",
"(",
")",
";",
"}",
"}"
] | Declarative Services method for setting a starting Application instance
@param ref reference to the service | [
"Declarative",
"Services",
"method",
"for",
"setting",
"a",
"starting",
"Application",
"instance"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.concurrent.persistent/src/com/ibm/ws/concurrent/persistent/internal/ApplicationTracker.java#L100-L113 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.concurrent.persistent/src/com/ibm/ws/concurrent/persistent/internal/ApplicationTracker.java | ApplicationTracker.isStarted | boolean isStarted(String appName) {
lock.readLock().lock();
try {
return appStates.get(appName) == ApplicationState.STARTED;
} finally {
lock.readLock().unlock();
}
} | java | boolean isStarted(String appName) {
lock.readLock().lock();
try {
return appStates.get(appName) == ApplicationState.STARTED;
} finally {
lock.readLock().unlock();
}
} | [
"boolean",
"isStarted",
"(",
"String",
"appName",
")",
"{",
"lock",
".",
"readLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"return",
"appStates",
".",
"get",
"(",
"appName",
")",
"==",
"ApplicationState",
".",
"STARTED",
";",
"}",
"finally",
"{",
"lock",
".",
"readLock",
"(",
")",
".",
"unlock",
"(",
")",
";",
"}",
"}"
] | Returns true if the application with the specified name is started, otherwise false.
@return true if the application with the specified name is started, otherwise false. | [
"Returns",
"true",
"if",
"the",
"application",
"with",
"the",
"specified",
"name",
"is",
"started",
"otherwise",
"false",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.concurrent.persistent/src/com/ibm/ws/concurrent/persistent/internal/ApplicationTracker.java#L151-L158 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.concurrent.persistent/src/com/ibm/ws/concurrent/persistent/internal/ApplicationTracker.java | ApplicationTracker.removeStartedApplication | protected void removeStartedApplication(ServiceReference<Application> ref) {
String appName = (String) ref.getProperty(NAME);
lock.writeLock().lock();
try {
appStates.remove(appName);
} finally {
lock.writeLock().unlock();
}
} | java | protected void removeStartedApplication(ServiceReference<Application> ref) {
String appName = (String) ref.getProperty(NAME);
lock.writeLock().lock();
try {
appStates.remove(appName);
} finally {
lock.writeLock().unlock();
}
} | [
"protected",
"void",
"removeStartedApplication",
"(",
"ServiceReference",
"<",
"Application",
">",
"ref",
")",
"{",
"String",
"appName",
"=",
"(",
"String",
")",
"ref",
".",
"getProperty",
"(",
"NAME",
")",
";",
"lock",
".",
"writeLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"appStates",
".",
"remove",
"(",
"appName",
")",
";",
"}",
"finally",
"{",
"lock",
".",
"writeLock",
"(",
")",
".",
"unlock",
"(",
")",
";",
"}",
"}"
] | Declarative Services method for unsetting a started Application instance
@param ref reference to the service | [
"Declarative",
"Services",
"method",
"for",
"unsetting",
"a",
"started",
"Application",
"instance"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.concurrent.persistent/src/com/ibm/ws/concurrent/persistent/internal/ApplicationTracker.java#L165-L173 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/utils/NLS.java | NLS.objectsToString | String objectsToString(String key, Object objects) {
java.io.StringWriter stringWriter = new java.io.StringWriter();
stringWriter.write(key);
stringWriter.write(":");
if (objects == null) {
stringWriter.write("\n");
} else if (objects instanceof Object[]) {
for (int i = 0; i < ((Object[]) objects).length; i++) {
Object object = ((Object[]) objects)[i];
if (object == null)
stringWriter.write("null\n");
else {
stringWriter.write(((Object[]) objects)[i].toString());
stringWriter.write("\n");
}
}
} else {
stringWriter.write(objects.toString());
stringWriter.write("\n");
}
return stringWriter.toString();
} | java | String objectsToString(String key, Object objects) {
java.io.StringWriter stringWriter = new java.io.StringWriter();
stringWriter.write(key);
stringWriter.write(":");
if (objects == null) {
stringWriter.write("\n");
} else if (objects instanceof Object[]) {
for (int i = 0; i < ((Object[]) objects).length; i++) {
Object object = ((Object[]) objects)[i];
if (object == null)
stringWriter.write("null\n");
else {
stringWriter.write(((Object[]) objects)[i].toString());
stringWriter.write("\n");
}
}
} else {
stringWriter.write(objects.toString());
stringWriter.write("\n");
}
return stringWriter.toString();
} | [
"String",
"objectsToString",
"(",
"String",
"key",
",",
"Object",
"objects",
")",
"{",
"java",
".",
"io",
".",
"StringWriter",
"stringWriter",
"=",
"new",
"java",
".",
"io",
".",
"StringWriter",
"(",
")",
";",
"stringWriter",
".",
"write",
"(",
"key",
")",
";",
"stringWriter",
".",
"write",
"(",
"\":\"",
")",
";",
"if",
"(",
"objects",
"==",
"null",
")",
"{",
"stringWriter",
".",
"write",
"(",
"\"\\n\"",
")",
";",
"}",
"else",
"if",
"(",
"objects",
"instanceof",
"Object",
"[",
"]",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"(",
"(",
"Object",
"[",
"]",
")",
"objects",
")",
".",
"length",
";",
"i",
"++",
")",
"{",
"Object",
"object",
"=",
"(",
"(",
"Object",
"[",
"]",
")",
"objects",
")",
"[",
"i",
"]",
";",
"if",
"(",
"object",
"==",
"null",
")",
"stringWriter",
".",
"write",
"(",
"\"null\\n\"",
")",
";",
"else",
"{",
"stringWriter",
".",
"write",
"(",
"(",
"(",
"Object",
"[",
"]",
")",
"objects",
")",
"[",
"i",
"]",
".",
"toString",
"(",
")",
")",
";",
"stringWriter",
".",
"write",
"(",
"\"\\n\"",
")",
";",
"}",
"}",
"}",
"else",
"{",
"stringWriter",
".",
"write",
"(",
"objects",
".",
"toString",
"(",
")",
")",
";",
"stringWriter",
".",
"write",
"(",
"\"\\n\"",
")",
";",
"}",
"return",
"stringWriter",
".",
"toString",
"(",
")",
";",
"}"
] | Create a simple default formatted string.
@param key which would look up the message in a resource bundle.
@param objects which would be inserted into the message.
@return String the formatted String. | [
"Create",
"a",
"simple",
"default",
"formatted",
"string",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/utils/NLS.java#L84-L109 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/commands/HotSpotJavaDumperImpl.java | HotSpotJavaDumperImpl.getPID | private static String getPID() {
String name = ManagementFactory.getRuntimeMXBean().getName();
int index = name.indexOf('@');
if (index == -1) {
return null;
}
String pid = name.substring(0, index);
if (!pid.matches("[0-9]+")) {
return null;
}
return pid;
} | java | private static String getPID() {
String name = ManagementFactory.getRuntimeMXBean().getName();
int index = name.indexOf('@');
if (index == -1) {
return null;
}
String pid = name.substring(0, index);
if (!pid.matches("[0-9]+")) {
return null;
}
return pid;
} | [
"private",
"static",
"String",
"getPID",
"(",
")",
"{",
"String",
"name",
"=",
"ManagementFactory",
".",
"getRuntimeMXBean",
"(",
")",
".",
"getName",
"(",
")",
";",
"int",
"index",
"=",
"name",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"index",
"==",
"-",
"1",
")",
"{",
"return",
"null",
";",
"}",
"String",
"pid",
"=",
"name",
".",
"substring",
"(",
"0",
",",
"index",
")",
";",
"if",
"(",
"!",
"pid",
".",
"matches",
"(",
"\"[0-9]+\"",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"pid",
";",
"}"
] | Return the current process ID. | [
"Return",
"the",
"current",
"process",
"ID",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/commands/HotSpotJavaDumperImpl.java#L46-L59 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/commands/HotSpotJavaDumperImpl.java | HotSpotJavaDumperImpl.createNewFile | private File createNewFile(File outputDir, String prefix, String extension) throws IOException {
String dateTime = new SimpleDateFormat("yyyyMMdd.HHmmss").format(new Date());
File outputFile;
do {
String pid = PID == null ? "" : PID + '.';
int sequenceNumber = nextSequenceNumber.getAndIncrement();
outputFile = new File(outputDir, String.format("%s.%s.%s%04d.%s", prefix, dateTime, pid, sequenceNumber, extension));
} while (outputFile.exists());
return outputFile;
} | java | private File createNewFile(File outputDir, String prefix, String extension) throws IOException {
String dateTime = new SimpleDateFormat("yyyyMMdd.HHmmss").format(new Date());
File outputFile;
do {
String pid = PID == null ? "" : PID + '.';
int sequenceNumber = nextSequenceNumber.getAndIncrement();
outputFile = new File(outputDir, String.format("%s.%s.%s%04d.%s", prefix, dateTime, pid, sequenceNumber, extension));
} while (outputFile.exists());
return outputFile;
} | [
"private",
"File",
"createNewFile",
"(",
"File",
"outputDir",
",",
"String",
"prefix",
",",
"String",
"extension",
")",
"throws",
"IOException",
"{",
"String",
"dateTime",
"=",
"new",
"SimpleDateFormat",
"(",
"\"yyyyMMdd.HHmmss\"",
")",
".",
"format",
"(",
"new",
"Date",
"(",
")",
")",
";",
"File",
"outputFile",
";",
"do",
"{",
"String",
"pid",
"=",
"PID",
"==",
"null",
"?",
"\"\"",
":",
"PID",
"+",
"'",
"'",
";",
"int",
"sequenceNumber",
"=",
"nextSequenceNumber",
".",
"getAndIncrement",
"(",
")",
";",
"outputFile",
"=",
"new",
"File",
"(",
"outputDir",
",",
"String",
".",
"format",
"(",
"\"%s.%s.%s%04d.%s\"",
",",
"prefix",
",",
"dateTime",
",",
"pid",
",",
"sequenceNumber",
",",
"extension",
")",
")",
";",
"}",
"while",
"(",
"outputFile",
".",
"exists",
"(",
")",
")",
";",
"return",
"outputFile",
";",
"}"
] | Create a dump file with a unique name.
@param outputDir the directory to contain the file
@param prefix the prefix for the filename
@param extension the file extension, not including a leading "."
@return the created file | [
"Create",
"a",
"dump",
"file",
"with",
"a",
"unique",
"name",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/commands/HotSpotJavaDumperImpl.java#L116-L126 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/commands/HotSpotJavaDumperImpl.java | HotSpotJavaDumperImpl.createThreadDump | private File createThreadDump(File outputDir) {
// Determine if we're using Java Attach (VirtualMachine.remoteDataDump)
// or the DiagnosticCommand MBean. Java Attach is only available on
// JREs (not JDKs) and sometimes fails to connect, but we prefer it when
// available because DiagnosticCommand returns the entire thread dump as
// a single String, which risks OutOfMemoryError.
VirtualMachine vm = null;
try {
vm = getAttachedVirtualMachine();
if (vm == null && diagnosticCommandName == null) {
// Neither Java Attach nor DiagnosticCommand are available, so
// it's not possible to create a thread dump.
return null;
}
} catch (VirtualMachineException e) {
// Sometimes Java Attach fails spuriously. If DiagnosticCommand is
// available, try that. Otherwise, propagate the failure.
if (diagnosticCommandName == null) {
Throwable cause = e.getCause();
throw cause instanceof RuntimeException ? (RuntimeException) cause : new RuntimeException(cause);
}
}
File outputFile = null;
InputStream input = null;
OutputStream output = null;
boolean success = false;
try {
// Use a filename that resembles an IBM javacore.
outputFile = createNewFile(outputDir, "javadump", "txt");
if (vm != null) {
input = vm.remoteDataDump();
input = new BufferedInputStream(input);
output = new FileOutputStream(outputFile);
output = new BufferedOutputStream(output);
byte[] buf = new byte[8192];
for (int read; (read = input.read(buf)) != -1;) {
output.write(buf, 0, read);
}
} else {
String outputString;
try {
outputString = (String) platformMBeanServer.invoke(diagnosticCommandName,
"threadPrint",
new Object[] { new String[] { "-l" } },
new String[] { String[].class.getName() });
} catch (Exception e) {
throw new RuntimeException(e);
}
output = new FileOutputStream(outputFile);
Writer writer = new OutputStreamWriter(output, "UTF-8");
writer.write(outputString);
writer.close();
}
success = true;
} catch (IOException ex) {
throw new RuntimeException(ex);
} finally {
Utils.tryToClose(input);
Utils.tryToClose(output);
if (!success && outputFile != null && !outputFile.delete()) {
// Avoid FindBugs warning. We .delete() as a best effort.
outputFile = null;
}
}
return outputFile;
} | java | private File createThreadDump(File outputDir) {
// Determine if we're using Java Attach (VirtualMachine.remoteDataDump)
// or the DiagnosticCommand MBean. Java Attach is only available on
// JREs (not JDKs) and sometimes fails to connect, but we prefer it when
// available because DiagnosticCommand returns the entire thread dump as
// a single String, which risks OutOfMemoryError.
VirtualMachine vm = null;
try {
vm = getAttachedVirtualMachine();
if (vm == null && diagnosticCommandName == null) {
// Neither Java Attach nor DiagnosticCommand are available, so
// it's not possible to create a thread dump.
return null;
}
} catch (VirtualMachineException e) {
// Sometimes Java Attach fails spuriously. If DiagnosticCommand is
// available, try that. Otherwise, propagate the failure.
if (diagnosticCommandName == null) {
Throwable cause = e.getCause();
throw cause instanceof RuntimeException ? (RuntimeException) cause : new RuntimeException(cause);
}
}
File outputFile = null;
InputStream input = null;
OutputStream output = null;
boolean success = false;
try {
// Use a filename that resembles an IBM javacore.
outputFile = createNewFile(outputDir, "javadump", "txt");
if (vm != null) {
input = vm.remoteDataDump();
input = new BufferedInputStream(input);
output = new FileOutputStream(outputFile);
output = new BufferedOutputStream(output);
byte[] buf = new byte[8192];
for (int read; (read = input.read(buf)) != -1;) {
output.write(buf, 0, read);
}
} else {
String outputString;
try {
outputString = (String) platformMBeanServer.invoke(diagnosticCommandName,
"threadPrint",
new Object[] { new String[] { "-l" } },
new String[] { String[].class.getName() });
} catch (Exception e) {
throw new RuntimeException(e);
}
output = new FileOutputStream(outputFile);
Writer writer = new OutputStreamWriter(output, "UTF-8");
writer.write(outputString);
writer.close();
}
success = true;
} catch (IOException ex) {
throw new RuntimeException(ex);
} finally {
Utils.tryToClose(input);
Utils.tryToClose(output);
if (!success && outputFile != null && !outputFile.delete()) {
// Avoid FindBugs warning. We .delete() as a best effort.
outputFile = null;
}
}
return outputFile;
} | [
"private",
"File",
"createThreadDump",
"(",
"File",
"outputDir",
")",
"{",
"// Determine if we're using Java Attach (VirtualMachine.remoteDataDump)",
"// or the DiagnosticCommand MBean. Java Attach is only available on",
"// JREs (not JDKs) and sometimes fails to connect, but we prefer it when",
"// available because DiagnosticCommand returns the entire thread dump as",
"// a single String, which risks OutOfMemoryError.",
"VirtualMachine",
"vm",
"=",
"null",
";",
"try",
"{",
"vm",
"=",
"getAttachedVirtualMachine",
"(",
")",
";",
"if",
"(",
"vm",
"==",
"null",
"&&",
"diagnosticCommandName",
"==",
"null",
")",
"{",
"// Neither Java Attach nor DiagnosticCommand are available, so",
"// it's not possible to create a thread dump.",
"return",
"null",
";",
"}",
"}",
"catch",
"(",
"VirtualMachineException",
"e",
")",
"{",
"// Sometimes Java Attach fails spuriously. If DiagnosticCommand is",
"// available, try that. Otherwise, propagate the failure.",
"if",
"(",
"diagnosticCommandName",
"==",
"null",
")",
"{",
"Throwable",
"cause",
"=",
"e",
".",
"getCause",
"(",
")",
";",
"throw",
"cause",
"instanceof",
"RuntimeException",
"?",
"(",
"RuntimeException",
")",
"cause",
":",
"new",
"RuntimeException",
"(",
"cause",
")",
";",
"}",
"}",
"File",
"outputFile",
"=",
"null",
";",
"InputStream",
"input",
"=",
"null",
";",
"OutputStream",
"output",
"=",
"null",
";",
"boolean",
"success",
"=",
"false",
";",
"try",
"{",
"// Use a filename that resembles an IBM javacore.",
"outputFile",
"=",
"createNewFile",
"(",
"outputDir",
",",
"\"javadump\"",
",",
"\"txt\"",
")",
";",
"if",
"(",
"vm",
"!=",
"null",
")",
"{",
"input",
"=",
"vm",
".",
"remoteDataDump",
"(",
")",
";",
"input",
"=",
"new",
"BufferedInputStream",
"(",
"input",
")",
";",
"output",
"=",
"new",
"FileOutputStream",
"(",
"outputFile",
")",
";",
"output",
"=",
"new",
"BufferedOutputStream",
"(",
"output",
")",
";",
"byte",
"[",
"]",
"buf",
"=",
"new",
"byte",
"[",
"8192",
"]",
";",
"for",
"(",
"int",
"read",
";",
"(",
"read",
"=",
"input",
".",
"read",
"(",
"buf",
")",
")",
"!=",
"-",
"1",
";",
")",
"{",
"output",
".",
"write",
"(",
"buf",
",",
"0",
",",
"read",
")",
";",
"}",
"}",
"else",
"{",
"String",
"outputString",
";",
"try",
"{",
"outputString",
"=",
"(",
"String",
")",
"platformMBeanServer",
".",
"invoke",
"(",
"diagnosticCommandName",
",",
"\"threadPrint\"",
",",
"new",
"Object",
"[",
"]",
"{",
"new",
"String",
"[",
"]",
"{",
"\"-l\"",
"}",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"String",
"[",
"]",
".",
"class",
".",
"getName",
"(",
")",
"}",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"e",
")",
";",
"}",
"output",
"=",
"new",
"FileOutputStream",
"(",
"outputFile",
")",
";",
"Writer",
"writer",
"=",
"new",
"OutputStreamWriter",
"(",
"output",
",",
"\"UTF-8\"",
")",
";",
"writer",
".",
"write",
"(",
"outputString",
")",
";",
"writer",
".",
"close",
"(",
")",
";",
"}",
"success",
"=",
"true",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"ex",
")",
";",
"}",
"finally",
"{",
"Utils",
".",
"tryToClose",
"(",
"input",
")",
";",
"Utils",
".",
"tryToClose",
"(",
"output",
")",
";",
"if",
"(",
"!",
"success",
"&&",
"outputFile",
"!=",
"null",
"&&",
"!",
"outputFile",
".",
"delete",
"(",
")",
")",
"{",
"// Avoid FindBugs warning. We .delete() as a best effort.",
"outputFile",
"=",
"null",
";",
"}",
"}",
"return",
"outputFile",
";",
"}"
] | Create a thread dump. This is the same output normally printed to the
console when a kill -QUIT or Ctrl-Break is sent to the process.
@param outputDir the server output directory
@return the resulting file, or null if the dump could not be created | [
"Create",
"a",
"thread",
"dump",
".",
"This",
"is",
"the",
"same",
"output",
"normally",
"printed",
"to",
"the",
"console",
"when",
"a",
"kill",
"-",
"QUIT",
"or",
"Ctrl",
"-",
"Break",
"is",
"sent",
"to",
"the",
"process",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/commands/HotSpotJavaDumperImpl.java#L162-L236 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/commands/HotSpotJavaDumperImpl.java | HotSpotJavaDumperImpl.getAttachedVirtualMachine | private synchronized VirtualMachine getAttachedVirtualMachine() throws VirtualMachineException {
if (PID == null) {
// Java Attach requires a PID.
return null;
}
if (vm == null) {
vm = createVirtualMachine();
}
return vm.isAttached() ? vm : null;
} | java | private synchronized VirtualMachine getAttachedVirtualMachine() throws VirtualMachineException {
if (PID == null) {
// Java Attach requires a PID.
return null;
}
if (vm == null) {
vm = createVirtualMachine();
}
return vm.isAttached() ? vm : null;
} | [
"private",
"synchronized",
"VirtualMachine",
"getAttachedVirtualMachine",
"(",
")",
"throws",
"VirtualMachineException",
"{",
"if",
"(",
"PID",
"==",
"null",
")",
"{",
"// Java Attach requires a PID.",
"return",
"null",
";",
"}",
"if",
"(",
"vm",
"==",
"null",
")",
"{",
"vm",
"=",
"createVirtualMachine",
"(",
")",
";",
"}",
"return",
"vm",
".",
"isAttached",
"(",
")",
"?",
"vm",
":",
"null",
";",
"}"
] | Returns sun.tools.attach.HotSpotVirtualMachine, if possible. | [
"Returns",
"sun",
".",
"tools",
".",
"attach",
".",
"HotSpotVirtualMachine",
"if",
"possible",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/commands/HotSpotJavaDumperImpl.java#L241-L251 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/commands/HotSpotJavaDumperImpl.java | HotSpotJavaDumperImpl.createVirtualMachine | private VirtualMachine createVirtualMachine() throws VirtualMachineException {
ClassLoader toolsClassLoader;
File toolsJar = getToolsJar();
if (toolsJar == null) {
// The attach classes are on the boot classpath on Mac.
toolsClassLoader = HotSpotJavaDumperImpl.class.getClassLoader();
} else {
try {
toolsClassLoader = new URLClassLoader(new URL[] { toolsJar.getAbsoluteFile().toURI().toURL() });
} catch (MalformedURLException e) {
throw new RuntimeException(e);
}
}
try {
Class<?> vmClass = toolsClassLoader.loadClass("com.sun.tools.attach.VirtualMachine");
Method attachMethod = vmClass.getMethod("attach", new Class<?>[] { String.class });
Object toolsVM = attachMethod.invoke(null, new Object[] { PID });
Method remoteDataDumpMethod = toolsVM.getClass().getMethod("remoteDataDump", new Class<?>[] { Object[].class });
return new VirtualMachine(toolsVM, remoteDataDumpMethod);
} catch (ClassNotFoundException e) {
// The class isn't found, so we won't be able to create dumps.
} catch (InvocationTargetException e) {
throw new VirtualMachineException(e);
} catch (Exception e) {
throw new RuntimeException(e);
}
return new VirtualMachine(null, null);
} | java | private VirtualMachine createVirtualMachine() throws VirtualMachineException {
ClassLoader toolsClassLoader;
File toolsJar = getToolsJar();
if (toolsJar == null) {
// The attach classes are on the boot classpath on Mac.
toolsClassLoader = HotSpotJavaDumperImpl.class.getClassLoader();
} else {
try {
toolsClassLoader = new URLClassLoader(new URL[] { toolsJar.getAbsoluteFile().toURI().toURL() });
} catch (MalformedURLException e) {
throw new RuntimeException(e);
}
}
try {
Class<?> vmClass = toolsClassLoader.loadClass("com.sun.tools.attach.VirtualMachine");
Method attachMethod = vmClass.getMethod("attach", new Class<?>[] { String.class });
Object toolsVM = attachMethod.invoke(null, new Object[] { PID });
Method remoteDataDumpMethod = toolsVM.getClass().getMethod("remoteDataDump", new Class<?>[] { Object[].class });
return new VirtualMachine(toolsVM, remoteDataDumpMethod);
} catch (ClassNotFoundException e) {
// The class isn't found, so we won't be able to create dumps.
} catch (InvocationTargetException e) {
throw new VirtualMachineException(e);
} catch (Exception e) {
throw new RuntimeException(e);
}
return new VirtualMachine(null, null);
} | [
"private",
"VirtualMachine",
"createVirtualMachine",
"(",
")",
"throws",
"VirtualMachineException",
"{",
"ClassLoader",
"toolsClassLoader",
";",
"File",
"toolsJar",
"=",
"getToolsJar",
"(",
")",
";",
"if",
"(",
"toolsJar",
"==",
"null",
")",
"{",
"// The attach classes are on the boot classpath on Mac.",
"toolsClassLoader",
"=",
"HotSpotJavaDumperImpl",
".",
"class",
".",
"getClassLoader",
"(",
")",
";",
"}",
"else",
"{",
"try",
"{",
"toolsClassLoader",
"=",
"new",
"URLClassLoader",
"(",
"new",
"URL",
"[",
"]",
"{",
"toolsJar",
".",
"getAbsoluteFile",
"(",
")",
".",
"toURI",
"(",
")",
".",
"toURL",
"(",
")",
"}",
")",
";",
"}",
"catch",
"(",
"MalformedURLException",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"e",
")",
";",
"}",
"}",
"try",
"{",
"Class",
"<",
"?",
">",
"vmClass",
"=",
"toolsClassLoader",
".",
"loadClass",
"(",
"\"com.sun.tools.attach.VirtualMachine\"",
")",
";",
"Method",
"attachMethod",
"=",
"vmClass",
".",
"getMethod",
"(",
"\"attach\"",
",",
"new",
"Class",
"<",
"?",
">",
"[",
"]",
"{",
"String",
".",
"class",
"}",
")",
";",
"Object",
"toolsVM",
"=",
"attachMethod",
".",
"invoke",
"(",
"null",
",",
"new",
"Object",
"[",
"]",
"{",
"PID",
"}",
")",
";",
"Method",
"remoteDataDumpMethod",
"=",
"toolsVM",
".",
"getClass",
"(",
")",
".",
"getMethod",
"(",
"\"remoteDataDump\"",
",",
"new",
"Class",
"<",
"?",
">",
"[",
"]",
"{",
"Object",
"[",
"]",
".",
"class",
"}",
")",
";",
"return",
"new",
"VirtualMachine",
"(",
"toolsVM",
",",
"remoteDataDumpMethod",
")",
";",
"}",
"catch",
"(",
"ClassNotFoundException",
"e",
")",
"{",
"// The class isn't found, so we won't be able to create dumps.",
"}",
"catch",
"(",
"InvocationTargetException",
"e",
")",
"{",
"throw",
"new",
"VirtualMachineException",
"(",
"e",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"e",
")",
";",
"}",
"return",
"new",
"VirtualMachine",
"(",
"null",
",",
"null",
")",
";",
"}"
] | Create a VirtualMachine wrapper. | [
"Create",
"a",
"VirtualMachine",
"wrapper",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/commands/HotSpotJavaDumperImpl.java#L256-L286 | train |
OpenLiberty/open-liberty | dev/com.ibm.websphere.security.wim.base/src/com/ibm/wsspi/security/wim/model/Person.java | Person.getManager | public List<com.ibm.wsspi.security.wim.model.IdentifierType> getManager() {
if (manager == null) {
manager = new ArrayList<com.ibm.wsspi.security.wim.model.IdentifierType>();
}
return this.manager;
} | java | public List<com.ibm.wsspi.security.wim.model.IdentifierType> getManager() {
if (manager == null) {
manager = new ArrayList<com.ibm.wsspi.security.wim.model.IdentifierType>();
}
return this.manager;
} | [
"public",
"List",
"<",
"com",
".",
"ibm",
".",
"wsspi",
".",
"security",
".",
"wim",
".",
"model",
".",
"IdentifierType",
">",
"getManager",
"(",
")",
"{",
"if",
"(",
"manager",
"==",
"null",
")",
"{",
"manager",
"=",
"new",
"ArrayList",
"<",
"com",
".",
"ibm",
".",
"wsspi",
".",
"security",
".",
"wim",
".",
"model",
".",
"IdentifierType",
">",
"(",
")",
";",
"}",
"return",
"this",
".",
"manager",
";",
"}"
] | Gets the value of the manager property.
<p>
This accessor method returns a reference to the live list,
not a snapshot. Therefore any modification you make to the
returned list will be present inside the JAXB object.
This is why there is not a <CODE>set</CODE> method for the manager property.
<p>
For example, to add a new item, do as follows:
<pre>
getManager().add(newItem);
</pre>
<p>
Objects of the following type(s) are allowed in the list {@link com.ibm.wsspi.security.wim.model.IdentifierType } | [
"Gets",
"the",
"value",
"of",
"the",
"manager",
"property",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.security.wim.base/src/com/ibm/wsspi/security/wim/model/Person.java#L1153-L1158 | train |
OpenLiberty/open-liberty | dev/com.ibm.websphere.security.wim.base/src/com/ibm/wsspi/security/wim/model/Person.java | Person.getSecretary | public List<com.ibm.wsspi.security.wim.model.IdentifierType> getSecretary() {
if (secretary == null) {
secretary = new ArrayList<com.ibm.wsspi.security.wim.model.IdentifierType>();
}
return this.secretary;
} | java | public List<com.ibm.wsspi.security.wim.model.IdentifierType> getSecretary() {
if (secretary == null) {
secretary = new ArrayList<com.ibm.wsspi.security.wim.model.IdentifierType>();
}
return this.secretary;
} | [
"public",
"List",
"<",
"com",
".",
"ibm",
".",
"wsspi",
".",
"security",
".",
"wim",
".",
"model",
".",
"IdentifierType",
">",
"getSecretary",
"(",
")",
"{",
"if",
"(",
"secretary",
"==",
"null",
")",
"{",
"secretary",
"=",
"new",
"ArrayList",
"<",
"com",
".",
"ibm",
".",
"wsspi",
".",
"security",
".",
"wim",
".",
"model",
".",
"IdentifierType",
">",
"(",
")",
";",
"}",
"return",
"this",
".",
"secretary",
";",
"}"
] | Gets the value of the secretary property.
<p>
This accessor method returns a reference to the live list,
not a snapshot. Therefore any modification you make to the
returned list will be present inside the JAXB object.
This is why there is not a <CODE>set</CODE> method for the secretary property.
<p>
For example, to add a new item, do as follows:
<pre>
getSecretary().add(newItem);
</pre>
<p>
Objects of the following type(s) are allowed in the list {@link com.ibm.wsspi.security.wim.model.IdentifierType } | [
"Gets",
"the",
"value",
"of",
"the",
"secretary",
"property",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.security.wim.base/src/com/ibm/wsspi/security/wim/model/Person.java#L1190-L1195 | train |
OpenLiberty/open-liberty | dev/com.ibm.websphere.security.wim.base/src/com/ibm/wsspi/security/wim/model/Person.java | Person.getHomeAddress | public List<com.ibm.wsspi.security.wim.model.AddressType> getHomeAddress() {
if (homeAddress == null) {
homeAddress = new ArrayList<com.ibm.wsspi.security.wim.model.AddressType>();
}
return this.homeAddress;
} | java | public List<com.ibm.wsspi.security.wim.model.AddressType> getHomeAddress() {
if (homeAddress == null) {
homeAddress = new ArrayList<com.ibm.wsspi.security.wim.model.AddressType>();
}
return this.homeAddress;
} | [
"public",
"List",
"<",
"com",
".",
"ibm",
".",
"wsspi",
".",
"security",
".",
"wim",
".",
"model",
".",
"AddressType",
">",
"getHomeAddress",
"(",
")",
"{",
"if",
"(",
"homeAddress",
"==",
"null",
")",
"{",
"homeAddress",
"=",
"new",
"ArrayList",
"<",
"com",
".",
"ibm",
".",
"wsspi",
".",
"security",
".",
"wim",
".",
"model",
".",
"AddressType",
">",
"(",
")",
";",
"}",
"return",
"this",
".",
"homeAddress",
";",
"}"
] | Gets the value of the homeAddress property.
<p>
This accessor method returns a reference to the live list,
not a snapshot. Therefore any modification you make to the
returned list will be present inside the JAXB object.
This is why there is not a <CODE>set</CODE> method for the homeAddress property.
<p>
For example, to add a new item, do as follows:
<pre>
getHomeAddress().add(newItem);
</pre>
<p>
Objects of the following type(s) are allowed in the list {@link com.ibm.wsspi.security.wim.model.AddressType } | [
"Gets",
"the",
"value",
"of",
"the",
"homeAddress",
"property",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.security.wim.base/src/com/ibm/wsspi/security/wim/model/Person.java#L1449-L1454 | train |
OpenLiberty/open-liberty | dev/com.ibm.websphere.security.wim.base/src/com/ibm/wsspi/security/wim/model/Person.java | Person.getBusinessAddress | public List<com.ibm.wsspi.security.wim.model.AddressType> getBusinessAddress() {
if (businessAddress == null) {
businessAddress = new ArrayList<com.ibm.wsspi.security.wim.model.AddressType>();
}
return this.businessAddress;
} | java | public List<com.ibm.wsspi.security.wim.model.AddressType> getBusinessAddress() {
if (businessAddress == null) {
businessAddress = new ArrayList<com.ibm.wsspi.security.wim.model.AddressType>();
}
return this.businessAddress;
} | [
"public",
"List",
"<",
"com",
".",
"ibm",
".",
"wsspi",
".",
"security",
".",
"wim",
".",
"model",
".",
"AddressType",
">",
"getBusinessAddress",
"(",
")",
"{",
"if",
"(",
"businessAddress",
"==",
"null",
")",
"{",
"businessAddress",
"=",
"new",
"ArrayList",
"<",
"com",
".",
"ibm",
".",
"wsspi",
".",
"security",
".",
"wim",
".",
"model",
".",
"AddressType",
">",
"(",
")",
";",
"}",
"return",
"this",
".",
"businessAddress",
";",
"}"
] | Gets the value of the businessAddress property.
<p>
This accessor method returns a reference to the live list,
not a snapshot. Therefore any modification you make to the
returned list will be present inside the JAXB object.
This is why there is not a <CODE>set</CODE> method for the businessAddress property.
<p>
For example, to add a new item, do as follows:
<pre>
getBusinessAddress().add(newItem);
</pre>
<p>
Objects of the following type(s) are allowed in the list {@link com.ibm.wsspi.security.wim.model.AddressType } | [
"Gets",
"the",
"value",
"of",
"the",
"businessAddress",
"property",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.security.wim.base/src/com/ibm/wsspi/security/wim/model/Person.java#L1486-L1491 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jaxws.clientcontainer/src/com/ibm/ws/jaxws/support/JaxWsMetaDataManager.java | JaxWsMetaDataManager.getModuleMetaData | public static ModuleMetaData getModuleMetaData() {
ComponentMetaData cmd = getComponentMetaData();
ModuleMetaData mmd = null;
if (cmd != null) {
mmd = cmd.getModuleMetaData();
}
if (tc.isDebugEnabled()) {
Tr.debug(tc, "ModuleMetaData object is " + (mmd != null ? mmd.toString() : "null!"));
}
return mmd;
} | java | public static ModuleMetaData getModuleMetaData() {
ComponentMetaData cmd = getComponentMetaData();
ModuleMetaData mmd = null;
if (cmd != null) {
mmd = cmd.getModuleMetaData();
}
if (tc.isDebugEnabled()) {
Tr.debug(tc, "ModuleMetaData object is " + (mmd != null ? mmd.toString() : "null!"));
}
return mmd;
} | [
"public",
"static",
"ModuleMetaData",
"getModuleMetaData",
"(",
")",
"{",
"ComponentMetaData",
"cmd",
"=",
"getComponentMetaData",
"(",
")",
";",
"ModuleMetaData",
"mmd",
"=",
"null",
";",
"if",
"(",
"cmd",
"!=",
"null",
")",
"{",
"mmd",
"=",
"cmd",
".",
"getModuleMetaData",
"(",
")",
";",
"}",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"ModuleMetaData object is \"",
"+",
"(",
"mmd",
"!=",
"null",
"?",
"mmd",
".",
"toString",
"(",
")",
":",
"\"null!\"",
")",
")",
";",
"}",
"return",
"mmd",
";",
"}"
] | Gets the metadata for the module | [
"Gets",
"the",
"metadata",
"for",
"the",
"module"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxws.clientcontainer/src/com/ibm/ws/jaxws/support/JaxWsMetaDataManager.java#L129-L142 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/DeleteNode.java | DeleteNode.setDelete | void setDelete(
GBSNode deleteNode,
int deleteIndex)
{
_deleteNode = deleteNode;
_deleteIndex = deleteIndex;
_notFound = false;
} | java | void setDelete(
GBSNode deleteNode,
int deleteIndex)
{
_deleteNode = deleteNode;
_deleteIndex = deleteIndex;
_notFound = false;
} | [
"void",
"setDelete",
"(",
"GBSNode",
"deleteNode",
",",
"int",
"deleteIndex",
")",
"{",
"_deleteNode",
"=",
"deleteNode",
";",
"_deleteIndex",
"=",
"deleteIndex",
";",
"_notFound",
"=",
"false",
";",
"}"
] | Remember the information about the delete point.
@param deleteNode The node in which the object resides.
@param deleteIndex The index within the node to the entry to
be deleted. | [
"Remember",
"the",
"information",
"about",
"the",
"delete",
"point",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/DeleteNode.java#L104-L111 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/DeleteNode.java | DeleteNode.setTarget | void setTarget(
GBSNode targetNode,
int targetIndex,
int type)
{
_targetNode = targetNode;
_targetIndex = targetIndex;
_type = type;
} | java | void setTarget(
GBSNode targetNode,
int targetIndex,
int type)
{
_targetNode = targetNode;
_targetIndex = targetIndex;
_type = type;
} | [
"void",
"setTarget",
"(",
"GBSNode",
"targetNode",
",",
"int",
"targetIndex",
",",
"int",
"type",
")",
"{",
"_targetNode",
"=",
"targetNode",
";",
"_targetIndex",
"=",
"targetIndex",
";",
"_type",
"=",
"type",
";",
"}"
] | Remember the information about the target point.
@param targetNode The node in which the target object resides.
@param targetIndex
The index within the node to the entry to
be overlayed by the key in the delete point.
@param type Defines the manner in which the overlay is to be done. | [
"Remember",
"the",
"information",
"about",
"the",
"target",
"point",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/DeleteNode.java#L122-L130 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/DeleteNode.java | DeleteNode.reset | void reset()
{
_deleteNode = null;
_deleteIndex = 0;
_targetNode = null;
_targetIndex = 0;
_type = NONE;
_notFound = true;
} | java | void reset()
{
_deleteNode = null;
_deleteIndex = 0;
_targetNode = null;
_targetIndex = 0;
_type = NONE;
_notFound = true;
} | [
"void",
"reset",
"(",
")",
"{",
"_deleteNode",
"=",
"null",
";",
"_deleteIndex",
"=",
"0",
";",
"_targetNode",
"=",
"null",
";",
"_targetIndex",
"=",
"0",
";",
"_type",
"=",
"NONE",
";",
"_notFound",
"=",
"true",
";",
"}"
] | Return this object to its original post-construction state. | [
"Return",
"this",
"object",
"to",
"its",
"original",
"post",
"-",
"construction",
"state",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/DeleteNode.java#L142-L150 | train |
OpenLiberty/open-liberty | dev/wlp.lib.extract/src/wlp/lib/extract/ShutdownHook.java | ShutdownHook.getPID | private String getPID(String dir, String serverName) {
String pid = null;
if (platformType == SelfExtractUtils.PlatformType_CYGWIN) {
String pidFile = dir + File.separator + "wlp" + File.separator + "usr" + File.separator + "servers" + File.separator + ".pid" + File.separator
+ serverName + ".pid";
try {
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(pidFile), "UTF-8"));
try {
return br.readLine();
} finally {
br.close();
}
} catch (IOException e) {
pid = null;
}
if (pid == null) {
Object[] substitution = { dir };
System.out.println(MessageFormat.format(resourceBundle.getString("UNABLE_TO_FIND_PID"), substitution));
}
}
return pid;
} | java | private String getPID(String dir, String serverName) {
String pid = null;
if (platformType == SelfExtractUtils.PlatformType_CYGWIN) {
String pidFile = dir + File.separator + "wlp" + File.separator + "usr" + File.separator + "servers" + File.separator + ".pid" + File.separator
+ serverName + ".pid";
try {
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(pidFile), "UTF-8"));
try {
return br.readLine();
} finally {
br.close();
}
} catch (IOException e) {
pid = null;
}
if (pid == null) {
Object[] substitution = { dir };
System.out.println(MessageFormat.format(resourceBundle.getString("UNABLE_TO_FIND_PID"), substitution));
}
}
return pid;
} | [
"private",
"String",
"getPID",
"(",
"String",
"dir",
",",
"String",
"serverName",
")",
"{",
"String",
"pid",
"=",
"null",
";",
"if",
"(",
"platformType",
"==",
"SelfExtractUtils",
".",
"PlatformType_CYGWIN",
")",
"{",
"String",
"pidFile",
"=",
"dir",
"+",
"File",
".",
"separator",
"+",
"\"wlp\"",
"+",
"File",
".",
"separator",
"+",
"\"usr\"",
"+",
"File",
".",
"separator",
"+",
"\"servers\"",
"+",
"File",
".",
"separator",
"+",
"\".pid\"",
"+",
"File",
".",
"separator",
"+",
"serverName",
"+",
"\".pid\"",
";",
"try",
"{",
"BufferedReader",
"br",
"=",
"new",
"BufferedReader",
"(",
"new",
"InputStreamReader",
"(",
"new",
"FileInputStream",
"(",
"pidFile",
")",
",",
"\"UTF-8\"",
")",
")",
";",
"try",
"{",
"return",
"br",
".",
"readLine",
"(",
")",
";",
"}",
"finally",
"{",
"br",
".",
"close",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"pid",
"=",
"null",
";",
"}",
"if",
"(",
"pid",
"==",
"null",
")",
"{",
"Object",
"[",
"]",
"substitution",
"=",
"{",
"dir",
"}",
";",
"System",
".",
"out",
".",
"println",
"(",
"MessageFormat",
".",
"format",
"(",
"resourceBundle",
".",
"getString",
"(",
"\"UNABLE_TO_FIND_PID\"",
")",
",",
"substitution",
")",
")",
";",
"}",
"}",
"return",
"pid",
";",
"}"
] | Return PID from server directory for cygwin environment only.
@return PID string or null if not cygwin environment or exception occurs
@throws IOException, FileNotFoundException if anything goes wrong | [
"Return",
"PID",
"from",
"server",
"directory",
"for",
"cygwin",
"environment",
"only",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/wlp.lib.extract/src/wlp/lib/extract/ShutdownHook.java#L72-L95 | train |
OpenLiberty/open-liberty | dev/wlp.lib.extract/src/wlp/lib/extract/ShutdownHook.java | ShutdownHook.stopServer | private void stopServer() throws IOException {
// build stop command for Unix platforms
String cmd = dir + File.separator + "wlp" + File.separator + "bin" + File.separator + "server stop " + serverName;
if (platformType == SelfExtractUtils.PlatformType_UNIX) {
// use command as-is
} else if (platformType == SelfExtractUtils.PlatformType_WINDOWS) {
cmd = "cmd /k " + cmd;
} else if (platformType == SelfExtractUtils.PlatformType_CYGWIN) {
cmd = "bash -c " + '"' + cmd.replace('\\', '/') + '"';
}
Runtime.getRuntime().exec(cmd, SelfExtractUtils.runEnv(dir), null); // stop server
} | java | private void stopServer() throws IOException {
// build stop command for Unix platforms
String cmd = dir + File.separator + "wlp" + File.separator + "bin" + File.separator + "server stop " + serverName;
if (platformType == SelfExtractUtils.PlatformType_UNIX) {
// use command as-is
} else if (platformType == SelfExtractUtils.PlatformType_WINDOWS) {
cmd = "cmd /k " + cmd;
} else if (platformType == SelfExtractUtils.PlatformType_CYGWIN) {
cmd = "bash -c " + '"' + cmd.replace('\\', '/') + '"';
}
Runtime.getRuntime().exec(cmd, SelfExtractUtils.runEnv(dir), null); // stop server
} | [
"private",
"void",
"stopServer",
"(",
")",
"throws",
"IOException",
"{",
"// build stop command for Unix platforms",
"String",
"cmd",
"=",
"dir",
"+",
"File",
".",
"separator",
"+",
"\"wlp\"",
"+",
"File",
".",
"separator",
"+",
"\"bin\"",
"+",
"File",
".",
"separator",
"+",
"\"server stop \"",
"+",
"serverName",
";",
"if",
"(",
"platformType",
"==",
"SelfExtractUtils",
".",
"PlatformType_UNIX",
")",
"{",
"// use command as-is",
"}",
"else",
"if",
"(",
"platformType",
"==",
"SelfExtractUtils",
".",
"PlatformType_WINDOWS",
")",
"{",
"cmd",
"=",
"\"cmd /k \"",
"+",
"cmd",
";",
"}",
"else",
"if",
"(",
"platformType",
"==",
"SelfExtractUtils",
".",
"PlatformType_CYGWIN",
")",
"{",
"cmd",
"=",
"\"bash -c \"",
"+",
"'",
"'",
"+",
"cmd",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",
"+",
"'",
"'",
";",
"}",
"Runtime",
".",
"getRuntime",
"(",
")",
".",
"exec",
"(",
"cmd",
",",
"SelfExtractUtils",
".",
"runEnv",
"(",
"dir",
")",
",",
"null",
")",
";",
"// stop server",
"}"
] | Run server stop command
@throws IOException if exec fails | [
"Run",
"server",
"stop",
"command"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/wlp.lib.extract/src/wlp/lib/extract/ShutdownHook.java#L102-L117 | train |
OpenLiberty/open-liberty | dev/wlp.lib.extract/src/wlp/lib/extract/ShutdownHook.java | ShutdownHook.startAsyncDelete | private void startAsyncDelete() throws IOException {
Runtime rt = Runtime.getRuntime();
File scriptFile = null;
if (platformType == SelfExtractUtils.PlatformType_UNIX) {
scriptFile = writeCleanupFile(SelfExtractUtils.PlatformType_UNIX);
rt.exec("chmod 750 " + scriptFile.getAbsolutePath());
rt.exec("sh -c " + scriptFile.getAbsolutePath() + " &");
} else if (platformType == SelfExtractUtils.PlatformType_WINDOWS) {
scriptFile = writeCleanupFile(SelfExtractUtils.PlatformType_WINDOWS);
// Note: must redirect output in order for script to run on windows.
// This is a quirk validated by testing. Redirect to NUL is fine since we're
// not trying to trap this output anyway.
rt.exec("cmd /k start /B " + scriptFile.getAbsolutePath() + " >/NUL 2>/NUL");
} else if (platformType == SelfExtractUtils.PlatformType_CYGWIN) {
scriptFile = writeCleanupFile(SelfExtractUtils.PlatformType_CYGWIN);
// convert to Unix type path and run under bash
rt.exec("bash -c " + scriptFile.getAbsolutePath().replace('\\', '/') + " &");
}
} | java | private void startAsyncDelete() throws IOException {
Runtime rt = Runtime.getRuntime();
File scriptFile = null;
if (platformType == SelfExtractUtils.PlatformType_UNIX) {
scriptFile = writeCleanupFile(SelfExtractUtils.PlatformType_UNIX);
rt.exec("chmod 750 " + scriptFile.getAbsolutePath());
rt.exec("sh -c " + scriptFile.getAbsolutePath() + " &");
} else if (platformType == SelfExtractUtils.PlatformType_WINDOWS) {
scriptFile = writeCleanupFile(SelfExtractUtils.PlatformType_WINDOWS);
// Note: must redirect output in order for script to run on windows.
// This is a quirk validated by testing. Redirect to NUL is fine since we're
// not trying to trap this output anyway.
rt.exec("cmd /k start /B " + scriptFile.getAbsolutePath() + " >/NUL 2>/NUL");
} else if (platformType == SelfExtractUtils.PlatformType_CYGWIN) {
scriptFile = writeCleanupFile(SelfExtractUtils.PlatformType_CYGWIN);
// convert to Unix type path and run under bash
rt.exec("bash -c " + scriptFile.getAbsolutePath().replace('\\', '/') + " &");
}
} | [
"private",
"void",
"startAsyncDelete",
"(",
")",
"throws",
"IOException",
"{",
"Runtime",
"rt",
"=",
"Runtime",
".",
"getRuntime",
"(",
")",
";",
"File",
"scriptFile",
"=",
"null",
";",
"if",
"(",
"platformType",
"==",
"SelfExtractUtils",
".",
"PlatformType_UNIX",
")",
"{",
"scriptFile",
"=",
"writeCleanupFile",
"(",
"SelfExtractUtils",
".",
"PlatformType_UNIX",
")",
";",
"rt",
".",
"exec",
"(",
"\"chmod 750 \"",
"+",
"scriptFile",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"rt",
".",
"exec",
"(",
"\"sh -c \"",
"+",
"scriptFile",
".",
"getAbsolutePath",
"(",
")",
"+",
"\" &\"",
")",
";",
"}",
"else",
"if",
"(",
"platformType",
"==",
"SelfExtractUtils",
".",
"PlatformType_WINDOWS",
")",
"{",
"scriptFile",
"=",
"writeCleanupFile",
"(",
"SelfExtractUtils",
".",
"PlatformType_WINDOWS",
")",
";",
"// Note: must redirect output in order for script to run on windows.",
"// This is a quirk validated by testing. Redirect to NUL is fine since we're",
"// not trying to trap this output anyway.",
"rt",
".",
"exec",
"(",
"\"cmd /k start /B \"",
"+",
"scriptFile",
".",
"getAbsolutePath",
"(",
")",
"+",
"\" >/NUL 2>/NUL\"",
")",
";",
"}",
"else",
"if",
"(",
"platformType",
"==",
"SelfExtractUtils",
".",
"PlatformType_CYGWIN",
")",
"{",
"scriptFile",
"=",
"writeCleanupFile",
"(",
"SelfExtractUtils",
".",
"PlatformType_CYGWIN",
")",
";",
"// convert to Unix type path and run under bash",
"rt",
".",
"exec",
"(",
"\"bash -c \"",
"+",
"scriptFile",
".",
"getAbsolutePath",
"(",
")",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",
"+",
"\" &\"",
")",
";",
"}",
"}"
] | Start async deletion using background script
@throws IOException | [
"Start",
"async",
"deletion",
"using",
"background",
"script"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/wlp.lib.extract/src/wlp/lib/extract/ShutdownHook.java#L124-L142 | train |
OpenLiberty/open-liberty | dev/wlp.lib.extract/src/wlp/lib/extract/ShutdownHook.java | ShutdownHook.writeWindowsCleanup | private void writeWindowsCleanup(File file, BufferedWriter bw) throws IOException {
bw.write("set max=30\n");
bw.write("set cnt=0\n");
bw.write("set dir=" + dir + "\n");
bw.write("echo delete %dir%\n");
bw.write(":while\n");
bw.write(" if exist %dir% (\n");
bw.write(" rmdir /s /q %dir%\n");
bw.write(" timeout 1\n");
bw.write(" set /a cnt+=1\n");
bw.write(" if %cnt% leq %max% (\n");
bw.write(" goto :while \n");
bw.write(" )\n");
bw.write(" )\n");
bw.write("erase " + file.getAbsoluteFile() + "\n");
} | java | private void writeWindowsCleanup(File file, BufferedWriter bw) throws IOException {
bw.write("set max=30\n");
bw.write("set cnt=0\n");
bw.write("set dir=" + dir + "\n");
bw.write("echo delete %dir%\n");
bw.write(":while\n");
bw.write(" if exist %dir% (\n");
bw.write(" rmdir /s /q %dir%\n");
bw.write(" timeout 1\n");
bw.write(" set /a cnt+=1\n");
bw.write(" if %cnt% leq %max% (\n");
bw.write(" goto :while \n");
bw.write(" )\n");
bw.write(" )\n");
bw.write("erase " + file.getAbsoluteFile() + "\n");
} | [
"private",
"void",
"writeWindowsCleanup",
"(",
"File",
"file",
",",
"BufferedWriter",
"bw",
")",
"throws",
"IOException",
"{",
"bw",
".",
"write",
"(",
"\"set max=30\\n\"",
")",
";",
"bw",
".",
"write",
"(",
"\"set cnt=0\\n\"",
")",
";",
"bw",
".",
"write",
"(",
"\"set dir=\"",
"+",
"dir",
"+",
"\"\\n\"",
")",
";",
"bw",
".",
"write",
"(",
"\"echo delete %dir%\\n\"",
")",
";",
"bw",
".",
"write",
"(",
"\":while\\n\"",
")",
";",
"bw",
".",
"write",
"(",
"\" if exist %dir% (\\n\"",
")",
";",
"bw",
".",
"write",
"(",
"\" rmdir /s /q %dir%\\n\"",
")",
";",
"bw",
".",
"write",
"(",
"\" timeout 1\\n\"",
")",
";",
"bw",
".",
"write",
"(",
"\" set /a cnt+=1\\n\"",
")",
";",
"bw",
".",
"write",
"(",
"\" if %cnt% leq %max% (\\n\"",
")",
";",
"bw",
".",
"write",
"(",
"\" goto :while \\n\"",
")",
";",
"bw",
".",
"write",
"(",
"\" )\\n\"",
")",
";",
"bw",
".",
"write",
"(",
"\" )\\n\"",
")",
";",
"bw",
".",
"write",
"(",
"\"erase \"",
"+",
"file",
".",
"getAbsoluteFile",
"(",
")",
"+",
"\"\\n\"",
")",
";",
"}"
] | Write logic for windows cleanup script
@param file - script File object
@param bw - bufferedWriter to write into script file
@throws IOException | [
"Write",
"logic",
"for",
"windows",
"cleanup",
"script"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/wlp.lib.extract/src/wlp/lib/extract/ShutdownHook.java#L151-L166 | train |
OpenLiberty/open-liberty | dev/wlp.lib.extract/src/wlp/lib/extract/ShutdownHook.java | ShutdownHook.writeUnixCleanup | private void writeUnixCleanup(File file, BufferedWriter bw) throws IOException {
bw.write("echo begin delete" + "\n");
bw.write("n=0" + "\n");
bw.write("while [ $n -ne 1 ]; do" + "\n");
bw.write(" sleep 3" + "\n");
bw.write(" if [ -e " + dir.replace('\\', '/') + " ]; then" + "\n");
bw.write(" rm -rf " + dir.replace('\\', '/') + "\n");
bw.write(" else" + "\n");
bw.write(" echo file not found - n=$n" + "\n");
bw.write(" n=1" + "\n");
bw.write(" fi" + "\n");
bw.write("done" + "\n");
bw.write("echo end delete" + "\n");
bw.write("rm " + file.getAbsolutePath().replace('\\', '/') + "\n");
} | java | private void writeUnixCleanup(File file, BufferedWriter bw) throws IOException {
bw.write("echo begin delete" + "\n");
bw.write("n=0" + "\n");
bw.write("while [ $n -ne 1 ]; do" + "\n");
bw.write(" sleep 3" + "\n");
bw.write(" if [ -e " + dir.replace('\\', '/') + " ]; then" + "\n");
bw.write(" rm -rf " + dir.replace('\\', '/') + "\n");
bw.write(" else" + "\n");
bw.write(" echo file not found - n=$n" + "\n");
bw.write(" n=1" + "\n");
bw.write(" fi" + "\n");
bw.write("done" + "\n");
bw.write("echo end delete" + "\n");
bw.write("rm " + file.getAbsolutePath().replace('\\', '/') + "\n");
} | [
"private",
"void",
"writeUnixCleanup",
"(",
"File",
"file",
",",
"BufferedWriter",
"bw",
")",
"throws",
"IOException",
"{",
"bw",
".",
"write",
"(",
"\"echo begin delete\"",
"+",
"\"\\n\"",
")",
";",
"bw",
".",
"write",
"(",
"\"n=0\"",
"+",
"\"\\n\"",
")",
";",
"bw",
".",
"write",
"(",
"\"while [ $n -ne 1 ]; do\"",
"+",
"\"\\n\"",
")",
";",
"bw",
".",
"write",
"(",
"\" sleep 3\"",
"+",
"\"\\n\"",
")",
";",
"bw",
".",
"write",
"(",
"\" if [ -e \"",
"+",
"dir",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",
"+",
"\" ]; then\"",
"+",
"\"\\n\"",
")",
";",
"bw",
".",
"write",
"(",
"\" rm -rf \"",
"+",
"dir",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",
"+",
"\"\\n\"",
")",
";",
"bw",
".",
"write",
"(",
"\" else\"",
"+",
"\"\\n\"",
")",
";",
"bw",
".",
"write",
"(",
"\" echo file not found - n=$n\"",
"+",
"\"\\n\"",
")",
";",
"bw",
".",
"write",
"(",
"\" n=1\"",
"+",
"\"\\n\"",
")",
";",
"bw",
".",
"write",
"(",
"\" fi\"",
"+",
"\"\\n\"",
")",
";",
"bw",
".",
"write",
"(",
"\"done\"",
"+",
"\"\\n\"",
")",
";",
"bw",
".",
"write",
"(",
"\"echo end delete\"",
"+",
"\"\\n\"",
")",
";",
"bw",
".",
"write",
"(",
"\"rm \"",
"+",
"file",
".",
"getAbsolutePath",
"(",
")",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",
"+",
"\"\\n\"",
")",
";",
"}"
] | Write logic for Unix cleanup script
@param file - script File object
@param bw - bufferedWriter to write into script file
@throws IOException | [
"Write",
"logic",
"for",
"Unix",
"cleanup",
"script"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/wlp.lib.extract/src/wlp/lib/extract/ShutdownHook.java#L175-L189 | train |
OpenLiberty/open-liberty | dev/wlp.lib.extract/src/wlp/lib/extract/ShutdownHook.java | ShutdownHook.writeCygwinCleanup | private void writeCygwinCleanup(File file, BufferedWriter bw) throws IOException {
// Under cygwin, must explicitly kill the process that runs
// the server. It simply does not die on its own. And it's
// JVM holds file locks which will prevent cleanup of extraction
// directory. So kill it.
String pid = getPID(dir, serverName);
if (pid != null)
bw.write("kill " + pid + "\n");
writeUnixCleanup(file, bw);
} | java | private void writeCygwinCleanup(File file, BufferedWriter bw) throws IOException {
// Under cygwin, must explicitly kill the process that runs
// the server. It simply does not die on its own. And it's
// JVM holds file locks which will prevent cleanup of extraction
// directory. So kill it.
String pid = getPID(dir, serverName);
if (pid != null)
bw.write("kill " + pid + "\n");
writeUnixCleanup(file, bw);
} | [
"private",
"void",
"writeCygwinCleanup",
"(",
"File",
"file",
",",
"BufferedWriter",
"bw",
")",
"throws",
"IOException",
"{",
"// Under cygwin, must explicitly kill the process that runs",
"// the server. It simply does not die on its own. And it's",
"// JVM holds file locks which will prevent cleanup of extraction",
"// directory. So kill it.",
"String",
"pid",
"=",
"getPID",
"(",
"dir",
",",
"serverName",
")",
";",
"if",
"(",
"pid",
"!=",
"null",
")",
"bw",
".",
"write",
"(",
"\"kill \"",
"+",
"pid",
"+",
"\"\\n\"",
")",
";",
"writeUnixCleanup",
"(",
"file",
",",
"bw",
")",
";",
"}"
] | Write logic for Cygwin cleanup script
@param file - script File object
@param bw - bufferedWriter to write into script file
@throws IOException | [
"Write",
"logic",
"for",
"Cygwin",
"cleanup",
"script"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/wlp.lib.extract/src/wlp/lib/extract/ShutdownHook.java#L198-L207 | train |
OpenLiberty/open-liberty | dev/wlp.lib.extract/src/wlp/lib/extract/ShutdownHook.java | ShutdownHook.run | public void run() {
try {
stopServer(); // first, stop server
// wait on error/output stream threads to complete
// note on Windows the streams never close, so wait with brief timeout
if (!System.getProperty("os.name").startsWith("Win")) {
out.join();
err.join();
} else { // windows, so use timeout
out.join(500);
err.join(500);
}
startAsyncDelete(); // now launch async process to cleanup extraction directory
} catch (Exception e) {
throw new RuntimeException("Shutdown hook failed with exception " + e.getMessage());
}
} | java | public void run() {
try {
stopServer(); // first, stop server
// wait on error/output stream threads to complete
// note on Windows the streams never close, so wait with brief timeout
if (!System.getProperty("os.name").startsWith("Win")) {
out.join();
err.join();
} else { // windows, so use timeout
out.join(500);
err.join(500);
}
startAsyncDelete(); // now launch async process to cleanup extraction directory
} catch (Exception e) {
throw new RuntimeException("Shutdown hook failed with exception " + e.getMessage());
}
} | [
"public",
"void",
"run",
"(",
")",
"{",
"try",
"{",
"stopServer",
"(",
")",
";",
"// first, stop server",
"// wait on error/output stream threads to complete",
"// note on Windows the streams never close, so wait with brief timeout",
"if",
"(",
"!",
"System",
".",
"getProperty",
"(",
"\"os.name\"",
")",
".",
"startsWith",
"(",
"\"Win\"",
")",
")",
"{",
"out",
".",
"join",
"(",
")",
";",
"err",
".",
"join",
"(",
")",
";",
"}",
"else",
"{",
"// windows, so use timeout",
"out",
".",
"join",
"(",
"500",
")",
";",
"err",
".",
"join",
"(",
"500",
")",
";",
"}",
"startAsyncDelete",
"(",
")",
";",
"// now launch async process to cleanup extraction directory",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Shutdown hook failed with exception \"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"}"
] | Main method for shutdown hook. Job of this hook
is to stop server and delete extraction directory. | [
"Main",
"method",
"for",
"shutdown",
"hook",
".",
"Job",
"of",
"this",
"hook",
"is",
"to",
"stop",
"server",
"and",
"delete",
"extraction",
"directory",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/wlp.lib.extract/src/wlp/lib/extract/ShutdownHook.java#L265-L285 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/LogRecord.java | LogRecord.position | protected int position()
{
if (tc.isEntryEnabled()) Tr.entry(tc, "position", this);
int position = _absolutePosition + _buffer.position();
if (tc.isEntryEnabled()) Tr.exit(tc, "position", new Integer(position));
return position;
} | java | protected int position()
{
if (tc.isEntryEnabled()) Tr.entry(tc, "position", this);
int position = _absolutePosition + _buffer.position();
if (tc.isEntryEnabled()) Tr.exit(tc, "position", new Integer(position));
return position;
} | [
"protected",
"int",
"position",
"(",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"position\"",
",",
"this",
")",
";",
"int",
"position",
"=",
"_absolutePosition",
"+",
"_buffer",
".",
"position",
"(",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"position\"",
",",
"new",
"Integer",
"(",
"position",
")",
")",
";",
"return",
"position",
";",
"}"
] | Returns the position of the byte cursor for the mapped byte buffer.
@return The byte cursor position. | [
"Returns",
"the",
"position",
"of",
"the",
"byte",
"cursor",
"for",
"the",
"mapped",
"byte",
"buffer",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/LogRecord.java#L151-L159 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/LogRecord.java | LogRecord.position | protected void position(int newPosition)
{
if (tc.isEntryEnabled()) Tr.entry(tc, "position", new Object[]{this,new Integer(newPosition)});
newPosition -= _absolutePosition;
_buffer.position(newPosition);
if (tc.isEntryEnabled()) Tr.exit(tc, "position");
} | java | protected void position(int newPosition)
{
if (tc.isEntryEnabled()) Tr.entry(tc, "position", new Object[]{this,new Integer(newPosition)});
newPosition -= _absolutePosition;
_buffer.position(newPosition);
if (tc.isEntryEnabled()) Tr.exit(tc, "position");
} | [
"protected",
"void",
"position",
"(",
"int",
"newPosition",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"position\"",
",",
"new",
"Object",
"[",
"]",
"{",
"this",
",",
"new",
"Integer",
"(",
"newPosition",
")",
"}",
")",
";",
"newPosition",
"-=",
"_absolutePosition",
";",
"_buffer",
".",
"position",
"(",
"newPosition",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"position\"",
")",
";",
"}"
] | Sets the position of the byte cursor for the mapped byte buffer.
@param newPosition The required byte cursor position | [
"Sets",
"the",
"position",
"of",
"the",
"byte",
"cursor",
"for",
"the",
"mapped",
"byte",
"buffer",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/LogRecord.java#L169-L177 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/LogRecord.java | LogRecord.advancePosition | protected void advancePosition(int bytes)
{
if (tc.isEntryEnabled()) Tr.entry(tc, "advancePosition", new Object[] {this, new Integer(bytes)});
final int newPosition = _buffer.position() + bytes;
_buffer.position(newPosition);
if (tc.isDebugEnabled()) Tr.debug(tc, "Buffer's position now " + newPosition);
if (tc.isEntryEnabled()) Tr.exit(tc, "advancePosition");
} | java | protected void advancePosition(int bytes)
{
if (tc.isEntryEnabled()) Tr.entry(tc, "advancePosition", new Object[] {this, new Integer(bytes)});
final int newPosition = _buffer.position() + bytes;
_buffer.position(newPosition);
if (tc.isDebugEnabled()) Tr.debug(tc, "Buffer's position now " + newPosition);
if (tc.isEntryEnabled()) Tr.exit(tc, "advancePosition");
} | [
"protected",
"void",
"advancePosition",
"(",
"int",
"bytes",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"advancePosition\"",
",",
"new",
"Object",
"[",
"]",
"{",
"this",
",",
"new",
"Integer",
"(",
"bytes",
")",
"}",
")",
";",
"final",
"int",
"newPosition",
"=",
"_buffer",
".",
"position",
"(",
")",
"+",
"bytes",
";",
"_buffer",
".",
"position",
"(",
"newPosition",
")",
";",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Buffer's position now \"",
"+",
"newPosition",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"advancePosition\"",
")",
";",
"}"
] | Moves the current byte cursor position for the mapped byte buffer forwards.
@param bytes The offset in bytes to move to. | [
"Moves",
"the",
"current",
"byte",
"cursor",
"position",
"for",
"the",
"mapped",
"byte",
"buffer",
"forwards",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/LogRecord.java#L202-L212 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/LogRecord.java | LogRecord.get | protected void get(byte[] bytes)
{
if (tc.isEntryEnabled()) Tr.entry(tc, "get",new Object[] {this,new Integer(bytes.length)});
_buffer.get(bytes);
if (tc.isDebugEnabled()) Tr.debug(tc, RLSUtils.toHexString(bytes, RLSUtils.MAX_DISPLAY_BYTES));
if (tc.isEntryEnabled()) Tr.exit(tc, "get");
} | java | protected void get(byte[] bytes)
{
if (tc.isEntryEnabled()) Tr.entry(tc, "get",new Object[] {this,new Integer(bytes.length)});
_buffer.get(bytes);
if (tc.isDebugEnabled()) Tr.debug(tc, RLSUtils.toHexString(bytes, RLSUtils.MAX_DISPLAY_BYTES));
if (tc.isEntryEnabled()) Tr.exit(tc, "get");
} | [
"protected",
"void",
"get",
"(",
"byte",
"[",
"]",
"bytes",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"get\"",
",",
"new",
"Object",
"[",
"]",
"{",
"this",
",",
"new",
"Integer",
"(",
"bytes",
".",
"length",
")",
"}",
")",
";",
"_buffer",
".",
"get",
"(",
"bytes",
")",
";",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"RLSUtils",
".",
"toHexString",
"(",
"bytes",
",",
"RLSUtils",
".",
"MAX_DISPLAY_BYTES",
")",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"get\"",
")",
";",
"}"
] | Getter method used to read bytes.length bytes from the mapped byte buffer at
the current byte cursor position into the supplied byte array. The byte cursor
is advanced by bytes.length.
@param bytes The target byte array into which the bytes will be read. | [
"Getter",
"method",
"used",
"to",
"read",
"bytes",
".",
"length",
"bytes",
"from",
"the",
"mapped",
"byte",
"buffer",
"at",
"the",
"current",
"byte",
"cursor",
"position",
"into",
"the",
"supplied",
"byte",
"array",
".",
"The",
"byte",
"cursor",
"is",
"advanced",
"by",
"bytes",
".",
"length",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/LogRecord.java#L224-L232 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/LogRecord.java | LogRecord.getInt | protected int getInt()
{
if (tc.isEntryEnabled()) Tr.entry(tc, "getInt",this);
int data = _buffer.getInt();
if (tc.isEntryEnabled()) Tr.exit(tc, "getInt",new Integer(data));
return data;
} | java | protected int getInt()
{
if (tc.isEntryEnabled()) Tr.entry(tc, "getInt",this);
int data = _buffer.getInt();
if (tc.isEntryEnabled()) Tr.exit(tc, "getInt",new Integer(data));
return data;
} | [
"protected",
"int",
"getInt",
"(",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"getInt\"",
",",
"this",
")",
";",
"int",
"data",
"=",
"_buffer",
".",
"getInt",
"(",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"getInt\"",
",",
"new",
"Integer",
"(",
"data",
")",
")",
";",
"return",
"data",
";",
"}"
] | Getter method used to read an integer from the mapped byte buffer at the
current byte cursor position. The byte cursor is advanced by the size of an
integer.
@return The int value read from the mapped byte buffer. | [
"Getter",
"method",
"used",
"to",
"read",
"an",
"integer",
"from",
"the",
"mapped",
"byte",
"buffer",
"at",
"the",
"current",
"byte",
"cursor",
"position",
".",
"The",
"byte",
"cursor",
"is",
"advanced",
"by",
"the",
"size",
"of",
"an",
"integer",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/LogRecord.java#L244-L252 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/LogRecord.java | LogRecord.getLong | protected long getLong()
{
if (tc.isEntryEnabled()) Tr.entry(tc, "getLong",this);
long data = _buffer.getLong();
if (tc.isEntryEnabled()) Tr.exit(tc, "getLong", new Long(data));
return data;
} | java | protected long getLong()
{
if (tc.isEntryEnabled()) Tr.entry(tc, "getLong",this);
long data = _buffer.getLong();
if (tc.isEntryEnabled()) Tr.exit(tc, "getLong", new Long(data));
return data;
} | [
"protected",
"long",
"getLong",
"(",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"getLong\"",
",",
"this",
")",
";",
"long",
"data",
"=",
"_buffer",
".",
"getLong",
"(",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"getLong\"",
",",
"new",
"Long",
"(",
"data",
")",
")",
";",
"return",
"data",
";",
"}"
] | Getter method used to a long from the mapped byte buffer at the current
byte cursor position. The byte cursor is advanced by the size of a long.
@return The long value read from the mapped byte buffer. | [
"Getter",
"method",
"used",
"to",
"a",
"long",
"from",
"the",
"mapped",
"byte",
"buffer",
"at",
"the",
"current",
"byte",
"cursor",
"position",
".",
"The",
"byte",
"cursor",
"is",
"advanced",
"by",
"the",
"size",
"of",
"a",
"long",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/LogRecord.java#L263-L271 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/LogRecord.java | LogRecord.getShort | protected short getShort()
{
if (tc.isEntryEnabled()) Tr.entry(tc, "getShort",this);
short data = _buffer.getShort();
if (tc.isEntryEnabled()) Tr.exit(tc, "getShort", new Short(data));
return data;
} | java | protected short getShort()
{
if (tc.isEntryEnabled()) Tr.entry(tc, "getShort",this);
short data = _buffer.getShort();
if (tc.isEntryEnabled()) Tr.exit(tc, "getShort", new Short(data));
return data;
} | [
"protected",
"short",
"getShort",
"(",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"getShort\"",
",",
"this",
")",
";",
"short",
"data",
"=",
"_buffer",
".",
"getShort",
"(",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"getShort\"",
",",
"new",
"Short",
"(",
"data",
")",
")",
";",
"return",
"data",
";",
"}"
] | Getter method used to a short from the mapped byte buffer at the current
byte cursor position. The byte cursor is advanced by the size of a short.
@return The short value read from the mapped byte buffer. | [
"Getter",
"method",
"used",
"to",
"a",
"short",
"from",
"the",
"mapped",
"byte",
"buffer",
"at",
"the",
"current",
"byte",
"cursor",
"position",
".",
"The",
"byte",
"cursor",
"is",
"advanced",
"by",
"the",
"size",
"of",
"a",
"short",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/LogRecord.java#L282-L290 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/LogRecord.java | LogRecord.getBoolean | protected boolean getBoolean()
{
if (tc.isEntryEnabled()) Tr.entry(tc, "getBoolean", this);
byte dataByte = _buffer.get();
boolean data = (dataByte == TRUE);
if (tc.isEntryEnabled()) Tr.exit(tc, "getBoolean", new Boolean(data));
return data;
} | java | protected boolean getBoolean()
{
if (tc.isEntryEnabled()) Tr.entry(tc, "getBoolean", this);
byte dataByte = _buffer.get();
boolean data = (dataByte == TRUE);
if (tc.isEntryEnabled()) Tr.exit(tc, "getBoolean", new Boolean(data));
return data;
} | [
"protected",
"boolean",
"getBoolean",
"(",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"getBoolean\"",
",",
"this",
")",
";",
"byte",
"dataByte",
"=",
"_buffer",
".",
"get",
"(",
")",
";",
"boolean",
"data",
"=",
"(",
"dataByte",
"==",
"TRUE",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"getBoolean\"",
",",
"new",
"Boolean",
"(",
"data",
")",
")",
";",
"return",
"data",
";",
"}"
] | Getter method used to a boolean from the mapped byte buffer at the current
byte cursor position. The byte cursor is advanced by the size of a boolean.
@return The boolean value read from the mapped byte buffer. | [
"Getter",
"method",
"used",
"to",
"a",
"boolean",
"from",
"the",
"mapped",
"byte",
"buffer",
"at",
"the",
"current",
"byte",
"cursor",
"position",
".",
"The",
"byte",
"cursor",
"is",
"advanced",
"by",
"the",
"size",
"of",
"a",
"boolean",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/LogRecord.java#L301-L310 | train |
OpenLiberty/open-liberty | dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/controller/impl/ChunkStepControllerImpl.java | ChunkStepControllerImpl.readItem | private Object readItem() {
Object itemRead = null;
try {
currentChunkStatus.incrementItemsTouchedInCurrentChunk();
// call read listeners before and after the actual read
for (ItemReadListenerProxy readListenerProxy : itemReadListeners) {
readListenerProxy.beforeRead();
}
itemRead = readerProxy.readItem();
for (ItemReadListenerProxy readListenerProxy : itemReadListeners) {
readListenerProxy.afterRead(itemRead);
}
// itemRead == null means we reached the end of
// the readerProxy "resultset"
if (itemRead == null) {
currentChunkStatus.markReadNull();
currentChunkStatus.decrementItemsTouchedInCurrentChunk();
}
} catch (Exception e) {
runtimeStepExecution.setException(e);
for (ItemReadListenerProxy readListenerProxy : itemReadListeners) {
readListenerProxy.onReadError(e);
}
if (!currentChunkStatus.isRetryingAfterRollback()) {
if (retryReadException(e)) {
if (!retryHandler.isRollbackException(e)) {
// retry without rollback
itemRead = readItem();
} else {
// retry with rollback
currentChunkStatus.markForRollbackWithRetry(e);
}
} else if (skipReadException(e)) {
currentItemStatus.setSkipped(true);
runtimeStepExecution.getMetric(MetricImpl.MetricType.READ_SKIP_COUNT).incValue();
} else {
throw new BatchContainerRuntimeException(e);
}
} else {
// coming from a rollback retry
if (skipReadException(e)) {
currentItemStatus.setSkipped(true);
runtimeStepExecution.getMetric(MetricImpl.MetricType.READ_SKIP_COUNT).incValue();
} else if (retryReadException(e)) {
if (!retryHandler.isRollbackException(e)) {
// retry without rollback
itemRead = readItem();
} else {
// retry with rollback
currentChunkStatus.markForRollbackWithRetry(e);
}
} else {
throw new BatchContainerRuntimeException(e);
}
}
} catch (Throwable e) {
throw new BatchContainerRuntimeException(e);
}
logger.exiting(sourceClass, "readItem", itemRead == null ? "<null>" : itemRead);
return itemRead;
} | java | private Object readItem() {
Object itemRead = null;
try {
currentChunkStatus.incrementItemsTouchedInCurrentChunk();
// call read listeners before and after the actual read
for (ItemReadListenerProxy readListenerProxy : itemReadListeners) {
readListenerProxy.beforeRead();
}
itemRead = readerProxy.readItem();
for (ItemReadListenerProxy readListenerProxy : itemReadListeners) {
readListenerProxy.afterRead(itemRead);
}
// itemRead == null means we reached the end of
// the readerProxy "resultset"
if (itemRead == null) {
currentChunkStatus.markReadNull();
currentChunkStatus.decrementItemsTouchedInCurrentChunk();
}
} catch (Exception e) {
runtimeStepExecution.setException(e);
for (ItemReadListenerProxy readListenerProxy : itemReadListeners) {
readListenerProxy.onReadError(e);
}
if (!currentChunkStatus.isRetryingAfterRollback()) {
if (retryReadException(e)) {
if (!retryHandler.isRollbackException(e)) {
// retry without rollback
itemRead = readItem();
} else {
// retry with rollback
currentChunkStatus.markForRollbackWithRetry(e);
}
} else if (skipReadException(e)) {
currentItemStatus.setSkipped(true);
runtimeStepExecution.getMetric(MetricImpl.MetricType.READ_SKIP_COUNT).incValue();
} else {
throw new BatchContainerRuntimeException(e);
}
} else {
// coming from a rollback retry
if (skipReadException(e)) {
currentItemStatus.setSkipped(true);
runtimeStepExecution.getMetric(MetricImpl.MetricType.READ_SKIP_COUNT).incValue();
} else if (retryReadException(e)) {
if (!retryHandler.isRollbackException(e)) {
// retry without rollback
itemRead = readItem();
} else {
// retry with rollback
currentChunkStatus.markForRollbackWithRetry(e);
}
} else {
throw new BatchContainerRuntimeException(e);
}
}
} catch (Throwable e) {
throw new BatchContainerRuntimeException(e);
}
logger.exiting(sourceClass, "readItem", itemRead == null ? "<null>" : itemRead);
return itemRead;
} | [
"private",
"Object",
"readItem",
"(",
")",
"{",
"Object",
"itemRead",
"=",
"null",
";",
"try",
"{",
"currentChunkStatus",
".",
"incrementItemsTouchedInCurrentChunk",
"(",
")",
";",
"// call read listeners before and after the actual read",
"for",
"(",
"ItemReadListenerProxy",
"readListenerProxy",
":",
"itemReadListeners",
")",
"{",
"readListenerProxy",
".",
"beforeRead",
"(",
")",
";",
"}",
"itemRead",
"=",
"readerProxy",
".",
"readItem",
"(",
")",
";",
"for",
"(",
"ItemReadListenerProxy",
"readListenerProxy",
":",
"itemReadListeners",
")",
"{",
"readListenerProxy",
".",
"afterRead",
"(",
"itemRead",
")",
";",
"}",
"// itemRead == null means we reached the end of",
"// the readerProxy \"resultset\"",
"if",
"(",
"itemRead",
"==",
"null",
")",
"{",
"currentChunkStatus",
".",
"markReadNull",
"(",
")",
";",
"currentChunkStatus",
".",
"decrementItemsTouchedInCurrentChunk",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"runtimeStepExecution",
".",
"setException",
"(",
"e",
")",
";",
"for",
"(",
"ItemReadListenerProxy",
"readListenerProxy",
":",
"itemReadListeners",
")",
"{",
"readListenerProxy",
".",
"onReadError",
"(",
"e",
")",
";",
"}",
"if",
"(",
"!",
"currentChunkStatus",
".",
"isRetryingAfterRollback",
"(",
")",
")",
"{",
"if",
"(",
"retryReadException",
"(",
"e",
")",
")",
"{",
"if",
"(",
"!",
"retryHandler",
".",
"isRollbackException",
"(",
"e",
")",
")",
"{",
"// retry without rollback",
"itemRead",
"=",
"readItem",
"(",
")",
";",
"}",
"else",
"{",
"// retry with rollback",
"currentChunkStatus",
".",
"markForRollbackWithRetry",
"(",
"e",
")",
";",
"}",
"}",
"else",
"if",
"(",
"skipReadException",
"(",
"e",
")",
")",
"{",
"currentItemStatus",
".",
"setSkipped",
"(",
"true",
")",
";",
"runtimeStepExecution",
".",
"getMetric",
"(",
"MetricImpl",
".",
"MetricType",
".",
"READ_SKIP_COUNT",
")",
".",
"incValue",
"(",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"BatchContainerRuntimeException",
"(",
"e",
")",
";",
"}",
"}",
"else",
"{",
"// coming from a rollback retry",
"if",
"(",
"skipReadException",
"(",
"e",
")",
")",
"{",
"currentItemStatus",
".",
"setSkipped",
"(",
"true",
")",
";",
"runtimeStepExecution",
".",
"getMetric",
"(",
"MetricImpl",
".",
"MetricType",
".",
"READ_SKIP_COUNT",
")",
".",
"incValue",
"(",
")",
";",
"}",
"else",
"if",
"(",
"retryReadException",
"(",
"e",
")",
")",
"{",
"if",
"(",
"!",
"retryHandler",
".",
"isRollbackException",
"(",
"e",
")",
")",
"{",
"// retry without rollback",
"itemRead",
"=",
"readItem",
"(",
")",
";",
"}",
"else",
"{",
"// retry with rollback",
"currentChunkStatus",
".",
"markForRollbackWithRetry",
"(",
"e",
")",
";",
"}",
"}",
"else",
"{",
"throw",
"new",
"BatchContainerRuntimeException",
"(",
"e",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"Throwable",
"e",
")",
"{",
"throw",
"new",
"BatchContainerRuntimeException",
"(",
"e",
")",
";",
"}",
"logger",
".",
"exiting",
"(",
"sourceClass",
",",
"\"readItem\"",
",",
"itemRead",
"==",
"null",
"?",
"\"<null>\"",
":",
"itemRead",
")",
";",
"return",
"itemRead",
";",
"}"
] | Reads an item from the reader
@return the item read | [
"Reads",
"an",
"item",
"from",
"the",
"reader"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/controller/impl/ChunkStepControllerImpl.java#L316-L387 | train |
OpenLiberty/open-liberty | dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/controller/impl/ChunkStepControllerImpl.java | ChunkStepControllerImpl.publishCheckpointEvent | private void publishCheckpointEvent(String stepName, long jobInstanceId, long jobExecutionId, long stepExecutionId) {
BatchEventsPublisher publisher = getBatchEventsPublisher();
if (publisher != null) {
String correlationId = runtimeWorkUnitExecution.getCorrelationId();
publisher.publishCheckpointEvent(stepName, jobInstanceId, jobExecutionId, stepExecutionId, correlationId);
}
} | java | private void publishCheckpointEvent(String stepName, long jobInstanceId, long jobExecutionId, long stepExecutionId) {
BatchEventsPublisher publisher = getBatchEventsPublisher();
if (publisher != null) {
String correlationId = runtimeWorkUnitExecution.getCorrelationId();
publisher.publishCheckpointEvent(stepName, jobInstanceId, jobExecutionId, stepExecutionId, correlationId);
}
} | [
"private",
"void",
"publishCheckpointEvent",
"(",
"String",
"stepName",
",",
"long",
"jobInstanceId",
",",
"long",
"jobExecutionId",
",",
"long",
"stepExecutionId",
")",
"{",
"BatchEventsPublisher",
"publisher",
"=",
"getBatchEventsPublisher",
"(",
")",
";",
"if",
"(",
"publisher",
"!=",
"null",
")",
"{",
"String",
"correlationId",
"=",
"runtimeWorkUnitExecution",
".",
"getCorrelationId",
"(",
")",
";",
"publisher",
".",
"publishCheckpointEvent",
"(",
"stepName",
",",
"jobInstanceId",
",",
"jobExecutionId",
",",
"stepExecutionId",
",",
"correlationId",
")",
";",
"}",
"}"
] | Helper method to publish checkpoint event
@param stepName
@param jobInstanceId
@param jobExecutionId | [
"Helper",
"method",
"to",
"publish",
"checkpoint",
"event"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/controller/impl/ChunkStepControllerImpl.java#L718-L725 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.