repo
stringlengths 7
58
| path
stringlengths 12
218
| func_name
stringlengths 3
140
| original_string
stringlengths 73
34.1k
| language
stringclasses 1
value | code
stringlengths 73
34.1k
| code_tokens
sequence | docstring
stringlengths 3
16k
| docstring_tokens
sequence | sha
stringlengths 40
40
| url
stringlengths 105
339
| partition
stringclasses 1
value |
---|---|---|---|---|---|---|---|---|---|---|---|
OpenLiberty/open-liberty | dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapConnection.java | LdapConnection.modifyAttributes | public void modifyAttributes(String name, ModificationItem[] mods) throws NamingException, WIMException {
TimedDirContext ctx = iContextManager.getDirContext();
// checkWritePermission(ctx); TODO Why are we not checking for permission here?
try {
try {
ctx.modifyAttributes(new LdapName(name), mods);
} catch (NamingException e) {
if (!ContextManager.isConnectionException(e)) {
throw e;
}
ctx = iContextManager.reCreateDirContext(ctx, e.toString());
ctx.modifyAttributes(new LdapName(name), mods);
}
} catch (NameNotFoundException e) {
String msg = Tr.formatMessage(tc, WIMMessageKey.NAMING_EXCEPTION, WIMMessageHelper.generateMsgParms(e.toString(true)));
throw new EntityNotFoundException(WIMMessageKey.NAMING_EXCEPTION, msg, e);
} catch (NamingException e) {
throw e;
} finally {
iContextManager.releaseDirContext(ctx);
}
} | java | public void modifyAttributes(String name, ModificationItem[] mods) throws NamingException, WIMException {
TimedDirContext ctx = iContextManager.getDirContext();
// checkWritePermission(ctx); TODO Why are we not checking for permission here?
try {
try {
ctx.modifyAttributes(new LdapName(name), mods);
} catch (NamingException e) {
if (!ContextManager.isConnectionException(e)) {
throw e;
}
ctx = iContextManager.reCreateDirContext(ctx, e.toString());
ctx.modifyAttributes(new LdapName(name), mods);
}
} catch (NameNotFoundException e) {
String msg = Tr.formatMessage(tc, WIMMessageKey.NAMING_EXCEPTION, WIMMessageHelper.generateMsgParms(e.toString(true)));
throw new EntityNotFoundException(WIMMessageKey.NAMING_EXCEPTION, msg, e);
} catch (NamingException e) {
throw e;
} finally {
iContextManager.releaseDirContext(ctx);
}
} | [
"public",
"void",
"modifyAttributes",
"(",
"String",
"name",
",",
"ModificationItem",
"[",
"]",
"mods",
")",
"throws",
"NamingException",
",",
"WIMException",
"{",
"TimedDirContext",
"ctx",
"=",
"iContextManager",
".",
"getDirContext",
"(",
")",
";",
"// checkWritePermission(ctx); TODO Why are we not checking for permission here?",
"try",
"{",
"try",
"{",
"ctx",
".",
"modifyAttributes",
"(",
"new",
"LdapName",
"(",
"name",
")",
",",
"mods",
")",
";",
"}",
"catch",
"(",
"NamingException",
"e",
")",
"{",
"if",
"(",
"!",
"ContextManager",
".",
"isConnectionException",
"(",
"e",
")",
")",
"{",
"throw",
"e",
";",
"}",
"ctx",
"=",
"iContextManager",
".",
"reCreateDirContext",
"(",
"ctx",
",",
"e",
".",
"toString",
"(",
")",
")",
";",
"ctx",
".",
"modifyAttributes",
"(",
"new",
"LdapName",
"(",
"name",
")",
",",
"mods",
")",
";",
"}",
"}",
"catch",
"(",
"NameNotFoundException",
"e",
")",
"{",
"String",
"msg",
"=",
"Tr",
".",
"formatMessage",
"(",
"tc",
",",
"WIMMessageKey",
".",
"NAMING_EXCEPTION",
",",
"WIMMessageHelper",
".",
"generateMsgParms",
"(",
"e",
".",
"toString",
"(",
"true",
")",
")",
")",
";",
"throw",
"new",
"EntityNotFoundException",
"(",
"WIMMessageKey",
".",
"NAMING_EXCEPTION",
",",
"msg",
",",
"e",
")",
";",
"}",
"catch",
"(",
"NamingException",
"e",
")",
"{",
"throw",
"e",
";",
"}",
"finally",
"{",
"iContextManager",
".",
"releaseDirContext",
"(",
"ctx",
")",
";",
"}",
"}"
] | Modify the given LDAP name according to the specified modification items.
@param dn The distinguished name to modify attributes on.
@param mod_op The operation to perform.
@param mods The modification items.
@throws NamingException If there was an issue writing the new attribute values.
@throws WIMException If there was an issue getting or releasing a context, or the context is on a
fail-over server and writing to fail-over servers is prohibited, or the distinguished
name does not exist. | [
"Modify",
"the",
"given",
"LDAP",
"name",
"according",
"to",
"the",
"specified",
"modification",
"items",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapConnection.java#L2131-L2152 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapConnection.java | LdapConnection.modifyAttributes | public void modifyAttributes(String dn, int mod_op, Attributes attrs) throws NamingException, WIMException {
TimedDirContext ctx = iContextManager.getDirContext();
iContextManager.checkWritePermission(ctx);
try {
try {
ctx.modifyAttributes(new LdapName(dn), mod_op, attrs);
} catch (NamingException e) {
if (!ContextManager.isConnectionException(e)) {
throw e;
}
ctx = iContextManager.reCreateDirContext(ctx, e.toString());
ctx.modifyAttributes(new LdapName(dn), mod_op, attrs);
}
} catch (NameNotFoundException e) {
String msg = Tr.formatMessage(tc, WIMMessageKey.NAMING_EXCEPTION, WIMMessageHelper.generateMsgParms(e.toString(true)));
throw new EntityNotFoundException(WIMMessageKey.NAMING_EXCEPTION, msg, e);
} catch (NamingException e) {
throw e;
}
finally {
iContextManager.releaseDirContext(ctx);
}
} | java | public void modifyAttributes(String dn, int mod_op, Attributes attrs) throws NamingException, WIMException {
TimedDirContext ctx = iContextManager.getDirContext();
iContextManager.checkWritePermission(ctx);
try {
try {
ctx.modifyAttributes(new LdapName(dn), mod_op, attrs);
} catch (NamingException e) {
if (!ContextManager.isConnectionException(e)) {
throw e;
}
ctx = iContextManager.reCreateDirContext(ctx, e.toString());
ctx.modifyAttributes(new LdapName(dn), mod_op, attrs);
}
} catch (NameNotFoundException e) {
String msg = Tr.formatMessage(tc, WIMMessageKey.NAMING_EXCEPTION, WIMMessageHelper.generateMsgParms(e.toString(true)));
throw new EntityNotFoundException(WIMMessageKey.NAMING_EXCEPTION, msg, e);
} catch (NamingException e) {
throw e;
}
finally {
iContextManager.releaseDirContext(ctx);
}
} | [
"public",
"void",
"modifyAttributes",
"(",
"String",
"dn",
",",
"int",
"mod_op",
",",
"Attributes",
"attrs",
")",
"throws",
"NamingException",
",",
"WIMException",
"{",
"TimedDirContext",
"ctx",
"=",
"iContextManager",
".",
"getDirContext",
"(",
")",
";",
"iContextManager",
".",
"checkWritePermission",
"(",
"ctx",
")",
";",
"try",
"{",
"try",
"{",
"ctx",
".",
"modifyAttributes",
"(",
"new",
"LdapName",
"(",
"dn",
")",
",",
"mod_op",
",",
"attrs",
")",
";",
"}",
"catch",
"(",
"NamingException",
"e",
")",
"{",
"if",
"(",
"!",
"ContextManager",
".",
"isConnectionException",
"(",
"e",
")",
")",
"{",
"throw",
"e",
";",
"}",
"ctx",
"=",
"iContextManager",
".",
"reCreateDirContext",
"(",
"ctx",
",",
"e",
".",
"toString",
"(",
")",
")",
";",
"ctx",
".",
"modifyAttributes",
"(",
"new",
"LdapName",
"(",
"dn",
")",
",",
"mod_op",
",",
"attrs",
")",
";",
"}",
"}",
"catch",
"(",
"NameNotFoundException",
"e",
")",
"{",
"String",
"msg",
"=",
"Tr",
".",
"formatMessage",
"(",
"tc",
",",
"WIMMessageKey",
".",
"NAMING_EXCEPTION",
",",
"WIMMessageHelper",
".",
"generateMsgParms",
"(",
"e",
".",
"toString",
"(",
"true",
")",
")",
")",
";",
"throw",
"new",
"EntityNotFoundException",
"(",
"WIMMessageKey",
".",
"NAMING_EXCEPTION",
",",
"msg",
",",
"e",
")",
";",
"}",
"catch",
"(",
"NamingException",
"e",
")",
"{",
"throw",
"e",
";",
"}",
"finally",
"{",
"iContextManager",
".",
"releaseDirContext",
"(",
"ctx",
")",
";",
"}",
"}"
] | Modify the attributes for the specified distinguished name.
@param dn The distinguished name to modify attributes on.
@param mod_op The operation to perform.
@param attrs The attributes to modify.
@throws NamingException If there was an issue writing the new attribute values.
@throws WIMException If there was an issue getting or releasing a context, or the context is on a
fail-over server and writing to fail-over servers is prohibited, or the distinguished
name does not exist. | [
"Modify",
"the",
"attributes",
"for",
"the",
"specified",
"distinguished",
"name",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapConnection.java#L2165-L2188 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapConnection.java | LdapConnection.rename | public void rename(String dn, String newDn) throws WIMException {
TimedDirContext ctx = iContextManager.getDirContext();
iContextManager.checkWritePermission(ctx);
try {
try {
ctx.rename(dn, newDn);
} catch (NamingException e) {
if (!ContextManager.isConnectionException(e)) {
throw e;
}
ctx = iContextManager.reCreateDirContext(ctx, e.toString());
ctx.rename(dn, newDn);
}
} catch (NamingException e) {
String msg = Tr.formatMessage(tc, WIMMessageKey.NAMING_EXCEPTION, WIMMessageHelper.generateMsgParms(e.toString(true)));
throw new WIMSystemException(WIMMessageKey.NAMING_EXCEPTION, msg, e);
} finally {
iContextManager.releaseDirContext(ctx);
}
} | java | public void rename(String dn, String newDn) throws WIMException {
TimedDirContext ctx = iContextManager.getDirContext();
iContextManager.checkWritePermission(ctx);
try {
try {
ctx.rename(dn, newDn);
} catch (NamingException e) {
if (!ContextManager.isConnectionException(e)) {
throw e;
}
ctx = iContextManager.reCreateDirContext(ctx, e.toString());
ctx.rename(dn, newDn);
}
} catch (NamingException e) {
String msg = Tr.formatMessage(tc, WIMMessageKey.NAMING_EXCEPTION, WIMMessageHelper.generateMsgParms(e.toString(true)));
throw new WIMSystemException(WIMMessageKey.NAMING_EXCEPTION, msg, e);
} finally {
iContextManager.releaseDirContext(ctx);
}
} | [
"public",
"void",
"rename",
"(",
"String",
"dn",
",",
"String",
"newDn",
")",
"throws",
"WIMException",
"{",
"TimedDirContext",
"ctx",
"=",
"iContextManager",
".",
"getDirContext",
"(",
")",
";",
"iContextManager",
".",
"checkWritePermission",
"(",
"ctx",
")",
";",
"try",
"{",
"try",
"{",
"ctx",
".",
"rename",
"(",
"dn",
",",
"newDn",
")",
";",
"}",
"catch",
"(",
"NamingException",
"e",
")",
"{",
"if",
"(",
"!",
"ContextManager",
".",
"isConnectionException",
"(",
"e",
")",
")",
"{",
"throw",
"e",
";",
"}",
"ctx",
"=",
"iContextManager",
".",
"reCreateDirContext",
"(",
"ctx",
",",
"e",
".",
"toString",
"(",
")",
")",
";",
"ctx",
".",
"rename",
"(",
"dn",
",",
"newDn",
")",
";",
"}",
"}",
"catch",
"(",
"NamingException",
"e",
")",
"{",
"String",
"msg",
"=",
"Tr",
".",
"formatMessage",
"(",
"tc",
",",
"WIMMessageKey",
".",
"NAMING_EXCEPTION",
",",
"WIMMessageHelper",
".",
"generateMsgParms",
"(",
"e",
".",
"toString",
"(",
"true",
")",
")",
")",
";",
"throw",
"new",
"WIMSystemException",
"(",
"WIMMessageKey",
".",
"NAMING_EXCEPTION",
",",
"msg",
",",
"e",
")",
";",
"}",
"finally",
"{",
"iContextManager",
".",
"releaseDirContext",
"(",
"ctx",
")",
";",
"}",
"}"
] | Rename an entity.
@param dn The distinguished name to rename.
@param newDn The new distinguished name.
@throws WIMException If there was an issue getting or releasing a context, or the context is on a
fail-over server and writing to fail-over servers is prohibited, or the distinguished
name does not exist. | [
"Rename",
"an",
"entity",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapConnection.java#L2199-L2218 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/AbstractTagLibrary.java | AbstractTagLibrary.addConverter | protected final void addConverter(String name, String converterId)
{
_factories.put(name, new ConverterHandlerFactory(converterId));
} | java | protected final void addConverter(String name, String converterId)
{
_factories.put(name, new ConverterHandlerFactory(converterId));
} | [
"protected",
"final",
"void",
"addConverter",
"(",
"String",
"name",
",",
"String",
"converterId",
")",
"{",
"_factories",
".",
"put",
"(",
"name",
",",
"new",
"ConverterHandlerFactory",
"(",
"converterId",
")",
")",
";",
"}"
] | Add a ConvertHandler for the specified converterId
@see javax.faces.view.facelets.ConverterHandler
@see javax.faces.application.Application#createConverter(java.lang.String)
@param name
name to use, "foo" would be <my:foo />
@param converterId
id to pass to Application instance | [
"Add",
"a",
"ConvertHandler",
"for",
"the",
"specified",
"converterId"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/AbstractTagLibrary.java#L197-L200 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/AbstractTagLibrary.java | AbstractTagLibrary.addConverter | protected final void addConverter(String name, String converterId, Class<? extends TagHandler> type)
{
_factories.put(name, new UserConverterHandlerFactory(converterId, type));
} | java | protected final void addConverter(String name, String converterId, Class<? extends TagHandler> type)
{
_factories.put(name, new UserConverterHandlerFactory(converterId, type));
} | [
"protected",
"final",
"void",
"addConverter",
"(",
"String",
"name",
",",
"String",
"converterId",
",",
"Class",
"<",
"?",
"extends",
"TagHandler",
">",
"type",
")",
"{",
"_factories",
".",
"put",
"(",
"name",
",",
"new",
"UserConverterHandlerFactory",
"(",
"converterId",
",",
"type",
")",
")",
";",
"}"
] | Add a ConvertHandler for the specified converterId of a TagHandler type
@see javax.faces.view.facelets.ConverterHandler
@see javax.faces.view.facelets.ConverterConfig
@see javax.faces.application.Application#createConverter(java.lang.String)
@param name
name to use, "foo" would be <my:foo />
@param converterId
id to pass to Application instance
@param type
TagHandler type that takes in a ConverterConfig | [
"Add",
"a",
"ConvertHandler",
"for",
"the",
"specified",
"converterId",
"of",
"a",
"TagHandler",
"type"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/AbstractTagLibrary.java#L215-L218 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/AbstractTagLibrary.java | AbstractTagLibrary.addTagHandler | protected final void addTagHandler(String name, Class<? extends TagHandler> handlerType)
{
_factories.put(name, new HandlerFactory(handlerType));
} | java | protected final void addTagHandler(String name, Class<? extends TagHandler> handlerType)
{
_factories.put(name, new HandlerFactory(handlerType));
} | [
"protected",
"final",
"void",
"addTagHandler",
"(",
"String",
"name",
",",
"Class",
"<",
"?",
"extends",
"TagHandler",
">",
"handlerType",
")",
"{",
"_factories",
".",
"put",
"(",
"name",
",",
"new",
"HandlerFactory",
"(",
"handlerType",
")",
")",
";",
"}"
] | Use the specified HandlerType in compiling Facelets. HandlerType must extend TagHandler.
@see TagHandler
@param name
name to use, "foo" would be <my:foo />
@param handlerType
must extend TagHandler | [
"Use",
"the",
"specified",
"HandlerType",
"in",
"compiling",
"Facelets",
".",
"HandlerType",
"must",
"extend",
"TagHandler",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/AbstractTagLibrary.java#L262-L265 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/AbstractTagLibrary.java | AbstractTagLibrary.addUserTag | protected final void addUserTag(String name, URL source)
{
if (_strictJsf2FaceletsCompatibility == null)
{
MyfacesConfig config = MyfacesConfig.getCurrentInstance(
FacesContext.getCurrentInstance().getExternalContext());
_strictJsf2FaceletsCompatibility = config.isStrictJsf2FaceletsCompatibility();
}
if (Boolean.TRUE.equals(_strictJsf2FaceletsCompatibility))
{
_factories.put(name, new LegacyUserTagFactory(source));
}
else
{
_factories.put(name, new UserTagFactory(source));
}
} | java | protected final void addUserTag(String name, URL source)
{
if (_strictJsf2FaceletsCompatibility == null)
{
MyfacesConfig config = MyfacesConfig.getCurrentInstance(
FacesContext.getCurrentInstance().getExternalContext());
_strictJsf2FaceletsCompatibility = config.isStrictJsf2FaceletsCompatibility();
}
if (Boolean.TRUE.equals(_strictJsf2FaceletsCompatibility))
{
_factories.put(name, new LegacyUserTagFactory(source));
}
else
{
_factories.put(name, new UserTagFactory(source));
}
} | [
"protected",
"final",
"void",
"addUserTag",
"(",
"String",
"name",
",",
"URL",
"source",
")",
"{",
"if",
"(",
"_strictJsf2FaceletsCompatibility",
"==",
"null",
")",
"{",
"MyfacesConfig",
"config",
"=",
"MyfacesConfig",
".",
"getCurrentInstance",
"(",
"FacesContext",
".",
"getCurrentInstance",
"(",
")",
".",
"getExternalContext",
"(",
")",
")",
";",
"_strictJsf2FaceletsCompatibility",
"=",
"config",
".",
"isStrictJsf2FaceletsCompatibility",
"(",
")",
";",
"}",
"if",
"(",
"Boolean",
".",
"TRUE",
".",
"equals",
"(",
"_strictJsf2FaceletsCompatibility",
")",
")",
"{",
"_factories",
".",
"put",
"(",
"name",
",",
"new",
"LegacyUserTagFactory",
"(",
"source",
")",
")",
";",
"}",
"else",
"{",
"_factories",
".",
"put",
"(",
"name",
",",
"new",
"UserTagFactory",
"(",
"source",
")",
")",
";",
"}",
"}"
] | Add a UserTagHandler specified a the URL source.
@see UserTagHandler
@param name
name to use, "foo" would be <my:foo />
@param source
source where the Facelet (Tag) source is | [
"Add",
"a",
"UserTagHandler",
"specified",
"a",
"the",
"URL",
"source",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/AbstractTagLibrary.java#L276-L293 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.quickstart/src/com/ibm/ws/security/quickstart/internal/QuickStartSecurity.java | QuickStartSecurity.setUserRegistry | @Reference(policy = ReferencePolicy.DYNAMIC, cardinality = ReferenceCardinality.MULTIPLE, target = "(!(com.ibm.ws.security.registry.type=QuickStartSecurityRegistry))")
protected synchronized void setUserRegistry(ServiceReference<UserRegistry> ref) {
urs.add(ref);
unregisterQuickStartSecurityRegistryConfiguration();
unregisterQuickStartSecurityAdministratorRole();
} | java | @Reference(policy = ReferencePolicy.DYNAMIC, cardinality = ReferenceCardinality.MULTIPLE, target = "(!(com.ibm.ws.security.registry.type=QuickStartSecurityRegistry))")
protected synchronized void setUserRegistry(ServiceReference<UserRegistry> ref) {
urs.add(ref);
unregisterQuickStartSecurityRegistryConfiguration();
unregisterQuickStartSecurityAdministratorRole();
} | [
"@",
"Reference",
"(",
"policy",
"=",
"ReferencePolicy",
".",
"DYNAMIC",
",",
"cardinality",
"=",
"ReferenceCardinality",
".",
"MULTIPLE",
",",
"target",
"=",
"\"(!(com.ibm.ws.security.registry.type=QuickStartSecurityRegistry))\"",
")",
"protected",
"synchronized",
"void",
"setUserRegistry",
"(",
"ServiceReference",
"<",
"UserRegistry",
">",
"ref",
")",
"{",
"urs",
".",
"add",
"(",
"ref",
")",
";",
"unregisterQuickStartSecurityRegistryConfiguration",
"(",
")",
";",
"unregisterQuickStartSecurityAdministratorRole",
"(",
")",
";",
"}"
] | This method will only be called for UserRegistryConfigurations that are not
the one we have defined here.
@param ref | [
"This",
"method",
"will",
"only",
"be",
"called",
"for",
"UserRegistryConfigurations",
"that",
"are",
"not",
"the",
"one",
"we",
"have",
"defined",
"here",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.quickstart/src/com/ibm/ws/security/quickstart/internal/QuickStartSecurity.java#L109-L114 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.quickstart/src/com/ibm/ws/security/quickstart/internal/QuickStartSecurity.java | QuickStartSecurity.setManagementRole | @Reference(policy = ReferencePolicy.DYNAMIC, cardinality = ReferenceCardinality.MULTIPLE,
target = "(!(com.ibm.ws.management.security.role.name=QuickStartSecurityAdministratorRole))")
protected synchronized void setManagementRole(ServiceReference<ManagementRole> ref) {
managementRoles.add(ref);
unregisterQuickStartSecurityRegistryConfiguration();
unregisterQuickStartSecurityAdministratorRole();
} | java | @Reference(policy = ReferencePolicy.DYNAMIC, cardinality = ReferenceCardinality.MULTIPLE,
target = "(!(com.ibm.ws.management.security.role.name=QuickStartSecurityAdministratorRole))")
protected synchronized void setManagementRole(ServiceReference<ManagementRole> ref) {
managementRoles.add(ref);
unregisterQuickStartSecurityRegistryConfiguration();
unregisterQuickStartSecurityAdministratorRole();
} | [
"@",
"Reference",
"(",
"policy",
"=",
"ReferencePolicy",
".",
"DYNAMIC",
",",
"cardinality",
"=",
"ReferenceCardinality",
".",
"MULTIPLE",
",",
"target",
"=",
"\"(!(com.ibm.ws.management.security.role.name=QuickStartSecurityAdministratorRole))\"",
")",
"protected",
"synchronized",
"void",
"setManagementRole",
"(",
"ServiceReference",
"<",
"ManagementRole",
">",
"ref",
")",
"{",
"managementRoles",
".",
"add",
"(",
"ref",
")",
";",
"unregisterQuickStartSecurityRegistryConfiguration",
"(",
")",
";",
"unregisterQuickStartSecurityAdministratorRole",
"(",
")",
";",
"}"
] | This method will only be called for ManagementRoles that are not
the one we have defined here.
@param ref | [
"This",
"method",
"will",
"only",
"be",
"called",
"for",
"ManagementRoles",
"that",
"are",
"not",
"the",
"one",
"we",
"have",
"defined",
"here",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.quickstart/src/com/ibm/ws/security/quickstart/internal/QuickStartSecurity.java#L134-L140 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.quickstart/src/com/ibm/ws/security/quickstart/internal/QuickStartSecurity.java | QuickStartSecurity.modify | @Modified
protected synchronized void modify(QuickStartSecurityConfig config) {
this.config = config;
validateConfigurationProperties();
if (urConfigReg == null) {
registerQuickStartSecurityRegistryConfiguration();
} else {
updateQuickStartSecurityRegistryConfiguration();
}
unregisterQuickStartSecurityAdministratorRole();
registerQuickStartSecurityAdministratorRole();
} | java | @Modified
protected synchronized void modify(QuickStartSecurityConfig config) {
this.config = config;
validateConfigurationProperties();
if (urConfigReg == null) {
registerQuickStartSecurityRegistryConfiguration();
} else {
updateQuickStartSecurityRegistryConfiguration();
}
unregisterQuickStartSecurityAdministratorRole();
registerQuickStartSecurityAdministratorRole();
} | [
"@",
"Modified",
"protected",
"synchronized",
"void",
"modify",
"(",
"QuickStartSecurityConfig",
"config",
")",
"{",
"this",
".",
"config",
"=",
"config",
";",
"validateConfigurationProperties",
"(",
")",
";",
"if",
"(",
"urConfigReg",
"==",
"null",
")",
"{",
"registerQuickStartSecurityRegistryConfiguration",
"(",
")",
";",
"}",
"else",
"{",
"updateQuickStartSecurityRegistryConfiguration",
"(",
")",
";",
"}",
"unregisterQuickStartSecurityAdministratorRole",
"(",
")",
";",
"registerQuickStartSecurityAdministratorRole",
"(",
")",
";",
"}"
] | Push the new user and password into the registry's configuration. | [
"Push",
"the",
"new",
"user",
"and",
"password",
"into",
"the",
"registry",
"s",
"configuration",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.quickstart/src/com/ibm/ws/security/quickstart/internal/QuickStartSecurity.java#L168-L182 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.quickstart/src/com/ibm/ws/security/quickstart/internal/QuickStartSecurity.java | QuickStartSecurity.isStringValueUndefined | @Trivial
private boolean isStringValueUndefined(Object str) {
if (str instanceof SerializableProtectedString) {
// Avoid constructing a String from a ProtectedString
char[] contents = ((SerializableProtectedString) str).getChars();
for (char ch : contents)
if (ch > '\u0020')
return false; // See the description of String.trim()
return true;
} else {
return (str == null || ((String) str).trim().isEmpty());
}
} | java | @Trivial
private boolean isStringValueUndefined(Object str) {
if (str instanceof SerializableProtectedString) {
// Avoid constructing a String from a ProtectedString
char[] contents = ((SerializableProtectedString) str).getChars();
for (char ch : contents)
if (ch > '\u0020')
return false; // See the description of String.trim()
return true;
} else {
return (str == null || ((String) str).trim().isEmpty());
}
} | [
"@",
"Trivial",
"private",
"boolean",
"isStringValueUndefined",
"(",
"Object",
"str",
")",
"{",
"if",
"(",
"str",
"instanceof",
"SerializableProtectedString",
")",
"{",
"// Avoid constructing a String from a ProtectedString",
"char",
"[",
"]",
"contents",
"=",
"(",
"(",
"SerializableProtectedString",
")",
"str",
")",
".",
"getChars",
"(",
")",
";",
"for",
"(",
"char",
"ch",
":",
"contents",
")",
"if",
"(",
"ch",
">",
"'",
"'",
")",
"return",
"false",
";",
"// See the description of String.trim()",
"return",
"true",
";",
"}",
"else",
"{",
"return",
"(",
"str",
"==",
"null",
"||",
"(",
"(",
"String",
")",
"str",
")",
".",
"trim",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
";",
"}",
"}"
] | Check if the value is non-null, not empty, and not all white-space.
@return {@code false} if the string has characters, {@code true} otherwise. | [
"Check",
"if",
"the",
"value",
"is",
"non",
"-",
"null",
"not",
"empty",
"and",
"not",
"all",
"white",
"-",
"space",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.quickstart/src/com/ibm/ws/security/quickstart/internal/QuickStartSecurity.java#L198-L211 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.quickstart/src/com/ibm/ws/security/quickstart/internal/QuickStartSecurity.java | QuickStartSecurity.buildUserRegistryConfigProps | private Dictionary<String, Object> buildUserRegistryConfigProps() {
Hashtable<String, Object> properties = new Hashtable<String, Object>();
properties.put("config.id", QUICK_START_SECURITY_REGISTRY_ID);
properties.put("id", QUICK_START_SECURITY_REGISTRY_ID);
properties.put(UserRegistryService.REGISTRY_TYPE, QUICK_START_SECURITY_REGISTRY_TYPE);
properties.put(CFG_KEY_USER, config.userName());
properties.put("service.vendor", "IBM");
return properties;
} | java | private Dictionary<String, Object> buildUserRegistryConfigProps() {
Hashtable<String, Object> properties = new Hashtable<String, Object>();
properties.put("config.id", QUICK_START_SECURITY_REGISTRY_ID);
properties.put("id", QUICK_START_SECURITY_REGISTRY_ID);
properties.put(UserRegistryService.REGISTRY_TYPE, QUICK_START_SECURITY_REGISTRY_TYPE);
properties.put(CFG_KEY_USER, config.userName());
properties.put("service.vendor", "IBM");
return properties;
} | [
"private",
"Dictionary",
"<",
"String",
",",
"Object",
">",
"buildUserRegistryConfigProps",
"(",
")",
"{",
"Hashtable",
"<",
"String",
",",
"Object",
">",
"properties",
"=",
"new",
"Hashtable",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"properties",
".",
"put",
"(",
"\"config.id\"",
",",
"QUICK_START_SECURITY_REGISTRY_ID",
")",
";",
"properties",
".",
"put",
"(",
"\"id\"",
",",
"QUICK_START_SECURITY_REGISTRY_ID",
")",
";",
"properties",
".",
"put",
"(",
"UserRegistryService",
".",
"REGISTRY_TYPE",
",",
"QUICK_START_SECURITY_REGISTRY_TYPE",
")",
";",
"properties",
".",
"put",
"(",
"CFG_KEY_USER",
",",
"config",
".",
"userName",
"(",
")",
")",
";",
"properties",
".",
"put",
"(",
"\"service.vendor\"",
",",
"\"IBM\"",
")",
";",
"return",
"properties",
";",
"}"
] | Build the UserRegistryConfiguration properties based on the current
user and password.
@return UserRegistryConfiguration properties | [
"Build",
"the",
"UserRegistryConfiguration",
"properties",
"based",
"on",
"the",
"current",
"user",
"and",
"password",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.quickstart/src/com/ibm/ws/security/quickstart/internal/QuickStartSecurity.java#L257-L265 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.quickstart/src/com/ibm/ws/security/quickstart/internal/QuickStartSecurity.java | QuickStartSecurity.registerQuickStartSecurityRegistryConfiguration | private void registerQuickStartSecurityRegistryConfiguration() {
if (bc == null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "BundleContext is null, we must be deactivated.");
}
return;
}
if (urConfigReg != null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "QuickStartSecurityRegistry configuration is already registered.");
}
return;
}
if (isStringValueUndefined(config.userName()) || isStringValueUndefined(config.userPassword())) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Incomplete configuration. This should already have been reported. Will not register QuickStartSecurityRegistry configuration.");
}
return;
}
if (config.UserRegistry() != null && config.UserRegistry().length > 0) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Other UserRegistryConfiguration are present, will not register the QuickStartSecurityRegistry configuration.");
}
return;
}
if (!managementRoles.isEmpty()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Other ManagementRole are present, will not register the QuickStartSecurityRegistry configuration.");
}
return;
}
Dictionary<String, Object> props = buildUserRegistryConfigProps();
quickStartRegistry = new QuickStartSecurityRegistry(config.userName(), Password.create(config.userPassword()));
urConfigReg = bc.registerService(UserRegistry.class,
quickStartRegistry,
props);
} | java | private void registerQuickStartSecurityRegistryConfiguration() {
if (bc == null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "BundleContext is null, we must be deactivated.");
}
return;
}
if (urConfigReg != null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "QuickStartSecurityRegistry configuration is already registered.");
}
return;
}
if (isStringValueUndefined(config.userName()) || isStringValueUndefined(config.userPassword())) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Incomplete configuration. This should already have been reported. Will not register QuickStartSecurityRegistry configuration.");
}
return;
}
if (config.UserRegistry() != null && config.UserRegistry().length > 0) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Other UserRegistryConfiguration are present, will not register the QuickStartSecurityRegistry configuration.");
}
return;
}
if (!managementRoles.isEmpty()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Other ManagementRole are present, will not register the QuickStartSecurityRegistry configuration.");
}
return;
}
Dictionary<String, Object> props = buildUserRegistryConfigProps();
quickStartRegistry = new QuickStartSecurityRegistry(config.userName(), Password.create(config.userPassword()));
urConfigReg = bc.registerService(UserRegistry.class,
quickStartRegistry,
props);
} | [
"private",
"void",
"registerQuickStartSecurityRegistryConfiguration",
"(",
")",
"{",
"if",
"(",
"bc",
"==",
"null",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"BundleContext is null, we must be deactivated.\"",
")",
";",
"}",
"return",
";",
"}",
"if",
"(",
"urConfigReg",
"!=",
"null",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"QuickStartSecurityRegistry configuration is already registered.\"",
")",
";",
"}",
"return",
";",
"}",
"if",
"(",
"isStringValueUndefined",
"(",
"config",
".",
"userName",
"(",
")",
")",
"||",
"isStringValueUndefined",
"(",
"config",
".",
"userPassword",
"(",
")",
")",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Incomplete configuration. This should already have been reported. Will not register QuickStartSecurityRegistry configuration.\"",
")",
";",
"}",
"return",
";",
"}",
"if",
"(",
"config",
".",
"UserRegistry",
"(",
")",
"!=",
"null",
"&&",
"config",
".",
"UserRegistry",
"(",
")",
".",
"length",
">",
"0",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Other UserRegistryConfiguration are present, will not register the QuickStartSecurityRegistry configuration.\"",
")",
";",
"}",
"return",
";",
"}",
"if",
"(",
"!",
"managementRoles",
".",
"isEmpty",
"(",
")",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Other ManagementRole are present, will not register the QuickStartSecurityRegistry configuration.\"",
")",
";",
"}",
"return",
";",
"}",
"Dictionary",
"<",
"String",
",",
"Object",
">",
"props",
"=",
"buildUserRegistryConfigProps",
"(",
")",
";",
"quickStartRegistry",
"=",
"new",
"QuickStartSecurityRegistry",
"(",
"config",
".",
"userName",
"(",
")",
",",
"Password",
".",
"create",
"(",
"config",
".",
"userPassword",
"(",
")",
")",
")",
";",
"urConfigReg",
"=",
"bc",
".",
"registerService",
"(",
"UserRegistry",
".",
"class",
",",
"quickStartRegistry",
",",
"props",
")",
";",
"}"
] | Create, register and return the ServiceRegistration for the quick start
security UserRegistryConfiguration.
@param bc | [
"Create",
"register",
"and",
"return",
"the",
"ServiceRegistration",
"for",
"the",
"quick",
"start",
"security",
"UserRegistryConfiguration",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.quickstart/src/com/ibm/ws/security/quickstart/internal/QuickStartSecurity.java#L273-L310 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.quickstart/src/com/ibm/ws/security/quickstart/internal/QuickStartSecurity.java | QuickStartSecurity.unregisterQuickStartSecurityRegistryConfiguration | private void unregisterQuickStartSecurityRegistryConfiguration() {
if (urConfigReg != null) {
urConfigReg.unregister();
urConfigReg = null;
quickStartRegistry = null;
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "QuickStartSecurityRegistry configuration is not registered.");
}
}
} | java | private void unregisterQuickStartSecurityRegistryConfiguration() {
if (urConfigReg != null) {
urConfigReg.unregister();
urConfigReg = null;
quickStartRegistry = null;
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "QuickStartSecurityRegistry configuration is not registered.");
}
}
} | [
"private",
"void",
"unregisterQuickStartSecurityRegistryConfiguration",
"(",
")",
"{",
"if",
"(",
"urConfigReg",
"!=",
"null",
")",
"{",
"urConfigReg",
".",
"unregister",
"(",
")",
";",
"urConfigReg",
"=",
"null",
";",
"quickStartRegistry",
"=",
"null",
";",
"}",
"else",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"QuickStartSecurityRegistry configuration is not registered.\"",
")",
";",
"}",
"}",
"}"
] | Unregister the quick start security security UserRegistryConfiguration. | [
"Unregister",
"the",
"quick",
"start",
"security",
"security",
"UserRegistryConfiguration",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.quickstart/src/com/ibm/ws/security/quickstart/internal/QuickStartSecurity.java#L344-L354 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.quickstart/src/com/ibm/ws/security/quickstart/internal/QuickStartSecurity.java | QuickStartSecurity.registerQuickStartSecurityAdministratorRole | private void registerQuickStartSecurityAdministratorRole() {
if (bc == null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "BundleContext is null, we must be deactivated.");
}
return;
}
if (managementRoleReg != null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "QuickStartSecurityAdministratorRole is already registered.");
}
return;
}
if (urConfigReg == null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "QuickStartSecurityRegistry configuration is not registered, will not register QuickStartSecurityAdministratorRole.");
}
return;
}
if (isStringValueUndefined(config.userName())) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "User is not set, can not register the QuickStartSecurityAdministratorRole");
}
return;
}
if (!managementRoles.isEmpty()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Other managment roles are present, will not register the QuickStartSecurityAdministratorRole");
}
return;
}
Dictionary<String, Object> props = new Hashtable<String, Object>();
props.put(ManagementRole.MANAGEMENT_ROLE_NAME, QUICK_START_ADMINISTRATOR_ROLE_NAME);
props.put("service.vendor", "IBM");
managementRole = new QuickStartSecurityAdministratorRole(config.userName());
managementRoleReg = bc.registerService(ManagementRole.class,
managementRole,
props);
} | java | private void registerQuickStartSecurityAdministratorRole() {
if (bc == null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "BundleContext is null, we must be deactivated.");
}
return;
}
if (managementRoleReg != null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "QuickStartSecurityAdministratorRole is already registered.");
}
return;
}
if (urConfigReg == null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "QuickStartSecurityRegistry configuration is not registered, will not register QuickStartSecurityAdministratorRole.");
}
return;
}
if (isStringValueUndefined(config.userName())) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "User is not set, can not register the QuickStartSecurityAdministratorRole");
}
return;
}
if (!managementRoles.isEmpty()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Other managment roles are present, will not register the QuickStartSecurityAdministratorRole");
}
return;
}
Dictionary<String, Object> props = new Hashtable<String, Object>();
props.put(ManagementRole.MANAGEMENT_ROLE_NAME, QUICK_START_ADMINISTRATOR_ROLE_NAME);
props.put("service.vendor", "IBM");
managementRole = new QuickStartSecurityAdministratorRole(config.userName());
managementRoleReg = bc.registerService(ManagementRole.class,
managementRole,
props);
} | [
"private",
"void",
"registerQuickStartSecurityAdministratorRole",
"(",
")",
"{",
"if",
"(",
"bc",
"==",
"null",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"BundleContext is null, we must be deactivated.\"",
")",
";",
"}",
"return",
";",
"}",
"if",
"(",
"managementRoleReg",
"!=",
"null",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"QuickStartSecurityAdministratorRole is already registered.\"",
")",
";",
"}",
"return",
";",
"}",
"if",
"(",
"urConfigReg",
"==",
"null",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"QuickStartSecurityRegistry configuration is not registered, will not register QuickStartSecurityAdministratorRole.\"",
")",
";",
"}",
"return",
";",
"}",
"if",
"(",
"isStringValueUndefined",
"(",
"config",
".",
"userName",
"(",
")",
")",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"User is not set, can not register the QuickStartSecurityAdministratorRole\"",
")",
";",
"}",
"return",
";",
"}",
"if",
"(",
"!",
"managementRoles",
".",
"isEmpty",
"(",
")",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Other managment roles are present, will not register the QuickStartSecurityAdministratorRole\"",
")",
";",
"}",
"return",
";",
"}",
"Dictionary",
"<",
"String",
",",
"Object",
">",
"props",
"=",
"new",
"Hashtable",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"props",
".",
"put",
"(",
"ManagementRole",
".",
"MANAGEMENT_ROLE_NAME",
",",
"QUICK_START_ADMINISTRATOR_ROLE_NAME",
")",
";",
"props",
".",
"put",
"(",
"\"service.vendor\"",
",",
"\"IBM\"",
")",
";",
"managementRole",
"=",
"new",
"QuickStartSecurityAdministratorRole",
"(",
"config",
".",
"userName",
"(",
")",
")",
";",
"managementRoleReg",
"=",
"bc",
".",
"registerService",
"(",
"ManagementRole",
".",
"class",
",",
"managementRole",
",",
"props",
")",
";",
"}"
] | Register the quick start security management role. | [
"Register",
"the",
"quick",
"start",
"security",
"management",
"role",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.quickstart/src/com/ibm/ws/security/quickstart/internal/QuickStartSecurity.java#L359-L399 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.threading/src/com/ibm/ws/threading/internal/DeferrableScheduledExecutorImpl.java | DeferrableScheduledExecutorImpl.roundUpDelay | static long roundUpDelay(long delay, TimeUnit unit, long now) {
if (delay < 0) {
// Negative is treated as 0.
delay = 0;
}
long target = now + unit.toMillis(delay);
if (target < now) {
// We can't add the delay to the current time without overflow.
// Return the delay unaltered.
return delay;
}
long remainder = target % PERIOD_MILLISECONDS;
if (remainder == 0) {
// Already rounded.
return delay;
}
long extra = PERIOD_MILLISECONDS - remainder;
long newDelay = delay + unit.convert(extra, TimeUnit.MILLISECONDS);
if (newDelay < delay) {
// We can't round up without overflow. Return the delay unaltered.
return delay;
}
return newDelay;
} | java | static long roundUpDelay(long delay, TimeUnit unit, long now) {
if (delay < 0) {
// Negative is treated as 0.
delay = 0;
}
long target = now + unit.toMillis(delay);
if (target < now) {
// We can't add the delay to the current time without overflow.
// Return the delay unaltered.
return delay;
}
long remainder = target % PERIOD_MILLISECONDS;
if (remainder == 0) {
// Already rounded.
return delay;
}
long extra = PERIOD_MILLISECONDS - remainder;
long newDelay = delay + unit.convert(extra, TimeUnit.MILLISECONDS);
if (newDelay < delay) {
// We can't round up without overflow. Return the delay unaltered.
return delay;
}
return newDelay;
} | [
"static",
"long",
"roundUpDelay",
"(",
"long",
"delay",
",",
"TimeUnit",
"unit",
",",
"long",
"now",
")",
"{",
"if",
"(",
"delay",
"<",
"0",
")",
"{",
"// Negative is treated as 0.",
"delay",
"=",
"0",
";",
"}",
"long",
"target",
"=",
"now",
"+",
"unit",
".",
"toMillis",
"(",
"delay",
")",
";",
"if",
"(",
"target",
"<",
"now",
")",
"{",
"// We can't add the delay to the current time without overflow.",
"// Return the delay unaltered.",
"return",
"delay",
";",
"}",
"long",
"remainder",
"=",
"target",
"%",
"PERIOD_MILLISECONDS",
";",
"if",
"(",
"remainder",
"==",
"0",
")",
"{",
"// Already rounded.",
"return",
"delay",
";",
"}",
"long",
"extra",
"=",
"PERIOD_MILLISECONDS",
"-",
"remainder",
";",
"long",
"newDelay",
"=",
"delay",
"+",
"unit",
".",
"convert",
"(",
"extra",
",",
"TimeUnit",
".",
"MILLISECONDS",
")",
";",
"if",
"(",
"newDelay",
"<",
"delay",
")",
"{",
"// We can't round up without overflow. Return the delay unaltered.",
"return",
"delay",
";",
"}",
"return",
"newDelay",
";",
"}"
] | Round up delays so that all tasks fire at approximately with approximately the same 15s period. | [
"Round",
"up",
"delays",
"so",
"that",
"all",
"tasks",
"fire",
"at",
"approximately",
"with",
"approximately",
"the",
"same",
"15s",
"period",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.threading/src/com/ibm/ws/threading/internal/DeferrableScheduledExecutorImpl.java#L32-L60 | train |
OpenLiberty/open-liberty | dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/ws/impl/IOUtils.java | IOUtils.copyStream | public static void copyStream(InputStream from, OutputStream to) throws IOException {
byte buffer[] = new byte[2048];
int bytesRead;
while ((bytesRead = from.read(buffer)) != -1) {
to.write(buffer, 0, bytesRead);
}
from.close();
} | java | public static void copyStream(InputStream from, OutputStream to) throws IOException {
byte buffer[] = new byte[2048];
int bytesRead;
while ((bytesRead = from.read(buffer)) != -1) {
to.write(buffer, 0, bytesRead);
}
from.close();
} | [
"public",
"static",
"void",
"copyStream",
"(",
"InputStream",
"from",
",",
"OutputStream",
"to",
")",
"throws",
"IOException",
"{",
"byte",
"buffer",
"[",
"]",
"=",
"new",
"byte",
"[",
"2048",
"]",
";",
"int",
"bytesRead",
";",
"while",
"(",
"(",
"bytesRead",
"=",
"from",
".",
"read",
"(",
"buffer",
")",
")",
"!=",
"-",
"1",
")",
"{",
"to",
".",
"write",
"(",
"buffer",
",",
"0",
",",
"bytesRead",
")",
";",
"}",
"from",
".",
"close",
"(",
")",
";",
"}"
] | Copy the given InputStream to the given OutputStream.
Note: the InputStream is closed when the copy is complete. The OutputStream
is left open. | [
"Copy",
"the",
"given",
"InputStream",
"to",
"the",
"given",
"OutputStream",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/ws/impl/IOUtils.java#L27-L34 | train |
OpenLiberty/open-liberty | dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/ws/impl/IOUtils.java | IOUtils.copyReader | public static void copyReader(Reader from, Writer to) throws IOException {
char buffer[] = new char[2048];
int charsRead;
while ((charsRead = from.read(buffer)) != -1) {
to.write(buffer, 0, charsRead);
}
from.close();
to.flush();
} | java | public static void copyReader(Reader from, Writer to) throws IOException {
char buffer[] = new char[2048];
int charsRead;
while ((charsRead = from.read(buffer)) != -1) {
to.write(buffer, 0, charsRead);
}
from.close();
to.flush();
} | [
"public",
"static",
"void",
"copyReader",
"(",
"Reader",
"from",
",",
"Writer",
"to",
")",
"throws",
"IOException",
"{",
"char",
"buffer",
"[",
"]",
"=",
"new",
"char",
"[",
"2048",
"]",
";",
"int",
"charsRead",
";",
"while",
"(",
"(",
"charsRead",
"=",
"from",
".",
"read",
"(",
"buffer",
")",
")",
"!=",
"-",
"1",
")",
"{",
"to",
".",
"write",
"(",
"buffer",
",",
"0",
",",
"charsRead",
")",
";",
"}",
"from",
".",
"close",
"(",
")",
";",
"to",
".",
"flush",
"(",
")",
";",
"}"
] | Copy the given Reader to the given Writer.
This method is basically the same as copyStream; however Reader and Writer
objects are cognizant of character encoding, whereas InputStream and OutputStreams
objects deal only with bytes.
Note: the Reader is closed when the copy is complete. The Writer
is left open. The Write is flushed when the copy is complete. | [
"Copy",
"the",
"given",
"Reader",
"to",
"the",
"given",
"Writer",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/ws/impl/IOUtils.java#L46-L55 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/io/async/ResultHandler.java | ResultHandler.activate | public void activate() {
// if no handlers are currently running, start one now
if (this.numHandlersInFlight.getInt() == 0) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Activating result handler: " + this.completionPort);
}
startHandler();
}
} | java | public void activate() {
// if no handlers are currently running, start one now
if (this.numHandlersInFlight.getInt() == 0) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Activating result handler: " + this.completionPort);
}
startHandler();
}
} | [
"public",
"void",
"activate",
"(",
")",
"{",
"// if no handlers are currently running, start one now",
"if",
"(",
"this",
".",
"numHandlersInFlight",
".",
"getInt",
"(",
")",
"==",
"0",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Activating result handler: \"",
"+",
"this",
".",
"completionPort",
")",
";",
"}",
"startHandler",
"(",
")",
";",
"}",
"}"
] | Activate the result handler when the channel starts. | [
"Activate",
"the",
"result",
"handler",
"when",
"the",
"channel",
"starts",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/io/async/ResultHandler.java#L89-L97 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/wsspi/connmgmt/ConnectionHandle.java | ConnectionHandle.setConnectionHandle | public static void setConnectionHandle(VirtualConnection vc, ConnectionHandle handle) {
if (vc == null || handle == null) {
return;
}
Map<Object, Object> map = vc.getStateMap();
// set connection handle into VC
Object vcLock = vc.getLockObject();
synchronized (vcLock) {
Object tmpHandle = map.get(CONNECTION_HANDLE_VC_KEY);
// If this connection already has a unique handle when we get here,
// something went wrong.
if (tmpHandle != null) {
throw new IllegalStateException("Connection " + tmpHandle + " has already been created");
}
map.put(CONNECTION_HANDLE_VC_KEY, handle);
}
} | java | public static void setConnectionHandle(VirtualConnection vc, ConnectionHandle handle) {
if (vc == null || handle == null) {
return;
}
Map<Object, Object> map = vc.getStateMap();
// set connection handle into VC
Object vcLock = vc.getLockObject();
synchronized (vcLock) {
Object tmpHandle = map.get(CONNECTION_HANDLE_VC_KEY);
// If this connection already has a unique handle when we get here,
// something went wrong.
if (tmpHandle != null) {
throw new IllegalStateException("Connection " + tmpHandle + " has already been created");
}
map.put(CONNECTION_HANDLE_VC_KEY, handle);
}
} | [
"public",
"static",
"void",
"setConnectionHandle",
"(",
"VirtualConnection",
"vc",
",",
"ConnectionHandle",
"handle",
")",
"{",
"if",
"(",
"vc",
"==",
"null",
"||",
"handle",
"==",
"null",
")",
"{",
"return",
";",
"}",
"Map",
"<",
"Object",
",",
"Object",
">",
"map",
"=",
"vc",
".",
"getStateMap",
"(",
")",
";",
"// set connection handle into VC",
"Object",
"vcLock",
"=",
"vc",
".",
"getLockObject",
"(",
")",
";",
"synchronized",
"(",
"vcLock",
")",
"{",
"Object",
"tmpHandle",
"=",
"map",
".",
"get",
"(",
"CONNECTION_HANDLE_VC_KEY",
")",
";",
"// If this connection already has a unique handle when we get here,",
"// something went wrong.",
"if",
"(",
"tmpHandle",
"!=",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Connection \"",
"+",
"tmpHandle",
"+",
"\" has already been created\"",
")",
";",
"}",
"map",
".",
"put",
"(",
"CONNECTION_HANDLE_VC_KEY",
",",
"handle",
")",
";",
"}",
"}"
] | Set the connection handle on the virtual connection.
@param vc
VirtualConnection containing simple state for this connection
@param handle
ConnectionHandle for the VirtualConnection | [
"Set",
"the",
"connection",
"handle",
"on",
"the",
"virtual",
"connection",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/wsspi/connmgmt/ConnectionHandle.java#L107-L126 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/wsspi/connmgmt/ConnectionHandle.java | ConnectionHandle.setConnectionType | protected void setConnectionType(VirtualConnection vc) {
if (this.myType == 0 || vc == null) {
ConnectionType newType = ConnectionType.getVCConnectionType(vc);
this.myType = (newType == null) ? 0 : newType.export();
}
} | java | protected void setConnectionType(VirtualConnection vc) {
if (this.myType == 0 || vc == null) {
ConnectionType newType = ConnectionType.getVCConnectionType(vc);
this.myType = (newType == null) ? 0 : newType.export();
}
} | [
"protected",
"void",
"setConnectionType",
"(",
"VirtualConnection",
"vc",
")",
"{",
"if",
"(",
"this",
".",
"myType",
"==",
"0",
"||",
"vc",
"==",
"null",
")",
"{",
"ConnectionType",
"newType",
"=",
"ConnectionType",
".",
"getVCConnectionType",
"(",
"vc",
")",
";",
"this",
".",
"myType",
"=",
"(",
"newType",
"==",
"null",
")",
"?",
"0",
":",
"newType",
".",
"export",
"(",
")",
";",
"}",
"}"
] | Set ConnectionType based on the input virtual connection.
@param vc | [
"Set",
"ConnectionType",
"based",
"on",
"the",
"input",
"virtual",
"connection",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/wsspi/connmgmt/ConnectionHandle.java#L189-L195 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.core/src/com/ibm/ws/ffdc/FFDCFilter.java | FFDCFilter.processException | public static void processException(Throwable th, String sourceId, String probeId, Object callerThis) {
FFDCConfigurator.getDelegate().processException(th, sourceId, probeId, callerThis);
} | java | public static void processException(Throwable th, String sourceId, String probeId, Object callerThis) {
FFDCConfigurator.getDelegate().processException(th, sourceId, probeId, callerThis);
} | [
"public",
"static",
"void",
"processException",
"(",
"Throwable",
"th",
",",
"String",
"sourceId",
",",
"String",
"probeId",
",",
"Object",
"callerThis",
")",
"{",
"FFDCConfigurator",
".",
"getDelegate",
"(",
")",
".",
"processException",
"(",
"th",
",",
"sourceId",
",",
"probeId",
",",
"callerThis",
")",
";",
"}"
] | Write a first failure data capture record for the provided throwable
@param th
The throwable
@param sourceId
An identifier for the source of this record, for example the package and class name
@param probeId
A unique identifier within the source of this record, for example the source file line number
@param callerThis
The object making this call, which will be introspected for inclusion in the FFDC record | [
"Write",
"a",
"first",
"failure",
"data",
"capture",
"record",
"for",
"the",
"provided",
"throwable"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.core/src/com/ibm/ws/ffdc/FFDCFilter.java#L59-L61 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/RESTMBeanServerConnection.java | RESTMBeanServerConnection.close | void close() {
if (logger.isLoggable(Level.FINER)) {
logger.logp(Level.FINER, logger.getName(), "close", "Close called for " + RESTClientMessagesUtil.getObjID(this) + " within connection: "
+ connector.getConnectionId());
}
closePollingThread();
if (notificationRegistry != null) {
notificationRegistry.close();
}
if (connector.logFailovers()) {
String disconnectMsg = RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.MEMBER_DISCONNECT, connector.getCurrentEndpoint());
logger.logp(Level.INFO, logger.getName(), "close", disconnectMsg);
}
disconnect();
} | java | void close() {
if (logger.isLoggable(Level.FINER)) {
logger.logp(Level.FINER, logger.getName(), "close", "Close called for " + RESTClientMessagesUtil.getObjID(this) + " within connection: "
+ connector.getConnectionId());
}
closePollingThread();
if (notificationRegistry != null) {
notificationRegistry.close();
}
if (connector.logFailovers()) {
String disconnectMsg = RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.MEMBER_DISCONNECT, connector.getCurrentEndpoint());
logger.logp(Level.INFO, logger.getName(), "close", disconnectMsg);
}
disconnect();
} | [
"void",
"close",
"(",
")",
"{",
"if",
"(",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"FINER",
")",
")",
"{",
"logger",
".",
"logp",
"(",
"Level",
".",
"FINER",
",",
"logger",
".",
"getName",
"(",
")",
",",
"\"close\"",
",",
"\"Close called for \"",
"+",
"RESTClientMessagesUtil",
".",
"getObjID",
"(",
"this",
")",
"+",
"\" within connection: \"",
"+",
"connector",
".",
"getConnectionId",
"(",
")",
")",
";",
"}",
"closePollingThread",
"(",
")",
";",
"if",
"(",
"notificationRegistry",
"!=",
"null",
")",
"{",
"notificationRegistry",
".",
"close",
"(",
")",
";",
"}",
"if",
"(",
"connector",
".",
"logFailovers",
"(",
")",
")",
"{",
"String",
"disconnectMsg",
"=",
"RESTClientMessagesUtil",
".",
"getMessage",
"(",
"RESTClientMessagesUtil",
".",
"MEMBER_DISCONNECT",
",",
"connector",
".",
"getCurrentEndpoint",
"(",
")",
")",
";",
"logger",
".",
"logp",
"(",
"Level",
".",
"INFO",
",",
"logger",
".",
"getName",
"(",
")",
",",
"\"close\"",
",",
"disconnectMsg",
")",
";",
"}",
"disconnect",
"(",
")",
";",
"}"
] | do the proper cleaning procedures. | [
"do",
"the",
"proper",
"cleaning",
"procedures",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/RESTMBeanServerConnection.java#L1778-L1796 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.artifact.zip/src/com/ibm/ws/artifact/zip/internal/ZipFileContainer.java | ZipFileContainer.getArchiveFile | @Trivial
private File getArchiveFile() {
String methodName = "getArchiveFile";
if ( archiveFileLock != null ) {
synchronized ( archiveFileLock ) {
if ( (archiveFile == null) && !archiveFileFailed ) {
try {
archiveFile = extractEntry( entryInEnclosingContainer, getCacheDir() );
// 'extractEntry' throws IOException
if ( archiveFile != null ) {
archiveFilePath = archiveFile.getAbsolutePath();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled() ) {
Tr.debug(tc, methodName + " Archive file [ " + archiveFilePath + " ]");
}
} else {
archiveFileFailed = true;
Tr.error(tc, "extract.cache.null", entryInEnclosingContainer.getPath());
}
} catch ( IOException e ) {
archiveFileFailed = true;
Tr.error(tc, "extract.cache.fail", e.getMessage());
}
}
}
}
return archiveFile;
} | java | @Trivial
private File getArchiveFile() {
String methodName = "getArchiveFile";
if ( archiveFileLock != null ) {
synchronized ( archiveFileLock ) {
if ( (archiveFile == null) && !archiveFileFailed ) {
try {
archiveFile = extractEntry( entryInEnclosingContainer, getCacheDir() );
// 'extractEntry' throws IOException
if ( archiveFile != null ) {
archiveFilePath = archiveFile.getAbsolutePath();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled() ) {
Tr.debug(tc, methodName + " Archive file [ " + archiveFilePath + " ]");
}
} else {
archiveFileFailed = true;
Tr.error(tc, "extract.cache.null", entryInEnclosingContainer.getPath());
}
} catch ( IOException e ) {
archiveFileFailed = true;
Tr.error(tc, "extract.cache.fail", e.getMessage());
}
}
}
}
return archiveFile;
} | [
"@",
"Trivial",
"private",
"File",
"getArchiveFile",
"(",
")",
"{",
"String",
"methodName",
"=",
"\"getArchiveFile\"",
";",
"if",
"(",
"archiveFileLock",
"!=",
"null",
")",
"{",
"synchronized",
"(",
"archiveFileLock",
")",
"{",
"if",
"(",
"(",
"archiveFile",
"==",
"null",
")",
"&&",
"!",
"archiveFileFailed",
")",
"{",
"try",
"{",
"archiveFile",
"=",
"extractEntry",
"(",
"entryInEnclosingContainer",
",",
"getCacheDir",
"(",
")",
")",
";",
"// 'extractEntry' throws IOException",
"if",
"(",
"archiveFile",
"!=",
"null",
")",
"{",
"archiveFilePath",
"=",
"archiveFile",
".",
"getAbsolutePath",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"methodName",
"+",
"\" Archive file [ \"",
"+",
"archiveFilePath",
"+",
"\" ]\"",
")",
";",
"}",
"}",
"else",
"{",
"archiveFileFailed",
"=",
"true",
";",
"Tr",
".",
"error",
"(",
"tc",
",",
"\"extract.cache.null\"",
",",
"entryInEnclosingContainer",
".",
"getPath",
"(",
")",
")",
";",
"}",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"archiveFileFailed",
"=",
"true",
";",
"Tr",
".",
"error",
"(",
"tc",
",",
"\"extract.cache.fail\"",
",",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"}",
"}",
"}",
"return",
"archiveFile",
";",
"}"
] | Answer the archive file. Extract it if necessary. Answer null
if extraction fails.
If this container was created as a root-of-roots container, the archive
will already be set.
Otherwise, the container is a nested root container, and the archive may
not have not yet been set. In that case, extract the archive, then answer
the extracted file as the archive file.
Extraction may fail, in which case null will be returned.
Extraction is only attempted once: Access to the archive file after a failure
immediately answer null.
@return The archive file. Extracted if necessary. Null if extraction failed. | [
"Answer",
"the",
"archive",
"file",
".",
"Extract",
"it",
"if",
"necessary",
".",
"Answer",
"null",
"if",
"extraction",
"fails",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.artifact.zip/src/com/ibm/ws/artifact/zip/internal/ZipFileContainer.java#L599-L629 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.artifact.zip/src/com/ibm/ws/artifact/zip/internal/ZipFileContainer.java | ZipFileContainer.getArchiveFilePath | private String getArchiveFilePath() {
if ( archiveFileLock == null ) {
return archiveFilePath;
} else {
synchronized( archiveFileLock ) {
@SuppressWarnings("unused")
File useArchiveFile = getArchiveFile();
return archiveFilePath;
}
}
} | java | private String getArchiveFilePath() {
if ( archiveFileLock == null ) {
return archiveFilePath;
} else {
synchronized( archiveFileLock ) {
@SuppressWarnings("unused")
File useArchiveFile = getArchiveFile();
return archiveFilePath;
}
}
} | [
"private",
"String",
"getArchiveFilePath",
"(",
")",
"{",
"if",
"(",
"archiveFileLock",
"==",
"null",
")",
"{",
"return",
"archiveFilePath",
";",
"}",
"else",
"{",
"synchronized",
"(",
"archiveFileLock",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"File",
"useArchiveFile",
"=",
"getArchiveFile",
"(",
")",
";",
"return",
"archiveFilePath",
";",
"}",
"}",
"}"
] | Answer the absolute path to the archive file. Do an extraction if this
is a nested archive and the file is not yet extracted. Answer null
if extraction fails.
@return The absolute path to the archive file. | [
"Answer",
"the",
"absolute",
"path",
"to",
"the",
"archive",
"file",
".",
"Do",
"an",
"extraction",
"if",
"this",
"is",
"a",
"nested",
"archive",
"and",
"the",
"file",
"is",
"not",
"yet",
"extracted",
".",
"Answer",
"null",
"if",
"extraction",
"fails",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.artifact.zip/src/com/ibm/ws/artifact/zip/internal/ZipFileContainer.java#L638-L648 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.artifact.zip/src/com/ibm/ws/artifact/zip/internal/ZipFileContainer.java | ZipFileContainer.getZipFileHandle | ZipFileHandle getZipFileHandle() throws IOException {
synchronized( zipFileHandleLock ) {
if ( zipFileHandleFailed ) {
return null;
} else if ( zipFileHandle != null ) {
return zipFileHandle;
}
File useArchiveFile = getArchiveFile();
if ( useArchiveFile == null ) {
zipFileHandleFailed = true;
throw new FileNotFoundException( entryInEnclosingContainer.getPath() );
}
try {
String useCanonicalPath = getCanonicalPath(useArchiveFile); // throws IOException
zipFileHandle = getZipFileHandle(useCanonicalPath); // throws IOException
} catch ( IOException e ) {
zipFileHandleFailed = true;
throw e;
}
return zipFileHandle;
}
} | java | ZipFileHandle getZipFileHandle() throws IOException {
synchronized( zipFileHandleLock ) {
if ( zipFileHandleFailed ) {
return null;
} else if ( zipFileHandle != null ) {
return zipFileHandle;
}
File useArchiveFile = getArchiveFile();
if ( useArchiveFile == null ) {
zipFileHandleFailed = true;
throw new FileNotFoundException( entryInEnclosingContainer.getPath() );
}
try {
String useCanonicalPath = getCanonicalPath(useArchiveFile); // throws IOException
zipFileHandle = getZipFileHandle(useCanonicalPath); // throws IOException
} catch ( IOException e ) {
zipFileHandleFailed = true;
throw e;
}
return zipFileHandle;
}
} | [
"ZipFileHandle",
"getZipFileHandle",
"(",
")",
"throws",
"IOException",
"{",
"synchronized",
"(",
"zipFileHandleLock",
")",
"{",
"if",
"(",
"zipFileHandleFailed",
")",
"{",
"return",
"null",
";",
"}",
"else",
"if",
"(",
"zipFileHandle",
"!=",
"null",
")",
"{",
"return",
"zipFileHandle",
";",
"}",
"File",
"useArchiveFile",
"=",
"getArchiveFile",
"(",
")",
";",
"if",
"(",
"useArchiveFile",
"==",
"null",
")",
"{",
"zipFileHandleFailed",
"=",
"true",
";",
"throw",
"new",
"FileNotFoundException",
"(",
"entryInEnclosingContainer",
".",
"getPath",
"(",
")",
")",
";",
"}",
"try",
"{",
"String",
"useCanonicalPath",
"=",
"getCanonicalPath",
"(",
"useArchiveFile",
")",
";",
"// throws IOException",
"zipFileHandle",
"=",
"getZipFileHandle",
"(",
"useCanonicalPath",
")",
";",
"// throws IOException",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"zipFileHandleFailed",
"=",
"true",
";",
"throw",
"e",
";",
"}",
"return",
"zipFileHandle",
";",
"}",
"}"
] | Answer the handle to the archive file of this container.
@return The zip file handle of this container.
@throws IOException Thrown if the zip file handle could not be
obtained.
TODO: That the zip file container retains a reference to its
handle is a problem, as the zip file handle cache has
a maximum size. Zip file container might hold stale
handles.
This is not an immediate problem: Both APIs which use
the zip file handle ({@link #openZipFileHandle()} and
{@link ZipFileEntry#getInputStream()} immediately
open the zip file handle.
The problem occurs after the zip file handle is closed
(either {@link #closeZipFileHandle()} or when the
entry input stream is closed. After the close, the
zip file handle is free to be removed by the zip file
handle cache. However, the zip file container does
not clear and re-acquire its zip file handle.
The consequence is according to whether the zip file reaper
is active. When the zip file reaper is inactive, each
zip file handle obtains its own zip file. Continued use
of a stale zip file handle will result in multiple opens
of the same zip file. That is inefficient, but no failures
will occur.
That multiple zip file handles might be created is possible
because zip file containers are not guaranteed to be unique.
Non-unique but equivalent zip file containers will result
because entries are not unique: Each call to obtain a non-
nested container entry from an artifact container obtains a
new entry instance. Each of the non-unique but equivalent
entries will obtain a different container.
When the zip file reaper is active, the problem of multiple
non-unique, equivalent zip files cannot occur. The problem
is avoided because, first, a zip file handle cannot perform
a close on a zip file through the zip file reaper without
first having opened the zip file handle, and second, because
a zip file handle cannot perform more closes than it has
performed opens. | [
"Answer",
"the",
"handle",
"to",
"the",
"archive",
"file",
"of",
"this",
"container",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.artifact.zip/src/com/ibm/ws/artifact/zip/internal/ZipFileContainer.java#L730-L753 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.artifact.zip/src/com/ibm/ws/artifact/zip/internal/ZipFileContainer.java | ZipFileContainer.createEntry | @Trivial
protected ZipFileEntry createEntry(String entryName, String a_entryPath) {
ZipEntryData[] useZipEntries = getZipEntryData();
if ( useZipEntries.length == 0 ) {
return null;
}
String r_entryPath = a_entryPath.substring(1);
int location = locatePath(r_entryPath);
ZipEntryData entryData;
if ( location < 0 ) {
location = ( (location + 1) * -1 );
entryData = null;
} else {
entryData = useZipEntries[location];
}
return createEntry(
null,
entryName, a_entryPath,
entryData);
} | java | @Trivial
protected ZipFileEntry createEntry(String entryName, String a_entryPath) {
ZipEntryData[] useZipEntries = getZipEntryData();
if ( useZipEntries.length == 0 ) {
return null;
}
String r_entryPath = a_entryPath.substring(1);
int location = locatePath(r_entryPath);
ZipEntryData entryData;
if ( location < 0 ) {
location = ( (location + 1) * -1 );
entryData = null;
} else {
entryData = useZipEntries[location];
}
return createEntry(
null,
entryName, a_entryPath,
entryData);
} | [
"@",
"Trivial",
"protected",
"ZipFileEntry",
"createEntry",
"(",
"String",
"entryName",
",",
"String",
"a_entryPath",
")",
"{",
"ZipEntryData",
"[",
"]",
"useZipEntries",
"=",
"getZipEntryData",
"(",
")",
";",
"if",
"(",
"useZipEntries",
".",
"length",
"==",
"0",
")",
"{",
"return",
"null",
";",
"}",
"String",
"r_entryPath",
"=",
"a_entryPath",
".",
"substring",
"(",
"1",
")",
";",
"int",
"location",
"=",
"locatePath",
"(",
"r_entryPath",
")",
";",
"ZipEntryData",
"entryData",
";",
"if",
"(",
"location",
"<",
"0",
")",
"{",
"location",
"=",
"(",
"(",
"location",
"+",
"1",
")",
"*",
"-",
"1",
")",
";",
"entryData",
"=",
"null",
";",
"}",
"else",
"{",
"entryData",
"=",
"useZipEntries",
"[",
"location",
"]",
";",
"}",
"return",
"createEntry",
"(",
"null",
",",
"entryName",
",",
"a_entryPath",
",",
"entryData",
")",
";",
"}"
] | Answer the zip entry for the zip file entry at the specified path.
The zip file entry may be virtual.
@param entryName The simple name of the entry.
@param a_entryPath The absolute path of the entry.
@return The zip entry for the zip file entry at the specified path. | [
"Answer",
"the",
"zip",
"entry",
"for",
"the",
"zip",
"file",
"entry",
"at",
"the",
"specified",
"path",
".",
"The",
"zip",
"file",
"entry",
"may",
"be",
"virtual",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.artifact.zip/src/com/ibm/ws/artifact/zip/internal/ZipFileContainer.java#L1106-L1128 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.artifact.zip/src/com/ibm/ws/artifact/zip/internal/ZipFileContainer.java | ZipFileContainer.createEntryUri | URI createEntryUri(String r_entryPath, File useArchiveFile) {
URI archiveUri = getURI(useArchiveFile);
if ( archiveUri == null ) {
return null;
}
if ( r_entryPath.isEmpty() ) {
return null;
}
// URLs for jar/zip data now use wsjar to avoid locking issues via jar protocol.
//
// The single string constructor is used to control the encoding an ddecoding.
//
// The return value of 'parentUri.toString()' is an encoded string. The
// handler (usually WSJarURLStreamHandler) must decode that string.
//
// See: http://stackoverflow.com/questions/9419658/normalising-possibly-encoded-uri-strings-in-java.
String encodedUriText =
getProtocol() + ":" +
archiveUri.toString() + "!/" +
ParserUtils.encode(r_entryPath);
try {
return new URI(encodedUriText);
} catch ( URISyntaxException e ) {
// FFDC
return null;
}
} | java | URI createEntryUri(String r_entryPath, File useArchiveFile) {
URI archiveUri = getURI(useArchiveFile);
if ( archiveUri == null ) {
return null;
}
if ( r_entryPath.isEmpty() ) {
return null;
}
// URLs for jar/zip data now use wsjar to avoid locking issues via jar protocol.
//
// The single string constructor is used to control the encoding an ddecoding.
//
// The return value of 'parentUri.toString()' is an encoded string. The
// handler (usually WSJarURLStreamHandler) must decode that string.
//
// See: http://stackoverflow.com/questions/9419658/normalising-possibly-encoded-uri-strings-in-java.
String encodedUriText =
getProtocol() + ":" +
archiveUri.toString() + "!/" +
ParserUtils.encode(r_entryPath);
try {
return new URI(encodedUriText);
} catch ( URISyntaxException e ) {
// FFDC
return null;
}
} | [
"URI",
"createEntryUri",
"(",
"String",
"r_entryPath",
",",
"File",
"useArchiveFile",
")",
"{",
"URI",
"archiveUri",
"=",
"getURI",
"(",
"useArchiveFile",
")",
";",
"if",
"(",
"archiveUri",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"r_entryPath",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"// URLs for jar/zip data now use wsjar to avoid locking issues via jar protocol.",
"//",
"// The single string constructor is used to control the encoding an ddecoding.",
"//",
"// The return value of 'parentUri.toString()' is an encoded string. The",
"// handler (usually WSJarURLStreamHandler) must decode that string.",
"//",
"// See: http://stackoverflow.com/questions/9419658/normalising-possibly-encoded-uri-strings-in-java.",
"String",
"encodedUriText",
"=",
"getProtocol",
"(",
")",
"+",
"\":\"",
"+",
"archiveUri",
".",
"toString",
"(",
")",
"+",
"\"!/\"",
"+",
"ParserUtils",
".",
"encode",
"(",
"r_entryPath",
")",
";",
"try",
"{",
"return",
"new",
"URI",
"(",
"encodedUriText",
")",
";",
"}",
"catch",
"(",
"URISyntaxException",
"e",
")",
"{",
"// FFDC",
"return",
"null",
";",
"}",
"}"
] | Create and return a URI for an entry of an archive.
Usually, "wsjar" is used as the protocol:
<code>wsjar:<archiveUri>!/<entryPath></code>
Optionally, the protocol can be changed to "jar":
<code>jar:<archiveUri>!/<entryPath></code>
@param absPath The path to the entry.
@param useArchiveFile The archive file containing the entry.
@return The URI of the entry in the archive file.
TODO: Has default protection, but should not. Having default
protection allows it to be used from
"com.ibm.ws.artifact.zip.internal.ZipFileContainerTest". | [
"Create",
"and",
"return",
"a",
"URI",
"for",
"an",
"entry",
"of",
"an",
"archive",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.artifact.zip/src/com/ibm/ws/artifact/zip/internal/ZipFileContainer.java#L1299-L1329 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.artifact.zip/src/com/ibm/ws/artifact/zip/internal/ZipFileContainer.java | ZipFileContainer.getURI | @Trivial
private static URI getURI(final File file) {
return AccessController.doPrivileged( new PrivilegedAction<URI>() {
@Override
public URI run() {
return file.toURI();
}
} );
} | java | @Trivial
private static URI getURI(final File file) {
return AccessController.doPrivileged( new PrivilegedAction<URI>() {
@Override
public URI run() {
return file.toURI();
}
} );
} | [
"@",
"Trivial",
"private",
"static",
"URI",
"getURI",
"(",
"final",
"File",
"file",
")",
"{",
"return",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"PrivilegedAction",
"<",
"URI",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"URI",
"run",
"(",
")",
"{",
"return",
"file",
".",
"toURI",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | File utility ... | [
"File",
"utility",
"..."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.artifact.zip/src/com/ibm/ws/artifact/zip/internal/ZipFileContainer.java#L1342-L1350 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.artifact.zip/src/com/ibm/ws/artifact/zip/internal/ZipFileContainer.java | ZipFileContainer.placeExtractionGuard | private ExtractionGuard placeExtractionGuard(String path) {
boolean isPrimary;
CountDownLatch completionLatch;
synchronized( extractionsLock ) {
completionLatch = extractionLocks.get(path);
if ( completionLatch != null ) {
isPrimary = false;
} else {
isPrimary = true;
completionLatch = new CountDownLatch(1);
extractionLocks.put(path, completionLatch);
}
}
return new ExtractionGuard(path, isPrimary, completionLatch);
} | java | private ExtractionGuard placeExtractionGuard(String path) {
boolean isPrimary;
CountDownLatch completionLatch;
synchronized( extractionsLock ) {
completionLatch = extractionLocks.get(path);
if ( completionLatch != null ) {
isPrimary = false;
} else {
isPrimary = true;
completionLatch = new CountDownLatch(1);
extractionLocks.put(path, completionLatch);
}
}
return new ExtractionGuard(path, isPrimary, completionLatch);
} | [
"private",
"ExtractionGuard",
"placeExtractionGuard",
"(",
"String",
"path",
")",
"{",
"boolean",
"isPrimary",
";",
"CountDownLatch",
"completionLatch",
";",
"synchronized",
"(",
"extractionsLock",
")",
"{",
"completionLatch",
"=",
"extractionLocks",
".",
"get",
"(",
"path",
")",
";",
"if",
"(",
"completionLatch",
"!=",
"null",
")",
"{",
"isPrimary",
"=",
"false",
";",
"}",
"else",
"{",
"isPrimary",
"=",
"true",
";",
"completionLatch",
"=",
"new",
"CountDownLatch",
"(",
"1",
")",
";",
"extractionLocks",
".",
"put",
"(",
"path",
",",
"completionLatch",
")",
";",
"}",
"}",
"return",
"new",
"ExtractionGuard",
"(",
"path",
",",
"isPrimary",
",",
"completionLatch",
")",
";",
"}"
] | Make sure a completion latch exists for a specified path.
Create and store one if necessary.
Answer the completion latch encapsulated in an extraction latch,
which brings together the completion latch with the path and
with a setting of whether the extraction is a primary (doing
the extraction) or secondary (waiting for the primary to do the
extraction).
@param path The path which is being extracted.
@return An extraction latch for the path which encapsulates
the extraction state (primary or secondary), the path,
and the completion latch for the extraction. | [
"Make",
"sure",
"a",
"completion",
"latch",
"exists",
"for",
"a",
"specified",
"path",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.artifact.zip/src/com/ibm/ws/artifact/zip/internal/ZipFileContainer.java#L1401-L1420 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.artifact.zip/src/com/ibm/ws/artifact/zip/internal/ZipFileContainer.java | ZipFileContainer.releaseExtractionGuard | private void releaseExtractionGuard(ExtractionGuard extractionLatch) {
synchronized( extractionsLock ) {
extractionLocks.remove( extractionLatch.path );
}
extractionLatch.completionLatch.countDown();
} | java | private void releaseExtractionGuard(ExtractionGuard extractionLatch) {
synchronized( extractionsLock ) {
extractionLocks.remove( extractionLatch.path );
}
extractionLatch.completionLatch.countDown();
} | [
"private",
"void",
"releaseExtractionGuard",
"(",
"ExtractionGuard",
"extractionLatch",
")",
"{",
"synchronized",
"(",
"extractionsLock",
")",
"{",
"extractionLocks",
".",
"remove",
"(",
"extractionLatch",
".",
"path",
")",
";",
"}",
"extractionLatch",
".",
"completionLatch",
".",
"countDown",
"(",
")",
";",
"}"
] | unblocking secondary extractions. | [
"unblocking",
"secondary",
"extractions",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.artifact.zip/src/com/ibm/ws/artifact/zip/internal/ZipFileContainer.java#L1425-L1430 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.artifact.zip/src/com/ibm/ws/artifact/zip/internal/ZipFileContainer.java | ZipFileContainer.isModified | private boolean isModified(ArtifactEntry entry, File file) {
long fileLastModified = FileUtils.fileLastModified(file);
long entryLastModified = entry.getLastModified();
// File 100K entry 10K delta 90k true (entry is much older than the file)
// File 10k entry 100k delta 90k true (file is much older than the entry)
// File 10k entry 9k delta 1k false (entry is slightly older than the file)
// File 9k entry 10k delta 1k false (file is slightly older than the entry)
// File 9k entry 9k delta 0k false (file and entry are exactly the same age)
return ( Math.abs(fileLastModified - entryLastModified) >= 1010L );
} | java | private boolean isModified(ArtifactEntry entry, File file) {
long fileLastModified = FileUtils.fileLastModified(file);
long entryLastModified = entry.getLastModified();
// File 100K entry 10K delta 90k true (entry is much older than the file)
// File 10k entry 100k delta 90k true (file is much older than the entry)
// File 10k entry 9k delta 1k false (entry is slightly older than the file)
// File 9k entry 10k delta 1k false (file is slightly older than the entry)
// File 9k entry 9k delta 0k false (file and entry are exactly the same age)
return ( Math.abs(fileLastModified - entryLastModified) >= 1010L );
} | [
"private",
"boolean",
"isModified",
"(",
"ArtifactEntry",
"entry",
",",
"File",
"file",
")",
"{",
"long",
"fileLastModified",
"=",
"FileUtils",
".",
"fileLastModified",
"(",
"file",
")",
";",
"long",
"entryLastModified",
"=",
"entry",
".",
"getLastModified",
"(",
")",
";",
"// File 100K entry 10K delta 90k true (entry is much older than the file)",
"// File 10k entry 100k delta 90k true (file is much older than the entry)",
"// File 10k entry 9k delta 1k false (entry is slightly older than the file)",
"// File 9k entry 10k delta 1k false (file is slightly older than the entry)",
"// File 9k entry 9k delta 0k false (file and entry are exactly the same age)",
"return",
"(",
"Math",
".",
"abs",
"(",
"fileLastModified",
"-",
"entryLastModified",
")",
">=",
"1010L",
")",
";",
"}"
] | Tell if an entry is modified relative to a file. That is if
the last modified times are different.
File last update times are accurate to about a second. Allow
the last modified times to match if they are that close.
@param entry The entry to test.
@param file The file to test.
@return True or false telling if the last modified times of the
file and entry are different. | [
"Tell",
"if",
"an",
"entry",
"is",
"modified",
"relative",
"to",
"a",
"file",
".",
"That",
"is",
"if",
"the",
"last",
"modified",
"times",
"are",
"different",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.artifact.zip/src/com/ibm/ws/artifact/zip/internal/ZipFileContainer.java#L1621-L1632 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.artifact.zip/src/com/ibm/ws/artifact/zip/internal/ZipFileContainer.java | ZipFileContainer.deleteAll | @Trivial
private boolean deleteAll(File rootFile) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled() ) {
Tr.debug(tc, "Delete [ " + rootFile.getAbsolutePath() + " ]");
}
if ( FileUtils.fileIsFile(rootFile) ) {
boolean didDelete = FileUtils.fileDelete(rootFile);
if ( !didDelete ) {
Tr.error(tc, "Could not delete file [ " + rootFile.getAbsolutePath() + " ]");
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled() ) {
Tr.debug(tc, "Deleted");
}
}
return didDelete;
} else {
boolean didDeleteAll = true;
int deleteCount = 0;
File childFiles[] = FileUtils.listFiles(rootFile);
int childCount;
if ( childFiles != null ) {
childCount = childFiles.length;
for ( File childFile : childFiles ) {
// Keep iterating even if one of the deletes fails.
// Delete as much as possible.
if ( !deleteAll(childFile) ) {
didDeleteAll = false;
} else {
deleteCount++;
}
}
} else {
childCount = 0;
deleteCount = 0;
}
if ( didDeleteAll ) {
didDeleteAll = FileUtils.fileDelete(rootFile);
}
if ( !didDeleteAll ) {
Tr.error(tc, "Could not delete directory [ " + rootFile.getAbsolutePath() + " ]");
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled() ) {
Tr.debug(tc, "Deleted [ " + Integer.valueOf(deleteCount) + " ]" +
" of [ " + Integer.valueOf(childCount) + " ]");
}
return didDeleteAll;
}
} | java | @Trivial
private boolean deleteAll(File rootFile) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled() ) {
Tr.debug(tc, "Delete [ " + rootFile.getAbsolutePath() + " ]");
}
if ( FileUtils.fileIsFile(rootFile) ) {
boolean didDelete = FileUtils.fileDelete(rootFile);
if ( !didDelete ) {
Tr.error(tc, "Could not delete file [ " + rootFile.getAbsolutePath() + " ]");
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled() ) {
Tr.debug(tc, "Deleted");
}
}
return didDelete;
} else {
boolean didDeleteAll = true;
int deleteCount = 0;
File childFiles[] = FileUtils.listFiles(rootFile);
int childCount;
if ( childFiles != null ) {
childCount = childFiles.length;
for ( File childFile : childFiles ) {
// Keep iterating even if one of the deletes fails.
// Delete as much as possible.
if ( !deleteAll(childFile) ) {
didDeleteAll = false;
} else {
deleteCount++;
}
}
} else {
childCount = 0;
deleteCount = 0;
}
if ( didDeleteAll ) {
didDeleteAll = FileUtils.fileDelete(rootFile);
}
if ( !didDeleteAll ) {
Tr.error(tc, "Could not delete directory [ " + rootFile.getAbsolutePath() + " ]");
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled() ) {
Tr.debug(tc, "Deleted [ " + Integer.valueOf(deleteCount) + " ]" +
" of [ " + Integer.valueOf(childCount) + " ]");
}
return didDeleteAll;
}
} | [
"@",
"Trivial",
"private",
"boolean",
"deleteAll",
"(",
"File",
"rootFile",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Delete [ \"",
"+",
"rootFile",
".",
"getAbsolutePath",
"(",
")",
"+",
"\" ]\"",
")",
";",
"}",
"if",
"(",
"FileUtils",
".",
"fileIsFile",
"(",
"rootFile",
")",
")",
"{",
"boolean",
"didDelete",
"=",
"FileUtils",
".",
"fileDelete",
"(",
"rootFile",
")",
";",
"if",
"(",
"!",
"didDelete",
")",
"{",
"Tr",
".",
"error",
"(",
"tc",
",",
"\"Could not delete file [ \"",
"+",
"rootFile",
".",
"getAbsolutePath",
"(",
")",
"+",
"\" ]\"",
")",
";",
"}",
"else",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Deleted\"",
")",
";",
"}",
"}",
"return",
"didDelete",
";",
"}",
"else",
"{",
"boolean",
"didDeleteAll",
"=",
"true",
";",
"int",
"deleteCount",
"=",
"0",
";",
"File",
"childFiles",
"[",
"]",
"=",
"FileUtils",
".",
"listFiles",
"(",
"rootFile",
")",
";",
"int",
"childCount",
";",
"if",
"(",
"childFiles",
"!=",
"null",
")",
"{",
"childCount",
"=",
"childFiles",
".",
"length",
";",
"for",
"(",
"File",
"childFile",
":",
"childFiles",
")",
"{",
"// Keep iterating even if one of the deletes fails.",
"// Delete as much as possible.",
"if",
"(",
"!",
"deleteAll",
"(",
"childFile",
")",
")",
"{",
"didDeleteAll",
"=",
"false",
";",
"}",
"else",
"{",
"deleteCount",
"++",
";",
"}",
"}",
"}",
"else",
"{",
"childCount",
"=",
"0",
";",
"deleteCount",
"=",
"0",
";",
"}",
"if",
"(",
"didDeleteAll",
")",
"{",
"didDeleteAll",
"=",
"FileUtils",
".",
"fileDelete",
"(",
"rootFile",
")",
";",
"}",
"if",
"(",
"!",
"didDeleteAll",
")",
"{",
"Tr",
".",
"error",
"(",
"tc",
",",
"\"Could not delete directory [ \"",
"+",
"rootFile",
".",
"getAbsolutePath",
"(",
")",
"+",
"\" ]\"",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Deleted [ \"",
"+",
"Integer",
".",
"valueOf",
"(",
"deleteCount",
")",
"+",
"\" ]\"",
"+",
"\" of [ \"",
"+",
"Integer",
".",
"valueOf",
"(",
"childCount",
")",
"+",
"\" ]\"",
")",
";",
"}",
"return",
"didDeleteAll",
";",
"}",
"}"
] | a single consolidated wrapper. | [
"a",
"single",
"consolidated",
"wrapper",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.artifact.zip/src/com/ibm/ws/artifact/zip/internal/ZipFileContainer.java#L1670-L1723 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/RecLogServiceImpl.java | RecLogServiceImpl.startRecovery | public void startRecovery(RecoveryLogFactory fac) {
if (tc.isEntryEnabled())
Tr.entry(tc, "startRecovery", fac);
// This is a stand alone server. HA can never effect this server so direct local recovery now.
RecoveryDirector director = null;
try {
director = RecoveryDirectorFactory.recoveryDirector(); /* @LI1578-22A */
director.setRecoveryLogFactory(fac);
((RecoveryDirectorImpl) director).driveLocalRecovery();/* @LI1578-22C */
} catch (RecoveryFailedException exc) {
FFDCFilter.processException(exc, "com.ibm.ws.recoverylog.spi.RecLogServiceImpl.startRecovery", "421", this);
if (tc.isDebugEnabled())
Tr.debug(tc, "Local recovery failed.");
// if (tc.isEntryEnabled()) Tr.exit(tc, "start", "RuntimeError");
// throw new RuntimeError("Unable to complete local recovery processing", exc);
} catch (InternalLogException ile) {
FFDCFilter.processException(ile, "com.ibm.ws.recoverylog.spi.RecLogServiceImpl.startRecovery", "478", this);
if (tc.isDebugEnabled())
Tr.debug(tc, "Local recovery not attempted.", ile);
// if (tc.isEntryEnabled()) Tr.exit(tc, "start", "RuntimeError");
// throw new RuntimeError("Unable to complete local recovery processing", ile);
}
if (director != null && _isPeerRecoverySupported) // used to test _recoveryGroup != null
{
if (checkPeersAtStartup()) {
try {
if (director instanceof LibertyRecoveryDirectorImpl) {
((LibertyRecoveryDirectorImpl) director).drivePeerRecovery();
}
} catch (RecoveryFailedException exc) {
FFDCFilter.processException(exc, "com.ibm.ws.recoverylog.spi.RecLogServiceImpl.startRecovery", "421", this);
if (tc.isDebugEnabled())
Tr.debug(tc, "Local peer failed.");
}
}
}
if (tc.isEntryEnabled())
Tr.exit(tc, "startRecovery");
} | java | public void startRecovery(RecoveryLogFactory fac) {
if (tc.isEntryEnabled())
Tr.entry(tc, "startRecovery", fac);
// This is a stand alone server. HA can never effect this server so direct local recovery now.
RecoveryDirector director = null;
try {
director = RecoveryDirectorFactory.recoveryDirector(); /* @LI1578-22A */
director.setRecoveryLogFactory(fac);
((RecoveryDirectorImpl) director).driveLocalRecovery();/* @LI1578-22C */
} catch (RecoveryFailedException exc) {
FFDCFilter.processException(exc, "com.ibm.ws.recoverylog.spi.RecLogServiceImpl.startRecovery", "421", this);
if (tc.isDebugEnabled())
Tr.debug(tc, "Local recovery failed.");
// if (tc.isEntryEnabled()) Tr.exit(tc, "start", "RuntimeError");
// throw new RuntimeError("Unable to complete local recovery processing", exc);
} catch (InternalLogException ile) {
FFDCFilter.processException(ile, "com.ibm.ws.recoverylog.spi.RecLogServiceImpl.startRecovery", "478", this);
if (tc.isDebugEnabled())
Tr.debug(tc, "Local recovery not attempted.", ile);
// if (tc.isEntryEnabled()) Tr.exit(tc, "start", "RuntimeError");
// throw new RuntimeError("Unable to complete local recovery processing", ile);
}
if (director != null && _isPeerRecoverySupported) // used to test _recoveryGroup != null
{
if (checkPeersAtStartup()) {
try {
if (director instanceof LibertyRecoveryDirectorImpl) {
((LibertyRecoveryDirectorImpl) director).drivePeerRecovery();
}
} catch (RecoveryFailedException exc) {
FFDCFilter.processException(exc, "com.ibm.ws.recoverylog.spi.RecLogServiceImpl.startRecovery", "421", this);
if (tc.isDebugEnabled())
Tr.debug(tc, "Local peer failed.");
}
}
}
if (tc.isEntryEnabled())
Tr.exit(tc, "startRecovery");
} | [
"public",
"void",
"startRecovery",
"(",
"RecoveryLogFactory",
"fac",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"startRecovery\"",
",",
"fac",
")",
";",
"// This is a stand alone server. HA can never effect this server so direct local recovery now.",
"RecoveryDirector",
"director",
"=",
"null",
";",
"try",
"{",
"director",
"=",
"RecoveryDirectorFactory",
".",
"recoveryDirector",
"(",
")",
";",
"/* @LI1578-22A */",
"director",
".",
"setRecoveryLogFactory",
"(",
"fac",
")",
";",
"(",
"(",
"RecoveryDirectorImpl",
")",
"director",
")",
".",
"driveLocalRecovery",
"(",
")",
";",
"/* @LI1578-22C */",
"}",
"catch",
"(",
"RecoveryFailedException",
"exc",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"exc",
",",
"\"com.ibm.ws.recoverylog.spi.RecLogServiceImpl.startRecovery\"",
",",
"\"421\"",
",",
"this",
")",
";",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Local recovery failed.\"",
")",
";",
"// if (tc.isEntryEnabled()) Tr.exit(tc, \"start\", \"RuntimeError\");",
"// throw new RuntimeError(\"Unable to complete local recovery processing\", exc);",
"}",
"catch",
"(",
"InternalLogException",
"ile",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"ile",
",",
"\"com.ibm.ws.recoverylog.spi.RecLogServiceImpl.startRecovery\"",
",",
"\"478\"",
",",
"this",
")",
";",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Local recovery not attempted.\"",
",",
"ile",
")",
";",
"// if (tc.isEntryEnabled()) Tr.exit(tc, \"start\", \"RuntimeError\");",
"// throw new RuntimeError(\"Unable to complete local recovery processing\", ile);",
"}",
"if",
"(",
"director",
"!=",
"null",
"&&",
"_isPeerRecoverySupported",
")",
"// used to test _recoveryGroup != null",
"{",
"if",
"(",
"checkPeersAtStartup",
"(",
")",
")",
"{",
"try",
"{",
"if",
"(",
"director",
"instanceof",
"LibertyRecoveryDirectorImpl",
")",
"{",
"(",
"(",
"LibertyRecoveryDirectorImpl",
")",
"director",
")",
".",
"drivePeerRecovery",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"RecoveryFailedException",
"exc",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"exc",
",",
"\"com.ibm.ws.recoverylog.spi.RecLogServiceImpl.startRecovery\"",
",",
"\"421\"",
",",
"this",
")",
";",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Local peer failed.\"",
")",
";",
"}",
"}",
"}",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"startRecovery\"",
")",
";",
"}"
] | Driven by the runtime during server startup. This 'hook' is used to perform
recovery log service initialization. | [
"Driven",
"by",
"the",
"runtime",
"during",
"server",
"startup",
".",
"This",
"hook",
"is",
"used",
"to",
"perform",
"recovery",
"log",
"service",
"initialization",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/RecLogServiceImpl.java#L103-L144 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/RecLogServiceImpl.java | RecLogServiceImpl.checkPeersAtStartup | private boolean checkPeersAtStartup() {
if (tc.isEntryEnabled())
Tr.entry(tc, "checkPeersAtStartup");
boolean checkAtStartup;
try {
checkAtStartup = AccessController.doPrivileged(
new PrivilegedExceptionAction<Boolean>() {
@Override
public Boolean run() {
return Boolean.getBoolean("com.ibm.ws.recoverylog.spi.CheckPeersAtStartup");
}
});
} catch (PrivilegedActionException e) {
if (tc.isDebugEnabled())
Tr.debug(tc, "checkPeersAtStartup", e);
checkAtStartup = false;
}
if (tc.isEntryEnabled())
Tr.exit(tc, "checkPeersAtStartup", checkAtStartup);
return checkAtStartup;
} | java | private boolean checkPeersAtStartup() {
if (tc.isEntryEnabled())
Tr.entry(tc, "checkPeersAtStartup");
boolean checkAtStartup;
try {
checkAtStartup = AccessController.doPrivileged(
new PrivilegedExceptionAction<Boolean>() {
@Override
public Boolean run() {
return Boolean.getBoolean("com.ibm.ws.recoverylog.spi.CheckPeersAtStartup");
}
});
} catch (PrivilegedActionException e) {
if (tc.isDebugEnabled())
Tr.debug(tc, "checkPeersAtStartup", e);
checkAtStartup = false;
}
if (tc.isEntryEnabled())
Tr.exit(tc, "checkPeersAtStartup", checkAtStartup);
return checkAtStartup;
} | [
"private",
"boolean",
"checkPeersAtStartup",
"(",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"checkPeersAtStartup\"",
")",
";",
"boolean",
"checkAtStartup",
";",
"try",
"{",
"checkAtStartup",
"=",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"PrivilegedExceptionAction",
"<",
"Boolean",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Boolean",
"run",
"(",
")",
"{",
"return",
"Boolean",
".",
"getBoolean",
"(",
"\"com.ibm.ws.recoverylog.spi.CheckPeersAtStartup\"",
")",
";",
"}",
"}",
")",
";",
"}",
"catch",
"(",
"PrivilegedActionException",
"e",
")",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"checkPeersAtStartup\"",
",",
"e",
")",
";",
"checkAtStartup",
"=",
"false",
";",
"}",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"checkPeersAtStartup\"",
",",
"checkAtStartup",
")",
";",
"return",
"checkAtStartup",
";",
"}"
] | This method retrieves a system property named com.ibm.ws.recoverylog.spi.CheckPeersAtStartup
which allows the check to see if peer servers are stale to be bypassed at server startup. The checks
will subsequently be performed through the spun-off timer thread.
@return | [
"This",
"method",
"retrieves",
"a",
"system",
"property",
"named",
"com",
".",
"ibm",
".",
"ws",
".",
"recoverylog",
".",
"spi",
".",
"CheckPeersAtStartup",
"which",
"allows",
"the",
"check",
"to",
"see",
"if",
"peer",
"servers",
"are",
"stale",
"to",
"be",
"bypassed",
"at",
"server",
"startup",
".",
"The",
"checks",
"will",
"subsequently",
"be",
"performed",
"through",
"the",
"spun",
"-",
"off",
"timer",
"thread",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/RecLogServiceImpl.java#L190-L213 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/impl/LogRepositoryWriterImpl.java | LogRepositoryWriterImpl.writeHeader | public synchronized void writeHeader(long timestamp) throws IOException {
if (writer == null && headerBytes != null) {
writer = createNewWriter(manager.startNewFile(timestamp));
writer.write(headerBytes);
manager.notifyOfFileAction(LogEventListener.EVENTTYPEROLL) ;
}
} | java | public synchronized void writeHeader(long timestamp) throws IOException {
if (writer == null && headerBytes != null) {
writer = createNewWriter(manager.startNewFile(timestamp));
writer.write(headerBytes);
manager.notifyOfFileAction(LogEventListener.EVENTTYPEROLL) ;
}
} | [
"public",
"synchronized",
"void",
"writeHeader",
"(",
"long",
"timestamp",
")",
"throws",
"IOException",
"{",
"if",
"(",
"writer",
"==",
"null",
"&&",
"headerBytes",
"!=",
"null",
")",
"{",
"writer",
"=",
"createNewWriter",
"(",
"manager",
".",
"startNewFile",
"(",
"timestamp",
")",
")",
";",
"writer",
".",
"write",
"(",
"headerBytes",
")",
";",
"manager",
".",
"notifyOfFileAction",
"(",
"LogEventListener",
".",
"EVENTTYPEROLL",
")",
";",
"}",
"}"
] | Publishes header if it wasn't done yet.
@param timestamp creation time to use on the new file if it needs to be created | [
"Publishes",
"header",
"if",
"it",
"wasn",
"t",
"done",
"yet",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/impl/LogRepositoryWriterImpl.java#L213-L219 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/impl/LogRepositoryWriterImpl.java | LogRepositoryWriterImpl.stop | public synchronized void stop() {
if (writer != null) {
try {
writer.close(headerBytes);
writer = null;
} catch (IOException ex) {
// No need to crash on this error even if the tail won't be written
// since reading logic can take care of that.
}
}
// Ensure that timer is stopped as well.
disableFileSwitch();
headerBytes = null;
// Don't stop manager here since it can be reused for a different repository writer.
//manager.stop();
} | java | public synchronized void stop() {
if (writer != null) {
try {
writer.close(headerBytes);
writer = null;
} catch (IOException ex) {
// No need to crash on this error even if the tail won't be written
// since reading logic can take care of that.
}
}
// Ensure that timer is stopped as well.
disableFileSwitch();
headerBytes = null;
// Don't stop manager here since it can be reused for a different repository writer.
//manager.stop();
} | [
"public",
"synchronized",
"void",
"stop",
"(",
")",
"{",
"if",
"(",
"writer",
"!=",
"null",
")",
"{",
"try",
"{",
"writer",
".",
"close",
"(",
"headerBytes",
")",
";",
"writer",
"=",
"null",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"// No need to crash on this error even if the tail won't be written",
"// since reading logic can take care of that.",
"}",
"}",
"// Ensure that timer is stopped as well.",
"disableFileSwitch",
"(",
")",
";",
"headerBytes",
"=",
"null",
";",
"// Don't stop manager here since it can be reused for a different repository writer.",
"//manager.stop();",
"}"
] | Stops this writer and close its output stream. | [
"Stops",
"this",
"writer",
"and",
"close",
"its",
"output",
"stream",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/impl/LogRepositoryWriterImpl.java#L224-L240 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/impl/LogRepositoryWriterImpl.java | LogRepositoryWriterImpl.enableFileSwitch | public void enableFileSwitch(int switchHour) {
if(fileSwitchTimer == null){
fileSwitchTimer = AccessHelper.createTimer();
}
//set calendar instance to the specified configuration hour for cutting
//default to midnight when the passed in value is invalid, or midnight is specified (to avoid negative value when 1 is subtracted
if(switchHour < MIN_SWITCH_HOUR || switchHour > MAX_SWITCH_HOUR ){
// It's OK to use logger here since adding logging record will not result in changing
// file switching configuration.
logger.logp(Level.WARNING, className, "enableFileSwitch", "HPEL_IncorrectSwitchHour", new Object[]{switchHour,MIN_SWITCH_HOUR, MAX_SWITCH_HOUR,MIN_SWITCH_HOUR});
switchHour = MIN_SWITCH_HOUR;
}
//Note: We will set the file cutting time to match the exact hour that was specified, but it's possible for the timestamp attribute of the file
//to go beyond the switchTime, as the final writes to close the file will alter the timestamp attribute.
//For example, if a fileSwitch was set to midnight, log records that are written after midnight will go to a new file, but it's possible for the
//previous file being closed to have a midnight timestamp attribute.
Calendar currentTime = Calendar.getInstance();
Calendar switchTime = currentTime;
switchTime.set(Calendar.HOUR_OF_DAY, switchHour);
switchTime.set(Calendar.MINUTE, 00);
switchTime.set(Calendar.SECOND, 00);
//if the time has already passed, then set to the next day. Otherwise
//the timer will catch up on the missed tasks that would've been executed.
//For example: If the switchTime was set to 11 (for 11AM), and the server gets started after 11AM, we do not want the file switch
//to occur until 11AM of the following day.
if(currentTime.after(switchTime)){
switchTime.add(Calendar.DATE, 1);
}
fileSwitchTime.setTime(switchTime.getTimeInMillis());
fileSwitchTimer.scheduleAtFixedRate(fileSwitchTask, fileSwitchTime, SWITCH_PERIOD);
} | java | public void enableFileSwitch(int switchHour) {
if(fileSwitchTimer == null){
fileSwitchTimer = AccessHelper.createTimer();
}
//set calendar instance to the specified configuration hour for cutting
//default to midnight when the passed in value is invalid, or midnight is specified (to avoid negative value when 1 is subtracted
if(switchHour < MIN_SWITCH_HOUR || switchHour > MAX_SWITCH_HOUR ){
// It's OK to use logger here since adding logging record will not result in changing
// file switching configuration.
logger.logp(Level.WARNING, className, "enableFileSwitch", "HPEL_IncorrectSwitchHour", new Object[]{switchHour,MIN_SWITCH_HOUR, MAX_SWITCH_HOUR,MIN_SWITCH_HOUR});
switchHour = MIN_SWITCH_HOUR;
}
//Note: We will set the file cutting time to match the exact hour that was specified, but it's possible for the timestamp attribute of the file
//to go beyond the switchTime, as the final writes to close the file will alter the timestamp attribute.
//For example, if a fileSwitch was set to midnight, log records that are written after midnight will go to a new file, but it's possible for the
//previous file being closed to have a midnight timestamp attribute.
Calendar currentTime = Calendar.getInstance();
Calendar switchTime = currentTime;
switchTime.set(Calendar.HOUR_OF_DAY, switchHour);
switchTime.set(Calendar.MINUTE, 00);
switchTime.set(Calendar.SECOND, 00);
//if the time has already passed, then set to the next day. Otherwise
//the timer will catch up on the missed tasks that would've been executed.
//For example: If the switchTime was set to 11 (for 11AM), and the server gets started after 11AM, we do not want the file switch
//to occur until 11AM of the following day.
if(currentTime.after(switchTime)){
switchTime.add(Calendar.DATE, 1);
}
fileSwitchTime.setTime(switchTime.getTimeInMillis());
fileSwitchTimer.scheduleAtFixedRate(fileSwitchTask, fileSwitchTime, SWITCH_PERIOD);
} | [
"public",
"void",
"enableFileSwitch",
"(",
"int",
"switchHour",
")",
"{",
"if",
"(",
"fileSwitchTimer",
"==",
"null",
")",
"{",
"fileSwitchTimer",
"=",
"AccessHelper",
".",
"createTimer",
"(",
")",
";",
"}",
"//set calendar instance to the specified configuration hour for cutting",
"//default to midnight when the passed in value is invalid, or midnight is specified (to avoid negative value when 1 is subtracted",
"if",
"(",
"switchHour",
"<",
"MIN_SWITCH_HOUR",
"||",
"switchHour",
">",
"MAX_SWITCH_HOUR",
")",
"{",
"// It's OK to use logger here since adding logging record will not result in changing",
"// file switching configuration.",
"logger",
".",
"logp",
"(",
"Level",
".",
"WARNING",
",",
"className",
",",
"\"enableFileSwitch\"",
",",
"\"HPEL_IncorrectSwitchHour\"",
",",
"new",
"Object",
"[",
"]",
"{",
"switchHour",
",",
"MIN_SWITCH_HOUR",
",",
"MAX_SWITCH_HOUR",
",",
"MIN_SWITCH_HOUR",
"}",
")",
";",
"switchHour",
"=",
"MIN_SWITCH_HOUR",
";",
"}",
"//Note: We will set the file cutting time to match the exact hour that was specified, but it's possible for the timestamp attribute of the file",
"//to go beyond the switchTime, as the final writes to close the file will alter the timestamp attribute.",
"//For example, if a fileSwitch was set to midnight, log records that are written after midnight will go to a new file, but it's possible for the",
"//previous file being closed to have a midnight timestamp attribute.",
"Calendar",
"currentTime",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"Calendar",
"switchTime",
"=",
"currentTime",
";",
"switchTime",
".",
"set",
"(",
"Calendar",
".",
"HOUR_OF_DAY",
",",
"switchHour",
")",
";",
"switchTime",
".",
"set",
"(",
"Calendar",
".",
"MINUTE",
",",
"00",
")",
";",
"switchTime",
".",
"set",
"(",
"Calendar",
".",
"SECOND",
",",
"00",
")",
";",
"//if the time has already passed, then set to the next day. Otherwise",
"//the timer will catch up on the missed tasks that would've been executed.",
"//For example: If the switchTime was set to 11 (for 11AM), and the server gets started after 11AM, we do not want the file switch",
"//to occur until 11AM of the following day.",
"if",
"(",
"currentTime",
".",
"after",
"(",
"switchTime",
")",
")",
"{",
"switchTime",
".",
"add",
"(",
"Calendar",
".",
"DATE",
",",
"1",
")",
";",
"}",
"fileSwitchTime",
".",
"setTime",
"(",
"switchTime",
".",
"getTimeInMillis",
"(",
")",
")",
";",
"fileSwitchTimer",
".",
"scheduleAtFixedRate",
"(",
"fileSwitchTask",
",",
"fileSwitchTime",
",",
"SWITCH_PERIOD",
")",
";",
"}"
] | Enables file switching for the writer by configuring the timer to set a trigger based on the switchHour parm
@param switchHour the hour of the day for the file switching to occur, must be between the values of 0 through 23 | [
"Enables",
"file",
"switching",
"for",
"the",
"writer",
"by",
"configuring",
"the",
"timer",
"to",
"set",
"a",
"trigger",
"based",
"on",
"the",
"switchHour",
"parm"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/impl/LogRepositoryWriterImpl.java#L260-L296 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webserver.plugin.utility/src/com/ibm/ws/webserver/plugin/utility/utils/CommonMBeanConnection.java | CommonMBeanConnection.createPromptingTrustManager | private X509TrustManager createPromptingTrustManager() {
TrustManager[] trustManagers = null;
try {
String defaultAlg = TrustManagerFactory.getDefaultAlgorithm();
TrustManagerFactory tmf = TrustManagerFactory.getInstance(defaultAlg);
tmf.init((KeyStore) null);
trustManagers = tmf.getTrustManagers();
} catch (KeyStoreException e) {
// Unable to initialize the default trust managers.
// This is not a problem as PromptX509rustManager can handle null.
} catch (NoSuchAlgorithmException e) {
// Unable to get default trust managers.
// This is not a problem as PromptX509rustManager can handle null.
}
boolean autoAccept = Boolean.valueOf(System.getProperty(SYS_PROP_AUTO_ACCEPT, "false"));
return new PromptX509TrustManager(stdin, stdout, trustManagers, autoAccept);
} | java | private X509TrustManager createPromptingTrustManager() {
TrustManager[] trustManagers = null;
try {
String defaultAlg = TrustManagerFactory.getDefaultAlgorithm();
TrustManagerFactory tmf = TrustManagerFactory.getInstance(defaultAlg);
tmf.init((KeyStore) null);
trustManagers = tmf.getTrustManagers();
} catch (KeyStoreException e) {
// Unable to initialize the default trust managers.
// This is not a problem as PromptX509rustManager can handle null.
} catch (NoSuchAlgorithmException e) {
// Unable to get default trust managers.
// This is not a problem as PromptX509rustManager can handle null.
}
boolean autoAccept = Boolean.valueOf(System.getProperty(SYS_PROP_AUTO_ACCEPT, "false"));
return new PromptX509TrustManager(stdin, stdout, trustManagers, autoAccept);
} | [
"private",
"X509TrustManager",
"createPromptingTrustManager",
"(",
")",
"{",
"TrustManager",
"[",
"]",
"trustManagers",
"=",
"null",
";",
"try",
"{",
"String",
"defaultAlg",
"=",
"TrustManagerFactory",
".",
"getDefaultAlgorithm",
"(",
")",
";",
"TrustManagerFactory",
"tmf",
"=",
"TrustManagerFactory",
".",
"getInstance",
"(",
"defaultAlg",
")",
";",
"tmf",
".",
"init",
"(",
"(",
"KeyStore",
")",
"null",
")",
";",
"trustManagers",
"=",
"tmf",
".",
"getTrustManagers",
"(",
")",
";",
"}",
"catch",
"(",
"KeyStoreException",
"e",
")",
"{",
"// Unable to initialize the default trust managers.",
"// This is not a problem as PromptX509rustManager can handle null.",
"}",
"catch",
"(",
"NoSuchAlgorithmException",
"e",
")",
"{",
"// Unable to get default trust managers.",
"// This is not a problem as PromptX509rustManager can handle null.",
"}",
"boolean",
"autoAccept",
"=",
"Boolean",
".",
"valueOf",
"(",
"System",
".",
"getProperty",
"(",
"SYS_PROP_AUTO_ACCEPT",
",",
"\"false\"",
")",
")",
";",
"return",
"new",
"PromptX509TrustManager",
"(",
"stdin",
",",
"stdout",
",",
"trustManagers",
",",
"autoAccept",
")",
";",
"}"
] | Create a custom trust manager which will prompt for trust acceptance.
@return | [
"Create",
"a",
"custom",
"trust",
"manager",
"which",
"will",
"prompt",
"for",
"trust",
"acceptance",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webserver.plugin.utility/src/com/ibm/ws/webserver/plugin/utility/utils/CommonMBeanConnection.java#L55-L72 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webserver.plugin.utility/src/com/ibm/ws/webserver/plugin/utility/utils/CommonMBeanConnection.java | CommonMBeanConnection.setUpSSLContext | private SSLSocketFactory setUpSSLContext() throws NoSuchAlgorithmException, KeyManagementException {
SSLContext ctx = SSLContext.getInstance("SSL");
ctx.init(null, new TrustManager[] { createPromptingTrustManager() }, null);
return ctx.getSocketFactory();
} | java | private SSLSocketFactory setUpSSLContext() throws NoSuchAlgorithmException, KeyManagementException {
SSLContext ctx = SSLContext.getInstance("SSL");
ctx.init(null, new TrustManager[] { createPromptingTrustManager() }, null);
return ctx.getSocketFactory();
} | [
"private",
"SSLSocketFactory",
"setUpSSLContext",
"(",
")",
"throws",
"NoSuchAlgorithmException",
",",
"KeyManagementException",
"{",
"SSLContext",
"ctx",
"=",
"SSLContext",
".",
"getInstance",
"(",
"\"SSL\"",
")",
";",
"ctx",
".",
"init",
"(",
"null",
",",
"new",
"TrustManager",
"[",
"]",
"{",
"createPromptingTrustManager",
"(",
")",
"}",
",",
"null",
")",
";",
"return",
"ctx",
".",
"getSocketFactory",
"(",
")",
";",
"}"
] | Set up the common SSL context for the outbound connection.
@throws NoSuchAlgorithmException
@throws KeyManagementException | [
"Set",
"up",
"the",
"common",
"SSL",
"context",
"for",
"the",
"outbound",
"connection",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webserver.plugin.utility/src/com/ibm/ws/webserver/plugin/utility/utils/CommonMBeanConnection.java#L80-L84 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webserver.plugin.utility/src/com/ibm/ws/webserver/plugin/utility/utils/CommonMBeanConnection.java | CommonMBeanConnection.createJMXEnvironment | private HashMap<String, Object> createJMXEnvironment(final String user, final String password, final SSLSocketFactory sslSF) {
HashMap<String, Object> environment = new HashMap<String, Object>();
environment.put("jmx.remote.protocol.provider.pkgs", "com.ibm.ws.jmx.connector.client");
environment.put(JMXConnector.CREDENTIALS, new String[] { user, password });
environment.put(ClientProvider.READ_TIMEOUT, 2 * 60 * 1000);
environment.put(ConnectorSettings.DISABLE_HOSTNAME_VERIFICATION, Boolean.TRUE);
environment.put(ConnectorSettings.CUSTOM_SSLSOCKETFACTORY, sslSF);
environment.put("isCollectiveUtil", Boolean.TRUE);
return environment;
} | java | private HashMap<String, Object> createJMXEnvironment(final String user, final String password, final SSLSocketFactory sslSF) {
HashMap<String, Object> environment = new HashMap<String, Object>();
environment.put("jmx.remote.protocol.provider.pkgs", "com.ibm.ws.jmx.connector.client");
environment.put(JMXConnector.CREDENTIALS, new String[] { user, password });
environment.put(ClientProvider.READ_TIMEOUT, 2 * 60 * 1000);
environment.put(ConnectorSettings.DISABLE_HOSTNAME_VERIFICATION, Boolean.TRUE);
environment.put(ConnectorSettings.CUSTOM_SSLSOCKETFACTORY, sslSF);
environment.put("isCollectiveUtil", Boolean.TRUE);
return environment;
} | [
"private",
"HashMap",
"<",
"String",
",",
"Object",
">",
"createJMXEnvironment",
"(",
"final",
"String",
"user",
",",
"final",
"String",
"password",
",",
"final",
"SSLSocketFactory",
"sslSF",
")",
"{",
"HashMap",
"<",
"String",
",",
"Object",
">",
"environment",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"environment",
".",
"put",
"(",
"\"jmx.remote.protocol.provider.pkgs\"",
",",
"\"com.ibm.ws.jmx.connector.client\"",
")",
";",
"environment",
".",
"put",
"(",
"JMXConnector",
".",
"CREDENTIALS",
",",
"new",
"String",
"[",
"]",
"{",
"user",
",",
"password",
"}",
")",
";",
"environment",
".",
"put",
"(",
"ClientProvider",
".",
"READ_TIMEOUT",
",",
"2",
"*",
"60",
"*",
"1000",
")",
";",
"environment",
".",
"put",
"(",
"ConnectorSettings",
".",
"DISABLE_HOSTNAME_VERIFICATION",
",",
"Boolean",
".",
"TRUE",
")",
";",
"environment",
".",
"put",
"(",
"ConnectorSettings",
".",
"CUSTOM_SSLSOCKETFACTORY",
",",
"sslSF",
")",
";",
"environment",
".",
"put",
"(",
"\"isCollectiveUtil\"",
",",
"Boolean",
".",
"TRUE",
")",
";",
"return",
"environment",
";",
"}"
] | Creates the common JMX environment used to connect to the controller.
@param user
@param password
@return | [
"Creates",
"the",
"common",
"JMX",
"environment",
"used",
"to",
"connect",
"to",
"the",
"controller",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webserver.plugin.utility/src/com/ibm/ws/webserver/plugin/utility/utils/CommonMBeanConnection.java#L93-L102 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webserver.plugin.utility/src/com/ibm/ws/webserver/plugin/utility/utils/CommonMBeanConnection.java | CommonMBeanConnection.getMBeanServerConnection | private JMXConnector getMBeanServerConnection(String controllerHost, int controllerPort, HashMap<String, Object> environment) throws MalformedURLException, IOException {
JMXServiceURL serviceURL = new JMXServiceURL("REST", controllerHost, controllerPort, "/IBMJMXConnectorREST");
return new ClientProvider().newJMXConnector(serviceURL, environment);
} | java | private JMXConnector getMBeanServerConnection(String controllerHost, int controllerPort, HashMap<String, Object> environment) throws MalformedURLException, IOException {
JMXServiceURL serviceURL = new JMXServiceURL("REST", controllerHost, controllerPort, "/IBMJMXConnectorREST");
return new ClientProvider().newJMXConnector(serviceURL, environment);
} | [
"private",
"JMXConnector",
"getMBeanServerConnection",
"(",
"String",
"controllerHost",
",",
"int",
"controllerPort",
",",
"HashMap",
"<",
"String",
",",
"Object",
">",
"environment",
")",
"throws",
"MalformedURLException",
",",
"IOException",
"{",
"JMXServiceURL",
"serviceURL",
"=",
"new",
"JMXServiceURL",
"(",
"\"REST\"",
",",
"controllerHost",
",",
"controllerPort",
",",
"\"/IBMJMXConnectorREST\"",
")",
";",
"return",
"new",
"ClientProvider",
"(",
")",
".",
"newJMXConnector",
"(",
"serviceURL",
",",
"environment",
")",
";",
"}"
] | Get the MBeanServerConnection for the target controller host and port.
@param controllerHost
@param controllerPort
@param environment
@return
@throws MalformedURLException
@throws IOException | [
"Get",
"the",
"MBeanServerConnection",
"for",
"the",
"target",
"controller",
"host",
"and",
"port",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webserver.plugin.utility/src/com/ibm/ws/webserver/plugin/utility/utils/CommonMBeanConnection.java#L114-L117 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webserver.plugin.utility/src/com/ibm/ws/webserver/plugin/utility/utils/CommonMBeanConnection.java | CommonMBeanConnection.getJMXConnector | public JMXConnector getJMXConnector(String controllerHost, int controllerPort, String user, String password) throws NoSuchAlgorithmException, KeyManagementException, MalformedURLException, IOException {
HashMap<String, Object> environment = createJMXEnvironment(user, password, setUpSSLContext());
JMXConnector connector = getMBeanServerConnection(controllerHost, controllerPort, environment);
connector.connect();
return connector;
} | java | public JMXConnector getJMXConnector(String controllerHost, int controllerPort, String user, String password) throws NoSuchAlgorithmException, KeyManagementException, MalformedURLException, IOException {
HashMap<String, Object> environment = createJMXEnvironment(user, password, setUpSSLContext());
JMXConnector connector = getMBeanServerConnection(controllerHost, controllerPort, environment);
connector.connect();
return connector;
} | [
"public",
"JMXConnector",
"getJMXConnector",
"(",
"String",
"controllerHost",
",",
"int",
"controllerPort",
",",
"String",
"user",
",",
"String",
"password",
")",
"throws",
"NoSuchAlgorithmException",
",",
"KeyManagementException",
",",
"MalformedURLException",
",",
"IOException",
"{",
"HashMap",
"<",
"String",
",",
"Object",
">",
"environment",
"=",
"createJMXEnvironment",
"(",
"user",
",",
"password",
",",
"setUpSSLContext",
"(",
")",
")",
";",
"JMXConnector",
"connector",
"=",
"getMBeanServerConnection",
"(",
"controllerHost",
",",
"controllerPort",
",",
"environment",
")",
";",
"connector",
".",
"connect",
"(",
")",
";",
"return",
"connector",
";",
"}"
] | Returns a connected JMXConnector.
@param controllerHost
@param controllerPort
@param user
@param password
@return
@throws NoSuchAlgorithmException
@throws KeyManagementException
@throws MalformedURLException
@throws IOException | [
"Returns",
"a",
"connected",
"JMXConnector",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webserver.plugin.utility/src/com/ibm/ws/webserver/plugin/utility/utils/CommonMBeanConnection.java#L132-L137 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/LocalTransactionProxy.java | LocalTransactionProxy.commit | public synchronized void commit()
throws SIIncorrectCallException,
SIRollbackException,
SIResourceException,
SIConnectionLostException,
SIErrorException
{
if (tc.isEntryEnabled()) SibTr.entry(this, tc, "commit");
if (!valid)
{
throw new SIIncorrectCallException(
nls.getFormattedMessage("TRANSACTION_COMPLETE_SICO1022", null, null)
);
}
// Mark this as invalid
valid = false;
CommsByteBuffer request = getCommsByteBuffer();
request.putShort(getConnectionObjectID());
request.putInt(getTransactionId());
CommsByteBuffer reply = null;
try
{
// Pass on call to server
reply = jfapExchange(request,
JFapChannelConstants.SEG_COMMIT_TRANSACTION,
lowestPriority,
true);
short err = reply.getCommandCompletionCode(JFapChannelConstants.SEG_COMMIT_TRANSACTION_R);
if (err != CommsConstants.SI_NO_EXCEPTION)
{
checkFor_SIIncorrectCallException(reply, err);
checkFor_SIRollbackException(reply, err);
checkFor_SIResourceException(reply, err);
checkFor_SIConnectionLostException(reply, err);
checkFor_SIErrorException(reply, err);
defaultChecker(reply, err);
}
}
catch (SIConnectionDroppedException e)
{
// No FFDC Code needed
// In this case we translate this to an SIConnectionLostException - as transactions aren't
// tided to a particular connection
throw new SIConnectionLostException(e.getMessage(), e);
}
finally
{
if (reply != null) reply.release();
}
if (tc.isEntryEnabled()) SibTr.exit(this, tc, "commit");
} | java | public synchronized void commit()
throws SIIncorrectCallException,
SIRollbackException,
SIResourceException,
SIConnectionLostException,
SIErrorException
{
if (tc.isEntryEnabled()) SibTr.entry(this, tc, "commit");
if (!valid)
{
throw new SIIncorrectCallException(
nls.getFormattedMessage("TRANSACTION_COMPLETE_SICO1022", null, null)
);
}
// Mark this as invalid
valid = false;
CommsByteBuffer request = getCommsByteBuffer();
request.putShort(getConnectionObjectID());
request.putInt(getTransactionId());
CommsByteBuffer reply = null;
try
{
// Pass on call to server
reply = jfapExchange(request,
JFapChannelConstants.SEG_COMMIT_TRANSACTION,
lowestPriority,
true);
short err = reply.getCommandCompletionCode(JFapChannelConstants.SEG_COMMIT_TRANSACTION_R);
if (err != CommsConstants.SI_NO_EXCEPTION)
{
checkFor_SIIncorrectCallException(reply, err);
checkFor_SIRollbackException(reply, err);
checkFor_SIResourceException(reply, err);
checkFor_SIConnectionLostException(reply, err);
checkFor_SIErrorException(reply, err);
defaultChecker(reply, err);
}
}
catch (SIConnectionDroppedException e)
{
// No FFDC Code needed
// In this case we translate this to an SIConnectionLostException - as transactions aren't
// tided to a particular connection
throw new SIConnectionLostException(e.getMessage(), e);
}
finally
{
if (reply != null) reply.release();
}
if (tc.isEntryEnabled()) SibTr.exit(this, tc, "commit");
} | [
"public",
"synchronized",
"void",
"commit",
"(",
")",
"throws",
"SIIncorrectCallException",
",",
"SIRollbackException",
",",
"SIResourceException",
",",
"SIConnectionLostException",
",",
"SIErrorException",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"commit\"",
")",
";",
"if",
"(",
"!",
"valid",
")",
"{",
"throw",
"new",
"SIIncorrectCallException",
"(",
"nls",
".",
"getFormattedMessage",
"(",
"\"TRANSACTION_COMPLETE_SICO1022\"",
",",
"null",
",",
"null",
")",
")",
";",
"}",
"// Mark this as invalid",
"valid",
"=",
"false",
";",
"CommsByteBuffer",
"request",
"=",
"getCommsByteBuffer",
"(",
")",
";",
"request",
".",
"putShort",
"(",
"getConnectionObjectID",
"(",
")",
")",
";",
"request",
".",
"putInt",
"(",
"getTransactionId",
"(",
")",
")",
";",
"CommsByteBuffer",
"reply",
"=",
"null",
";",
"try",
"{",
"// Pass on call to server",
"reply",
"=",
"jfapExchange",
"(",
"request",
",",
"JFapChannelConstants",
".",
"SEG_COMMIT_TRANSACTION",
",",
"lowestPriority",
",",
"true",
")",
";",
"short",
"err",
"=",
"reply",
".",
"getCommandCompletionCode",
"(",
"JFapChannelConstants",
".",
"SEG_COMMIT_TRANSACTION_R",
")",
";",
"if",
"(",
"err",
"!=",
"CommsConstants",
".",
"SI_NO_EXCEPTION",
")",
"{",
"checkFor_SIIncorrectCallException",
"(",
"reply",
",",
"err",
")",
";",
"checkFor_SIRollbackException",
"(",
"reply",
",",
"err",
")",
";",
"checkFor_SIResourceException",
"(",
"reply",
",",
"err",
")",
";",
"checkFor_SIConnectionLostException",
"(",
"reply",
",",
"err",
")",
";",
"checkFor_SIErrorException",
"(",
"reply",
",",
"err",
")",
";",
"defaultChecker",
"(",
"reply",
",",
"err",
")",
";",
"}",
"}",
"catch",
"(",
"SIConnectionDroppedException",
"e",
")",
"{",
"// No FFDC Code needed",
"// In this case we translate this to an SIConnectionLostException - as transactions aren't",
"// tided to a particular connection",
"throw",
"new",
"SIConnectionLostException",
"(",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"reply",
"!=",
"null",
")",
"reply",
".",
"release",
"(",
")",
";",
"}",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"commit\"",
")",
";",
"}"
] | Commits this transaction by flowing the commit to the server and marking this
transaction as invalid. | [
"Commits",
"this",
"transaction",
"by",
"flowing",
"the",
"commit",
"to",
"the",
"server",
"and",
"marking",
"this",
"transaction",
"as",
"invalid",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/LocalTransactionProxy.java#L83-L139 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/LocalTransactionProxy.java | LocalTransactionProxy.rollback | public synchronized void rollback()
throws SIIncorrectCallException,
SIResourceException,
SIConnectionLostException,
SIErrorException
{
if (tc.isEntryEnabled()) SibTr.entry(this, tc, "rollback");
if (!valid)
{
throw new SIIncorrectCallException(
nls.getFormattedMessage("TRANSACTION_COMPLETE_SICO1022", null, null)
);
}
// Mark this as invalid
valid = false;
CommsByteBuffer request = getCommsByteBuffer();
request.putShort(getConnectionObjectID());
request.putInt(getTransactionId());
CommsByteBuffer reply = null;
try
{
// Pass on call to server
reply = jfapExchange(request,
JFapChannelConstants.SEG_ROLLBACK_TRANSACTION,
lowestPriority,
true);
// Inform any associated consumers of the rollback, in case there are
// redelivery ordering considerations. We do this regardless of the
// success of the rollback, but need to do it after the rollback has
// been sent to the ME.
informConsumersOfRollback();
short err = reply.getCommandCompletionCode(JFapChannelConstants.SEG_ROLLBACK_TRANSACTION_R);
if (err != CommsConstants.SI_NO_EXCEPTION)
{
checkFor_SIIncorrectCallException(reply, err);
checkFor_SIResourceException(reply, err);
checkFor_SIConnectionLostException(reply, err);
checkFor_SIErrorException(reply, err);
defaultChecker(reply, err);
}
}
catch (SIConnectionDroppedException e)
{
// No FFDC Code needed
// PK60857: The connection broke on us, but the ME side will eventually timeout
// and assume rollback. So we can safely consume this exception. We previously
// threw an exception here but that leaked a connection from the pool because
// the tx never completed.
if (tc.isDebugEnabled()) SibTr.debug(this, tc, "Connection failure during rollback.");
}
finally
{
if (reply != null) reply.release();
}
if (tc.isEntryEnabled()) SibTr.exit(this, tc, "rollback");
} | java | public synchronized void rollback()
throws SIIncorrectCallException,
SIResourceException,
SIConnectionLostException,
SIErrorException
{
if (tc.isEntryEnabled()) SibTr.entry(this, tc, "rollback");
if (!valid)
{
throw new SIIncorrectCallException(
nls.getFormattedMessage("TRANSACTION_COMPLETE_SICO1022", null, null)
);
}
// Mark this as invalid
valid = false;
CommsByteBuffer request = getCommsByteBuffer();
request.putShort(getConnectionObjectID());
request.putInt(getTransactionId());
CommsByteBuffer reply = null;
try
{
// Pass on call to server
reply = jfapExchange(request,
JFapChannelConstants.SEG_ROLLBACK_TRANSACTION,
lowestPriority,
true);
// Inform any associated consumers of the rollback, in case there are
// redelivery ordering considerations. We do this regardless of the
// success of the rollback, but need to do it after the rollback has
// been sent to the ME.
informConsumersOfRollback();
short err = reply.getCommandCompletionCode(JFapChannelConstants.SEG_ROLLBACK_TRANSACTION_R);
if (err != CommsConstants.SI_NO_EXCEPTION)
{
checkFor_SIIncorrectCallException(reply, err);
checkFor_SIResourceException(reply, err);
checkFor_SIConnectionLostException(reply, err);
checkFor_SIErrorException(reply, err);
defaultChecker(reply, err);
}
}
catch (SIConnectionDroppedException e)
{
// No FFDC Code needed
// PK60857: The connection broke on us, but the ME side will eventually timeout
// and assume rollback. So we can safely consume this exception. We previously
// threw an exception here but that leaked a connection from the pool because
// the tx never completed.
if (tc.isDebugEnabled()) SibTr.debug(this, tc, "Connection failure during rollback.");
}
finally
{
if (reply != null) reply.release();
}
if (tc.isEntryEnabled()) SibTr.exit(this, tc, "rollback");
} | [
"public",
"synchronized",
"void",
"rollback",
"(",
")",
"throws",
"SIIncorrectCallException",
",",
"SIResourceException",
",",
"SIConnectionLostException",
",",
"SIErrorException",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"rollback\"",
")",
";",
"if",
"(",
"!",
"valid",
")",
"{",
"throw",
"new",
"SIIncorrectCallException",
"(",
"nls",
".",
"getFormattedMessage",
"(",
"\"TRANSACTION_COMPLETE_SICO1022\"",
",",
"null",
",",
"null",
")",
")",
";",
"}",
"// Mark this as invalid",
"valid",
"=",
"false",
";",
"CommsByteBuffer",
"request",
"=",
"getCommsByteBuffer",
"(",
")",
";",
"request",
".",
"putShort",
"(",
"getConnectionObjectID",
"(",
")",
")",
";",
"request",
".",
"putInt",
"(",
"getTransactionId",
"(",
")",
")",
";",
"CommsByteBuffer",
"reply",
"=",
"null",
";",
"try",
"{",
"// Pass on call to server",
"reply",
"=",
"jfapExchange",
"(",
"request",
",",
"JFapChannelConstants",
".",
"SEG_ROLLBACK_TRANSACTION",
",",
"lowestPriority",
",",
"true",
")",
";",
"// Inform any associated consumers of the rollback, in case there are",
"// redelivery ordering considerations. We do this regardless of the",
"// success of the rollback, but need to do it after the rollback has",
"// been sent to the ME.",
"informConsumersOfRollback",
"(",
")",
";",
"short",
"err",
"=",
"reply",
".",
"getCommandCompletionCode",
"(",
"JFapChannelConstants",
".",
"SEG_ROLLBACK_TRANSACTION_R",
")",
";",
"if",
"(",
"err",
"!=",
"CommsConstants",
".",
"SI_NO_EXCEPTION",
")",
"{",
"checkFor_SIIncorrectCallException",
"(",
"reply",
",",
"err",
")",
";",
"checkFor_SIResourceException",
"(",
"reply",
",",
"err",
")",
";",
"checkFor_SIConnectionLostException",
"(",
"reply",
",",
"err",
")",
";",
"checkFor_SIErrorException",
"(",
"reply",
",",
"err",
")",
";",
"defaultChecker",
"(",
"reply",
",",
"err",
")",
";",
"}",
"}",
"catch",
"(",
"SIConnectionDroppedException",
"e",
")",
"{",
"// No FFDC Code needed",
"// PK60857: The connection broke on us, but the ME side will eventually timeout",
"// and assume rollback. So we can safely consume this exception. We previously",
"// threw an exception here but that leaked a connection from the pool because",
"// the tx never completed.",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Connection failure during rollback.\"",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"reply",
"!=",
"null",
")",
"reply",
".",
"release",
"(",
")",
";",
"}",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"rollback\"",
")",
";",
"}"
] | Rolls back this transaction by flowing the rollback to the server and marking this
transaction as invalid.
@throws com.ibm.websphere.sib.exception.SIIncorrectCallException
@throws com.ibm.wsspi.sib.core.exception.SIRollbackException
@throws com.ibm.websphere.sib.exception.SIResourceException
@throws com.ibm.wsspi.sib.core.exception.SIConnectionLostException
@throws com.ibm.websphere.sib.exception.SIErrorException | [
"Rolls",
"back",
"this",
"transaction",
"by",
"flowing",
"the",
"rollback",
"to",
"the",
"server",
"and",
"marking",
"this",
"transaction",
"as",
"invalid",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/LocalTransactionProxy.java#L151-L213 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/LocalTransactionProxy.java | LocalTransactionProxy.isValid | public synchronized boolean isValid()
{
if (tc.isEntryEnabled()) SibTr.entry(this, tc, "isValid");
if (tc.isEntryEnabled()) SibTr.exit(this, tc, "isValid", ""+valid);
return valid;
} | java | public synchronized boolean isValid()
{
if (tc.isEntryEnabled()) SibTr.entry(this, tc, "isValid");
if (tc.isEntryEnabled()) SibTr.exit(this, tc, "isValid", ""+valid);
return valid;
} | [
"public",
"synchronized",
"boolean",
"isValid",
"(",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"isValid\"",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"isValid\"",
",",
"\"\"",
"+",
"valid",
")",
";",
"return",
"valid",
";",
"}"
] | This method will return true if the transaction has not been committed
or rolled back.
@return boolean | [
"This",
"method",
"will",
"return",
"true",
"if",
"the",
"transaction",
"has",
"not",
"been",
"committed",
"or",
"rolled",
"back",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/LocalTransactionProxy.java#L221-L226 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/Transaction.java | Transaction.getLowestMessagePriority | public short getLowestMessagePriority()
{
if (tc.isEntryEnabled()) SibTr.entry(this, tc, "getLowestMessagePriority");
if (tc.isEntryEnabled()) SibTr.exit(this, tc, "getLowestMessagePriority", ""+lowestPriority);
return lowestPriority;
} | java | public short getLowestMessagePriority()
{
if (tc.isEntryEnabled()) SibTr.entry(this, tc, "getLowestMessagePriority");
if (tc.isEntryEnabled()) SibTr.exit(this, tc, "getLowestMessagePriority", ""+lowestPriority);
return lowestPriority;
} | [
"public",
"short",
"getLowestMessagePriority",
"(",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"getLowestMessagePriority\"",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"getLowestMessagePriority\"",
",",
"\"\"",
"+",
"lowestPriority",
")",
";",
"return",
"lowestPriority",
";",
"}"
] | This method gets the lowest message priority being used in this transaction
and as such is the JFAP priority that commit and rollback will be sent as.
@return short | [
"This",
"method",
"gets",
"the",
"lowest",
"message",
"priority",
"being",
"used",
"in",
"this",
"transaction",
"and",
"as",
"such",
"is",
"the",
"JFAP",
"priority",
"that",
"commit",
"and",
"rollback",
"will",
"be",
"sent",
"as",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/Transaction.java#L121-L126 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/Transaction.java | Transaction.updateLowestMessagePriority | public void updateLowestMessagePriority(short messagePriority)
{
if (tc.isEntryEnabled()) SibTr.entry(this, tc, "updateLowestMessagePriority",
new Object[] {""+messagePriority});
// Only update if the message priority is lower than another message
if (messagePriority < this.lowestPriority)
{
if (tc.isDebugEnabled()) SibTr.debug(this, tc, "Updating lowest priority");
this.lowestPriority = messagePriority;
}
if (tc.isEntryEnabled()) SibTr.exit(this, tc, "updateLowestMessagePriority");
} | java | public void updateLowestMessagePriority(short messagePriority)
{
if (tc.isEntryEnabled()) SibTr.entry(this, tc, "updateLowestMessagePriority",
new Object[] {""+messagePriority});
// Only update if the message priority is lower than another message
if (messagePriority < this.lowestPriority)
{
if (tc.isDebugEnabled()) SibTr.debug(this, tc, "Updating lowest priority");
this.lowestPriority = messagePriority;
}
if (tc.isEntryEnabled()) SibTr.exit(this, tc, "updateLowestMessagePriority");
} | [
"public",
"void",
"updateLowestMessagePriority",
"(",
"short",
"messagePriority",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"updateLowestMessagePriority\"",
",",
"new",
"Object",
"[",
"]",
"{",
"\"\"",
"+",
"messagePriority",
"}",
")",
";",
"// Only update if the message priority is lower than another message",
"if",
"(",
"messagePriority",
"<",
"this",
".",
"lowestPriority",
")",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Updating lowest priority\"",
")",
";",
"this",
".",
"lowestPriority",
"=",
"messagePriority",
";",
"}",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"updateLowestMessagePriority\"",
")",
";",
"}"
] | This method is used to update the lowest message priority
that has been sent on this transaction. The value passed in
is stored if it is lower than a previous value. Otherwise
it is ignored. The stored value is then used on the exchanges
sent when we commit or rollback.
@param messagePriority | [
"This",
"method",
"is",
"used",
"to",
"update",
"the",
"lowest",
"message",
"priority",
"that",
"has",
"been",
"sent",
"on",
"this",
"transaction",
".",
"The",
"value",
"passed",
"in",
"is",
"stored",
"if",
"it",
"is",
"lower",
"than",
"a",
"previous",
"value",
".",
"Otherwise",
"it",
"is",
"ignored",
".",
"The",
"stored",
"value",
"is",
"then",
"used",
"on",
"the",
"exchanges",
"sent",
"when",
"we",
"commit",
"or",
"rollback",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/Transaction.java#L137-L150 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/Transaction.java | Transaction.associateConsumer | public void associateConsumer(ConsumerSessionProxy consumer) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "associateConsumer", new Object[]{consumer, Boolean.valueOf(strictRedeliveryOrdering)});
// This is a no-op if strict redelivery ordering is disabled
if (strictRedeliveryOrdering && consumer != null) {
synchronized (associatedConsumersLock) {
associatedConsumers.add(consumer);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "associateConsumer");
} | java | public void associateConsumer(ConsumerSessionProxy consumer) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "associateConsumer", new Object[]{consumer, Boolean.valueOf(strictRedeliveryOrdering)});
// This is a no-op if strict redelivery ordering is disabled
if (strictRedeliveryOrdering && consumer != null) {
synchronized (associatedConsumersLock) {
associatedConsumers.add(consumer);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "associateConsumer");
} | [
"public",
"void",
"associateConsumer",
"(",
"ConsumerSessionProxy",
"consumer",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"associateConsumer\"",
",",
"new",
"Object",
"[",
"]",
"{",
"consumer",
",",
"Boolean",
".",
"valueOf",
"(",
"strictRedeliveryOrdering",
")",
"}",
")",
";",
"// This is a no-op if strict redelivery ordering is disabled",
"if",
"(",
"strictRedeliveryOrdering",
"&&",
"consumer",
"!=",
"null",
")",
"{",
"synchronized",
"(",
"associatedConsumersLock",
")",
"{",
"associatedConsumers",
".",
"add",
"(",
"consumer",
")",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"associateConsumer\"",
")",
";",
"}"
] | Called each time a recoverable message is deleted from a consumer using a
proxy queue under this transaction, to allow the transaction to callback
inform the proxy queue it should purge any read-ahead messages if required.
No-op if strict redelivery ordering is disabled. | [
"Called",
"each",
"time",
"a",
"recoverable",
"message",
"is",
"deleted",
"from",
"a",
"consumer",
"using",
"a",
"proxy",
"queue",
"under",
"this",
"transaction",
"to",
"allow",
"the",
"transaction",
"to",
"callback",
"inform",
"the",
"proxy",
"queue",
"it",
"should",
"purge",
"any",
"read",
"-",
"ahead",
"messages",
"if",
"required",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/Transaction.java#L159-L173 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/Transaction.java | Transaction.informConsumersOfRollback | public void informConsumersOfRollback() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "informConsumersOfRollback", new Object[]{Boolean.valueOf(strictRedeliveryOrdering)});
if (strictRedeliveryOrdering) {
// Take a copy of the set of consumers, to avoid additional locking
// when we call into the consumers to inform them of a rollback.
ConsumerSessionProxy[] consumersToNotify;
synchronized(associatedConsumersLock) {
consumersToNotify =
new ConsumerSessionProxy[associatedConsumers.size()];
consumersToNotify = (ConsumerSessionProxy[])
associatedConsumers.toArray(consumersToNotify);
}
// Callback each consumer to inform them of the rollback
for (int i = 0; i < consumersToNotify.length; i++) {
try {
consumersToNotify[i].rollbackOccurred();
}
catch (SIException e) {
// FFDC for the error, but do not re-throw.
// Most likely the connection to the ME is unavailable, or the
// consumer has been closed and cleaned up.
// In these cases the consumer will not be able to consume any
// more messages - so redelivery ordering is not an issue.
FFDCFilter.processException(e, CLASS_NAME + ".informConsumersOfRollback",
CommsConstants.TRANSACTION_INFORMCONSUMERSOFROLLBACK_01, this);
if (tc.isDebugEnabled()) SibTr.debug(tc, "Encountered error informing consumer of rollback: " + consumersToNotify[i]);
if (tc.isEventEnabled()) SibTr.exception(tc, e);
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "informConsumersOfRollback");
} | java | public void informConsumersOfRollback() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "informConsumersOfRollback", new Object[]{Boolean.valueOf(strictRedeliveryOrdering)});
if (strictRedeliveryOrdering) {
// Take a copy of the set of consumers, to avoid additional locking
// when we call into the consumers to inform them of a rollback.
ConsumerSessionProxy[] consumersToNotify;
synchronized(associatedConsumersLock) {
consumersToNotify =
new ConsumerSessionProxy[associatedConsumers.size()];
consumersToNotify = (ConsumerSessionProxy[])
associatedConsumers.toArray(consumersToNotify);
}
// Callback each consumer to inform them of the rollback
for (int i = 0; i < consumersToNotify.length; i++) {
try {
consumersToNotify[i].rollbackOccurred();
}
catch (SIException e) {
// FFDC for the error, but do not re-throw.
// Most likely the connection to the ME is unavailable, or the
// consumer has been closed and cleaned up.
// In these cases the consumer will not be able to consume any
// more messages - so redelivery ordering is not an issue.
FFDCFilter.processException(e, CLASS_NAME + ".informConsumersOfRollback",
CommsConstants.TRANSACTION_INFORMCONSUMERSOFROLLBACK_01, this);
if (tc.isDebugEnabled()) SibTr.debug(tc, "Encountered error informing consumer of rollback: " + consumersToNotify[i]);
if (tc.isEventEnabled()) SibTr.exception(tc, e);
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "informConsumersOfRollback");
} | [
"public",
"void",
"informConsumersOfRollback",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"informConsumersOfRollback\"",
",",
"new",
"Object",
"[",
"]",
"{",
"Boolean",
".",
"valueOf",
"(",
"strictRedeliveryOrdering",
")",
"}",
")",
";",
"if",
"(",
"strictRedeliveryOrdering",
")",
"{",
"// Take a copy of the set of consumers, to avoid additional locking",
"// when we call into the consumers to inform them of a rollback.",
"ConsumerSessionProxy",
"[",
"]",
"consumersToNotify",
";",
"synchronized",
"(",
"associatedConsumersLock",
")",
"{",
"consumersToNotify",
"=",
"new",
"ConsumerSessionProxy",
"[",
"associatedConsumers",
".",
"size",
"(",
")",
"]",
";",
"consumersToNotify",
"=",
"(",
"ConsumerSessionProxy",
"[",
"]",
")",
"associatedConsumers",
".",
"toArray",
"(",
"consumersToNotify",
")",
";",
"}",
"// Callback each consumer to inform them of the rollback",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"consumersToNotify",
".",
"length",
";",
"i",
"++",
")",
"{",
"try",
"{",
"consumersToNotify",
"[",
"i",
"]",
".",
"rollbackOccurred",
"(",
")",
";",
"}",
"catch",
"(",
"SIException",
"e",
")",
"{",
"// FFDC for the error, but do not re-throw.",
"// Most likely the connection to the ME is unavailable, or the",
"// consumer has been closed and cleaned up.",
"// In these cases the consumer will not be able to consume any",
"// more messages - so redelivery ordering is not an issue.",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"CLASS_NAME",
"+",
"\".informConsumersOfRollback\"",
",",
"CommsConstants",
".",
"TRANSACTION_INFORMCONSUMERSOFROLLBACK_01",
",",
"this",
")",
";",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"Encountered error informing consumer of rollback: \"",
"+",
"consumersToNotify",
"[",
"i",
"]",
")",
";",
"if",
"(",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"e",
")",
";",
"}",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"informConsumersOfRollback\"",
")",
";",
"}"
] | Inform all associated consumers that a rollback has occurred.
No-op if strict redelivery ordering is disabled. | [
"Inform",
"all",
"associated",
"consumers",
"that",
"a",
"rollback",
"has",
"occurred",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/Transaction.java#L180-L216 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jpa.container.core/src/com/ibm/ws/jpa/management/JPAExEntityManager.java | JPAExEntityManager.unboundSfsbFromExtendedPC | static void unboundSfsbFromExtendedPC(JPAExPcBindingContext bindingContext)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.entry(tc, "unboundSfsbFromExtendedPC : " + bindingContext);
JPAPuId puIds[] = bindingContext.getExPcPuIds();
long bindId = bindingContext.getBindId();
// New this binding key only once and update the puid in the loop
ExPcBindingKey bindingKey = new ExPcBindingKey(bindId, null);
for (JPAPuId puId : puIds)
{
bindingKey.puId = puId;
ExPcBindingInfo exPcBindingInfo = svExPcBindingMap.remove(bindingKey);
if (exPcBindingInfo != null)
{
// JPA 5.9.1 Container Responsibilities
//
// The container closes the entity manager by calling EntityManager.close after the
// stateful session bean and all other stateful session beans that have inherited
// the same persistence context as the EntityManager have been removed.
if (exPcBindingInfo.removeRemovedOrDiscardedSfsb(bindingKey) == 0)
{
EntityManager em = exPcBindingInfo.getEntityManager();
if (em != null)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "All SFSBs using the same extend-scoped persistence "
+ "context have been removed, closing EntityManager " + em);
if (em.isOpen()) // d442445
em.close();
}
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "unboundSfsbFromExtendedPC : exPcBindMap size=" + svExPcBindingMap.size());
} | java | static void unboundSfsbFromExtendedPC(JPAExPcBindingContext bindingContext)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.entry(tc, "unboundSfsbFromExtendedPC : " + bindingContext);
JPAPuId puIds[] = bindingContext.getExPcPuIds();
long bindId = bindingContext.getBindId();
// New this binding key only once and update the puid in the loop
ExPcBindingKey bindingKey = new ExPcBindingKey(bindId, null);
for (JPAPuId puId : puIds)
{
bindingKey.puId = puId;
ExPcBindingInfo exPcBindingInfo = svExPcBindingMap.remove(bindingKey);
if (exPcBindingInfo != null)
{
// JPA 5.9.1 Container Responsibilities
//
// The container closes the entity manager by calling EntityManager.close after the
// stateful session bean and all other stateful session beans that have inherited
// the same persistence context as the EntityManager have been removed.
if (exPcBindingInfo.removeRemovedOrDiscardedSfsb(bindingKey) == 0)
{
EntityManager em = exPcBindingInfo.getEntityManager();
if (em != null)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "All SFSBs using the same extend-scoped persistence "
+ "context have been removed, closing EntityManager " + em);
if (em.isOpen()) // d442445
em.close();
}
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "unboundSfsbFromExtendedPC : exPcBindMap size=" + svExPcBindingMap.size());
} | [
"static",
"void",
"unboundSfsbFromExtendedPC",
"(",
"JPAExPcBindingContext",
"bindingContext",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"unboundSfsbFromExtendedPC : \"",
"+",
"bindingContext",
")",
";",
"JPAPuId",
"puIds",
"[",
"]",
"=",
"bindingContext",
".",
"getExPcPuIds",
"(",
")",
";",
"long",
"bindId",
"=",
"bindingContext",
".",
"getBindId",
"(",
")",
";",
"// New this binding key only once and update the puid in the loop",
"ExPcBindingKey",
"bindingKey",
"=",
"new",
"ExPcBindingKey",
"(",
"bindId",
",",
"null",
")",
";",
"for",
"(",
"JPAPuId",
"puId",
":",
"puIds",
")",
"{",
"bindingKey",
".",
"puId",
"=",
"puId",
";",
"ExPcBindingInfo",
"exPcBindingInfo",
"=",
"svExPcBindingMap",
".",
"remove",
"(",
"bindingKey",
")",
";",
"if",
"(",
"exPcBindingInfo",
"!=",
"null",
")",
"{",
"// JPA 5.9.1 Container Responsibilities",
"//",
"// The container closes the entity manager by calling EntityManager.close after the",
"// stateful session bean and all other stateful session beans that have inherited",
"// the same persistence context as the EntityManager have been removed.",
"if",
"(",
"exPcBindingInfo",
".",
"removeRemovedOrDiscardedSfsb",
"(",
"bindingKey",
")",
"==",
"0",
")",
"{",
"EntityManager",
"em",
"=",
"exPcBindingInfo",
".",
"getEntityManager",
"(",
")",
";",
"if",
"(",
"em",
"!=",
"null",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"All SFSBs using the same extend-scoped persistence \"",
"+",
"\"context have been removed, closing EntityManager \"",
"+",
"em",
")",
";",
"if",
"(",
"em",
".",
"isOpen",
"(",
")",
")",
"// d442445",
"em",
".",
"close",
"(",
")",
";",
"}",
"}",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"unboundSfsbFromExtendedPC : exPcBindMap size=\"",
"+",
"svExPcBindingMap",
".",
"size",
"(",
")",
")",
";",
"}"
] | When SFSB instances are removed or discard, this method is called to unbind the SFSB from the
associated persistence context. When the last SFSB is removed from the bound collection, the
associated EntityManager is closed.
@param bindingContext
to be unbound | [
"When",
"SFSB",
"instances",
"are",
"removed",
"or",
"discard",
"this",
"method",
"is",
"called",
"to",
"unbind",
"the",
"SFSB",
"from",
"the",
"associated",
"persistence",
"context",
".",
"When",
"the",
"last",
"SFSB",
"is",
"removed",
"from",
"the",
"bound",
"collection",
"the",
"associated",
"EntityManager",
"is",
"closed",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jpa.container.core/src/com/ibm/ws/jpa/management/JPAExEntityManager.java#L719-L756 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jpa.container.core/src/com/ibm/ws/jpa/management/JPAExEntityManager.java | JPAExEntityManager.parentHasSameExPc | private static final boolean parentHasSameExPc(JPAPuId parentPuIds[], JPAPuId puId)
{
for (JPAPuId parentPuId : parentPuIds)
{
if (parentPuId.equals(puId))
{
return true;
}
}
return false;
} | java | private static final boolean parentHasSameExPc(JPAPuId parentPuIds[], JPAPuId puId)
{
for (JPAPuId parentPuId : parentPuIds)
{
if (parentPuId.equals(puId))
{
return true;
}
}
return false;
} | [
"private",
"static",
"final",
"boolean",
"parentHasSameExPc",
"(",
"JPAPuId",
"parentPuIds",
"[",
"]",
",",
"JPAPuId",
"puId",
")",
"{",
"for",
"(",
"JPAPuId",
"parentPuId",
":",
"parentPuIds",
")",
"{",
"if",
"(",
"parentPuId",
".",
"equals",
"(",
"puId",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
] | Returns true if the caller and callee have declared the same @ PersistneceContext
in their components. | [
"Returns",
"true",
"if",
"the",
"caller",
"and",
"callee",
"have",
"declared",
"the",
"same"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jpa.container.core/src/com/ibm/ws/jpa/management/JPAExEntityManager.java#L762-L772 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/PriorityQueue.java | PriorityQueue.queue | public void queue(JFapByteBuffer bufferData,
int segmentType,
int requestNumber,
int priority,
SendListener sendListener,
Conversation conversation,
Connection connection,
int conversationId,
boolean pooledBuffers,
boolean partOfExchange,
long size,
boolean terminal,
ThrottlingPolicy throttlingPolicy)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "queue");
TransmissionDataIterator iterator =
TransmissionDataIterator.allocateFromPool(connection,
bufferData,
priority,
pooledBuffers,
partOfExchange,
segmentType,
conversationId,
requestNumber,
conversation,
sendListener,
terminal,
(int)size);
// begin F193735.3
if (type == Conversation.ME) meQueuedBytes += size;
else if (type == Conversation.CLIENT) clientQueuedBytes += size;
// end F193735.3
queueInternal(iterator, throttlingPolicy, terminal);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "queue");
} | java | public void queue(JFapByteBuffer bufferData,
int segmentType,
int requestNumber,
int priority,
SendListener sendListener,
Conversation conversation,
Connection connection,
int conversationId,
boolean pooledBuffers,
boolean partOfExchange,
long size,
boolean terminal,
ThrottlingPolicy throttlingPolicy)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "queue");
TransmissionDataIterator iterator =
TransmissionDataIterator.allocateFromPool(connection,
bufferData,
priority,
pooledBuffers,
partOfExchange,
segmentType,
conversationId,
requestNumber,
conversation,
sendListener,
terminal,
(int)size);
// begin F193735.3
if (type == Conversation.ME) meQueuedBytes += size;
else if (type == Conversation.CLIENT) clientQueuedBytes += size;
// end F193735.3
queueInternal(iterator, throttlingPolicy, terminal);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "queue");
} | [
"public",
"void",
"queue",
"(",
"JFapByteBuffer",
"bufferData",
",",
"int",
"segmentType",
",",
"int",
"requestNumber",
",",
"int",
"priority",
",",
"SendListener",
"sendListener",
",",
"Conversation",
"conversation",
",",
"Connection",
"connection",
",",
"int",
"conversationId",
",",
"boolean",
"pooledBuffers",
",",
"boolean",
"partOfExchange",
",",
"long",
"size",
",",
"boolean",
"terminal",
",",
"ThrottlingPolicy",
"throttlingPolicy",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"queue\"",
")",
";",
"TransmissionDataIterator",
"iterator",
"=",
"TransmissionDataIterator",
".",
"allocateFromPool",
"(",
"connection",
",",
"bufferData",
",",
"priority",
",",
"pooledBuffers",
",",
"partOfExchange",
",",
"segmentType",
",",
"conversationId",
",",
"requestNumber",
",",
"conversation",
",",
"sendListener",
",",
"terminal",
",",
"(",
"int",
")",
"size",
")",
";",
"// begin F193735.3",
"if",
"(",
"type",
"==",
"Conversation",
".",
"ME",
")",
"meQueuedBytes",
"+=",
"size",
";",
"else",
"if",
"(",
"type",
"==",
"Conversation",
".",
"CLIENT",
")",
"clientQueuedBytes",
"+=",
"size",
";",
"// end F193735.3",
"queueInternal",
"(",
"iterator",
",",
"throttlingPolicy",
",",
"terminal",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"queue\"",
")",
";",
"}"
] | Queues the specified request into the priority table. | [
"Queues",
"the",
"specified",
"request",
"into",
"the",
"priority",
"table",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/PriorityQueue.java#L234-L271 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/PriorityQueue.java | PriorityQueue.dequeue | public TransmissionData dequeue()
throws SIConnectionDroppedException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "dequeue");
TransmissionData retValue = null;
Queue queue = null;
synchronized(queueMonitor)
{
if (state == CLOSED)
{
throw new SIConnectionDroppedException(TraceNLS.getFormattedMessage(JFapChannelConstants.MSG_BUNDLE, "PRIORITY_QUEUE_PURGED_SICJ0077", null, "PRIORITY_QUEUE_PURGED_SICJ0077"));
}
else
{
// Find the highest non-empty priority
int priority = JFapChannelConstants.MAX_PRIORITY_LEVELS-1;
while((priority >= 0) && (queueArray[priority].depth == 0)) --priority;
if (priority >= 0)
{
queue = queueArray[priority];
// Dequeue the data and update the queue appropriately.
TransmissionDataIterator iterator = queue.head(); // D217401
retValue = iterator.next();
queue.bytes -= retValue.getSize();
// If there is no more data left to iterate over then remove the
// transmission data from the queue and update the depth counters.
if (!iterator.hasNext())
{
queue.dequeue(); // D217401
--queue.depth;
--totalQueueDepth;
}
// If the priority queue is in closing state and we have just emptied
// the queue, mark the queue as closed and unblock anyone waiting for the
// queue to close.
if ((totalQueueDepth == 0) && (state == CLOSING))
{
state = CLOSED; // Transition to the close state
closeWaitersMonitor.setActive(false); // Unblock anyone waiting for the close
// Un-block any queue monitors, in case other threads are blocked waiting
// to try and queue data.
for (int i=0; i < JFapChannelConstants.MAX_PRIORITY_LEVELS; ++i)
queueArray[i].monitor.setActive(false);
}
// If dequeueing the data caused a change in capacity then
// take the appropriate actions
if (!queue.hasCapacity &&
(queue.bytes < maxQueueBytes) &&
queue.depth < maxQueueDepth)
{
// Mark the queue as having capacity
queue.hasCapacity = true;
// If the change in capacity results in more priority levels having capacity then...
if (priority < lowestPriorityWithCapacity)
{
// Unblock any threads waiting on the lower capacity levels
int newLowestPriorityWithCapacity = priority;
while((newLowestPriorityWithCapacity > 0) &&
queueArray[newLowestPriorityWithCapacity-1].hasCapacity)
{
queueArray[newLowestPriorityWithCapacity].monitor.setActive(false);
--newLowestPriorityWithCapacity;
}
lowestPriorityWithCapacity = newLowestPriorityWithCapacity;
queueArray[lowestPriorityWithCapacity].monitor.setActive(false);
}
}
}
}
}
if (retValue != null)
{
if (type == Conversation.CLIENT)
clientQueuedBytes -= retValue.getSize();
else
meQueuedBytes -= retValue.getSize();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "dequeue", retValue);
return retValue;
} | java | public TransmissionData dequeue()
throws SIConnectionDroppedException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "dequeue");
TransmissionData retValue = null;
Queue queue = null;
synchronized(queueMonitor)
{
if (state == CLOSED)
{
throw new SIConnectionDroppedException(TraceNLS.getFormattedMessage(JFapChannelConstants.MSG_BUNDLE, "PRIORITY_QUEUE_PURGED_SICJ0077", null, "PRIORITY_QUEUE_PURGED_SICJ0077"));
}
else
{
// Find the highest non-empty priority
int priority = JFapChannelConstants.MAX_PRIORITY_LEVELS-1;
while((priority >= 0) && (queueArray[priority].depth == 0)) --priority;
if (priority >= 0)
{
queue = queueArray[priority];
// Dequeue the data and update the queue appropriately.
TransmissionDataIterator iterator = queue.head(); // D217401
retValue = iterator.next();
queue.bytes -= retValue.getSize();
// If there is no more data left to iterate over then remove the
// transmission data from the queue and update the depth counters.
if (!iterator.hasNext())
{
queue.dequeue(); // D217401
--queue.depth;
--totalQueueDepth;
}
// If the priority queue is in closing state and we have just emptied
// the queue, mark the queue as closed and unblock anyone waiting for the
// queue to close.
if ((totalQueueDepth == 0) && (state == CLOSING))
{
state = CLOSED; // Transition to the close state
closeWaitersMonitor.setActive(false); // Unblock anyone waiting for the close
// Un-block any queue monitors, in case other threads are blocked waiting
// to try and queue data.
for (int i=0; i < JFapChannelConstants.MAX_PRIORITY_LEVELS; ++i)
queueArray[i].monitor.setActive(false);
}
// If dequeueing the data caused a change in capacity then
// take the appropriate actions
if (!queue.hasCapacity &&
(queue.bytes < maxQueueBytes) &&
queue.depth < maxQueueDepth)
{
// Mark the queue as having capacity
queue.hasCapacity = true;
// If the change in capacity results in more priority levels having capacity then...
if (priority < lowestPriorityWithCapacity)
{
// Unblock any threads waiting on the lower capacity levels
int newLowestPriorityWithCapacity = priority;
while((newLowestPriorityWithCapacity > 0) &&
queueArray[newLowestPriorityWithCapacity-1].hasCapacity)
{
queueArray[newLowestPriorityWithCapacity].monitor.setActive(false);
--newLowestPriorityWithCapacity;
}
lowestPriorityWithCapacity = newLowestPriorityWithCapacity;
queueArray[lowestPriorityWithCapacity].monitor.setActive(false);
}
}
}
}
}
if (retValue != null)
{
if (type == Conversation.CLIENT)
clientQueuedBytes -= retValue.getSize();
else
meQueuedBytes -= retValue.getSize();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "dequeue", retValue);
return retValue;
} | [
"public",
"TransmissionData",
"dequeue",
"(",
")",
"throws",
"SIConnectionDroppedException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"dequeue\"",
")",
";",
"TransmissionData",
"retValue",
"=",
"null",
";",
"Queue",
"queue",
"=",
"null",
";",
"synchronized",
"(",
"queueMonitor",
")",
"{",
"if",
"(",
"state",
"==",
"CLOSED",
")",
"{",
"throw",
"new",
"SIConnectionDroppedException",
"(",
"TraceNLS",
".",
"getFormattedMessage",
"(",
"JFapChannelConstants",
".",
"MSG_BUNDLE",
",",
"\"PRIORITY_QUEUE_PURGED_SICJ0077\"",
",",
"null",
",",
"\"PRIORITY_QUEUE_PURGED_SICJ0077\"",
")",
")",
";",
"}",
"else",
"{",
"// Find the highest non-empty priority",
"int",
"priority",
"=",
"JFapChannelConstants",
".",
"MAX_PRIORITY_LEVELS",
"-",
"1",
";",
"while",
"(",
"(",
"priority",
">=",
"0",
")",
"&&",
"(",
"queueArray",
"[",
"priority",
"]",
".",
"depth",
"==",
"0",
")",
")",
"--",
"priority",
";",
"if",
"(",
"priority",
">=",
"0",
")",
"{",
"queue",
"=",
"queueArray",
"[",
"priority",
"]",
";",
"// Dequeue the data and update the queue appropriately.",
"TransmissionDataIterator",
"iterator",
"=",
"queue",
".",
"head",
"(",
")",
";",
"// D217401",
"retValue",
"=",
"iterator",
".",
"next",
"(",
")",
";",
"queue",
".",
"bytes",
"-=",
"retValue",
".",
"getSize",
"(",
")",
";",
"// If there is no more data left to iterate over then remove the",
"// transmission data from the queue and update the depth counters.",
"if",
"(",
"!",
"iterator",
".",
"hasNext",
"(",
")",
")",
"{",
"queue",
".",
"dequeue",
"(",
")",
";",
"// D217401",
"--",
"queue",
".",
"depth",
";",
"--",
"totalQueueDepth",
";",
"}",
"// If the priority queue is in closing state and we have just emptied",
"// the queue, mark the queue as closed and unblock anyone waiting for the",
"// queue to close.",
"if",
"(",
"(",
"totalQueueDepth",
"==",
"0",
")",
"&&",
"(",
"state",
"==",
"CLOSING",
")",
")",
"{",
"state",
"=",
"CLOSED",
";",
"// Transition to the close state",
"closeWaitersMonitor",
".",
"setActive",
"(",
"false",
")",
";",
"// Unblock anyone waiting for the close",
"// Un-block any queue monitors, in case other threads are blocked waiting",
"// to try and queue data.",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"JFapChannelConstants",
".",
"MAX_PRIORITY_LEVELS",
";",
"++",
"i",
")",
"queueArray",
"[",
"i",
"]",
".",
"monitor",
".",
"setActive",
"(",
"false",
")",
";",
"}",
"// If dequeueing the data caused a change in capacity then",
"// take the appropriate actions",
"if",
"(",
"!",
"queue",
".",
"hasCapacity",
"&&",
"(",
"queue",
".",
"bytes",
"<",
"maxQueueBytes",
")",
"&&",
"queue",
".",
"depth",
"<",
"maxQueueDepth",
")",
"{",
"// Mark the queue as having capacity",
"queue",
".",
"hasCapacity",
"=",
"true",
";",
"// If the change in capacity results in more priority levels having capacity then...",
"if",
"(",
"priority",
"<",
"lowestPriorityWithCapacity",
")",
"{",
"// Unblock any threads waiting on the lower capacity levels",
"int",
"newLowestPriorityWithCapacity",
"=",
"priority",
";",
"while",
"(",
"(",
"newLowestPriorityWithCapacity",
">",
"0",
")",
"&&",
"queueArray",
"[",
"newLowestPriorityWithCapacity",
"-",
"1",
"]",
".",
"hasCapacity",
")",
"{",
"queueArray",
"[",
"newLowestPriorityWithCapacity",
"]",
".",
"monitor",
".",
"setActive",
"(",
"false",
")",
";",
"--",
"newLowestPriorityWithCapacity",
";",
"}",
"lowestPriorityWithCapacity",
"=",
"newLowestPriorityWithCapacity",
";",
"queueArray",
"[",
"lowestPriorityWithCapacity",
"]",
".",
"monitor",
".",
"setActive",
"(",
"false",
")",
";",
"}",
"}",
"}",
"}",
"}",
"if",
"(",
"retValue",
"!=",
"null",
")",
"{",
"if",
"(",
"type",
"==",
"Conversation",
".",
"CLIENT",
")",
"clientQueuedBytes",
"-=",
"retValue",
".",
"getSize",
"(",
")",
";",
"else",
"meQueuedBytes",
"-=",
"retValue",
".",
"getSize",
"(",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"dequeue\"",
",",
"retValue",
")",
";",
"return",
"retValue",
";",
"}"
] | De-queues the highest priority entry from the table
@throws SIConnectionDroppedException if the priorty queue has been
closed or purged.
@return RequestData Returns the highest priority request data
object or null. | [
"De",
"-",
"queues",
"the",
"highest",
"priority",
"entry",
"from",
"the",
"table"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/PriorityQueue.java#L390-L481 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/PriorityQueue.java | PriorityQueue.hasCapacity | public boolean hasCapacity(int priority)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "hasCapacity", ""+priority);
boolean result;
synchronized(queueMonitor)
{
result = priority >= lowestPriorityWithCapacity;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "hasCapacity", ""+result);
return result;
} | java | public boolean hasCapacity(int priority)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "hasCapacity", ""+priority);
boolean result;
synchronized(queueMonitor)
{
result = priority >= lowestPriorityWithCapacity;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "hasCapacity", ""+result);
return result;
} | [
"public",
"boolean",
"hasCapacity",
"(",
"int",
"priority",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"hasCapacity\"",
",",
"\"\"",
"+",
"priority",
")",
";",
"boolean",
"result",
";",
"synchronized",
"(",
"queueMonitor",
")",
"{",
"result",
"=",
"priority",
">=",
"lowestPriorityWithCapacity",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"hasCapacity\"",
",",
"\"\"",
"+",
"result",
")",
";",
"return",
"result",
";",
"}"
] | Checks to see if a given priority level has the capacity to accept another
message to be queued.
@param priority
@return boolean | [
"Checks",
"to",
"see",
"if",
"a",
"given",
"priority",
"level",
"has",
"the",
"capacity",
"to",
"accept",
"another",
"message",
"to",
"be",
"queued",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/PriorityQueue.java#L489-L501 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/PriorityQueue.java | PriorityQueue.close | public void close(boolean immediate)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "close", ""+immediate);
synchronized(queueMonitor)
{
if (immediate || (totalQueueDepth == 0))
{
state = CLOSED;
closeWaitersMonitor.setActive(false);
}
else
state = CLOSING;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "close");
} | java | public void close(boolean immediate)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "close", ""+immediate);
synchronized(queueMonitor)
{
if (immediate || (totalQueueDepth == 0))
{
state = CLOSED;
closeWaitersMonitor.setActive(false);
}
else
state = CLOSING;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "close");
} | [
"public",
"void",
"close",
"(",
"boolean",
"immediate",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"close\"",
",",
"\"\"",
"+",
"immediate",
")",
";",
"synchronized",
"(",
"queueMonitor",
")",
"{",
"if",
"(",
"immediate",
"||",
"(",
"totalQueueDepth",
"==",
"0",
")",
")",
"{",
"state",
"=",
"CLOSED",
";",
"closeWaitersMonitor",
".",
"setActive",
"(",
"false",
")",
";",
"}",
"else",
"state",
"=",
"CLOSING",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"close\"",
")",
";",
"}"
] | Closes the priority queue. This causes all new queue requests to be ignored.
Any existing data that has been queued may be dequeued, unless the immediate flag
has been set, in which case, we consider ourselves closed. | [
"Closes",
"the",
"priority",
"queue",
".",
"This",
"causes",
"all",
"new",
"queue",
"requests",
"to",
"be",
"ignored",
".",
"Any",
"existing",
"data",
"that",
"has",
"been",
"queued",
"may",
"be",
"dequeued",
"unless",
"the",
"immediate",
"flag",
"has",
"been",
"set",
"in",
"which",
"case",
"we",
"consider",
"ourselves",
"closed",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/PriorityQueue.java#L508-L524 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/PriorityQueue.java | PriorityQueue.purge | public void purge()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "purge");
synchronized(queueMonitor)
{
state = CLOSED;
for (int i=0; i < JFapChannelConstants.MAX_PRIORITY_LEVELS-1; ++i)
{
queueArray[i].monitor.setActive(false);
}
closeWaitersMonitor.setActive(false);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "purge");
} | java | public void purge()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "purge");
synchronized(queueMonitor)
{
state = CLOSED;
for (int i=0; i < JFapChannelConstants.MAX_PRIORITY_LEVELS-1; ++i)
{
queueArray[i].monitor.setActive(false);
}
closeWaitersMonitor.setActive(false);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "purge");
} | [
"public",
"void",
"purge",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"purge\"",
")",
";",
"synchronized",
"(",
"queueMonitor",
")",
"{",
"state",
"=",
"CLOSED",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"JFapChannelConstants",
".",
"MAX_PRIORITY_LEVELS",
"-",
"1",
";",
"++",
"i",
")",
"{",
"queueArray",
"[",
"i",
"]",
".",
"monitor",
".",
"setActive",
"(",
"false",
")",
";",
"}",
"closeWaitersMonitor",
".",
"setActive",
"(",
"false",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"purge\"",
")",
";",
"}"
] | Purges the content of the priority queue. This closes the queue and
wakes up any blocked threads | [
"Purges",
"the",
"content",
"of",
"the",
"priority",
"queue",
".",
"This",
"closes",
"the",
"queue",
"and",
"wakes",
"up",
"any",
"blocked",
"threads"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/PriorityQueue.java#L530-L545 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/PriorityQueue.java | PriorityQueue.waitForCloseToComplete | public void waitForCloseToComplete()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "waitForCloseToComplete");
closeWaitersMonitor.waitOn();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "waitForCloseToComplete");
} | java | public void waitForCloseToComplete()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "waitForCloseToComplete");
closeWaitersMonitor.waitOn();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "waitForCloseToComplete");
} | [
"public",
"void",
"waitForCloseToComplete",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"waitForCloseToComplete\"",
")",
";",
"closeWaitersMonitor",
".",
"waitOn",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"waitForCloseToComplete\"",
")",
";",
"}"
] | Blocks until a close operation has completed. I.e. the priority queue has been
drained. If the queue is already closed, this method returns immeidately. | [
"Blocks",
"until",
"a",
"close",
"operation",
"has",
"completed",
".",
"I",
".",
"e",
".",
"the",
"priority",
"queue",
"has",
"been",
"drained",
".",
"If",
"the",
"queue",
"is",
"already",
"closed",
"this",
"method",
"returns",
"immeidately",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/PriorityQueue.java#L552-L559 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/PriorityQueue.java | PriorityQueue.isEmpty | public boolean isEmpty() throws SIConnectionDroppedException
{
synchronized(queueMonitor)
{
if (state == CLOSED) throw new SIConnectionDroppedException(TraceNLS.getFormattedMessage(JFapChannelConstants.MSG_BUNDLE, "PRIORITY_QUEUE_PURGED_SICJ0077", null, "PRIORITY_QUEUE_PURGED_SICJ0077"));
return totalQueueDepth == 0;
}
} | java | public boolean isEmpty() throws SIConnectionDroppedException
{
synchronized(queueMonitor)
{
if (state == CLOSED) throw new SIConnectionDroppedException(TraceNLS.getFormattedMessage(JFapChannelConstants.MSG_BUNDLE, "PRIORITY_QUEUE_PURGED_SICJ0077", null, "PRIORITY_QUEUE_PURGED_SICJ0077"));
return totalQueueDepth == 0;
}
} | [
"public",
"boolean",
"isEmpty",
"(",
")",
"throws",
"SIConnectionDroppedException",
"{",
"synchronized",
"(",
"queueMonitor",
")",
"{",
"if",
"(",
"state",
"==",
"CLOSED",
")",
"throw",
"new",
"SIConnectionDroppedException",
"(",
"TraceNLS",
".",
"getFormattedMessage",
"(",
"JFapChannelConstants",
".",
"MSG_BUNDLE",
",",
"\"PRIORITY_QUEUE_PURGED_SICJ0077\"",
",",
"null",
",",
"\"PRIORITY_QUEUE_PURGED_SICJ0077\"",
")",
")",
";",
"return",
"totalQueueDepth",
"==",
"0",
";",
"}",
"}"
] | Returns true iff this priority queue is empty.
@throws SIConnectionDroppedException if the priorty queue has been
closed or purged.
@return True iff this priority queue is empty. | [
"Returns",
"true",
"iff",
"this",
"priority",
"queue",
"is",
"empty",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/PriorityQueue.java#L578-L585 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.feature.cmdline/src/com/ibm/ws/kernel/feature/internal/generator/FeatureList.java | FeatureList.isGABuild | private static boolean isGABuild() {
boolean result = true;
final Properties props = new Properties();
AccessController.doPrivileged(new PrivilegedAction<Object>() {
@Override
public Object run() {
try {
final File version = new File(getInstallDir(), "lib/versions/WebSphereApplicationServer.properties");
Reader r = new InputStreamReader(new FileInputStream(version), "UTF-8");
props.load(r);
r.close();
} catch (IOException e) {
// ignore because we fail safe. Returning true will result in a GA suitable schema
}
return null;
}
});
String v = props.getProperty("com.ibm.websphere.productVersion");
if (v != null) {
int index = v.indexOf('.');
if (index != -1) {
try {
int major = Integer.parseInt(v.substring(0, index));
if (major > 2012) {
result = false;
}
} catch (NumberFormatException nfe) {
// ignore because we fail safe. True for this hides stuff
}
}
}
return result;
} | java | private static boolean isGABuild() {
boolean result = true;
final Properties props = new Properties();
AccessController.doPrivileged(new PrivilegedAction<Object>() {
@Override
public Object run() {
try {
final File version = new File(getInstallDir(), "lib/versions/WebSphereApplicationServer.properties");
Reader r = new InputStreamReader(new FileInputStream(version), "UTF-8");
props.load(r);
r.close();
} catch (IOException e) {
// ignore because we fail safe. Returning true will result in a GA suitable schema
}
return null;
}
});
String v = props.getProperty("com.ibm.websphere.productVersion");
if (v != null) {
int index = v.indexOf('.');
if (index != -1) {
try {
int major = Integer.parseInt(v.substring(0, index));
if (major > 2012) {
result = false;
}
} catch (NumberFormatException nfe) {
// ignore because we fail safe. True for this hides stuff
}
}
}
return result;
} | [
"private",
"static",
"boolean",
"isGABuild",
"(",
")",
"{",
"boolean",
"result",
"=",
"true",
";",
"final",
"Properties",
"props",
"=",
"new",
"Properties",
"(",
")",
";",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"PrivilegedAction",
"<",
"Object",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Object",
"run",
"(",
")",
"{",
"try",
"{",
"final",
"File",
"version",
"=",
"new",
"File",
"(",
"getInstallDir",
"(",
")",
",",
"\"lib/versions/WebSphereApplicationServer.properties\"",
")",
";",
"Reader",
"r",
"=",
"new",
"InputStreamReader",
"(",
"new",
"FileInputStream",
"(",
"version",
")",
",",
"\"UTF-8\"",
")",
";",
"props",
".",
"load",
"(",
"r",
")",
";",
"r",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"// ignore because we fail safe. Returning true will result in a GA suitable schema",
"}",
"return",
"null",
";",
"}",
"}",
")",
";",
"String",
"v",
"=",
"props",
".",
"getProperty",
"(",
"\"com.ibm.websphere.productVersion\"",
")",
";",
"if",
"(",
"v",
"!=",
"null",
")",
"{",
"int",
"index",
"=",
"v",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"index",
"!=",
"-",
"1",
")",
"{",
"try",
"{",
"int",
"major",
"=",
"Integer",
".",
"parseInt",
"(",
"v",
".",
"substring",
"(",
"0",
",",
"index",
")",
")",
";",
"if",
"(",
"major",
">",
"2012",
")",
"{",
"result",
"=",
"false",
";",
"}",
"}",
"catch",
"(",
"NumberFormatException",
"nfe",
")",
"{",
"// ignore because we fail safe. True for this hides stuff",
"}",
"}",
"}",
"return",
"result",
";",
"}"
] | Work out whether we should generate the schema for a GA build or not.
@return true if ga schema, false otherwise. | [
"Work",
"out",
"whether",
"we",
"should",
"generate",
"the",
"schema",
"for",
"a",
"GA",
"build",
"or",
"not",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.feature.cmdline/src/com/ibm/ws/kernel/feature/internal/generator/FeatureList.java#L580-L616 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.social/src/com/ibm/ws/security/social/error/SocialLoginException.java | SocialLoginException.setFfdcAlready | public void setFfdcAlready(boolean ffdcAlready) {
this.ffdcAlready = ffdcAlready;
if (tc.isDebugEnabled()) {
Tr.debug(tc, "ffdc already handled? " + ffdcAlready);
}
} | java | public void setFfdcAlready(boolean ffdcAlready) {
this.ffdcAlready = ffdcAlready;
if (tc.isDebugEnabled()) {
Tr.debug(tc, "ffdc already handled? " + ffdcAlready);
}
} | [
"public",
"void",
"setFfdcAlready",
"(",
"boolean",
"ffdcAlready",
")",
"{",
"this",
".",
"ffdcAlready",
"=",
"ffdcAlready",
";",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"ffdc already handled? \"",
"+",
"ffdcAlready",
")",
";",
"}",
"}"
] | set to true if FFDC already handle this exception | [
"set",
"to",
"true",
"if",
"FFDC",
"already",
"handle",
"this",
"exception"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.social/src/com/ibm/ws/security/social/error/SocialLoginException.java#L150-L155 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.openapi/src/com/ibm/ws/microprofile/openapi/impl/OpenAPIUIBundlesUpdater.java | OpenAPIUIBundlesUpdater.getResource | private static String getResource(Bundle myBundle, String resourcePath) {
if (myBundle == null)
return null;
String bundleShortDescription = getBundleDescription(myBundle);
StringBuilder responseString = new StringBuilder();
URL bundleResource = myBundle.getResource(resourcePath);
if (bundleResource != null) {
BufferedReader br = null;
try { // read the requested resource from the bundle
br = new BufferedReader(new InputStreamReader(bundleResource.openConnection().getInputStream(), "UTF-8"));
while (br.ready()) {
responseString.append(br.readLine());
}
br.close();
} catch (Exception e) { // shouldn't happen
if (OpenAPIUtils.isEventEnabled(tc)) {
Tr.event(tc, "Exception trying to read resource at " + resourcePath + " from bundle " + bundleShortDescription);
}
}
} else {
if (OpenAPIUtils.isEventEnabled(tc)) {
Tr.event(tc, "Unexpected error getting resource from WAB bundle.");
}
}
return responseString.toString();
} | java | private static String getResource(Bundle myBundle, String resourcePath) {
if (myBundle == null)
return null;
String bundleShortDescription = getBundleDescription(myBundle);
StringBuilder responseString = new StringBuilder();
URL bundleResource = myBundle.getResource(resourcePath);
if (bundleResource != null) {
BufferedReader br = null;
try { // read the requested resource from the bundle
br = new BufferedReader(new InputStreamReader(bundleResource.openConnection().getInputStream(), "UTF-8"));
while (br.ready()) {
responseString.append(br.readLine());
}
br.close();
} catch (Exception e) { // shouldn't happen
if (OpenAPIUtils.isEventEnabled(tc)) {
Tr.event(tc, "Exception trying to read resource at " + resourcePath + " from bundle " + bundleShortDescription);
}
}
} else {
if (OpenAPIUtils.isEventEnabled(tc)) {
Tr.event(tc, "Unexpected error getting resource from WAB bundle.");
}
}
return responseString.toString();
} | [
"private",
"static",
"String",
"getResource",
"(",
"Bundle",
"myBundle",
",",
"String",
"resourcePath",
")",
"{",
"if",
"(",
"myBundle",
"==",
"null",
")",
"return",
"null",
";",
"String",
"bundleShortDescription",
"=",
"getBundleDescription",
"(",
"myBundle",
")",
";",
"StringBuilder",
"responseString",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"URL",
"bundleResource",
"=",
"myBundle",
".",
"getResource",
"(",
"resourcePath",
")",
";",
"if",
"(",
"bundleResource",
"!=",
"null",
")",
"{",
"BufferedReader",
"br",
"=",
"null",
";",
"try",
"{",
"// read the requested resource from the bundle",
"br",
"=",
"new",
"BufferedReader",
"(",
"new",
"InputStreamReader",
"(",
"bundleResource",
".",
"openConnection",
"(",
")",
".",
"getInputStream",
"(",
")",
",",
"\"UTF-8\"",
")",
")",
";",
"while",
"(",
"br",
".",
"ready",
"(",
")",
")",
"{",
"responseString",
".",
"append",
"(",
"br",
".",
"readLine",
"(",
")",
")",
";",
"}",
"br",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"// shouldn't happen",
"if",
"(",
"OpenAPIUtils",
".",
"isEventEnabled",
"(",
"tc",
")",
")",
"{",
"Tr",
".",
"event",
"(",
"tc",
",",
"\"Exception trying to read resource at \"",
"+",
"resourcePath",
"+",
"\" from bundle \"",
"+",
"bundleShortDescription",
")",
";",
"}",
"}",
"}",
"else",
"{",
"if",
"(",
"OpenAPIUtils",
".",
"isEventEnabled",
"(",
"tc",
")",
")",
"{",
"Tr",
".",
"event",
"(",
"tc",
",",
"\"Unexpected error getting resource from WAB bundle.\"",
")",
";",
"}",
"}",
"return",
"responseString",
".",
"toString",
"(",
")",
";",
"}"
] | Return as a string the contents of a file in the bundle. | [
"Return",
"as",
"a",
"string",
"the",
"contents",
"of",
"a",
"file",
"in",
"the",
"bundle",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.openapi/src/com/ibm/ws/microprofile/openapi/impl/OpenAPIUIBundlesUpdater.java#L267-L293 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.core/src/com/ibm/ws/logging/internal/PackageProcessor.java | PackageProcessor.harvestPackageList | private static void harvestPackageList(BundlePackages packages, Bundle bundle) {
// Double check that the bundle is (still) installed:
if (bundle.getLocation() != null && bundle.getState() != Bundle.UNINSTALLED) {
BundleManifest manifest = new BundleManifest(bundle);
/*
* Only bundles with a bundle vendor of IBM should count as internal.
* We definitely don't want to be filtering out user bundles in the shared bundle space.
* This filter might catch stack products, which is probably a good thing
* if it happens.
* We also want to count the system bundle as internal. Some of
* the bundles with higher IDs aren't ours, but since we rebuild them
* with bnd, they get an IBM vendor header.
*/
if (bundle.getBundleId() == 0 || IBM.equals(manifest.getBundleVendor()) || IBM.equals(manifest.getBundleDistributor())) {
packages.addPackages(manifest);
}
}
} | java | private static void harvestPackageList(BundlePackages packages, Bundle bundle) {
// Double check that the bundle is (still) installed:
if (bundle.getLocation() != null && bundle.getState() != Bundle.UNINSTALLED) {
BundleManifest manifest = new BundleManifest(bundle);
/*
* Only bundles with a bundle vendor of IBM should count as internal.
* We definitely don't want to be filtering out user bundles in the shared bundle space.
* This filter might catch stack products, which is probably a good thing
* if it happens.
* We also want to count the system bundle as internal. Some of
* the bundles with higher IDs aren't ours, but since we rebuild them
* with bnd, they get an IBM vendor header.
*/
if (bundle.getBundleId() == 0 || IBM.equals(manifest.getBundleVendor()) || IBM.equals(manifest.getBundleDistributor())) {
packages.addPackages(manifest);
}
}
} | [
"private",
"static",
"void",
"harvestPackageList",
"(",
"BundlePackages",
"packages",
",",
"Bundle",
"bundle",
")",
"{",
"// Double check that the bundle is (still) installed:",
"if",
"(",
"bundle",
".",
"getLocation",
"(",
")",
"!=",
"null",
"&&",
"bundle",
".",
"getState",
"(",
")",
"!=",
"Bundle",
".",
"UNINSTALLED",
")",
"{",
"BundleManifest",
"manifest",
"=",
"new",
"BundleManifest",
"(",
"bundle",
")",
";",
"/*\n * Only bundles with a bundle vendor of IBM should count as internal.\n * We definitely don't want to be filtering out user bundles in the shared bundle space.\n * This filter might catch stack products, which is probably a good thing\n * if it happens.\n * We also want to count the system bundle as internal. Some of\n * the bundles with higher IDs aren't ours, but since we rebuild them\n * with bnd, they get an IBM vendor header.\n */",
"if",
"(",
"bundle",
".",
"getBundleId",
"(",
")",
"==",
"0",
"||",
"IBM",
".",
"equals",
"(",
"manifest",
".",
"getBundleVendor",
"(",
")",
")",
"||",
"IBM",
".",
"equals",
"(",
"manifest",
".",
"getBundleDistributor",
"(",
")",
")",
")",
"{",
"packages",
".",
"addPackages",
"(",
"manifest",
")",
";",
"}",
"}",
"}"
] | This method is static to avoid concurrent access issues. | [
"This",
"method",
"is",
"static",
"to",
"avoid",
"concurrent",
"access",
"issues",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.core/src/com/ibm/ws/logging/internal/PackageProcessor.java#L183-L200 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.core/src/com/ibm/ws/logging/internal/PackageProcessor.java | PackageProcessor.extractPackageFromStackTraceElement | public static String extractPackageFromStackTraceElement(StackTraceElement element) {
String className = element.getClassName();
int lastDotIndex = className.lastIndexOf(".");
String packageName;
if (lastDotIndex > 0) {
packageName = className.substring(0, lastDotIndex);
} else {
packageName = className;
}
return packageName;
} | java | public static String extractPackageFromStackTraceElement(StackTraceElement element) {
String className = element.getClassName();
int lastDotIndex = className.lastIndexOf(".");
String packageName;
if (lastDotIndex > 0) {
packageName = className.substring(0, lastDotIndex);
} else {
packageName = className;
}
return packageName;
} | [
"public",
"static",
"String",
"extractPackageFromStackTraceElement",
"(",
"StackTraceElement",
"element",
")",
"{",
"String",
"className",
"=",
"element",
".",
"getClassName",
"(",
")",
";",
"int",
"lastDotIndex",
"=",
"className",
".",
"lastIndexOf",
"(",
"\".\"",
")",
";",
"String",
"packageName",
";",
"if",
"(",
"lastDotIndex",
">",
"0",
")",
"{",
"packageName",
"=",
"className",
".",
"substring",
"(",
"0",
",",
"lastDotIndex",
")",
";",
"}",
"else",
"{",
"packageName",
"=",
"className",
";",
"}",
"return",
"packageName",
";",
"}"
] | Work out the package name from a StackTraceElement. This is easier than a stack trace
line, because we already know the class name. | [
"Work",
"out",
"the",
"package",
"name",
"from",
"a",
"StackTraceElement",
".",
"This",
"is",
"easier",
"than",
"a",
"stack",
"trace",
"line",
"because",
"we",
"already",
"know",
"the",
"class",
"name",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.core/src/com/ibm/ws/logging/internal/PackageProcessor.java#L237-L247 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.core/src/com/ibm/ws/logging/internal/PackageProcessor.java | PackageProcessor.isSpecOrThirdPartyOrBootDelegationPackage | public boolean isSpecOrThirdPartyOrBootDelegationPackage(String packageName) {
SharedPackageInspector inspector = st.getService();
if (inspector != null) {
PackageType type = inspector.getExportedPackageType(packageName);
if (type != null && type.isSpecApi()) {
return true;
}
}
boolean isBundlePackage = false;
// Check the boot delegation packages second, since they're patterns, and slower
for (Pattern pattern : bootDelegationPackages) {
isBundlePackage = pattern.matcher(packageName).matches();
if (isBundlePackage) {
return isBundlePackage;
}
}
// If we can't work it out, assume things aren't spec packages
return false;
} | java | public boolean isSpecOrThirdPartyOrBootDelegationPackage(String packageName) {
SharedPackageInspector inspector = st.getService();
if (inspector != null) {
PackageType type = inspector.getExportedPackageType(packageName);
if (type != null && type.isSpecApi()) {
return true;
}
}
boolean isBundlePackage = false;
// Check the boot delegation packages second, since they're patterns, and slower
for (Pattern pattern : bootDelegationPackages) {
isBundlePackage = pattern.matcher(packageName).matches();
if (isBundlePackage) {
return isBundlePackage;
}
}
// If we can't work it out, assume things aren't spec packages
return false;
} | [
"public",
"boolean",
"isSpecOrThirdPartyOrBootDelegationPackage",
"(",
"String",
"packageName",
")",
"{",
"SharedPackageInspector",
"inspector",
"=",
"st",
".",
"getService",
"(",
")",
";",
"if",
"(",
"inspector",
"!=",
"null",
")",
"{",
"PackageType",
"type",
"=",
"inspector",
".",
"getExportedPackageType",
"(",
"packageName",
")",
";",
"if",
"(",
"type",
"!=",
"null",
"&&",
"type",
".",
"isSpecApi",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"boolean",
"isBundlePackage",
"=",
"false",
";",
"// Check the boot delegation packages second, since they're patterns, and slower",
"for",
"(",
"Pattern",
"pattern",
":",
"bootDelegationPackages",
")",
"{",
"isBundlePackage",
"=",
"pattern",
".",
"matcher",
"(",
"packageName",
")",
".",
"matches",
"(",
")",
";",
"if",
"(",
"isBundlePackage",
")",
"{",
"return",
"isBundlePackage",
";",
"}",
"}",
"// If we can't work it out, assume things aren't spec packages",
"return",
"false",
";",
"}"
] | Returns true is this package is distributed as part of the Liberty server, but
is 'external' to IBM and available to user applications - that is, if its
exposed as a boot delegation package, or a spec package, or a third party API.
@param packageName the package name to check for
@return | [
"Returns",
"true",
"is",
"this",
"package",
"is",
"distributed",
"as",
"part",
"of",
"the",
"Liberty",
"server",
"but",
"is",
"external",
"to",
"IBM",
"and",
"available",
"to",
"user",
"applications",
"-",
"that",
"is",
"if",
"its",
"exposed",
"as",
"a",
"boot",
"delegation",
"package",
"or",
"a",
"spec",
"package",
"or",
"a",
"third",
"party",
"API",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.core/src/com/ibm/ws/logging/internal/PackageProcessor.java#L257-L279 | train |
OpenLiberty/open-liberty | dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/jsl/CloneUtility.java | CloneUtility.jslPropertiesToJavaProperties | public static Properties jslPropertiesToJavaProperties(
final JSLProperties xmlProperties) {
final Properties props = new Properties();
for (final Property prop : xmlProperties.getPropertyList()) {
props.setProperty(prop.getName(), prop.getValue());
}
return props;
} | java | public static Properties jslPropertiesToJavaProperties(
final JSLProperties xmlProperties) {
final Properties props = new Properties();
for (final Property prop : xmlProperties.getPropertyList()) {
props.setProperty(prop.getName(), prop.getValue());
}
return props;
} | [
"public",
"static",
"Properties",
"jslPropertiesToJavaProperties",
"(",
"final",
"JSLProperties",
"xmlProperties",
")",
"{",
"final",
"Properties",
"props",
"=",
"new",
"Properties",
"(",
")",
";",
"for",
"(",
"final",
"Property",
"prop",
":",
"xmlProperties",
".",
"getPropertyList",
"(",
")",
")",
"{",
"props",
".",
"setProperty",
"(",
"prop",
".",
"getName",
"(",
")",
",",
"prop",
".",
"getValue",
"(",
")",
")",
";",
"}",
"return",
"props",
";",
"}"
] | Creates a java.util.Properties map from a com.ibm.jbatch.jsl.model.Properties
object.
@param xmlProperties
@return | [
"Creates",
"a",
"java",
".",
"util",
".",
"Properties",
"map",
"from",
"a",
"com",
".",
"ibm",
".",
"jbatch",
".",
"jsl",
".",
"model",
".",
"Properties",
"object",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/jsl/CloneUtility.java#L257-L268 | train |
OpenLiberty/open-liberty | dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/jsl/CloneUtility.java | CloneUtility.javaPropsTojslProperties | public static JSLProperties javaPropsTojslProperties(final Properties javaProps) {
JSLProperties newJSLProps = jslFactory.createJSLProperties();
Enumeration<?> keySet = javaProps.propertyNames();
while (keySet.hasMoreElements()) {
String key = (String)keySet.nextElement();
String value = javaProps.getProperty(key);
Property newProperty = jslFactory.createProperty();
newProperty.setName(key);
newProperty.setValue(value);
newJSLProps.getPropertyList().add(newProperty);
}
return newJSLProps;
} | java | public static JSLProperties javaPropsTojslProperties(final Properties javaProps) {
JSLProperties newJSLProps = jslFactory.createJSLProperties();
Enumeration<?> keySet = javaProps.propertyNames();
while (keySet.hasMoreElements()) {
String key = (String)keySet.nextElement();
String value = javaProps.getProperty(key);
Property newProperty = jslFactory.createProperty();
newProperty.setName(key);
newProperty.setValue(value);
newJSLProps.getPropertyList().add(newProperty);
}
return newJSLProps;
} | [
"public",
"static",
"JSLProperties",
"javaPropsTojslProperties",
"(",
"final",
"Properties",
"javaProps",
")",
"{",
"JSLProperties",
"newJSLProps",
"=",
"jslFactory",
".",
"createJSLProperties",
"(",
")",
";",
"Enumeration",
"<",
"?",
">",
"keySet",
"=",
"javaProps",
".",
"propertyNames",
"(",
")",
";",
"while",
"(",
"keySet",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"String",
"key",
"=",
"(",
"String",
")",
"keySet",
".",
"nextElement",
"(",
")",
";",
"String",
"value",
"=",
"javaProps",
".",
"getProperty",
"(",
"key",
")",
";",
"Property",
"newProperty",
"=",
"jslFactory",
".",
"createProperty",
"(",
")",
";",
"newProperty",
".",
"setName",
"(",
"key",
")",
";",
"newProperty",
".",
"setValue",
"(",
"value",
")",
";",
"newJSLProps",
".",
"getPropertyList",
"(",
")",
".",
"add",
"(",
"newProperty",
")",
";",
"}",
"return",
"newJSLProps",
";",
"}"
] | Creates a new JSLProperties list from a java.util.Properties
object.
@param xmlProperties
@return | [
"Creates",
"a",
"new",
"JSLProperties",
"list",
"from",
"a",
"java",
".",
"util",
".",
"Properties",
"object",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/jsl/CloneUtility.java#L277-L296 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.boot.logging/src/com/ibm/ws/kernel/boot/logging/WsLogManager.java | WsLogManager.getLogger | @Override
public Logger getLogger(String name) {
// get the logger from the super impl
Logger logger = super.getLogger(name);
// At this point we don't know which concrete class to use until the
// ras/logging provider is initialized enough to provide a
// wsLogger class
if (wsLogger == null) {
return logger;
}
// The Java Logging (JSR47) spec requires that the method,
// LogManager.getLogManager().getLogger(...) returns null if the logger
// with the passed in name does not exist. However, the method
// Logger.getLogger(...)
// calls this method in order to create a new Logger object. In WAS, we
// always want the call to Logger.getLogger(...) to return an instance
// of WsLogger. If this method returns null to it (as the spec requires),
// then Logger.getLogger() would return an instance of java.util.logging.Logger
// rather than our WsLogger.
// To account for this "issue", we need to return null when a customer
// calls this method and passes in a non-existent logger name, but must
// create a new WsLogger when Logger.getLogger() calls this method. As
// such, the following code will get the current thread's stack trace
// and look for a pattern like:
// ...
// at com.ibm.ws.bootstrap.WsLogManager.getLogger ...
// at java.util.logging.Logger.getLogger ...
// ...
// If it identifies this pattern in the stacktrace, this method will
// create a new logger. If not, it will return null.
if (logger == null) {
boolean createNewLogger = false;
boolean foundCaller = false;
Exception ex = new Exception();
StackTraceElement[] ste = ex.getStackTrace();
Class<?> caller = null;
int i = 0;
while (!foundCaller && i < ste.length) {
StackTraceElement s = ste[i++];
// A) look for com.ibm.ws.bootstrap.WsLogManager.getLogger
if (s.getClassName().equals(CLASS_NAME) && s.getMethodName().equals("getLogger")) {
// B) java.util.logging.Logger.getLogger
while (!foundCaller && i < ste.length) {
s = ste[i++];
if (s.getClassName().equals("java.util.logging.Logger") && s.getMethodName().equals("getLogger")) {
createNewLogger = true;
} else if (createNewLogger) {
caller = StackFinderSingleton.instance.getCaller(i, s.getClassName());
foundCaller = caller != null;
}
}
}
}
if (createNewLogger) {
try {
logger = (Logger) wsLogger.newInstance(name, caller, null);
// constructing the new logger will add the logger to the log manager
// See the constructor com.ibm.ws.logging.internal.WsLogger.WsLogger(String, Class<?>, String)
// This is pretty unfortunate escaping of 'this' out of the constructor, but may be risky to try and fix that.
// Instead add a hack here to double check that another thread did not win in creating and adding the WsLogger instance
Logger checkLogger = super.getLogger(name);
if (checkLogger != null) {
// Simply reassign because checkLogger is for sure the one that got added.
// Not really sure what it would mean if null was returned from super.getLogger, but do nothing in that case
logger = checkLogger;
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
return logger;
} | java | @Override
public Logger getLogger(String name) {
// get the logger from the super impl
Logger logger = super.getLogger(name);
// At this point we don't know which concrete class to use until the
// ras/logging provider is initialized enough to provide a
// wsLogger class
if (wsLogger == null) {
return logger;
}
// The Java Logging (JSR47) spec requires that the method,
// LogManager.getLogManager().getLogger(...) returns null if the logger
// with the passed in name does not exist. However, the method
// Logger.getLogger(...)
// calls this method in order to create a new Logger object. In WAS, we
// always want the call to Logger.getLogger(...) to return an instance
// of WsLogger. If this method returns null to it (as the spec requires),
// then Logger.getLogger() would return an instance of java.util.logging.Logger
// rather than our WsLogger.
// To account for this "issue", we need to return null when a customer
// calls this method and passes in a non-existent logger name, but must
// create a new WsLogger when Logger.getLogger() calls this method. As
// such, the following code will get the current thread's stack trace
// and look for a pattern like:
// ...
// at com.ibm.ws.bootstrap.WsLogManager.getLogger ...
// at java.util.logging.Logger.getLogger ...
// ...
// If it identifies this pattern in the stacktrace, this method will
// create a new logger. If not, it will return null.
if (logger == null) {
boolean createNewLogger = false;
boolean foundCaller = false;
Exception ex = new Exception();
StackTraceElement[] ste = ex.getStackTrace();
Class<?> caller = null;
int i = 0;
while (!foundCaller && i < ste.length) {
StackTraceElement s = ste[i++];
// A) look for com.ibm.ws.bootstrap.WsLogManager.getLogger
if (s.getClassName().equals(CLASS_NAME) && s.getMethodName().equals("getLogger")) {
// B) java.util.logging.Logger.getLogger
while (!foundCaller && i < ste.length) {
s = ste[i++];
if (s.getClassName().equals("java.util.logging.Logger") && s.getMethodName().equals("getLogger")) {
createNewLogger = true;
} else if (createNewLogger) {
caller = StackFinderSingleton.instance.getCaller(i, s.getClassName());
foundCaller = caller != null;
}
}
}
}
if (createNewLogger) {
try {
logger = (Logger) wsLogger.newInstance(name, caller, null);
// constructing the new logger will add the logger to the log manager
// See the constructor com.ibm.ws.logging.internal.WsLogger.WsLogger(String, Class<?>, String)
// This is pretty unfortunate escaping of 'this' out of the constructor, but may be risky to try and fix that.
// Instead add a hack here to double check that another thread did not win in creating and adding the WsLogger instance
Logger checkLogger = super.getLogger(name);
if (checkLogger != null) {
// Simply reassign because checkLogger is for sure the one that got added.
// Not really sure what it would mean if null was returned from super.getLogger, but do nothing in that case
logger = checkLogger;
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
return logger;
} | [
"@",
"Override",
"public",
"Logger",
"getLogger",
"(",
"String",
"name",
")",
"{",
"// get the logger from the super impl",
"Logger",
"logger",
"=",
"super",
".",
"getLogger",
"(",
"name",
")",
";",
"// At this point we don't know which concrete class to use until the",
"// ras/logging provider is initialized enough to provide a",
"// wsLogger class",
"if",
"(",
"wsLogger",
"==",
"null",
")",
"{",
"return",
"logger",
";",
"}",
"// The Java Logging (JSR47) spec requires that the method,",
"// LogManager.getLogManager().getLogger(...) returns null if the logger",
"// with the passed in name does not exist. However, the method",
"// Logger.getLogger(...)",
"// calls this method in order to create a new Logger object. In WAS, we",
"// always want the call to Logger.getLogger(...) to return an instance",
"// of WsLogger. If this method returns null to it (as the spec requires),",
"// then Logger.getLogger() would return an instance of java.util.logging.Logger",
"// rather than our WsLogger.",
"// To account for this \"issue\", we need to return null when a customer",
"// calls this method and passes in a non-existent logger name, but must",
"// create a new WsLogger when Logger.getLogger() calls this method. As",
"// such, the following code will get the current thread's stack trace",
"// and look for a pattern like:",
"// ...",
"// at com.ibm.ws.bootstrap.WsLogManager.getLogger ...",
"// at java.util.logging.Logger.getLogger ...",
"// ...",
"// If it identifies this pattern in the stacktrace, this method will",
"// create a new logger. If not, it will return null.",
"if",
"(",
"logger",
"==",
"null",
")",
"{",
"boolean",
"createNewLogger",
"=",
"false",
";",
"boolean",
"foundCaller",
"=",
"false",
";",
"Exception",
"ex",
"=",
"new",
"Exception",
"(",
")",
";",
"StackTraceElement",
"[",
"]",
"ste",
"=",
"ex",
".",
"getStackTrace",
"(",
")",
";",
"Class",
"<",
"?",
">",
"caller",
"=",
"null",
";",
"int",
"i",
"=",
"0",
";",
"while",
"(",
"!",
"foundCaller",
"&&",
"i",
"<",
"ste",
".",
"length",
")",
"{",
"StackTraceElement",
"s",
"=",
"ste",
"[",
"i",
"++",
"]",
";",
"// A) look for com.ibm.ws.bootstrap.WsLogManager.getLogger",
"if",
"(",
"s",
".",
"getClassName",
"(",
")",
".",
"equals",
"(",
"CLASS_NAME",
")",
"&&",
"s",
".",
"getMethodName",
"(",
")",
".",
"equals",
"(",
"\"getLogger\"",
")",
")",
"{",
"// B) java.util.logging.Logger.getLogger",
"while",
"(",
"!",
"foundCaller",
"&&",
"i",
"<",
"ste",
".",
"length",
")",
"{",
"s",
"=",
"ste",
"[",
"i",
"++",
"]",
";",
"if",
"(",
"s",
".",
"getClassName",
"(",
")",
".",
"equals",
"(",
"\"java.util.logging.Logger\"",
")",
"&&",
"s",
".",
"getMethodName",
"(",
")",
".",
"equals",
"(",
"\"getLogger\"",
")",
")",
"{",
"createNewLogger",
"=",
"true",
";",
"}",
"else",
"if",
"(",
"createNewLogger",
")",
"{",
"caller",
"=",
"StackFinderSingleton",
".",
"instance",
".",
"getCaller",
"(",
"i",
",",
"s",
".",
"getClassName",
"(",
")",
")",
";",
"foundCaller",
"=",
"caller",
"!=",
"null",
";",
"}",
"}",
"}",
"}",
"if",
"(",
"createNewLogger",
")",
"{",
"try",
"{",
"logger",
"=",
"(",
"Logger",
")",
"wsLogger",
".",
"newInstance",
"(",
"name",
",",
"caller",
",",
"null",
")",
";",
"// constructing the new logger will add the logger to the log manager",
"// See the constructor com.ibm.ws.logging.internal.WsLogger.WsLogger(String, Class<?>, String)",
"// This is pretty unfortunate escaping of 'this' out of the constructor, but may be risky to try and fix that.",
"// Instead add a hack here to double check that another thread did not win in creating and adding the WsLogger instance",
"Logger",
"checkLogger",
"=",
"super",
".",
"getLogger",
"(",
"name",
")",
";",
"if",
"(",
"checkLogger",
"!=",
"null",
")",
"{",
"// Simply reassign because checkLogger is for sure the one that got added.",
"// Not really sure what it would mean if null was returned from super.getLogger, but do nothing in that case",
"logger",
"=",
"checkLogger",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"e",
")",
";",
"}",
"}",
"}",
"return",
"logger",
";",
"}"
] | Returns an instance of WsLogger with specified name. If an instance with
specified name does not exist, it will be created.
@param name
name of the logger to obtain
@return Logger instance of a logger with specified name | [
"Returns",
"an",
"instance",
"of",
"WsLogger",
"with",
"specified",
"name",
".",
"If",
"an",
"instance",
"with",
"specified",
"name",
"does",
"not",
"exist",
"it",
"will",
"be",
"created",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.logging/src/com/ibm/ws/kernel/boot/logging/WsLogManager.java#L93-L172 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/internal/KeyringMonitorImpl.java | KeyringMonitorImpl.monitorKeyRings | public ServiceRegistration<KeyringMonitor> monitorKeyRings(String ID, String trigger, String keyStoreLocation) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(this, tc, "monitorKeyRing registration for", ID);
}
BundleContext bundleContext = actionable.getBundleContext();
final Hashtable<String, Object> keyRingMonitorProps = new Hashtable<String, Object>();
keyRingMonitorProps.put(KeyringMonitor.MONITOR_KEYSTORE_CONFIG_ID, ID);
keyRingMonitorProps.put(KeyringMonitor.KEYSTORE_LOCATION, keyStoreLocation);
if (!(trigger.equalsIgnoreCase("disabled")) && trigger.equals("polled")) {
Tr.warning(tc, "Cannot have polled trigger for keyRing ID: ", ID);
}
return bundleContext.registerService(KeyringMonitor.class, this, keyRingMonitorProps);
} | java | public ServiceRegistration<KeyringMonitor> monitorKeyRings(String ID, String trigger, String keyStoreLocation) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(this, tc, "monitorKeyRing registration for", ID);
}
BundleContext bundleContext = actionable.getBundleContext();
final Hashtable<String, Object> keyRingMonitorProps = new Hashtable<String, Object>();
keyRingMonitorProps.put(KeyringMonitor.MONITOR_KEYSTORE_CONFIG_ID, ID);
keyRingMonitorProps.put(KeyringMonitor.KEYSTORE_LOCATION, keyStoreLocation);
if (!(trigger.equalsIgnoreCase("disabled")) && trigger.equals("polled")) {
Tr.warning(tc, "Cannot have polled trigger for keyRing ID: ", ID);
}
return bundleContext.registerService(KeyringMonitor.class, this, keyRingMonitorProps);
} | [
"public",
"ServiceRegistration",
"<",
"KeyringMonitor",
">",
"monitorKeyRings",
"(",
"String",
"ID",
",",
"String",
"trigger",
",",
"String",
"keyStoreLocation",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"event",
"(",
"this",
",",
"tc",
",",
"\"monitorKeyRing registration for\"",
",",
"ID",
")",
";",
"}",
"BundleContext",
"bundleContext",
"=",
"actionable",
".",
"getBundleContext",
"(",
")",
";",
"final",
"Hashtable",
"<",
"String",
",",
"Object",
">",
"keyRingMonitorProps",
"=",
"new",
"Hashtable",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"keyRingMonitorProps",
".",
"put",
"(",
"KeyringMonitor",
".",
"MONITOR_KEYSTORE_CONFIG_ID",
",",
"ID",
")",
";",
"keyRingMonitorProps",
".",
"put",
"(",
"KeyringMonitor",
".",
"KEYSTORE_LOCATION",
",",
"keyStoreLocation",
")",
";",
"if",
"(",
"!",
"(",
"trigger",
".",
"equalsIgnoreCase",
"(",
"\"disabled\"",
")",
")",
"&&",
"trigger",
".",
"equals",
"(",
"\"polled\"",
")",
")",
"{",
"Tr",
".",
"warning",
"(",
"tc",
",",
"\"Cannot have polled trigger for keyRing ID: \"",
",",
"ID",
")",
";",
"}",
"return",
"bundleContext",
".",
"registerService",
"(",
"KeyringMonitor",
".",
"class",
",",
"this",
",",
"keyRingMonitorProps",
")",
";",
"}"
] | Registers this KeyringMonitor to start monitoring the specified keyrings
by mbean notification.
@param id of keyrings to monitor.
@param trigger what trigger the keyring update notification mbean
@return The <code>KeyringMonitor</code> service registration. | [
"Registers",
"this",
"KeyringMonitor",
"to",
"start",
"monitoring",
"the",
"specified",
"keyrings",
"by",
"mbean",
"notification",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/internal/KeyringMonitorImpl.java#L46-L58 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AOStream.java | AOStream.start | public void start() throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "start");
synchronized (this)
{
active = true;
// start the liveness timer for sending ControlRequestHighestGeneratedTick, if needed
if (!completedTicksInitialized)
{
if (initRequestId == -1)
initRequestId = parent.generateUniqueValue();
requestHighestGeneratedTickTimer = new RequestHighestGeneratedTick();
//we call the alarm directly
requestHighestGeneratedTickTimer.alarm(null);
}
if (parent.getCardinalityOne() && !isFlushed)
{
inactivityTimer =
am.create(
mp.getCustomProperties().get_remote_consumer_cardinality_inactivity_interval(),
inactivityHandler);
}
if (resetRequestAckSender != null)
{
boolean done = resetRequestAckSender.start();
if (done)
resetRequestAckSender = null;
}
// start all the liveness timers for value ticks
dem.startTimer();
if (imeRestorationHandler!=null)
imeRestorationHandler.startTimer();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "start");
} | java | public void start() throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "start");
synchronized (this)
{
active = true;
// start the liveness timer for sending ControlRequestHighestGeneratedTick, if needed
if (!completedTicksInitialized)
{
if (initRequestId == -1)
initRequestId = parent.generateUniqueValue();
requestHighestGeneratedTickTimer = new RequestHighestGeneratedTick();
//we call the alarm directly
requestHighestGeneratedTickTimer.alarm(null);
}
if (parent.getCardinalityOne() && !isFlushed)
{
inactivityTimer =
am.create(
mp.getCustomProperties().get_remote_consumer_cardinality_inactivity_interval(),
inactivityHandler);
}
if (resetRequestAckSender != null)
{
boolean done = resetRequestAckSender.start();
if (done)
resetRequestAckSender = null;
}
// start all the liveness timers for value ticks
dem.startTimer();
if (imeRestorationHandler!=null)
imeRestorationHandler.startTimer();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "start");
} | [
"public",
"void",
"start",
"(",
")",
"throws",
"SIResourceException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"start\"",
")",
";",
"synchronized",
"(",
"this",
")",
"{",
"active",
"=",
"true",
";",
"// start the liveness timer for sending ControlRequestHighestGeneratedTick, if needed",
"if",
"(",
"!",
"completedTicksInitialized",
")",
"{",
"if",
"(",
"initRequestId",
"==",
"-",
"1",
")",
"initRequestId",
"=",
"parent",
".",
"generateUniqueValue",
"(",
")",
";",
"requestHighestGeneratedTickTimer",
"=",
"new",
"RequestHighestGeneratedTick",
"(",
")",
";",
"//we call the alarm directly",
"requestHighestGeneratedTickTimer",
".",
"alarm",
"(",
"null",
")",
";",
"}",
"if",
"(",
"parent",
".",
"getCardinalityOne",
"(",
")",
"&&",
"!",
"isFlushed",
")",
"{",
"inactivityTimer",
"=",
"am",
".",
"create",
"(",
"mp",
".",
"getCustomProperties",
"(",
")",
".",
"get_remote_consumer_cardinality_inactivity_interval",
"(",
")",
",",
"inactivityHandler",
")",
";",
"}",
"if",
"(",
"resetRequestAckSender",
"!=",
"null",
")",
"{",
"boolean",
"done",
"=",
"resetRequestAckSender",
".",
"start",
"(",
")",
";",
"if",
"(",
"done",
")",
"resetRequestAckSender",
"=",
"null",
";",
"}",
"// start all the liveness timers for value ticks",
"dem",
".",
"startTimer",
"(",
")",
";",
"if",
"(",
"imeRestorationHandler",
"!=",
"null",
")",
"imeRestorationHandler",
".",
"startTimer",
"(",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"start\"",
")",
";",
"}"
] | Start the stream, i.e., start sending data and control messages | [
"Start",
"the",
"stream",
"i",
".",
"e",
".",
"start",
"sending",
"data",
"and",
"control",
"messages"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AOStream.java#L539-L577 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AOStream.java | AOStream.stop | public void stop()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "stop");
synchronized (this)
{
active = false;
// stop the liveness timer for sending ControlRequestHighestGeneratedTick, if needed
//NOTE: the requestHighestGeneratedTickTimer will stop of its own accord once the
//stream is noticed to be
if (initRepeatHandler != null)
{
initRepeatHandler.cancel();
}
if (inactivityTimer != null)
{
inactivityTimer.cancel();
inactivityTimer = null;
}
if (resetRequestAckSender != null)
{
resetRequestAckSender.stop();
}
// stop all the liveness timers for value ticks
dem.stopTimer();
if (imeRestorationHandler!=null)
imeRestorationHandler.stopTimer();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "stop");
} | java | public void stop()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "stop");
synchronized (this)
{
active = false;
// stop the liveness timer for sending ControlRequestHighestGeneratedTick, if needed
//NOTE: the requestHighestGeneratedTickTimer will stop of its own accord once the
//stream is noticed to be
if (initRepeatHandler != null)
{
initRepeatHandler.cancel();
}
if (inactivityTimer != null)
{
inactivityTimer.cancel();
inactivityTimer = null;
}
if (resetRequestAckSender != null)
{
resetRequestAckSender.stop();
}
// stop all the liveness timers for value ticks
dem.stopTimer();
if (imeRestorationHandler!=null)
imeRestorationHandler.stopTimer();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "stop");
} | [
"public",
"void",
"stop",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"stop\"",
")",
";",
"synchronized",
"(",
"this",
")",
"{",
"active",
"=",
"false",
";",
"// stop the liveness timer for sending ControlRequestHighestGeneratedTick, if needed",
"//NOTE: the requestHighestGeneratedTickTimer will stop of its own accord once the",
"//stream is noticed to be",
"if",
"(",
"initRepeatHandler",
"!=",
"null",
")",
"{",
"initRepeatHandler",
".",
"cancel",
"(",
")",
";",
"}",
"if",
"(",
"inactivityTimer",
"!=",
"null",
")",
"{",
"inactivityTimer",
".",
"cancel",
"(",
")",
";",
"inactivityTimer",
"=",
"null",
";",
"}",
"if",
"(",
"resetRequestAckSender",
"!=",
"null",
")",
"{",
"resetRequestAckSender",
".",
"stop",
"(",
")",
";",
"}",
"// stop all the liveness timers for value ticks",
"dem",
".",
"stopTimer",
"(",
")",
";",
"if",
"(",
"imeRestorationHandler",
"!=",
"null",
")",
"imeRestorationHandler",
".",
"stopTimer",
"(",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"stop\"",
")",
";",
"}"
] | Stop the stream, i.e., stop sending data and control messages | [
"Stop",
"the",
"stream",
"i",
".",
"e",
".",
"stop",
"sending",
"data",
"and",
"control",
"messages"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AOStream.java#L582-L616 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AOStream.java | AOStream.processTimedoutEntries | public void processTimedoutEntries(List timedout)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "processTimedoutEntries", new Object[] {this,timedout});
boolean sendMsg = false;
synchronized (this)
{
if (active && completedTicksInitialized && !timedout.isEmpty())
{
sendMsg = true;
}
}
if (sendMsg)
parent.sendDecisionExpected(remoteMEUuid, gatheringTargetDestUuid, streamId, timedout);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "processTimedoutEntries");
} | java | public void processTimedoutEntries(List timedout)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "processTimedoutEntries", new Object[] {this,timedout});
boolean sendMsg = false;
synchronized (this)
{
if (active && completedTicksInitialized && !timedout.isEmpty())
{
sendMsg = true;
}
}
if (sendMsg)
parent.sendDecisionExpected(remoteMEUuid, gatheringTargetDestUuid, streamId, timedout);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "processTimedoutEntries");
} | [
"public",
"void",
"processTimedoutEntries",
"(",
"List",
"timedout",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"processTimedoutEntries\"",
",",
"new",
"Object",
"[",
"]",
"{",
"this",
",",
"timedout",
"}",
")",
";",
"boolean",
"sendMsg",
"=",
"false",
";",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"active",
"&&",
"completedTicksInitialized",
"&&",
"!",
"timedout",
".",
"isEmpty",
"(",
")",
")",
"{",
"sendMsg",
"=",
"true",
";",
"}",
"}",
"if",
"(",
"sendMsg",
")",
"parent",
".",
"sendDecisionExpected",
"(",
"remoteMEUuid",
",",
"gatheringTargetDestUuid",
",",
"streamId",
",",
"timedout",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"processTimedoutEntries\"",
")",
";",
"}"
] | Called when the DecisionExpected timeout occurs
@param timedout | [
"Called",
"when",
"the",
"DecisionExpected",
"timeout",
"occurs"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AOStream.java#L813-L831 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AOStream.java | AOStream.expiredRequest | public final void expiredRequest(long tick)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "expiredRequest", Long.valueOf(tick));
expiredRequest(tick, false);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "expiredRequest");
} | java | public final void expiredRequest(long tick)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "expiredRequest", Long.valueOf(tick));
expiredRequest(tick, false);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "expiredRequest");
} | [
"public",
"final",
"void",
"expiredRequest",
"(",
"long",
"tick",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"expiredRequest\"",
",",
"Long",
".",
"valueOf",
"(",
"tick",
")",
")",
";",
"expiredRequest",
"(",
"tick",
",",
"false",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"expiredRequest\"",
")",
";",
"}"
] | Callback from JSRemoteConsumerPoint that the given tick in the stream should be changed to the completed state.
@param tick | [
"Callback",
"from",
"JSRemoteConsumerPoint",
"that",
"the",
"given",
"tick",
"in",
"the",
"stream",
"should",
"be",
"changed",
"to",
"the",
"completed",
"state",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AOStream.java#L837-L844 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AOStream.java | AOStream.removeConsumerKey | public final void removeConsumerKey(String selector, JSRemoteConsumerPoint aock)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "removeConsumerKey", new Object[] { selector, aock });
synchronized (this)
{
JSRemoteConsumerPoint aock2 = (JSRemoteConsumerPoint) consumerKeyTable.get(selector);
if (aock2 == aock)
{ // the object is still in the table
consumerKeyTable.remove(selector);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "removeConsumerKey");
} | java | public final void removeConsumerKey(String selector, JSRemoteConsumerPoint aock)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "removeConsumerKey", new Object[] { selector, aock });
synchronized (this)
{
JSRemoteConsumerPoint aock2 = (JSRemoteConsumerPoint) consumerKeyTable.get(selector);
if (aock2 == aock)
{ // the object is still in the table
consumerKeyTable.remove(selector);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "removeConsumerKey");
} | [
"public",
"final",
"void",
"removeConsumerKey",
"(",
"String",
"selector",
",",
"JSRemoteConsumerPoint",
"aock",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"removeConsumerKey\"",
",",
"new",
"Object",
"[",
"]",
"{",
"selector",
",",
"aock",
"}",
")",
";",
"synchronized",
"(",
"this",
")",
"{",
"JSRemoteConsumerPoint",
"aock2",
"=",
"(",
"JSRemoteConsumerPoint",
")",
"consumerKeyTable",
".",
"get",
"(",
"selector",
")",
";",
"if",
"(",
"aock2",
"==",
"aock",
")",
"{",
"// the object is still in the table",
"consumerKeyTable",
".",
"remove",
"(",
"selector",
")",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"removeConsumerKey\"",
")",
";",
"}"
] | Method to remove the given JSRemoteConsumerPoint from the consumerKeyTable
@param selector The string representation of the SelectionCriteria(s) of this JSRemoteConsumerPoint
@param aock The JSRemoteConsumerPoint to remove | [
"Method",
"to",
"remove",
"the",
"given",
"JSRemoteConsumerPoint",
"from",
"the",
"consumerKeyTable"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AOStream.java#L1068-L1084 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AOStream.java | AOStream.getNumberOfRequestsInState | public synchronized long getNumberOfRequestsInState(int requiredState)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getNumberOfRequestsInState", Integer.valueOf(requiredState));
//Count the number of tick range objects that are in the
//specified state
long requestCount=0;
// Initial range in stream is always completed Range
stream.setCursor(0);
// skip this and move to next range
stream.getNext();
// Get the first TickRange after completed range and move cursor to the next one
TickRange tr = stream.getNext();
// Iterate until we reach final Unknown range
while (tr.endstamp < RangeList.INFINITY)
{
if((tr.type == requiredState) )
{
requestCount++;
}
tr = stream.getNext();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getNumberOfRequestsInState", Long.valueOf(requestCount));
return requestCount;
} | java | public synchronized long getNumberOfRequestsInState(int requiredState)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getNumberOfRequestsInState", Integer.valueOf(requiredState));
//Count the number of tick range objects that are in the
//specified state
long requestCount=0;
// Initial range in stream is always completed Range
stream.setCursor(0);
// skip this and move to next range
stream.getNext();
// Get the first TickRange after completed range and move cursor to the next one
TickRange tr = stream.getNext();
// Iterate until we reach final Unknown range
while (tr.endstamp < RangeList.INFINITY)
{
if((tr.type == requiredState) )
{
requestCount++;
}
tr = stream.getNext();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getNumberOfRequestsInState", Long.valueOf(requestCount));
return requestCount;
} | [
"public",
"synchronized",
"long",
"getNumberOfRequestsInState",
"(",
"int",
"requiredState",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"getNumberOfRequestsInState\"",
",",
"Integer",
".",
"valueOf",
"(",
"requiredState",
")",
")",
";",
"//Count the number of tick range objects that are in the",
"//specified state",
"long",
"requestCount",
"=",
"0",
";",
"// Initial range in stream is always completed Range",
"stream",
".",
"setCursor",
"(",
"0",
")",
";",
"// skip this and move to next range",
"stream",
".",
"getNext",
"(",
")",
";",
"// Get the first TickRange after completed range and move cursor to the next one",
"TickRange",
"tr",
"=",
"stream",
".",
"getNext",
"(",
")",
";",
"// Iterate until we reach final Unknown range",
"while",
"(",
"tr",
".",
"endstamp",
"<",
"RangeList",
".",
"INFINITY",
")",
"{",
"if",
"(",
"(",
"tr",
".",
"type",
"==",
"requiredState",
")",
")",
"{",
"requestCount",
"++",
";",
"}",
"tr",
"=",
"stream",
".",
"getNext",
"(",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"getNumberOfRequestsInState\"",
",",
"Long",
".",
"valueOf",
"(",
"requestCount",
")",
")",
";",
"return",
"requestCount",
";",
"}"
] | Counts the number of requests that have been completed since reboot
@return
@author tpm | [
"Counts",
"the",
"number",
"of",
"requests",
"that",
"have",
"been",
"completed",
"since",
"reboot"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AOStream.java#L2398-L2425 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AOStream.java | AOStream.unlockRejectedTick | public final void unlockRejectedTick(TransactionCommon t, AOValue storedTick) throws MessageStoreException, SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "unlockRejectedTick");
try {
SIMPMessage msg =
consumerDispatcher.getMessageByValue(storedTick);
Transaction msTran = mp.resolveAndEnlistMsgStoreTransaction(t);
if(msg != null)
{
// Set the rme unlock count into the Messageitem so it can be taken into
// account on further rollback threshold checks. (Note we take one off
// because the following operation will perform an unlock itself)
// 488794.
boolean incrementCount = false;
// TODO: THIS DOESN'T WORK - MsgStore does not support the use of 'don't increment count'
// when unlocking a persistently locked message (i.e. one of these). So the count will
// get incremented anyway. So if the message has been rejected because it was never consumed
// (and therefore, shouldn't have the count incremented) the unlock count WILL be incremented
// which could cause us to exception it.
// TODO: However, this is still an improvement on the pre-V7 logic and not a regression
// so we'll leave it as is unless someone complains.
// TODO: I also doubt all this logic as the rmeUnlockCount is only transient, if MsgStore
// chooses to un-cache this message we'll lose the extra count info. Although I guess it does
// solve the case when the RME has rolled it back enough to reach the max failure limit, so I
// guess we leave it as is.
if(storedTick.rmeUnlockCount > 0)
{
incrementCount = true;
msg.setRMEUnlockCount(storedTick.rmeUnlockCount - 1);
}
if (msg.getLockID()==storedTick.getPLockId())
msg.unlockMsg(storedTick.getPLockId(), msTran, incrementCount);
}
storedTick.lockItemIfAvailable(controlItemLockID); // should always be successful
storedTick.remove(msTran, controlItemLockID);
}
catch (MessageStoreException e)
{
// No FFDC code needed
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "unlockRejectedTick", e);
throw e;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "unlockRejectedTick");
} | java | public final void unlockRejectedTick(TransactionCommon t, AOValue storedTick) throws MessageStoreException, SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "unlockRejectedTick");
try {
SIMPMessage msg =
consumerDispatcher.getMessageByValue(storedTick);
Transaction msTran = mp.resolveAndEnlistMsgStoreTransaction(t);
if(msg != null)
{
// Set the rme unlock count into the Messageitem so it can be taken into
// account on further rollback threshold checks. (Note we take one off
// because the following operation will perform an unlock itself)
// 488794.
boolean incrementCount = false;
// TODO: THIS DOESN'T WORK - MsgStore does not support the use of 'don't increment count'
// when unlocking a persistently locked message (i.e. one of these). So the count will
// get incremented anyway. So if the message has been rejected because it was never consumed
// (and therefore, shouldn't have the count incremented) the unlock count WILL be incremented
// which could cause us to exception it.
// TODO: However, this is still an improvement on the pre-V7 logic and not a regression
// so we'll leave it as is unless someone complains.
// TODO: I also doubt all this logic as the rmeUnlockCount is only transient, if MsgStore
// chooses to un-cache this message we'll lose the extra count info. Although I guess it does
// solve the case when the RME has rolled it back enough to reach the max failure limit, so I
// guess we leave it as is.
if(storedTick.rmeUnlockCount > 0)
{
incrementCount = true;
msg.setRMEUnlockCount(storedTick.rmeUnlockCount - 1);
}
if (msg.getLockID()==storedTick.getPLockId())
msg.unlockMsg(storedTick.getPLockId(), msTran, incrementCount);
}
storedTick.lockItemIfAvailable(controlItemLockID); // should always be successful
storedTick.remove(msTran, controlItemLockID);
}
catch (MessageStoreException e)
{
// No FFDC code needed
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "unlockRejectedTick", e);
throw e;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "unlockRejectedTick");
} | [
"public",
"final",
"void",
"unlockRejectedTick",
"(",
"TransactionCommon",
"t",
",",
"AOValue",
"storedTick",
")",
"throws",
"MessageStoreException",
",",
"SIResourceException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"unlockRejectedTick\"",
")",
";",
"try",
"{",
"SIMPMessage",
"msg",
"=",
"consumerDispatcher",
".",
"getMessageByValue",
"(",
"storedTick",
")",
";",
"Transaction",
"msTran",
"=",
"mp",
".",
"resolveAndEnlistMsgStoreTransaction",
"(",
"t",
")",
";",
"if",
"(",
"msg",
"!=",
"null",
")",
"{",
"// Set the rme unlock count into the Messageitem so it can be taken into",
"// account on further rollback threshold checks. (Note we take one off",
"// because the following operation will perform an unlock itself)",
"// 488794.",
"boolean",
"incrementCount",
"=",
"false",
";",
"// TODO: THIS DOESN'T WORK - MsgStore does not support the use of 'don't increment count'",
"// when unlocking a persistently locked message (i.e. one of these). So the count will",
"// get incremented anyway. So if the message has been rejected because it was never consumed",
"// (and therefore, shouldn't have the count incremented) the unlock count WILL be incremented",
"// which could cause us to exception it.",
"// TODO: However, this is still an improvement on the pre-V7 logic and not a regression",
"// so we'll leave it as is unless someone complains.",
"// TODO: I also doubt all this logic as the rmeUnlockCount is only transient, if MsgStore",
"// chooses to un-cache this message we'll lose the extra count info. Although I guess it does",
"// solve the case when the RME has rolled it back enough to reach the max failure limit, so I",
"// guess we leave it as is.",
"if",
"(",
"storedTick",
".",
"rmeUnlockCount",
">",
"0",
")",
"{",
"incrementCount",
"=",
"true",
";",
"msg",
".",
"setRMEUnlockCount",
"(",
"storedTick",
".",
"rmeUnlockCount",
"-",
"1",
")",
";",
"}",
"if",
"(",
"msg",
".",
"getLockID",
"(",
")",
"==",
"storedTick",
".",
"getPLockId",
"(",
")",
")",
"msg",
".",
"unlockMsg",
"(",
"storedTick",
".",
"getPLockId",
"(",
")",
",",
"msTran",
",",
"incrementCount",
")",
";",
"}",
"storedTick",
".",
"lockItemIfAvailable",
"(",
"controlItemLockID",
")",
";",
"// should always be successful",
"storedTick",
".",
"remove",
"(",
"msTran",
",",
"controlItemLockID",
")",
";",
"}",
"catch",
"(",
"MessageStoreException",
"e",
")",
"{",
"// No FFDC code needed",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"unlockRejectedTick\"",
",",
"e",
")",
";",
"throw",
"e",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"unlockRejectedTick\"",
")",
";",
"}"
] | Helper method called by the AOStream when a persistent tick representing a persistently locked
message should be removed since the message has been rejected. This method will also unlock the
message
@param t the transaction
@param stream the stream making this call
@param storedTick the persistent tick
@throws SIResourceException
@throws Exception | [
"Helper",
"method",
"called",
"by",
"the",
"AOStream",
"when",
"a",
"persistent",
"tick",
"representing",
"a",
"persistently",
"locked",
"message",
"should",
"be",
"removed",
"since",
"the",
"message",
"has",
"been",
"rejected",
".",
"This",
"method",
"will",
"also",
"unlock",
"the",
"message"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AOStream.java#L3120-L3173 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AOStream.java | AOStream.consumeAcceptedTick | public final void consumeAcceptedTick(TransactionCommon t, AOValue storedTick) throws Exception
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "consumeAcceptedTick", storedTick);
try {
SIMPMessage msg =
consumerDispatcher.getMessageByValue(storedTick);
Transaction msTran = mp.resolveAndEnlistMsgStoreTransaction(t);
// PK67067 We may not find a message in the store for this tick, because
// it may have been removed using the SIBQueuePoint MBean
if (msg != null) {
msg.remove(msTran, storedTick.getPLockId());
}
storedTick.lockItemIfAvailable(controlItemLockID); // should always be successful
storedTick.remove(msTran, controlItemLockID);
}
catch (Exception e)
{
// No FFDC code needed
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "consumeAcceptedTick", e);
throw e;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "consumeAcceptedTick");
} | java | public final void consumeAcceptedTick(TransactionCommon t, AOValue storedTick) throws Exception
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "consumeAcceptedTick", storedTick);
try {
SIMPMessage msg =
consumerDispatcher.getMessageByValue(storedTick);
Transaction msTran = mp.resolveAndEnlistMsgStoreTransaction(t);
// PK67067 We may not find a message in the store for this tick, because
// it may have been removed using the SIBQueuePoint MBean
if (msg != null) {
msg.remove(msTran, storedTick.getPLockId());
}
storedTick.lockItemIfAvailable(controlItemLockID); // should always be successful
storedTick.remove(msTran, controlItemLockID);
}
catch (Exception e)
{
// No FFDC code needed
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "consumeAcceptedTick", e);
throw e;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "consumeAcceptedTick");
} | [
"public",
"final",
"void",
"consumeAcceptedTick",
"(",
"TransactionCommon",
"t",
",",
"AOValue",
"storedTick",
")",
"throws",
"Exception",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"consumeAcceptedTick\"",
",",
"storedTick",
")",
";",
"try",
"{",
"SIMPMessage",
"msg",
"=",
"consumerDispatcher",
".",
"getMessageByValue",
"(",
"storedTick",
")",
";",
"Transaction",
"msTran",
"=",
"mp",
".",
"resolveAndEnlistMsgStoreTransaction",
"(",
"t",
")",
";",
"// PK67067 We may not find a message in the store for this tick, because",
"// it may have been removed using the SIBQueuePoint MBean",
"if",
"(",
"msg",
"!=",
"null",
")",
"{",
"msg",
".",
"remove",
"(",
"msTran",
",",
"storedTick",
".",
"getPLockId",
"(",
")",
")",
";",
"}",
"storedTick",
".",
"lockItemIfAvailable",
"(",
"controlItemLockID",
")",
";",
"// should always be successful",
"storedTick",
".",
"remove",
"(",
"msTran",
",",
"controlItemLockID",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"// No FFDC code needed",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"consumeAcceptedTick\"",
",",
"e",
")",
";",
"throw",
"e",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"consumeAcceptedTick\"",
")",
";",
"}"
] | Helper method called by the AOStream when a persistent tick representing a persistently locked
message should be removed since the message has been accepted. This method will also consume the
message
@param t the transaction
@param stream the stream making this call
@param storedTick the persistent tick
@throws Exception | [
"Helper",
"method",
"called",
"by",
"the",
"AOStream",
"when",
"a",
"persistent",
"tick",
"representing",
"a",
"persistently",
"locked",
"message",
"should",
"be",
"removed",
"since",
"the",
"message",
"has",
"been",
"accepted",
".",
"This",
"method",
"will",
"also",
"consume",
"the",
"message"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AOStream.java#L3184-L3214 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/bytebuffer/internal/FCWsByteBufferImpl.java | FCWsByteBufferImpl.getFileChannel | public FileChannel getFileChannel() {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "getFileChannel(): " + fc);
}
return this.fc;
} | java | public FileChannel getFileChannel() {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "getFileChannel(): " + fc);
}
return this.fc;
} | [
"public",
"FileChannel",
"getFileChannel",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"getFileChannel(): \"",
"+",
"fc",
")",
";",
"}",
"return",
"this",
".",
"fc",
";",
"}"
] | Return the FileChannel object that is representing this WsByteBufferImpl.
@return FileChannel | [
"Return",
"the",
"FileChannel",
"object",
"that",
"is",
"representing",
"this",
"WsByteBufferImpl",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/bytebuffer/internal/FCWsByteBufferImpl.java#L120-L125 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/bytebuffer/internal/FCWsByteBufferImpl.java | FCWsByteBufferImpl.convertBufferIfNeeded | private void convertBufferIfNeeded() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "convertBufferIfNeeded status: " + status);
}
if (isFCEnabled()) {
// TRANSFER_TO status is currently on, so turn if OFF
status = status & (~WsByteBuffer.STATUS_TRANSFER_TO);
// and turn on BUFFER status
status = status | WsByteBuffer.STATUS_BUFFER;
try {
// save so we can restore the current position
int bufPosition = (int) fc.position();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "creating a MappedByteBuffer from the FileChannel. position: " + 0 + " size: " + fc.size());
}
// map entire FileChannel buffer to ByteBuffer
try {
oByteBuffer = fc.map(MapMode.PRIVATE, 0, fc.size());
} catch (NonWritableChannelException e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "FileChannel is readonly");
}
oByteBuffer = fc.map(MapMode.READ_ONLY, 0, fc.size());
setReadOnly(true);
}
// The mapped byte buffer returned by this method will have a
// position of zero and a limit and capacity of size;
// its mark will be undefined.
// The buffer and the mapping that it represents will
// remain valid until the buffer itself is garbage-collected.
// restore the position and limit
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "set MappedByteBuffer position to: " + bufPosition + " limit to: " + fcLimit);
}
position(bufPosition);
limit(fcLimit);
} catch (IOException e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "got IOException: " + e);
}
FFDCFilter.processException(e, CLASS_NAME + ".convertBufferIfNeeded", "112", this);
throw new RuntimeException(e);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "convertBufferIfNeeded status: " + status);
}
} | java | private void convertBufferIfNeeded() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "convertBufferIfNeeded status: " + status);
}
if (isFCEnabled()) {
// TRANSFER_TO status is currently on, so turn if OFF
status = status & (~WsByteBuffer.STATUS_TRANSFER_TO);
// and turn on BUFFER status
status = status | WsByteBuffer.STATUS_BUFFER;
try {
// save so we can restore the current position
int bufPosition = (int) fc.position();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "creating a MappedByteBuffer from the FileChannel. position: " + 0 + " size: " + fc.size());
}
// map entire FileChannel buffer to ByteBuffer
try {
oByteBuffer = fc.map(MapMode.PRIVATE, 0, fc.size());
} catch (NonWritableChannelException e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "FileChannel is readonly");
}
oByteBuffer = fc.map(MapMode.READ_ONLY, 0, fc.size());
setReadOnly(true);
}
// The mapped byte buffer returned by this method will have a
// position of zero and a limit and capacity of size;
// its mark will be undefined.
// The buffer and the mapping that it represents will
// remain valid until the buffer itself is garbage-collected.
// restore the position and limit
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "set MappedByteBuffer position to: " + bufPosition + " limit to: " + fcLimit);
}
position(bufPosition);
limit(fcLimit);
} catch (IOException e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "got IOException: " + e);
}
FFDCFilter.processException(e, CLASS_NAME + ".convertBufferIfNeeded", "112", this);
throw new RuntimeException(e);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "convertBufferIfNeeded status: " + status);
}
} | [
"private",
"void",
"convertBufferIfNeeded",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"convertBufferIfNeeded status: \"",
"+",
"status",
")",
";",
"}",
"if",
"(",
"isFCEnabled",
"(",
")",
")",
"{",
"// TRANSFER_TO status is currently on, so turn if OFF",
"status",
"=",
"status",
"&",
"(",
"~",
"WsByteBuffer",
".",
"STATUS_TRANSFER_TO",
")",
";",
"// and turn on BUFFER status",
"status",
"=",
"status",
"|",
"WsByteBuffer",
".",
"STATUS_BUFFER",
";",
"try",
"{",
"// save so we can restore the current position",
"int",
"bufPosition",
"=",
"(",
"int",
")",
"fc",
".",
"position",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"creating a MappedByteBuffer from the FileChannel. position: \"",
"+",
"0",
"+",
"\" size: \"",
"+",
"fc",
".",
"size",
"(",
")",
")",
";",
"}",
"// map entire FileChannel buffer to ByteBuffer",
"try",
"{",
"oByteBuffer",
"=",
"fc",
".",
"map",
"(",
"MapMode",
".",
"PRIVATE",
",",
"0",
",",
"fc",
".",
"size",
"(",
")",
")",
";",
"}",
"catch",
"(",
"NonWritableChannelException",
"e",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"FileChannel is readonly\"",
")",
";",
"}",
"oByteBuffer",
"=",
"fc",
".",
"map",
"(",
"MapMode",
".",
"READ_ONLY",
",",
"0",
",",
"fc",
".",
"size",
"(",
")",
")",
";",
"setReadOnly",
"(",
"true",
")",
";",
"}",
"// The mapped byte buffer returned by this method will have a",
"// position of zero and a limit and capacity of size;",
"// its mark will be undefined.",
"// The buffer and the mapping that it represents will",
"// remain valid until the buffer itself is garbage-collected.",
"// restore the position and limit",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"set MappedByteBuffer position to: \"",
"+",
"bufPosition",
"+",
"\" limit to: \"",
"+",
"fcLimit",
")",
";",
"}",
"position",
"(",
"bufPosition",
")",
";",
"limit",
"(",
"fcLimit",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"got IOException: \"",
"+",
"e",
")",
";",
"}",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"CLASS_NAME",
"+",
"\".convertBufferIfNeeded\"",
",",
"\"112\"",
",",
"this",
")",
";",
"throw",
"new",
"RuntimeException",
"(",
"e",
")",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"convertBufferIfNeeded status: \"",
"+",
"status",
")",
";",
"}",
"}"
] | If the buffer has not already been converted from a TRANSFER_TO buffer back
to the more common base BUFFER, then do so now. | [
"If",
"the",
"buffer",
"has",
"not",
"already",
"been",
"converted",
"from",
"a",
"TRANSFER_TO",
"buffer",
"back",
"to",
"the",
"more",
"common",
"base",
"BUFFER",
"then",
"do",
"so",
"now",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/bytebuffer/internal/FCWsByteBufferImpl.java#L132-L187 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSListImpl.java | JSListImpl.checkType | public void checkType(JSField elem, int indir) throws JMFSchemaViolationException {
if (!equivFields(element, elem) || indir != indirect)
throw new JMFSchemaViolationException("Incorrect list element types");
} | java | public void checkType(JSField elem, int indir) throws JMFSchemaViolationException {
if (!equivFields(element, elem) || indir != indirect)
throw new JMFSchemaViolationException("Incorrect list element types");
} | [
"public",
"void",
"checkType",
"(",
"JSField",
"elem",
",",
"int",
"indir",
")",
"throws",
"JMFSchemaViolationException",
"{",
"if",
"(",
"!",
"equivFields",
"(",
"element",
",",
"elem",
")",
"||",
"indir",
"!=",
"indirect",
")",
"throw",
"new",
"JMFSchemaViolationException",
"(",
"\"Incorrect list element types\"",
")",
";",
"}"
] | SchemaViolationException if not | [
"SchemaViolationException",
"if",
"not"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSListImpl.java#L170-L173 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSListImpl.java | JSListImpl.equivFields | private boolean equivFields(JSField one, JSField two) {
if (one instanceof JSDynamic) {
return two instanceof JSDynamic;
}
else if (one instanceof JSEnum) {
return two instanceof JSEnum;
}
else if (one instanceof JSPrimitive) {
return (two instanceof JSPrimitive)
&& ((JSPrimitive)one).getTypeCode() == ((JSPrimitive)two).getTypeCode();
}
else if (one instanceof JSVariant) {
// we assume without checking that JSVariants in this context must be boxed
return (two instanceof JSVariant)
&& ((JSVariant)one).getBoxed().getID() == ((JSVariant)two).getBoxed().getID();
}
else
return false;
} | java | private boolean equivFields(JSField one, JSField two) {
if (one instanceof JSDynamic) {
return two instanceof JSDynamic;
}
else if (one instanceof JSEnum) {
return two instanceof JSEnum;
}
else if (one instanceof JSPrimitive) {
return (two instanceof JSPrimitive)
&& ((JSPrimitive)one).getTypeCode() == ((JSPrimitive)two).getTypeCode();
}
else if (one instanceof JSVariant) {
// we assume without checking that JSVariants in this context must be boxed
return (two instanceof JSVariant)
&& ((JSVariant)one).getBoxed().getID() == ((JSVariant)two).getBoxed().getID();
}
else
return false;
} | [
"private",
"boolean",
"equivFields",
"(",
"JSField",
"one",
",",
"JSField",
"two",
")",
"{",
"if",
"(",
"one",
"instanceof",
"JSDynamic",
")",
"{",
"return",
"two",
"instanceof",
"JSDynamic",
";",
"}",
"else",
"if",
"(",
"one",
"instanceof",
"JSEnum",
")",
"{",
"return",
"two",
"instanceof",
"JSEnum",
";",
"}",
"else",
"if",
"(",
"one",
"instanceof",
"JSPrimitive",
")",
"{",
"return",
"(",
"two",
"instanceof",
"JSPrimitive",
")",
"&&",
"(",
"(",
"JSPrimitive",
")",
"one",
")",
".",
"getTypeCode",
"(",
")",
"==",
"(",
"(",
"JSPrimitive",
")",
"two",
")",
".",
"getTypeCode",
"(",
")",
";",
"}",
"else",
"if",
"(",
"one",
"instanceof",
"JSVariant",
")",
"{",
"// we assume without checking that JSVariants in this context must be boxed",
"return",
"(",
"two",
"instanceof",
"JSVariant",
")",
"&&",
"(",
"(",
"JSVariant",
")",
"one",
")",
".",
"getBoxed",
"(",
")",
".",
"getID",
"(",
")",
"==",
"(",
"(",
"JSVariant",
")",
"two",
")",
".",
"getBoxed",
"(",
")",
".",
"getID",
"(",
")",
";",
"}",
"else",
"return",
"false",
";",
"}"
] | here is too specialized. | [
"here",
"is",
"too",
"specialized",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSListImpl.java#L178-L196 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSListImpl.java | JSListImpl.reallocate | int reallocate(int fieldOffset) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) JmfTr.entry(this, tc, "reallocate", new Object[]{Integer.valueOf(offset)});
byte[] oldContents = contents;
int oldOffset = offset;
contents = new byte[length];
System.arraycopy(oldContents, offset, contents, 0, length);
offset = 0;
int result = fieldOffset - oldOffset;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) JmfTr.exit(this, tc, "reallocate", Integer.valueOf(result));
return result;
} | java | int reallocate(int fieldOffset) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) JmfTr.entry(this, tc, "reallocate", new Object[]{Integer.valueOf(offset)});
byte[] oldContents = contents;
int oldOffset = offset;
contents = new byte[length];
System.arraycopy(oldContents, offset, contents, 0, length);
offset = 0;
int result = fieldOffset - oldOffset;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) JmfTr.exit(this, tc, "reallocate", Integer.valueOf(result));
return result;
} | [
"int",
"reallocate",
"(",
"int",
"fieldOffset",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"JmfTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"reallocate\"",
",",
"new",
"Object",
"[",
"]",
"{",
"Integer",
".",
"valueOf",
"(",
"offset",
")",
"}",
")",
";",
"byte",
"[",
"]",
"oldContents",
"=",
"contents",
";",
"int",
"oldOffset",
"=",
"offset",
";",
"contents",
"=",
"new",
"byte",
"[",
"length",
"]",
";",
"System",
".",
"arraycopy",
"(",
"oldContents",
",",
"offset",
",",
"contents",
",",
"0",
",",
"length",
")",
";",
"offset",
"=",
"0",
";",
"int",
"result",
"=",
"fieldOffset",
"-",
"oldOffset",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"JmfTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"reallocate\"",
",",
"Integer",
".",
"valueOf",
"(",
"result",
")",
")",
";",
"return",
"result",
";",
"}"
] | Reallocate the entire contents buffer | [
"Reallocate",
"the",
"entire",
"contents",
"buffer"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSListImpl.java#L258-L268 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSListImpl.java | JSListImpl.reallocated | void reallocated(byte[] newContents, int newOffset) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) JmfTr.entry(this, tc, "reallocated", new Object[]{newContents, Integer.valueOf(newOffset)});
if (contents != null) {
contents = newContents;
offset = newOffset + 8;
sharedContents = false;
// Now we must run through the cache any pass the changes down to any depenedent
// JSMessageData parts we find.
// d282049: respect implicit state invariant implied by JSMessageData#unassemble
// that an unassembled List can have no assembled contents
if (cache != null) {
for (int i = 0; i < cache.length; i++) {
try {
Object entry = cache[i];
if (entry != null && entry instanceof JSMessageData) {
((JSMessageData)entry).reallocated(newContents, getAbsoluteOffset(i));
}
} catch (JMFUninitializedAccessException e) {
// No FFDC code needed - this cannot occur as we know the JSMessageData part is present
}
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) JmfTr.exit(this, tc, "reallocated");
} | java | void reallocated(byte[] newContents, int newOffset) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) JmfTr.entry(this, tc, "reallocated", new Object[]{newContents, Integer.valueOf(newOffset)});
if (contents != null) {
contents = newContents;
offset = newOffset + 8;
sharedContents = false;
// Now we must run through the cache any pass the changes down to any depenedent
// JSMessageData parts we find.
// d282049: respect implicit state invariant implied by JSMessageData#unassemble
// that an unassembled List can have no assembled contents
if (cache != null) {
for (int i = 0; i < cache.length; i++) {
try {
Object entry = cache[i];
if (entry != null && entry instanceof JSMessageData) {
((JSMessageData)entry).reallocated(newContents, getAbsoluteOffset(i));
}
} catch (JMFUninitializedAccessException e) {
// No FFDC code needed - this cannot occur as we know the JSMessageData part is present
}
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) JmfTr.exit(this, tc, "reallocated");
} | [
"void",
"reallocated",
"(",
"byte",
"[",
"]",
"newContents",
",",
"int",
"newOffset",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"JmfTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"reallocated\"",
",",
"new",
"Object",
"[",
"]",
"{",
"newContents",
",",
"Integer",
".",
"valueOf",
"(",
"newOffset",
")",
"}",
")",
";",
"if",
"(",
"contents",
"!=",
"null",
")",
"{",
"contents",
"=",
"newContents",
";",
"offset",
"=",
"newOffset",
"+",
"8",
";",
"sharedContents",
"=",
"false",
";",
"// Now we must run through the cache any pass the changes down to any depenedent",
"// JSMessageData parts we find.",
"// d282049: respect implicit state invariant implied by JSMessageData#unassemble",
"// that an unassembled List can have no assembled contents",
"if",
"(",
"cache",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"cache",
".",
"length",
";",
"i",
"++",
")",
"{",
"try",
"{",
"Object",
"entry",
"=",
"cache",
"[",
"i",
"]",
";",
"if",
"(",
"entry",
"!=",
"null",
"&&",
"entry",
"instanceof",
"JSMessageData",
")",
"{",
"(",
"(",
"JSMessageData",
")",
"entry",
")",
".",
"reallocated",
"(",
"newContents",
",",
"getAbsoluteOffset",
"(",
"i",
")",
")",
";",
"}",
"}",
"catch",
"(",
"JMFUninitializedAccessException",
"e",
")",
"{",
"// No FFDC code needed - this cannot occur as we know the JSMessageData part is present",
"}",
"}",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"JmfTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"reallocated\"",
")",
";",
"}"
] | JSMessageData items currently in the cache. | [
"JSMessageData",
"items",
"currently",
"in",
"the",
"cache",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSListImpl.java#L273-L298 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSListImpl.java | JSListImpl.getSize | static int getSize(Object agg) throws JMFSchemaViolationException {
if (agg == null) {
return 0;
}
else if (agg instanceof Collection) {
return ((Collection)agg).size();
}
else if (agg.getClass().isArray()) {
return Array.getLength(agg);
}
else {
throw new JMFSchemaViolationException(agg.getClass().getName());
}
} | java | static int getSize(Object agg) throws JMFSchemaViolationException {
if (agg == null) {
return 0;
}
else if (agg instanceof Collection) {
return ((Collection)agg).size();
}
else if (agg.getClass().isArray()) {
return Array.getLength(agg);
}
else {
throw new JMFSchemaViolationException(agg.getClass().getName());
}
} | [
"static",
"int",
"getSize",
"(",
"Object",
"agg",
")",
"throws",
"JMFSchemaViolationException",
"{",
"if",
"(",
"agg",
"==",
"null",
")",
"{",
"return",
"0",
";",
"}",
"else",
"if",
"(",
"agg",
"instanceof",
"Collection",
")",
"{",
"return",
"(",
"(",
"Collection",
")",
"agg",
")",
".",
"size",
"(",
")",
";",
"}",
"else",
"if",
"(",
"agg",
".",
"getClass",
"(",
")",
".",
"isArray",
"(",
")",
")",
"{",
"return",
"Array",
".",
"getLength",
"(",
"agg",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"JMFSchemaViolationException",
"(",
"agg",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"}",
"}"
] | Get the size of an aggregate that may be either an array or a Collection | [
"Get",
"the",
"size",
"of",
"an",
"aggregate",
"that",
"may",
"be",
"either",
"an",
"array",
"or",
"a",
"Collection"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSListImpl.java#L338-L351 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSListImpl.java | JSListImpl.getIterator | static Iterator getIterator(Object agg) throws JMFSchemaViolationException {
if (agg instanceof Collection) {
return ((Collection)agg).iterator();
}
else if (agg.getClass().isArray()) {
return new LiteIterator(agg);
}
else {
throw new JMFSchemaViolationException(agg.getClass().getName());
}
} | java | static Iterator getIterator(Object agg) throws JMFSchemaViolationException {
if (agg instanceof Collection) {
return ((Collection)agg).iterator();
}
else if (agg.getClass().isArray()) {
return new LiteIterator(agg);
}
else {
throw new JMFSchemaViolationException(agg.getClass().getName());
}
} | [
"static",
"Iterator",
"getIterator",
"(",
"Object",
"agg",
")",
"throws",
"JMFSchemaViolationException",
"{",
"if",
"(",
"agg",
"instanceof",
"Collection",
")",
"{",
"return",
"(",
"(",
"Collection",
")",
"agg",
")",
".",
"iterator",
"(",
")",
";",
"}",
"else",
"if",
"(",
"agg",
".",
"getClass",
"(",
")",
".",
"isArray",
"(",
")",
")",
"{",
"return",
"new",
"LiteIterator",
"(",
"agg",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"JMFSchemaViolationException",
"(",
"agg",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"}",
"}"
] | Get an Iterator over an aggregate that may be either an array or a Collection | [
"Get",
"an",
"Iterator",
"over",
"an",
"aggregate",
"that",
"may",
"be",
"either",
"an",
"array",
"or",
"a",
"Collection"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSListImpl.java#L354-L364 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.faulttolerance.cdi_fat/fat/src/com/ibm/websphere/microprofile/faulttolerance_fat/validation/AppValidator.java | AppValidator.failsWith | public AppValidator failsWith(String expectedFailure) {
stringsToFind.add(expectedFailure);
stringsToFind.add(APP_FAIL_CODE);
server.addIgnoredErrors(Collections.singletonList(expectedFailure));
return this;
} | java | public AppValidator failsWith(String expectedFailure) {
stringsToFind.add(expectedFailure);
stringsToFind.add(APP_FAIL_CODE);
server.addIgnoredErrors(Collections.singletonList(expectedFailure));
return this;
} | [
"public",
"AppValidator",
"failsWith",
"(",
"String",
"expectedFailure",
")",
"{",
"stringsToFind",
".",
"add",
"(",
"expectedFailure",
")",
";",
"stringsToFind",
".",
"add",
"(",
"APP_FAIL_CODE",
")",
";",
"server",
".",
"addIgnoredErrors",
"(",
"Collections",
".",
"singletonList",
"(",
"expectedFailure",
")",
")",
";",
"return",
"this",
";",
"}"
] | Specify that the app should fail to start, and that the given failure message should be seen during app startup | [
"Specify",
"that",
"the",
"app",
"should",
"fail",
"to",
"start",
"and",
"that",
"the",
"given",
"failure",
"message",
"should",
"be",
"seen",
"during",
"app",
"startup"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.faulttolerance.cdi_fat/fat/src/com/ibm/websphere/microprofile/faulttolerance_fat/validation/AppValidator.java#L89-L94 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.threading/src/com/ibm/ws/threading/internal/PolicyExecutorImpl.java | PolicyExecutorImpl.acquireExpedite | private int acquireExpedite() {
int a;
while ((a = expeditesAvailable.get()) > 0 && !expeditesAvailable.compareAndSet(a, a - 1));
return a; // returning the value rather than true/false will enable better debug
} | java | private int acquireExpedite() {
int a;
while ((a = expeditesAvailable.get()) > 0 && !expeditesAvailable.compareAndSet(a, a - 1));
return a; // returning the value rather than true/false will enable better debug
} | [
"private",
"int",
"acquireExpedite",
"(",
")",
"{",
"int",
"a",
";",
"while",
"(",
"(",
"a",
"=",
"expeditesAvailable",
".",
"get",
"(",
")",
")",
">",
"0",
"&&",
"!",
"expeditesAvailable",
".",
"compareAndSet",
"(",
"a",
",",
"a",
"-",
"1",
")",
")",
";",
"return",
"a",
";",
"// returning the value rather than true/false will enable better debug",
"}"
] | Attempt to acquire a permit to expedite, which involves decrementing the available expedites.
Only allow decrement of a positive value, and otherwise indicate there are no available expedites.
@return number of available expedites at the time we acquired a permit. 0 if none remains and we did not get a permit. | [
"Attempt",
"to",
"acquire",
"a",
"permit",
"to",
"expedite",
"which",
"involves",
"decrementing",
"the",
"available",
"expedites",
".",
"Only",
"allow",
"decrement",
"of",
"a",
"positive",
"value",
"and",
"otherwise",
"indicate",
"there",
"are",
"no",
"available",
"expedites",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.threading/src/com/ibm/ws/threading/internal/PolicyExecutorImpl.java#L275-L279 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.threading/src/com/ibm/ws/threading/internal/PolicyExecutorImpl.java | PolicyExecutorImpl.decrementWithheldConcurrency | @Trivial
private void decrementWithheldConcurrency() {
int w;
while ((w = withheldConcurrency.get()) > 0 && !withheldConcurrency.compareAndSet(w, w - 1));
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "withheld concurrency " + w + " --> " + (w == 0 ? 0 : (w - 1)));
} | java | @Trivial
private void decrementWithheldConcurrency() {
int w;
while ((w = withheldConcurrency.get()) > 0 && !withheldConcurrency.compareAndSet(w, w - 1));
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "withheld concurrency " + w + " --> " + (w == 0 ? 0 : (w - 1)));
} | [
"@",
"Trivial",
"private",
"void",
"decrementWithheldConcurrency",
"(",
")",
"{",
"int",
"w",
";",
"while",
"(",
"(",
"w",
"=",
"withheldConcurrency",
".",
"get",
"(",
")",
")",
">",
"0",
"&&",
"!",
"withheldConcurrency",
".",
"compareAndSet",
"(",
"w",
",",
"w",
"-",
"1",
")",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"withheld concurrency \"",
"+",
"w",
"+",
"\" --> \"",
"+",
"(",
"w",
"==",
"0",
"?",
"0",
":",
"(",
"w",
"-",
"1",
")",
")",
")",
";",
"}"
] | Decrement the counter of withheld concurrency only if positive.
This method should only ever be invoked if the caller is about to enqueue a task to the global executor.
Otherwise there is a risk of a race condition where withheldConcurrency decrements to 0 with a task still on the queue. | [
"Decrement",
"the",
"counter",
"of",
"withheld",
"concurrency",
"only",
"if",
"positive",
".",
"This",
"method",
"should",
"only",
"ever",
"be",
"invoked",
"if",
"the",
"caller",
"is",
"about",
"to",
"enqueue",
"a",
"task",
"to",
"the",
"global",
"executor",
".",
"Otherwise",
"there",
"is",
"a",
"risk",
"of",
"a",
"race",
"condition",
"where",
"withheldConcurrency",
"decrements",
"to",
"0",
"with",
"a",
"task",
"still",
"on",
"the",
"queue",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.threading/src/com/ibm/ws/threading/internal/PolicyExecutorImpl.java#L400-L406 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.threading/src/com/ibm/ws/threading/internal/PolicyExecutorImpl.java | PolicyExecutorImpl.invokeAny | @Override
@FFDCIgnore(value = { RejectedExecutionException.class })
public <T> T invokeAny(Collection<? extends Callable<T>> tasks, PolicyTaskCallback[] callbacks) throws InterruptedException, ExecutionException {
int taskCount = tasks.size();
// Special case to run a single task on the current thread if we can acquire a permit, if a permit is required
if (taskCount == 1) {
boolean havePermit = false;
if (maxPolicy == MaxPolicy.loose || (havePermit = maxConcurrencyConstraint.tryAcquire())) // use current thread
try {
if (state.get() != State.ACTIVE)
throw new RejectedExecutionException(Tr.formatMessage(tc, "CWWKE1202.submit.after.shutdown", identifier));
// startTimeout does not apply because the task starts immediately
PolicyTaskFutureImpl<T> taskFuture = new PolicyTaskFutureImpl<T>(this, tasks.iterator().next(), callbacks == null ? null : callbacks[0], -1);
taskFuture.accept(true);
runTask(taskFuture);
// raise InterruptedException if current thread is interrupted
taskFuture.throwIfInterrupted();
return taskFuture.get();
} finally {
if (havePermit)
transferOrReleasePermit();
}
} else if (taskCount == 0)
throw new IllegalArgumentException();
InvokeAnyLatch latch = new InvokeAnyLatch(taskCount);
ArrayList<PolicyTaskFutureImpl<T>> futures = new ArrayList<PolicyTaskFutureImpl<T>>(taskCount);
try {
// create futures in advance, which gives the callback an opportunity to reject
int t = 0;
for (Callable<T> task : tasks) {
PolicyTaskCallback callback = callbacks == null ? null : callbacks[t++];
PolicyExecutorImpl executor = callback == null ? this : (PolicyExecutorImpl) callback.getExecutor(this);
long startTimeoutNS = callback == null ? startTimeout : callback.getStartTimeout(executor.startTimeout);
futures.add(new PolicyTaskFutureImpl<T>(executor, task, callback, startTimeoutNS, latch));
}
// enqueue all tasks
for (PolicyTaskFutureImpl<T> taskFuture : futures) {
// check if done before enqueuing more tasks
if (latch.getCount() == 0)
break;
taskFuture.executor.enqueue(taskFuture, taskFuture.executor.maxWaitForEnqueueNS.get(), false); // never run on the current thread because it would prevent timeout
}
// wait for completion
return latch.await(-1, futures);
} catch (RejectedExecutionException x) {
if (x.getCause() instanceof InterruptedException) {
throw (InterruptedException) x.getCause();
} else
throw x;
} catch (TimeoutException x) {
throw new RuntimeException(x); // should be unreachable with infinite timeout
} finally {
for (Future<?> f : futures)
f.cancel(true);
}
} | java | @Override
@FFDCIgnore(value = { RejectedExecutionException.class })
public <T> T invokeAny(Collection<? extends Callable<T>> tasks, PolicyTaskCallback[] callbacks) throws InterruptedException, ExecutionException {
int taskCount = tasks.size();
// Special case to run a single task on the current thread if we can acquire a permit, if a permit is required
if (taskCount == 1) {
boolean havePermit = false;
if (maxPolicy == MaxPolicy.loose || (havePermit = maxConcurrencyConstraint.tryAcquire())) // use current thread
try {
if (state.get() != State.ACTIVE)
throw new RejectedExecutionException(Tr.formatMessage(tc, "CWWKE1202.submit.after.shutdown", identifier));
// startTimeout does not apply because the task starts immediately
PolicyTaskFutureImpl<T> taskFuture = new PolicyTaskFutureImpl<T>(this, tasks.iterator().next(), callbacks == null ? null : callbacks[0], -1);
taskFuture.accept(true);
runTask(taskFuture);
// raise InterruptedException if current thread is interrupted
taskFuture.throwIfInterrupted();
return taskFuture.get();
} finally {
if (havePermit)
transferOrReleasePermit();
}
} else if (taskCount == 0)
throw new IllegalArgumentException();
InvokeAnyLatch latch = new InvokeAnyLatch(taskCount);
ArrayList<PolicyTaskFutureImpl<T>> futures = new ArrayList<PolicyTaskFutureImpl<T>>(taskCount);
try {
// create futures in advance, which gives the callback an opportunity to reject
int t = 0;
for (Callable<T> task : tasks) {
PolicyTaskCallback callback = callbacks == null ? null : callbacks[t++];
PolicyExecutorImpl executor = callback == null ? this : (PolicyExecutorImpl) callback.getExecutor(this);
long startTimeoutNS = callback == null ? startTimeout : callback.getStartTimeout(executor.startTimeout);
futures.add(new PolicyTaskFutureImpl<T>(executor, task, callback, startTimeoutNS, latch));
}
// enqueue all tasks
for (PolicyTaskFutureImpl<T> taskFuture : futures) {
// check if done before enqueuing more tasks
if (latch.getCount() == 0)
break;
taskFuture.executor.enqueue(taskFuture, taskFuture.executor.maxWaitForEnqueueNS.get(), false); // never run on the current thread because it would prevent timeout
}
// wait for completion
return latch.await(-1, futures);
} catch (RejectedExecutionException x) {
if (x.getCause() instanceof InterruptedException) {
throw (InterruptedException) x.getCause();
} else
throw x;
} catch (TimeoutException x) {
throw new RuntimeException(x); // should be unreachable with infinite timeout
} finally {
for (Future<?> f : futures)
f.cancel(true);
}
} | [
"@",
"Override",
"@",
"FFDCIgnore",
"(",
"value",
"=",
"{",
"RejectedExecutionException",
".",
"class",
"}",
")",
"public",
"<",
"T",
">",
"T",
"invokeAny",
"(",
"Collection",
"<",
"?",
"extends",
"Callable",
"<",
"T",
">",
">",
"tasks",
",",
"PolicyTaskCallback",
"[",
"]",
"callbacks",
")",
"throws",
"InterruptedException",
",",
"ExecutionException",
"{",
"int",
"taskCount",
"=",
"tasks",
".",
"size",
"(",
")",
";",
"// Special case to run a single task on the current thread if we can acquire a permit, if a permit is required",
"if",
"(",
"taskCount",
"==",
"1",
")",
"{",
"boolean",
"havePermit",
"=",
"false",
";",
"if",
"(",
"maxPolicy",
"==",
"MaxPolicy",
".",
"loose",
"||",
"(",
"havePermit",
"=",
"maxConcurrencyConstraint",
".",
"tryAcquire",
"(",
")",
")",
")",
"// use current thread",
"try",
"{",
"if",
"(",
"state",
".",
"get",
"(",
")",
"!=",
"State",
".",
"ACTIVE",
")",
"throw",
"new",
"RejectedExecutionException",
"(",
"Tr",
".",
"formatMessage",
"(",
"tc",
",",
"\"CWWKE1202.submit.after.shutdown\"",
",",
"identifier",
")",
")",
";",
"// startTimeout does not apply because the task starts immediately",
"PolicyTaskFutureImpl",
"<",
"T",
">",
"taskFuture",
"=",
"new",
"PolicyTaskFutureImpl",
"<",
"T",
">",
"(",
"this",
",",
"tasks",
".",
"iterator",
"(",
")",
".",
"next",
"(",
")",
",",
"callbacks",
"==",
"null",
"?",
"null",
":",
"callbacks",
"[",
"0",
"]",
",",
"-",
"1",
")",
";",
"taskFuture",
".",
"accept",
"(",
"true",
")",
";",
"runTask",
"(",
"taskFuture",
")",
";",
"// raise InterruptedException if current thread is interrupted",
"taskFuture",
".",
"throwIfInterrupted",
"(",
")",
";",
"return",
"taskFuture",
".",
"get",
"(",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"havePermit",
")",
"transferOrReleasePermit",
"(",
")",
";",
"}",
"}",
"else",
"if",
"(",
"taskCount",
"==",
"0",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"InvokeAnyLatch",
"latch",
"=",
"new",
"InvokeAnyLatch",
"(",
"taskCount",
")",
";",
"ArrayList",
"<",
"PolicyTaskFutureImpl",
"<",
"T",
">",
">",
"futures",
"=",
"new",
"ArrayList",
"<",
"PolicyTaskFutureImpl",
"<",
"T",
">",
">",
"(",
"taskCount",
")",
";",
"try",
"{",
"// create futures in advance, which gives the callback an opportunity to reject",
"int",
"t",
"=",
"0",
";",
"for",
"(",
"Callable",
"<",
"T",
">",
"task",
":",
"tasks",
")",
"{",
"PolicyTaskCallback",
"callback",
"=",
"callbacks",
"==",
"null",
"?",
"null",
":",
"callbacks",
"[",
"t",
"++",
"]",
";",
"PolicyExecutorImpl",
"executor",
"=",
"callback",
"==",
"null",
"?",
"this",
":",
"(",
"PolicyExecutorImpl",
")",
"callback",
".",
"getExecutor",
"(",
"this",
")",
";",
"long",
"startTimeoutNS",
"=",
"callback",
"==",
"null",
"?",
"startTimeout",
":",
"callback",
".",
"getStartTimeout",
"(",
"executor",
".",
"startTimeout",
")",
";",
"futures",
".",
"add",
"(",
"new",
"PolicyTaskFutureImpl",
"<",
"T",
">",
"(",
"executor",
",",
"task",
",",
"callback",
",",
"startTimeoutNS",
",",
"latch",
")",
")",
";",
"}",
"// enqueue all tasks",
"for",
"(",
"PolicyTaskFutureImpl",
"<",
"T",
">",
"taskFuture",
":",
"futures",
")",
"{",
"// check if done before enqueuing more tasks",
"if",
"(",
"latch",
".",
"getCount",
"(",
")",
"==",
"0",
")",
"break",
";",
"taskFuture",
".",
"executor",
".",
"enqueue",
"(",
"taskFuture",
",",
"taskFuture",
".",
"executor",
".",
"maxWaitForEnqueueNS",
".",
"get",
"(",
")",
",",
"false",
")",
";",
"// never run on the current thread because it would prevent timeout",
"}",
"// wait for completion",
"return",
"latch",
".",
"await",
"(",
"-",
"1",
",",
"futures",
")",
";",
"}",
"catch",
"(",
"RejectedExecutionException",
"x",
")",
"{",
"if",
"(",
"x",
".",
"getCause",
"(",
")",
"instanceof",
"InterruptedException",
")",
"{",
"throw",
"(",
"InterruptedException",
")",
"x",
".",
"getCause",
"(",
")",
";",
"}",
"else",
"throw",
"x",
";",
"}",
"catch",
"(",
"TimeoutException",
"x",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"x",
")",
";",
"// should be unreachable with infinite timeout",
"}",
"finally",
"{",
"for",
"(",
"Future",
"<",
"?",
">",
"f",
":",
"futures",
")",
"f",
".",
"cancel",
"(",
"true",
")",
";",
"}",
"}"
] | Because this method is not timed, we allow an optimization where if only a single task is submitted it can run on the current thread. | [
"Because",
"this",
"method",
"is",
"not",
"timed",
"we",
"allow",
"an",
"optimization",
"where",
"if",
"only",
"a",
"single",
"task",
"is",
"submitted",
"it",
"can",
"run",
"on",
"the",
"current",
"thread",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.threading/src/com/ibm/ws/threading/internal/PolicyExecutorImpl.java#L798-L861 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.threading/src/com/ibm/ws/threading/internal/PolicyExecutorImpl.java | PolicyExecutorImpl.runTask | void runTask(PolicyTaskFutureImpl<?> future) {
running.add(future); // intentionally done before checking state to avoid missing cancels on shutdownNow
int runCount = runningCount.incrementAndGet();
try {
Callback callback = cbLateStart.get();
if (callback != null) {
long delay = future.nsQueueEnd - future.nsAcceptBegin;
if (delay > callback.threshold
&& cbLateStart.compareAndSet(callback, null)) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "callback: late start " + delay + "ns > " + callback.threshold + "ns", callback.runnable);
globalExecutor.submit(callback.runnable);
}
}
callback = cbConcurrency.get();
if (callback != null
&& runCount > callback.threshold
&& cbConcurrency.compareAndSet(callback, null)) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "callback: concurrency > " + callback.threshold, callback.runnable);
globalExecutor.submit(callback.runnable);
}
if (state.get().canStartTask) {
future.run();
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "Cancel task due to policy executor state " + state);
future.nsRunEnd = System.nanoTime();
future.cancel(false);
if (future.callback != null)
future.callback.onEnd(future.task, future, null, true, 0, null); // aborted, queued task will never run
}
} catch (Error x) {
// auto FFDC
} catch (RuntimeException x) {
// auto FFDC
} finally {
runningCount.decrementAndGet();
running.remove(future);
}
} | java | void runTask(PolicyTaskFutureImpl<?> future) {
running.add(future); // intentionally done before checking state to avoid missing cancels on shutdownNow
int runCount = runningCount.incrementAndGet();
try {
Callback callback = cbLateStart.get();
if (callback != null) {
long delay = future.nsQueueEnd - future.nsAcceptBegin;
if (delay > callback.threshold
&& cbLateStart.compareAndSet(callback, null)) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "callback: late start " + delay + "ns > " + callback.threshold + "ns", callback.runnable);
globalExecutor.submit(callback.runnable);
}
}
callback = cbConcurrency.get();
if (callback != null
&& runCount > callback.threshold
&& cbConcurrency.compareAndSet(callback, null)) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "callback: concurrency > " + callback.threshold, callback.runnable);
globalExecutor.submit(callback.runnable);
}
if (state.get().canStartTask) {
future.run();
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "Cancel task due to policy executor state " + state);
future.nsRunEnd = System.nanoTime();
future.cancel(false);
if (future.callback != null)
future.callback.onEnd(future.task, future, null, true, 0, null); // aborted, queued task will never run
}
} catch (Error x) {
// auto FFDC
} catch (RuntimeException x) {
// auto FFDC
} finally {
runningCount.decrementAndGet();
running.remove(future);
}
} | [
"void",
"runTask",
"(",
"PolicyTaskFutureImpl",
"<",
"?",
">",
"future",
")",
"{",
"running",
".",
"add",
"(",
"future",
")",
";",
"// intentionally done before checking state to avoid missing cancels on shutdownNow",
"int",
"runCount",
"=",
"runningCount",
".",
"incrementAndGet",
"(",
")",
";",
"try",
"{",
"Callback",
"callback",
"=",
"cbLateStart",
".",
"get",
"(",
")",
";",
"if",
"(",
"callback",
"!=",
"null",
")",
"{",
"long",
"delay",
"=",
"future",
".",
"nsQueueEnd",
"-",
"future",
".",
"nsAcceptBegin",
";",
"if",
"(",
"delay",
">",
"callback",
".",
"threshold",
"&&",
"cbLateStart",
".",
"compareAndSet",
"(",
"callback",
",",
"null",
")",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"callback: late start \"",
"+",
"delay",
"+",
"\"ns > \"",
"+",
"callback",
".",
"threshold",
"+",
"\"ns\"",
",",
"callback",
".",
"runnable",
")",
";",
"globalExecutor",
".",
"submit",
"(",
"callback",
".",
"runnable",
")",
";",
"}",
"}",
"callback",
"=",
"cbConcurrency",
".",
"get",
"(",
")",
";",
"if",
"(",
"callback",
"!=",
"null",
"&&",
"runCount",
">",
"callback",
".",
"threshold",
"&&",
"cbConcurrency",
".",
"compareAndSet",
"(",
"callback",
",",
"null",
")",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"callback: concurrency > \"",
"+",
"callback",
".",
"threshold",
",",
"callback",
".",
"runnable",
")",
";",
"globalExecutor",
".",
"submit",
"(",
"callback",
".",
"runnable",
")",
";",
"}",
"if",
"(",
"state",
".",
"get",
"(",
")",
".",
"canStartTask",
")",
"{",
"future",
".",
"run",
"(",
")",
";",
"}",
"else",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Cancel task due to policy executor state \"",
"+",
"state",
")",
";",
"future",
".",
"nsRunEnd",
"=",
"System",
".",
"nanoTime",
"(",
")",
";",
"future",
".",
"cancel",
"(",
"false",
")",
";",
"if",
"(",
"future",
".",
"callback",
"!=",
"null",
")",
"future",
".",
"callback",
".",
"onEnd",
"(",
"future",
".",
"task",
",",
"future",
",",
"null",
",",
"true",
",",
"0",
",",
"null",
")",
";",
"// aborted, queued task will never run",
"}",
"}",
"catch",
"(",
"Error",
"x",
")",
"{",
"// auto FFDC",
"}",
"catch",
"(",
"RuntimeException",
"x",
")",
"{",
"// auto FFDC",
"}",
"finally",
"{",
"runningCount",
".",
"decrementAndGet",
"(",
")",
";",
"running",
".",
"remove",
"(",
"future",
")",
";",
"}",
"}"
] | Invoked by the policy executor thread to run a task.
@param future the future for the task.
@return Exception that occurred while running the task. Otherwise null. | [
"Invoked",
"by",
"the",
"policy",
"executor",
"thread",
"to",
"run",
"a",
"task",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.threading/src/com/ibm/ws/threading/internal/PolicyExecutorImpl.java#L1110-L1152 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.threading/src/com/ibm/ws/threading/internal/PolicyExecutorImpl.java | PolicyExecutorImpl.transferOrReleasePermit | @Trivial
private void transferOrReleasePermit() {
maxConcurrencyConstraint.release();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "expedites/maxConcurrency available",
expeditesAvailable, maxConcurrencyConstraint.availablePermits());
// The permit might be needed to run tasks on the global executor,
if (!queue.isEmpty() && withheldConcurrency.get() > 0 && maxConcurrencyConstraint.tryAcquire()) {
decrementWithheldConcurrency();
if (acquireExpedite() > 0)
expediteGlobal(new GlobalPoolTask());
else
enqueueGlobal(new GlobalPoolTask());
}
} | java | @Trivial
private void transferOrReleasePermit() {
maxConcurrencyConstraint.release();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "expedites/maxConcurrency available",
expeditesAvailable, maxConcurrencyConstraint.availablePermits());
// The permit might be needed to run tasks on the global executor,
if (!queue.isEmpty() && withheldConcurrency.get() > 0 && maxConcurrencyConstraint.tryAcquire()) {
decrementWithheldConcurrency();
if (acquireExpedite() > 0)
expediteGlobal(new GlobalPoolTask());
else
enqueueGlobal(new GlobalPoolTask());
}
} | [
"@",
"Trivial",
"private",
"void",
"transferOrReleasePermit",
"(",
")",
"{",
"maxConcurrencyConstraint",
".",
"release",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"expedites/maxConcurrency available\"",
",",
"expeditesAvailable",
",",
"maxConcurrencyConstraint",
".",
"availablePermits",
"(",
")",
")",
";",
"// The permit might be needed to run tasks on the global executor,",
"if",
"(",
"!",
"queue",
".",
"isEmpty",
"(",
")",
"&&",
"withheldConcurrency",
".",
"get",
"(",
")",
">",
"0",
"&&",
"maxConcurrencyConstraint",
".",
"tryAcquire",
"(",
")",
")",
"{",
"decrementWithheldConcurrency",
"(",
")",
";",
"if",
"(",
"acquireExpedite",
"(",
")",
">",
"0",
")",
"expediteGlobal",
"(",
"new",
"GlobalPoolTask",
"(",
")",
")",
";",
"else",
"enqueueGlobal",
"(",
"new",
"GlobalPoolTask",
"(",
")",
")",
";",
"}",
"}"
] | Releases a permit against maxConcurrency or transfers it to a worker task that runs on the global thread pool. | [
"Releases",
"a",
"permit",
"against",
"maxConcurrency",
"or",
"transfers",
"it",
"to",
"a",
"worker",
"task",
"that",
"runs",
"on",
"the",
"global",
"thread",
"pool",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.threading/src/com/ibm/ws/threading/internal/PolicyExecutorImpl.java#L1294-L1310 | train |
OpenLiberty/open-liberty | dev/com.ibm.tx.core/src/com/ibm/ws/Transaction/JTA/XARminst.java | XARminst.closeConnection | public void closeConnection()
{
if (tc.isEntryEnabled()) Tr.entry(tc, "closeConnection");
try
{
if(_XAResourceFactory != null && _XARes != null)
{
((XAResourceFactory)_XAResourceFactory).destroyXAResource(_XARes);
}
}
catch(Throwable t)
{
FFDCFilter.processException(t, "com.ibm.ws.Transaction.JTA.XARminst.closeConnection", "250", this);
Tr.audit(tc, "WTRN0038_ERR_DESTROYING_XARESOURCE", t);
}
if (tc.isEntryEnabled()) Tr.exit(tc, "closeConnection");
} | java | public void closeConnection()
{
if (tc.isEntryEnabled()) Tr.entry(tc, "closeConnection");
try
{
if(_XAResourceFactory != null && _XARes != null)
{
((XAResourceFactory)_XAResourceFactory).destroyXAResource(_XARes);
}
}
catch(Throwable t)
{
FFDCFilter.processException(t, "com.ibm.ws.Transaction.JTA.XARminst.closeConnection", "250", this);
Tr.audit(tc, "WTRN0038_ERR_DESTROYING_XARESOURCE", t);
}
if (tc.isEntryEnabled()) Tr.exit(tc, "closeConnection");
} | [
"public",
"void",
"closeConnection",
"(",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"closeConnection\"",
")",
";",
"try",
"{",
"if",
"(",
"_XAResourceFactory",
"!=",
"null",
"&&",
"_XARes",
"!=",
"null",
")",
"{",
"(",
"(",
"XAResourceFactory",
")",
"_XAResourceFactory",
")",
".",
"destroyXAResource",
"(",
"_XARes",
")",
";",
"}",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"t",
",",
"\"com.ibm.ws.Transaction.JTA.XARminst.closeConnection\"",
",",
"\"250\"",
",",
"this",
")",
";",
"Tr",
".",
"audit",
"(",
"tc",
",",
"\"WTRN0038_ERR_DESTROYING_XARESOURCE\"",
",",
"t",
")",
";",
"}",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"closeConnection\"",
")",
";",
"}"
] | Close the XAConnection with the XAResource. | [
"Close",
"the",
"XAConnection",
"with",
"the",
"XAResource",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.tx.core/src/com/ibm/ws/Transaction/JTA/XARminst.java#L298-L314 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/TCPReadRequestContextImpl.java | TCPReadRequestContextImpl.readInternal | protected VirtualConnection readInternal(long numBytes, TCPReadCompletedCallback readCallback, boolean forceQueue, int timeout) {
if (timeout == IMMED_TIMEOUT) {
immediateTimeout();
return null;
}
if (timeout == ABORT_TIMEOUT) {
abort();
immediateTimeout();
return null;
}
setIOAmount(numBytes);
setLastIOAmt(0);
setIODoneAmount(0);
setReadCompletedCallback(readCallback);
setForceQueue(forceQueue);
setTimeoutTime(timeout);
// IMPROVEMENT: buffers should be preprocessed before calling read,
// postprocessed after
return processAsyncReadRequest();
} | java | protected VirtualConnection readInternal(long numBytes, TCPReadCompletedCallback readCallback, boolean forceQueue, int timeout) {
if (timeout == IMMED_TIMEOUT) {
immediateTimeout();
return null;
}
if (timeout == ABORT_TIMEOUT) {
abort();
immediateTimeout();
return null;
}
setIOAmount(numBytes);
setLastIOAmt(0);
setIODoneAmount(0);
setReadCompletedCallback(readCallback);
setForceQueue(forceQueue);
setTimeoutTime(timeout);
// IMPROVEMENT: buffers should be preprocessed before calling read,
// postprocessed after
return processAsyncReadRequest();
} | [
"protected",
"VirtualConnection",
"readInternal",
"(",
"long",
"numBytes",
",",
"TCPReadCompletedCallback",
"readCallback",
",",
"boolean",
"forceQueue",
",",
"int",
"timeout",
")",
"{",
"if",
"(",
"timeout",
"==",
"IMMED_TIMEOUT",
")",
"{",
"immediateTimeout",
"(",
")",
";",
"return",
"null",
";",
"}",
"if",
"(",
"timeout",
"==",
"ABORT_TIMEOUT",
")",
"{",
"abort",
"(",
")",
";",
"immediateTimeout",
"(",
")",
";",
"return",
"null",
";",
"}",
"setIOAmount",
"(",
"numBytes",
")",
";",
"setLastIOAmt",
"(",
"0",
")",
";",
"setIODoneAmount",
"(",
"0",
")",
";",
"setReadCompletedCallback",
"(",
"readCallback",
")",
";",
"setForceQueue",
"(",
"forceQueue",
")",
";",
"setTimeoutTime",
"(",
"timeout",
")",
";",
"// IMPROVEMENT: buffers should be preprocessed before calling read,",
"// postprocessed after",
"return",
"processAsyncReadRequest",
"(",
")",
";",
"}"
] | internal async read entry point | [
"internal",
"async",
"read",
"entry",
"point"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/TCPReadRequestContextImpl.java#L145-L166 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/webapp/WebAppConfiguration.java | WebAppConfiguration.isFileServingEnabled | public boolean isFileServingEnabled() {
// PK54499 START
disallowAllFileServingProp = WCCustomProperties.DISALLOW_ALL_FILE_SERVING;
if (disallowAllFileServingProp != null && !this.getApplicationName().equalsIgnoreCase("isclite")) {
try
{
if (Boolean.valueOf(disallowAllFileServingProp).booleanValue())
{
this.fileServingEnabled = Boolean.FALSE;
}
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE))
{
logger.logp(Level.FINE, CLASS_NAME, "isFileServing", "PK54499: disallowAllFileServingProp set to " + disallowAllFileServingProp + " for application: "
+ this.getApplicationName());
}
}
catch (Exception x)
{
logger.logp(Level.SEVERE, CLASS_NAME, "isFileServing", "Illegal value set for property com.ibm.ws.webcontainer.disallowallfileserving");
}
}
// PK54499 END
if (this.fileServingEnabled != null)
return this.fileServingEnabled.booleanValue();
return WCCustomProperties.FILE_SERVING_ENABLED;
} | java | public boolean isFileServingEnabled() {
// PK54499 START
disallowAllFileServingProp = WCCustomProperties.DISALLOW_ALL_FILE_SERVING;
if (disallowAllFileServingProp != null && !this.getApplicationName().equalsIgnoreCase("isclite")) {
try
{
if (Boolean.valueOf(disallowAllFileServingProp).booleanValue())
{
this.fileServingEnabled = Boolean.FALSE;
}
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE))
{
logger.logp(Level.FINE, CLASS_NAME, "isFileServing", "PK54499: disallowAllFileServingProp set to " + disallowAllFileServingProp + " for application: "
+ this.getApplicationName());
}
}
catch (Exception x)
{
logger.logp(Level.SEVERE, CLASS_NAME, "isFileServing", "Illegal value set for property com.ibm.ws.webcontainer.disallowallfileserving");
}
}
// PK54499 END
if (this.fileServingEnabled != null)
return this.fileServingEnabled.booleanValue();
return WCCustomProperties.FILE_SERVING_ENABLED;
} | [
"public",
"boolean",
"isFileServingEnabled",
"(",
")",
"{",
"// PK54499 START",
"disallowAllFileServingProp",
"=",
"WCCustomProperties",
".",
"DISALLOW_ALL_FILE_SERVING",
";",
"if",
"(",
"disallowAllFileServingProp",
"!=",
"null",
"&&",
"!",
"this",
".",
"getApplicationName",
"(",
")",
".",
"equalsIgnoreCase",
"(",
"\"isclite\"",
")",
")",
"{",
"try",
"{",
"if",
"(",
"Boolean",
".",
"valueOf",
"(",
"disallowAllFileServingProp",
")",
".",
"booleanValue",
"(",
")",
")",
"{",
"this",
".",
"fileServingEnabled",
"=",
"Boolean",
".",
"FALSE",
";",
"}",
"if",
"(",
"com",
".",
"ibm",
".",
"ejs",
".",
"ras",
".",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"{",
"logger",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"CLASS_NAME",
",",
"\"isFileServing\"",
",",
"\"PK54499: disallowAllFileServingProp set to \"",
"+",
"disallowAllFileServingProp",
"+",
"\" for application: \"",
"+",
"this",
".",
"getApplicationName",
"(",
")",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"x",
")",
"{",
"logger",
".",
"logp",
"(",
"Level",
".",
"SEVERE",
",",
"CLASS_NAME",
",",
"\"isFileServing\"",
",",
"\"Illegal value set for property com.ibm.ws.webcontainer.disallowallfileserving\"",
")",
";",
"}",
"}",
"// PK54499 END",
"if",
"(",
"this",
".",
"fileServingEnabled",
"!=",
"null",
")",
"return",
"this",
".",
"fileServingEnabled",
".",
"booleanValue",
"(",
")",
";",
"return",
"WCCustomProperties",
".",
"FILE_SERVING_ENABLED",
";",
"}"
] | Returns the fileServingEnabled.
@return boolean | [
"Returns",
"the",
"fileServingEnabled",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/webapp/WebAppConfiguration.java#L318-L345 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/webapp/WebAppConfiguration.java | WebAppConfiguration.getJspAttributes | public Map<String, String> getJspAttributes() {
if (null == this.jspAttributes) {
this.jspAttributes = new HashMap<String, String>();
}
return this.jspAttributes;
} | java | public Map<String, String> getJspAttributes() {
if (null == this.jspAttributes) {
this.jspAttributes = new HashMap<String, String>();
}
return this.jspAttributes;
} | [
"public",
"Map",
"<",
"String",
",",
"String",
">",
"getJspAttributes",
"(",
")",
"{",
"if",
"(",
"null",
"==",
"this",
".",
"jspAttributes",
")",
"{",
"this",
".",
"jspAttributes",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
";",
"}",
"return",
"this",
".",
"jspAttributes",
";",
"}"
] | Returns the jspAttributes.
@return Map<String,String> | [
"Returns",
"the",
"jspAttributes",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/webapp/WebAppConfiguration.java#L545-L550 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/webapp/WebAppConfiguration.java | WebAppConfiguration.getServletInfo | public IServletConfig getServletInfo(String string) {
if (string == null || string.isEmpty()){
Tr.debug(tc, "getServletInfo", "servlet name is null/empty. Use internal servlet name " + NULLSERVLETNAME);
string = NULLSERVLETNAME;
}
return (IServletConfig) this.servletInfo.get(string);
} | java | public IServletConfig getServletInfo(String string) {
if (string == null || string.isEmpty()){
Tr.debug(tc, "getServletInfo", "servlet name is null/empty. Use internal servlet name " + NULLSERVLETNAME);
string = NULLSERVLETNAME;
}
return (IServletConfig) this.servletInfo.get(string);
} | [
"public",
"IServletConfig",
"getServletInfo",
"(",
"String",
"string",
")",
"{",
"if",
"(",
"string",
"==",
"null",
"||",
"string",
".",
"isEmpty",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"getServletInfo\"",
",",
"\"servlet name is null/empty. Use internal servlet name \"",
"+",
"NULLSERVLETNAME",
")",
";",
"string",
"=",
"NULLSERVLETNAME",
";",
"}",
"return",
"(",
"IServletConfig",
")",
"this",
".",
"servletInfo",
".",
"get",
"(",
"string",
")",
";",
"}"
] | Method getServletInfo.
@param string
@return ServletConfig | [
"Method",
"getServletInfo",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/webapp/WebAppConfiguration.java#L591-L598 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/webapp/WebAppConfiguration.java | WebAppConfiguration.isServeServletsByClassnameEnabled | public boolean isServeServletsByClassnameEnabled() {
// PK52059 START
disallowServeServletsByClassnameProp = WCCustomProperties.DISALLOW_SERVE_SERVLETS_BY_CLASSNAME_PROP;
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) {
logger.logp(Level.FINE, CLASS_NAME, "isServeServletsByClassnameEnabled", "disallowServeServletsByClassnameProp = " + disallowServeServletsByClassnameProp);
}
if (disallowServeServletsByClassnameProp != null) {
try {
if (Boolean.valueOf(disallowServeServletsByClassnameProp).booleanValue()) {
this.serveServletsByClassnameEnabled = Boolean.FALSE;
}
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) {
logger.logp(Level.FINE, CLASS_NAME, "isServeServletsByClassnameEnabled", "PK52059: disallowServeServletsByClassnameProp set to "
+ disallowServeServletsByClassnameProp
+ " for application: " + this.getApplicationName());
}
} catch (Exception x) {
logger.logp(Level.SEVERE, CLASS_NAME, "isServeServletsByClassnameEnabled",
"Illegal value set for property com.ibm.ws.webcontainer.disallowserveservletsbyclassname");
}
} // PK52059 END
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) {
logger.logp(Level.FINE, CLASS_NAME, "isServeServletsByClassnameEnabled", "value = " + (this.serveServletsByClassnameEnabled != null ? this.serveServletsByClassnameEnabled.booleanValue() : WCCustomProperties.SERVE_SERVLETS_BY_CLASSNAME_ENABLED));
}
if (this.serveServletsByClassnameEnabled != null)
return this.serveServletsByClassnameEnabled.booleanValue();
return WCCustomProperties.SERVE_SERVLETS_BY_CLASSNAME_ENABLED;
} | java | public boolean isServeServletsByClassnameEnabled() {
// PK52059 START
disallowServeServletsByClassnameProp = WCCustomProperties.DISALLOW_SERVE_SERVLETS_BY_CLASSNAME_PROP;
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) {
logger.logp(Level.FINE, CLASS_NAME, "isServeServletsByClassnameEnabled", "disallowServeServletsByClassnameProp = " + disallowServeServletsByClassnameProp);
}
if (disallowServeServletsByClassnameProp != null) {
try {
if (Boolean.valueOf(disallowServeServletsByClassnameProp).booleanValue()) {
this.serveServletsByClassnameEnabled = Boolean.FALSE;
}
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) {
logger.logp(Level.FINE, CLASS_NAME, "isServeServletsByClassnameEnabled", "PK52059: disallowServeServletsByClassnameProp set to "
+ disallowServeServletsByClassnameProp
+ " for application: " + this.getApplicationName());
}
} catch (Exception x) {
logger.logp(Level.SEVERE, CLASS_NAME, "isServeServletsByClassnameEnabled",
"Illegal value set for property com.ibm.ws.webcontainer.disallowserveservletsbyclassname");
}
} // PK52059 END
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) {
logger.logp(Level.FINE, CLASS_NAME, "isServeServletsByClassnameEnabled", "value = " + (this.serveServletsByClassnameEnabled != null ? this.serveServletsByClassnameEnabled.booleanValue() : WCCustomProperties.SERVE_SERVLETS_BY_CLASSNAME_ENABLED));
}
if (this.serveServletsByClassnameEnabled != null)
return this.serveServletsByClassnameEnabled.booleanValue();
return WCCustomProperties.SERVE_SERVLETS_BY_CLASSNAME_ENABLED;
} | [
"public",
"boolean",
"isServeServletsByClassnameEnabled",
"(",
")",
"{",
"// PK52059 START",
"disallowServeServletsByClassnameProp",
"=",
"WCCustomProperties",
".",
"DISALLOW_SERVE_SERVLETS_BY_CLASSNAME_PROP",
";",
"if",
"(",
"com",
".",
"ibm",
".",
"ejs",
".",
"ras",
".",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"{",
"logger",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"CLASS_NAME",
",",
"\"isServeServletsByClassnameEnabled\"",
",",
"\"disallowServeServletsByClassnameProp = \"",
"+",
"disallowServeServletsByClassnameProp",
")",
";",
"}",
"if",
"(",
"disallowServeServletsByClassnameProp",
"!=",
"null",
")",
"{",
"try",
"{",
"if",
"(",
"Boolean",
".",
"valueOf",
"(",
"disallowServeServletsByClassnameProp",
")",
".",
"booleanValue",
"(",
")",
")",
"{",
"this",
".",
"serveServletsByClassnameEnabled",
"=",
"Boolean",
".",
"FALSE",
";",
"}",
"if",
"(",
"com",
".",
"ibm",
".",
"ejs",
".",
"ras",
".",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"{",
"logger",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"CLASS_NAME",
",",
"\"isServeServletsByClassnameEnabled\"",
",",
"\"PK52059: disallowServeServletsByClassnameProp set to \"",
"+",
"disallowServeServletsByClassnameProp",
"+",
"\" for application: \"",
"+",
"this",
".",
"getApplicationName",
"(",
")",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"x",
")",
"{",
"logger",
".",
"logp",
"(",
"Level",
".",
"SEVERE",
",",
"CLASS_NAME",
",",
"\"isServeServletsByClassnameEnabled\"",
",",
"\"Illegal value set for property com.ibm.ws.webcontainer.disallowserveservletsbyclassname\"",
")",
";",
"}",
"}",
"// PK52059 END",
"if",
"(",
"com",
".",
"ibm",
".",
"ejs",
".",
"ras",
".",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"{",
"logger",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"CLASS_NAME",
",",
"\"isServeServletsByClassnameEnabled\"",
",",
"\"value = \"",
"+",
"(",
"this",
".",
"serveServletsByClassnameEnabled",
"!=",
"null",
"?",
"this",
".",
"serveServletsByClassnameEnabled",
".",
"booleanValue",
"(",
")",
":",
"WCCustomProperties",
".",
"SERVE_SERVLETS_BY_CLASSNAME_ENABLED",
")",
")",
";",
"}",
"if",
"(",
"this",
".",
"serveServletsByClassnameEnabled",
"!=",
"null",
")",
"return",
"this",
".",
"serveServletsByClassnameEnabled",
".",
"booleanValue",
"(",
")",
";",
"return",
"WCCustomProperties",
".",
"SERVE_SERVLETS_BY_CLASSNAME_ENABLED",
";",
"}"
] | Returns the serveServletsByClassname.
@return boolean | [
"Returns",
"the",
"serveServletsByClassname",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/webapp/WebAppConfiguration.java#L624-L654 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/webapp/WebAppConfiguration.java | WebAppConfiguration.setMimeFilters | public void setMimeFilters(HashMap mimeFilters) {
if (mimeFilters != null && mimeFilters.size() > 0) {
this.isMimeFilteringEnabled = true;
}
this.mimeFilters = mimeFilters;
} | java | public void setMimeFilters(HashMap mimeFilters) {
if (mimeFilters != null && mimeFilters.size() > 0) {
this.isMimeFilteringEnabled = true;
}
this.mimeFilters = mimeFilters;
} | [
"public",
"void",
"setMimeFilters",
"(",
"HashMap",
"mimeFilters",
")",
"{",
"if",
"(",
"mimeFilters",
"!=",
"null",
"&&",
"mimeFilters",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"this",
".",
"isMimeFilteringEnabled",
"=",
"true",
";",
"}",
"this",
".",
"mimeFilters",
"=",
"mimeFilters",
";",
"}"
] | Sets the mimeFilters.
@param mimeFilters
The mimeFilters to set | [
"Sets",
"the",
"mimeFilters",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/webapp/WebAppConfiguration.java#L787-L792 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/webapp/WebAppConfiguration.java | WebAppConfiguration.getApplicationName | public String getApplicationName() {
if (this.applicationName != null)
return this.applicationName;
else if (webApp != null)
return this.webApp.getApplicationName();
else
return null;
} | java | public String getApplicationName() {
if (this.applicationName != null)
return this.applicationName;
else if (webApp != null)
return this.webApp.getApplicationName();
else
return null;
} | [
"public",
"String",
"getApplicationName",
"(",
")",
"{",
"if",
"(",
"this",
".",
"applicationName",
"!=",
"null",
")",
"return",
"this",
".",
"applicationName",
";",
"else",
"if",
"(",
"webApp",
"!=",
"null",
")",
"return",
"this",
".",
"webApp",
".",
"getApplicationName",
"(",
")",
";",
"else",
"return",
"null",
";",
"}"
] | Return the applicationName.
@return String | [
"Return",
"the",
"applicationName",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/webapp/WebAppConfiguration.java#L962-L970 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/webapp/WebAppConfiguration.java | WebAppConfiguration.setDisableStaticMappingCache | public void setDisableStaticMappingCache(){
if (this.contextParams != null){
String value = (String) this.contextParams.get("com.ibm.ws.webcontainer.DISABLE_STATIC_MAPPING_CACHE");
if (value != null ){
if (value.equalsIgnoreCase("true")){
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
logger.logp(Level.FINE, CLASS_NAME,"setDisableStaticMappingCache", "cxtParam disable static mapping cache for application -> "+ applicationName);
this.setDisableStaticMappingCache(true);
}
return;
}
}
if (WCCustomProperties.DISABLE_STATIC_MAPPING_CACHE != null){
String disableStaticMappingCacheApp = WCCustomProperties.DISABLE_STATIC_MAPPING_CACHE;
if (disableStaticMappingCacheApp.equals("*")){
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
logger.logp(Level.FINE, CLASS_NAME,"setDisableStaticMappingCache", "disable static mapping cache for all apps.");
this.setDisableStaticMappingCache(true);
return;
}
else{
String [] parsedStr = disableStaticMappingCacheApp.split(",");
for (String toCheckStr:parsedStr){
toCheckStr = toCheckStr.trim();
if (applicationName != null && applicationName.equalsIgnoreCase(toCheckStr)){
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
logger.logp(Level.FINE, CLASS_NAME,"setDisableStaticMappingCache", "disable static mapping cache for application -> "+ applicationName);
this.setDisableStaticMappingCache(true);
return;
}
}
}
}
} | java | public void setDisableStaticMappingCache(){
if (this.contextParams != null){
String value = (String) this.contextParams.get("com.ibm.ws.webcontainer.DISABLE_STATIC_MAPPING_CACHE");
if (value != null ){
if (value.equalsIgnoreCase("true")){
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
logger.logp(Level.FINE, CLASS_NAME,"setDisableStaticMappingCache", "cxtParam disable static mapping cache for application -> "+ applicationName);
this.setDisableStaticMappingCache(true);
}
return;
}
}
if (WCCustomProperties.DISABLE_STATIC_MAPPING_CACHE != null){
String disableStaticMappingCacheApp = WCCustomProperties.DISABLE_STATIC_MAPPING_CACHE;
if (disableStaticMappingCacheApp.equals("*")){
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
logger.logp(Level.FINE, CLASS_NAME,"setDisableStaticMappingCache", "disable static mapping cache for all apps.");
this.setDisableStaticMappingCache(true);
return;
}
else{
String [] parsedStr = disableStaticMappingCacheApp.split(",");
for (String toCheckStr:parsedStr){
toCheckStr = toCheckStr.trim();
if (applicationName != null && applicationName.equalsIgnoreCase(toCheckStr)){
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
logger.logp(Level.FINE, CLASS_NAME,"setDisableStaticMappingCache", "disable static mapping cache for application -> "+ applicationName);
this.setDisableStaticMappingCache(true);
return;
}
}
}
}
} | [
"public",
"void",
"setDisableStaticMappingCache",
"(",
")",
"{",
"if",
"(",
"this",
".",
"contextParams",
"!=",
"null",
")",
"{",
"String",
"value",
"=",
"(",
"String",
")",
"this",
".",
"contextParams",
".",
"get",
"(",
"\"com.ibm.ws.webcontainer.DISABLE_STATIC_MAPPING_CACHE\"",
")",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"if",
"(",
"value",
".",
"equalsIgnoreCase",
"(",
"\"true\"",
")",
")",
"{",
"if",
"(",
"com",
".",
"ibm",
".",
"ejs",
".",
"ras",
".",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"logger",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"CLASS_NAME",
",",
"\"setDisableStaticMappingCache\"",
",",
"\"cxtParam disable static mapping cache for application -> \"",
"+",
"applicationName",
")",
";",
"this",
".",
"setDisableStaticMappingCache",
"(",
"true",
")",
";",
"}",
"return",
";",
"}",
"}",
"if",
"(",
"WCCustomProperties",
".",
"DISABLE_STATIC_MAPPING_CACHE",
"!=",
"null",
")",
"{",
"String",
"disableStaticMappingCacheApp",
"=",
"WCCustomProperties",
".",
"DISABLE_STATIC_MAPPING_CACHE",
";",
"if",
"(",
"disableStaticMappingCacheApp",
".",
"equals",
"(",
"\"*\"",
")",
")",
"{",
"if",
"(",
"com",
".",
"ibm",
".",
"ejs",
".",
"ras",
".",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"logger",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"CLASS_NAME",
",",
"\"setDisableStaticMappingCache\"",
",",
"\"disable static mapping cache for all apps.\"",
")",
";",
"this",
".",
"setDisableStaticMappingCache",
"(",
"true",
")",
";",
"return",
";",
"}",
"else",
"{",
"String",
"[",
"]",
"parsedStr",
"=",
"disableStaticMappingCacheApp",
".",
"split",
"(",
"\",\"",
")",
";",
"for",
"(",
"String",
"toCheckStr",
":",
"parsedStr",
")",
"{",
"toCheckStr",
"=",
"toCheckStr",
".",
"trim",
"(",
")",
";",
"if",
"(",
"applicationName",
"!=",
"null",
"&&",
"applicationName",
".",
"equalsIgnoreCase",
"(",
"toCheckStr",
")",
")",
"{",
"if",
"(",
"com",
".",
"ibm",
".",
"ejs",
".",
"ras",
".",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"logger",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"CLASS_NAME",
",",
"\"setDisableStaticMappingCache\"",
",",
"\"disable static mapping cache for application -> \"",
"+",
"applicationName",
")",
";",
"this",
".",
"setDisableStaticMappingCache",
"(",
"true",
")",
";",
"return",
";",
"}",
"}",
"}",
"}",
"}"
] | PM84305 - start | [
"PM84305",
"-",
"start"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/webapp/WebAppConfiguration.java#L1852-L1886 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.