repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1 value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1 value |
|---|---|---|---|---|---|---|---|---|---|---|---|
OpenLiberty/open-liberty | dev/com.ibm.ws.javamail.1.6_fat/fat/src/com/ibm/ws/javamail/fat/POP3Server.java | POP3Server.quit | public void quit() {
try {
this.keepOn = false;
if (this.serverSocket != null && !this.serverSocket.isClosed()) {
this.serverSocket.close();
this.serverSocket = null;
}
} catch (final IOException e) {
throw new RuntimeException(e);
}
} | java | public void quit() {
try {
this.keepOn = false;
if (this.serverSocket != null && !this.serverSocket.isClosed()) {
this.serverSocket.close();
this.serverSocket = null;
}
} catch (final IOException e) {
throw new RuntimeException(e);
}
} | [
"public",
"void",
"quit",
"(",
")",
"{",
"try",
"{",
"this",
".",
"keepOn",
"=",
"false",
";",
"if",
"(",
"this",
".",
"serverSocket",
"!=",
"null",
"&&",
"!",
"this",
".",
"serverSocket",
".",
"isClosed",
"(",
")",
")",
"{",
"this",
".",
"serverSocket",
".",
"close",
"(",
")",
";",
"this",
".",
"serverSocket",
"=",
"null",
";",
"}",
"}",
"catch",
"(",
"final",
"IOException",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"e",
")",
";",
"}",
"}"
] | Exit POP3 server. | [
"Exit",
"POP3",
"server",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.javamail.1.6_fat/fat/src/com/ibm/ws/javamail/fat/POP3Server.java#L52-L62 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.service.location/src/com/ibm/ws/kernel/service/location/internal/SymbolicRootResource.java | SymbolicRootResource.contains | boolean contains(String normalizedPath) {
if (normalizedPath == null)
return false;
if (normalizedPath.length() < normalizedRoot.length())
return false;
return normalizedPath.regionMatches(0, normalizedRoot, 0, normalizedRoot.length());
} | java | boolean contains(String normalizedPath) {
if (normalizedPath == null)
return false;
if (normalizedPath.length() < normalizedRoot.length())
return false;
return normalizedPath.regionMatches(0, normalizedRoot, 0, normalizedRoot.length());
} | [
"boolean",
"contains",
"(",
"String",
"normalizedPath",
")",
"{",
"if",
"(",
"normalizedPath",
"==",
"null",
")",
"return",
"false",
";",
"if",
"(",
"normalizedPath",
".",
"length",
"(",
")",
"<",
"normalizedRoot",
".",
"length",
"(",
")",
")",
"return",
"false",
";",
"return",
"normalizedPath",
".",
"regionMatches",
"(",
"0",
",",
"normalizedRoot",
",",
"0",
",",
"normalizedRoot",
".",
"length",
"(",
")",
")",
";",
"}"
] | Check if the provided path is contained within this root's hierarchy.
@param normalizedPath
normalized path for a potential descendant ('..' and '.' segments
removed)
@return
true if this root contains the resource indicated by the
normalized path, false otherwise (or if the path is null). | [
"Check",
"if",
"the",
"provided",
"path",
"is",
"contained",
"within",
"this",
"root",
"s",
"hierarchy",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.service.location/src/com/ibm/ws/kernel/service/location/internal/SymbolicRootResource.java#L195-L203 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.utils/src/com/ibm/ws/sib/utils/SIBUuidLength.java | SIBUuidLength.getIPAddress | private static String getIPAddress () {
String rc;
try {
rc = InetAddress.getLocalHost().getHostAddress();
} catch (Exception e) {
// No FFDC code needed
rc = Long.valueOf(new Random().nextLong()).toString();
}
return rc;
} | java | private static String getIPAddress () {
String rc;
try {
rc = InetAddress.getLocalHost().getHostAddress();
} catch (Exception e) {
// No FFDC code needed
rc = Long.valueOf(new Random().nextLong()).toString();
}
return rc;
} | [
"private",
"static",
"String",
"getIPAddress",
"(",
")",
"{",
"String",
"rc",
";",
"try",
"{",
"rc",
"=",
"InetAddress",
".",
"getLocalHost",
"(",
")",
".",
"getHostAddress",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"// No FFDC code needed",
"rc",
"=",
"Long",
".",
"valueOf",
"(",
"new",
"Random",
"(",
")",
".",
"nextLong",
"(",
")",
")",
".",
"toString",
"(",
")",
";",
"}",
"return",
"rc",
";",
"}"
] | InetAddress is compatible with both IPv4 & IPv6 | [
"InetAddress",
"is",
"compatible",
"with",
"both",
"IPv4",
"&",
"IPv6"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.utils/src/com/ibm/ws/sib/utils/SIBUuidLength.java#L157-L168 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.authorization.jacc.web/src/com/ibm/ws/security/authorization/jacc/web/impl/WebSecurityPropagatorImpl.java | WebSecurityPropagatorImpl.getSecurityMetadata | private SecurityMetadata getSecurityMetadata(WebAppConfig webAppConfig) {
WebModuleMetaData wmmd = ((WebAppConfigExtended) webAppConfig).getMetaData();
return (SecurityMetadata) wmmd.getSecurityMetaData();
} | java | private SecurityMetadata getSecurityMetadata(WebAppConfig webAppConfig) {
WebModuleMetaData wmmd = ((WebAppConfigExtended) webAppConfig).getMetaData();
return (SecurityMetadata) wmmd.getSecurityMetaData();
} | [
"private",
"SecurityMetadata",
"getSecurityMetadata",
"(",
"WebAppConfig",
"webAppConfig",
")",
"{",
"WebModuleMetaData",
"wmmd",
"=",
"(",
"(",
"WebAppConfigExtended",
")",
"webAppConfig",
")",
".",
"getMetaData",
"(",
")",
";",
"return",
"(",
"SecurityMetadata",
")",
"wmmd",
".",
"getSecurityMetaData",
"(",
")",
";",
"}"
] | Gets the security metadata from the web app config
@param webAppConfig the webAppConfig representing the deployed module
@return the security metadata | [
"Gets",
"the",
"security",
"metadata",
"from",
"the",
"web",
"app",
"config"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.authorization.jacc.web/src/com/ibm/ws/security/authorization/jacc/web/impl/WebSecurityPropagatorImpl.java#L560-L563 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.authorization.jacc.web/src/com/ibm/ws/security/authorization/jacc/web/impl/WebSecurityPropagatorImpl.java | WebSecurityPropagatorImpl.isDenyUncoveredHttpMethods | private boolean isDenyUncoveredHttpMethods(List<SecurityConstraint> scList) {
for (SecurityConstraint sc : scList) {
List<WebResourceCollection> wrcList = sc.getWebResourceCollections();
for (WebResourceCollection wrc : wrcList) {
if (wrc.getDenyUncoveredHttpMethods()) {
return true;
}
}
}
return false;
} | java | private boolean isDenyUncoveredHttpMethods(List<SecurityConstraint> scList) {
for (SecurityConstraint sc : scList) {
List<WebResourceCollection> wrcList = sc.getWebResourceCollections();
for (WebResourceCollection wrc : wrcList) {
if (wrc.getDenyUncoveredHttpMethods()) {
return true;
}
}
}
return false;
} | [
"private",
"boolean",
"isDenyUncoveredHttpMethods",
"(",
"List",
"<",
"SecurityConstraint",
">",
"scList",
")",
"{",
"for",
"(",
"SecurityConstraint",
"sc",
":",
"scList",
")",
"{",
"List",
"<",
"WebResourceCollection",
">",
"wrcList",
"=",
"sc",
".",
"getWebResourceCollections",
"(",
")",
";",
"for",
"(",
"WebResourceCollection",
"wrc",
":",
"wrcList",
")",
"{",
"if",
"(",
"wrc",
".",
"getDenyUncoveredHttpMethods",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"}",
"return",
"false",
";",
"}"
] | Returns whether deny-uncovered-http-methods attribute is set.
In order to check this value, entire WebResourceCollection objects need to be examined,
since it only set properly when web.xml is processed.
@param scList the List of SecurityConstraint objects.
@return true if deny-uncovered-http-methods attribute is set, false otherwise. | [
"Returns",
"whether",
"deny",
"-",
"uncovered",
"-",
"http",
"-",
"methods",
"attribute",
"is",
"set",
".",
"In",
"order",
"to",
"check",
"this",
"value",
"entire",
"WebResourceCollection",
"objects",
"need",
"to",
"be",
"examined",
"since",
"it",
"only",
"set",
"properly",
"when",
"web",
".",
"xml",
"is",
"processed",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.authorization.jacc.web/src/com/ibm/ws/security/authorization/jacc/web/impl/WebSecurityPropagatorImpl.java#L573-L583 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSManagedConnectionFactoryImpl.java | WSManagedConnectionFactoryImpl.createConnectionFactory | @Override
public final DataSource createConnectionFactory(ConnectionManager connMgr) {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(this, tc, "createConnectionFactory", connMgr);
DataSource connFactory = jdbcRuntime.newDataSource(this, connMgr);
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(this, tc, "createConnectionFactory", connFactory);
return connFactory;
} | java | @Override
public final DataSource createConnectionFactory(ConnectionManager connMgr) {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(this, tc, "createConnectionFactory", connMgr);
DataSource connFactory = jdbcRuntime.newDataSource(this, connMgr);
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(this, tc, "createConnectionFactory", connFactory);
return connFactory;
} | [
"@",
"Override",
"public",
"final",
"DataSource",
"createConnectionFactory",
"(",
"ConnectionManager",
"connMgr",
")",
"{",
"final",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"createConnectionFactory\"",
",",
"connMgr",
")",
";",
"DataSource",
"connFactory",
"=",
"jdbcRuntime",
".",
"newDataSource",
"(",
"this",
",",
"connMgr",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"createConnectionFactory\"",
",",
"connFactory",
")",
";",
"return",
"connFactory",
";",
"}"
] | Creates a javax.sql.DataSource that uses the application server provided
connection manager to manage its connections.
@param ConnectionManager connMgr - An application server provided ConnectionManager.
@return a new instance of WSJdbcDataSource or a subclass of it pertaining to a particular JDBC spec level. | [
"Creates",
"a",
"javax",
".",
"sql",
".",
"DataSource",
"that",
"uses",
"the",
"application",
"server",
"provided",
"connection",
"manager",
"to",
"manage",
"its",
"connections",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSManagedConnectionFactoryImpl.java#L352-L364 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSManagedConnectionFactoryImpl.java | WSManagedConnectionFactoryImpl.getConnection | private Connection getConnection(PooledConnection pconn, WSConnectionRequestInfoImpl cri, String userName) throws ResourceException
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(this, tc, "getConnection", AdapterUtil.toString(pconn));
Connection conn = null;
boolean isConnectionSetupComplete = false;
try {
conn = pconn.getConnection();
postGetConnectionHandling(conn);
isConnectionSetupComplete = true;
} catch (SQLException se) {
FFDCFilter.processException(se, getClass().getName(), "260", this);
ResourceException x = AdapterUtil.translateSQLException(se, this, false, getClass());
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(this, tc, "getConnection", se);
throw x;
} finally {
// Destroy the connection if we weren't able to successfully complete the setup.
if (!isConnectionSetupComplete) {
if (conn != null)
try {
conn.close();
} catch (Throwable x) {
}
if (pconn != null)
try {
pconn.close();
} catch (Throwable x) {
}
}
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(this, tc, "getConnection", AdapterUtil.toString(conn));
return conn;
} | java | private Connection getConnection(PooledConnection pconn, WSConnectionRequestInfoImpl cri, String userName) throws ResourceException
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(this, tc, "getConnection", AdapterUtil.toString(pconn));
Connection conn = null;
boolean isConnectionSetupComplete = false;
try {
conn = pconn.getConnection();
postGetConnectionHandling(conn);
isConnectionSetupComplete = true;
} catch (SQLException se) {
FFDCFilter.processException(se, getClass().getName(), "260", this);
ResourceException x = AdapterUtil.translateSQLException(se, this, false, getClass());
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(this, tc, "getConnection", se);
throw x;
} finally {
// Destroy the connection if we weren't able to successfully complete the setup.
if (!isConnectionSetupComplete) {
if (conn != null)
try {
conn.close();
} catch (Throwable x) {
}
if (pconn != null)
try {
pconn.close();
} catch (Throwable x) {
}
}
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(this, tc, "getConnection", AdapterUtil.toString(conn));
return conn;
} | [
"private",
"Connection",
"getConnection",
"(",
"PooledConnection",
"pconn",
",",
"WSConnectionRequestInfoImpl",
"cri",
",",
"String",
"userName",
")",
"throws",
"ResourceException",
"{",
"final",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"getConnection\"",
",",
"AdapterUtil",
".",
"toString",
"(",
"pconn",
")",
")",
";",
"Connection",
"conn",
"=",
"null",
";",
"boolean",
"isConnectionSetupComplete",
"=",
"false",
";",
"try",
"{",
"conn",
"=",
"pconn",
".",
"getConnection",
"(",
")",
";",
"postGetConnectionHandling",
"(",
"conn",
")",
";",
"isConnectionSetupComplete",
"=",
"true",
";",
"}",
"catch",
"(",
"SQLException",
"se",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"se",
",",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
",",
"\"260\"",
",",
"this",
")",
";",
"ResourceException",
"x",
"=",
"AdapterUtil",
".",
"translateSQLException",
"(",
"se",
",",
"this",
",",
"false",
",",
"getClass",
"(",
")",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"getConnection\"",
",",
"se",
")",
";",
"throw",
"x",
";",
"}",
"finally",
"{",
"// Destroy the connection if we weren't able to successfully complete the setup.",
"if",
"(",
"!",
"isConnectionSetupComplete",
")",
"{",
"if",
"(",
"conn",
"!=",
"null",
")",
"try",
"{",
"conn",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"Throwable",
"x",
")",
"{",
"}",
"if",
"(",
"pconn",
"!=",
"null",
")",
"try",
"{",
"pconn",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"Throwable",
"x",
")",
"{",
"}",
"}",
"}",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"getConnection\"",
",",
"AdapterUtil",
".",
"toString",
"(",
"conn",
")",
")",
";",
"return",
"conn",
";",
"}"
] | Gets a java.sql.Connection from a PooledConnection, use the cri to extract certain information
if needed, if trused context is supported, ...
@param PooledConnection pconn - the PooledConnection
@param WSConnectionRequestInfoImpl -- the cri
@param userName the user name for the connection, or NULL if unspecified.
@return java.sql.Connection - Connection to the database
@exception ResouceException - Possible causes for this error are:
1) the database threw an SQLException on PooledConnection.getConnection();
2) there was an SQLException when setting a default property on the Connection | [
"Gets",
"a",
"java",
".",
"sql",
".",
"Connection",
"from",
"a",
"PooledConnection",
"use",
"the",
"cri",
"to",
"extract",
"certain",
"information",
"if",
"needed",
"if",
"trused",
"context",
"is",
"supported",
"..."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSManagedConnectionFactoryImpl.java#L705-L742 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSManagedConnectionFactoryImpl.java | WSManagedConnectionFactoryImpl.getInvalidConnections | @Override
public Set<ManagedConnection> getInvalidConnections(@SuppressWarnings("rawtypes") Set connectionSet) throws ResourceException {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(this, tc, "getInvalidConnections", connectionSet);
Set<ManagedConnection> badSet = new HashSet<ManagedConnection>();
WSRdbManagedConnectionImpl mc = null;
// Loop through each ManagedConnection in the list, using each connection's
// preTestSQLString to check validity. Different connections can
// have different preTestSQLStrings if they were created by different
// ManagedConnectionFactories.
for (Iterator<?> it = connectionSet.iterator(); it.hasNext();) {
mc = (WSRdbManagedConnectionImpl) it.next();
if (!mc.validate())
badSet.add(mc);
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(this, tc, "getInvalidConnections", badSet);
return badSet;
} | java | @Override
public Set<ManagedConnection> getInvalidConnections(@SuppressWarnings("rawtypes") Set connectionSet) throws ResourceException {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(this, tc, "getInvalidConnections", connectionSet);
Set<ManagedConnection> badSet = new HashSet<ManagedConnection>();
WSRdbManagedConnectionImpl mc = null;
// Loop through each ManagedConnection in the list, using each connection's
// preTestSQLString to check validity. Different connections can
// have different preTestSQLStrings if they were created by different
// ManagedConnectionFactories.
for (Iterator<?> it = connectionSet.iterator(); it.hasNext();) {
mc = (WSRdbManagedConnectionImpl) it.next();
if (!mc.validate())
badSet.add(mc);
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(this, tc, "getInvalidConnections", badSet);
return badSet;
} | [
"@",
"Override",
"public",
"Set",
"<",
"ManagedConnection",
">",
"getInvalidConnections",
"(",
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"Set",
"connectionSet",
")",
"throws",
"ResourceException",
"{",
"final",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"getInvalidConnections\"",
",",
"connectionSet",
")",
";",
"Set",
"<",
"ManagedConnection",
">",
"badSet",
"=",
"new",
"HashSet",
"<",
"ManagedConnection",
">",
"(",
")",
";",
"WSRdbManagedConnectionImpl",
"mc",
"=",
"null",
";",
"// Loop through each ManagedConnection in the list, using each connection's",
"// preTestSQLString to check validity. Different connections can",
"// have different preTestSQLStrings if they were created by different",
"// ManagedConnectionFactories.",
"for",
"(",
"Iterator",
"<",
"?",
">",
"it",
"=",
"connectionSet",
".",
"iterator",
"(",
")",
";",
"it",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"mc",
"=",
"(",
"WSRdbManagedConnectionImpl",
")",
"it",
".",
"next",
"(",
")",
";",
"if",
"(",
"!",
"mc",
".",
"validate",
"(",
")",
")",
"badSet",
".",
"add",
"(",
"mc",
")",
";",
"}",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"getInvalidConnections\"",
",",
"badSet",
")",
";",
"return",
"badSet",
";",
"}"
] | The spec interface is defined with raw types, so we have no choice but to declare it that way, too | [
"The",
"spec",
"interface",
"is",
"defined",
"with",
"raw",
"types",
"so",
"we",
"have",
"no",
"choice",
"but",
"to",
"declare",
"it",
"that",
"way",
"too"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSManagedConnectionFactoryImpl.java#L1047-L1071 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSManagedConnectionFactoryImpl.java | WSManagedConnectionFactoryImpl.getTraceable | private Object getTraceable(Object d) throws ResourceException {
WSJdbcTracer tracer = new WSJdbcTracer(helper.getTracer(), helper.getPrintWriter(), d, type, null, true);
Set<Class<?>> classes = new HashSet<Class<?>>();
for (Class<?> cl = d.getClass(); cl != null; cl = cl.getSuperclass())
classes.addAll(Arrays.asList(cl.getInterfaces()));
return Proxy.newProxyInstance(jdbcDriverLoader,
classes.toArray(new Class[classes.size()]),
tracer);
} | java | private Object getTraceable(Object d) throws ResourceException {
WSJdbcTracer tracer = new WSJdbcTracer(helper.getTracer(), helper.getPrintWriter(), d, type, null, true);
Set<Class<?>> classes = new HashSet<Class<?>>();
for (Class<?> cl = d.getClass(); cl != null; cl = cl.getSuperclass())
classes.addAll(Arrays.asList(cl.getInterfaces()));
return Proxy.newProxyInstance(jdbcDriverLoader,
classes.toArray(new Class[classes.size()]),
tracer);
} | [
"private",
"Object",
"getTraceable",
"(",
"Object",
"d",
")",
"throws",
"ResourceException",
"{",
"WSJdbcTracer",
"tracer",
"=",
"new",
"WSJdbcTracer",
"(",
"helper",
".",
"getTracer",
"(",
")",
",",
"helper",
".",
"getPrintWriter",
"(",
")",
",",
"d",
",",
"type",
",",
"null",
",",
"true",
")",
";",
"Set",
"<",
"Class",
"<",
"?",
">",
">",
"classes",
"=",
"new",
"HashSet",
"<",
"Class",
"<",
"?",
">",
">",
"(",
")",
";",
"for",
"(",
"Class",
"<",
"?",
">",
"cl",
"=",
"d",
".",
"getClass",
"(",
")",
";",
"cl",
"!=",
"null",
";",
"cl",
"=",
"cl",
".",
"getSuperclass",
"(",
")",
")",
"classes",
".",
"addAll",
"(",
"Arrays",
".",
"asList",
"(",
"cl",
".",
"getInterfaces",
"(",
")",
")",
")",
";",
"return",
"Proxy",
".",
"newProxyInstance",
"(",
"jdbcDriverLoader",
",",
"classes",
".",
"toArray",
"(",
"new",
"Class",
"[",
"classes",
".",
"size",
"(",
")",
"]",
")",
",",
"tracer",
")",
";",
"}"
] | Enable supplemental tracing for the underlying data source or java.sql.Driver.
@param d the underlying data source or driver.
@return a data source or driver enabled for supplemental trace.
@throws ResourceException if an error occurs obtaining the print writer. | [
"Enable",
"supplemental",
"tracing",
"for",
"the",
"underlying",
"data",
"source",
"or",
"java",
".",
"sql",
".",
"Driver",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSManagedConnectionFactoryImpl.java#L1081-L1091 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSManagedConnectionFactoryImpl.java | WSManagedConnectionFactoryImpl.onConnect | private void onConnect(Connection con, String[] sqlCommands) throws SQLException {
final boolean trace = TraceComponent.isAnyTracingEnabled();
TransactionManager tm = connectorSvc.getTransactionManager();
Transaction suspendedTx = null;
String currentSQL = null;
Throwable failure = null;
try {
UOWCoordinator coord = tm == null ? null : ((UOWCurrent) tm).getUOWCoord();
if (coord != null && coord.isGlobal())
suspendedTx = tm.suspend();
Statement stmt = con.createStatement();
for (String sql : sqlCommands) {
currentSQL = sql;
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "execute onConnect SQL", sql);
stmt.execute(sql);
}
stmt.close();
} catch (Throwable x) {
failure = x;
}
if (suspendedTx != null) {
try {
tm.resume(suspendedTx);
} catch (Throwable x) {
failure = x;
}
}
if (failure != null) {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "failed", AdapterUtil.stackTraceToString(failure));
throw new SQLNonTransientConnectionException(
AdapterUtil.getNLSMessage("DSRA4004.onconnect.sql", currentSQL, dsConfig.get().id), "08000", 0, failure);
}
} | java | private void onConnect(Connection con, String[] sqlCommands) throws SQLException {
final boolean trace = TraceComponent.isAnyTracingEnabled();
TransactionManager tm = connectorSvc.getTransactionManager();
Transaction suspendedTx = null;
String currentSQL = null;
Throwable failure = null;
try {
UOWCoordinator coord = tm == null ? null : ((UOWCurrent) tm).getUOWCoord();
if (coord != null && coord.isGlobal())
suspendedTx = tm.suspend();
Statement stmt = con.createStatement();
for (String sql : sqlCommands) {
currentSQL = sql;
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "execute onConnect SQL", sql);
stmt.execute(sql);
}
stmt.close();
} catch (Throwable x) {
failure = x;
}
if (suspendedTx != null) {
try {
tm.resume(suspendedTx);
} catch (Throwable x) {
failure = x;
}
}
if (failure != null) {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "failed", AdapterUtil.stackTraceToString(failure));
throw new SQLNonTransientConnectionException(
AdapterUtil.getNLSMessage("DSRA4004.onconnect.sql", currentSQL, dsConfig.get().id), "08000", 0, failure);
}
} | [
"private",
"void",
"onConnect",
"(",
"Connection",
"con",
",",
"String",
"[",
"]",
"sqlCommands",
")",
"throws",
"SQLException",
"{",
"final",
"boolean",
"trace",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"TransactionManager",
"tm",
"=",
"connectorSvc",
".",
"getTransactionManager",
"(",
")",
";",
"Transaction",
"suspendedTx",
"=",
"null",
";",
"String",
"currentSQL",
"=",
"null",
";",
"Throwable",
"failure",
"=",
"null",
";",
"try",
"{",
"UOWCoordinator",
"coord",
"=",
"tm",
"==",
"null",
"?",
"null",
":",
"(",
"(",
"UOWCurrent",
")",
"tm",
")",
".",
"getUOWCoord",
"(",
")",
";",
"if",
"(",
"coord",
"!=",
"null",
"&&",
"coord",
".",
"isGlobal",
"(",
")",
")",
"suspendedTx",
"=",
"tm",
".",
"suspend",
"(",
")",
";",
"Statement",
"stmt",
"=",
"con",
".",
"createStatement",
"(",
")",
";",
"for",
"(",
"String",
"sql",
":",
"sqlCommands",
")",
"{",
"currentSQL",
"=",
"sql",
";",
"if",
"(",
"trace",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"execute onConnect SQL\"",
",",
"sql",
")",
";",
"stmt",
".",
"execute",
"(",
"sql",
")",
";",
"}",
"stmt",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"Throwable",
"x",
")",
"{",
"failure",
"=",
"x",
";",
"}",
"if",
"(",
"suspendedTx",
"!=",
"null",
")",
"{",
"try",
"{",
"tm",
".",
"resume",
"(",
"suspendedTx",
")",
";",
"}",
"catch",
"(",
"Throwable",
"x",
")",
"{",
"failure",
"=",
"x",
";",
"}",
"}",
"if",
"(",
"failure",
"!=",
"null",
")",
"{",
"if",
"(",
"trace",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"failed\"",
",",
"AdapterUtil",
".",
"stackTraceToString",
"(",
"failure",
")",
")",
";",
"throw",
"new",
"SQLNonTransientConnectionException",
"(",
"AdapterUtil",
".",
"getNLSMessage",
"(",
"\"DSRA4004.onconnect.sql\"",
",",
"currentSQL",
",",
"dsConfig",
".",
"get",
"(",
")",
".",
"id",
")",
",",
"\"08000\"",
",",
"0",
",",
"failure",
")",
";",
"}",
"}"
] | Execute the onConnect SQL commands. The connection won't be enlisted in a WAS transaction yet,
but it's necessary to suspend and WAS global transaction in order to avoid confusing the
DB2 type 2 JDBC driver.
@param con the connection
@param sqlCommands ordered list of SQL commands to run on the connection.
@throws SQLException if any of the commands fail. | [
"Execute",
"the",
"onConnect",
"SQL",
"commands",
".",
"The",
"connection",
"won",
"t",
"be",
"enlisted",
"in",
"a",
"WAS",
"transaction",
"yet",
"but",
"it",
"s",
"necessary",
"to",
"suspend",
"and",
"WAS",
"global",
"transaction",
"in",
"order",
"to",
"avoid",
"confusing",
"the",
"DB2",
"type",
"2",
"JDBC",
"driver",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSManagedConnectionFactoryImpl.java#L1241-L1278 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSManagedConnectionFactoryImpl.java | WSManagedConnectionFactoryImpl.postGetConnectionHandling | private void postGetConnectionHandling(Connection conn) throws SQLException {
helper.doConnectionSetup(conn);
String[] sqlCommands = dsConfig.get().onConnect;
if (sqlCommands != null && sqlCommands.length > 0)
onConnect(conn, sqlCommands);
// Log the database and driver versions on first getConnection.
if (!wasUsedToGetAConnection) {
// Wait until after the connection succeeds to set the indicator.
// This accounts for the scenario where the first connection attempt is bad.
// The information needs to be read again on the second attempt.
helper.gatherAndDisplayMetaDataInfo(conn, this);
wasUsedToGetAConnection = true;
}
} | java | private void postGetConnectionHandling(Connection conn) throws SQLException {
helper.doConnectionSetup(conn);
String[] sqlCommands = dsConfig.get().onConnect;
if (sqlCommands != null && sqlCommands.length > 0)
onConnect(conn, sqlCommands);
// Log the database and driver versions on first getConnection.
if (!wasUsedToGetAConnection) {
// Wait until after the connection succeeds to set the indicator.
// This accounts for the scenario where the first connection attempt is bad.
// The information needs to be read again on the second attempt.
helper.gatherAndDisplayMetaDataInfo(conn, this);
wasUsedToGetAConnection = true;
}
} | [
"private",
"void",
"postGetConnectionHandling",
"(",
"Connection",
"conn",
")",
"throws",
"SQLException",
"{",
"helper",
".",
"doConnectionSetup",
"(",
"conn",
")",
";",
"String",
"[",
"]",
"sqlCommands",
"=",
"dsConfig",
".",
"get",
"(",
")",
".",
"onConnect",
";",
"if",
"(",
"sqlCommands",
"!=",
"null",
"&&",
"sqlCommands",
".",
"length",
">",
"0",
")",
"onConnect",
"(",
"conn",
",",
"sqlCommands",
")",
";",
"// Log the database and driver versions on first getConnection.",
"if",
"(",
"!",
"wasUsedToGetAConnection",
")",
"{",
"// Wait until after the connection succeeds to set the indicator.",
"// This accounts for the scenario where the first connection attempt is bad.",
"// The information needs to be read again on the second attempt.",
"helper",
".",
"gatherAndDisplayMetaDataInfo",
"(",
"conn",
",",
"this",
")",
";",
"wasUsedToGetAConnection",
"=",
"true",
";",
"}",
"}"
] | utility used to gather metadata info and issue doConnectionSetup. | [
"utility",
"used",
"to",
"gather",
"metadata",
"info",
"and",
"issue",
"doConnectionSetup",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSManagedConnectionFactoryImpl.java#L1283-L1298 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSManagedConnectionFactoryImpl.java | WSManagedConnectionFactoryImpl.reallySetLogWriter | final void reallySetLogWriter(final PrintWriter out) throws ResourceException {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "setting the logWriter to:", out);
if (dataSourceOrDriver != null) {
try {
AccessController.doPrivileged(new PrivilegedExceptionAction<Void>() {
public Void run() throws SQLException {
if(!Driver.class.equals(type)) {
((CommonDataSource) dataSourceOrDriver).setLogWriter(out);
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "Unable to set logwriter on Driver type");
}
return null;
}
});
} catch (PrivilegedActionException pae) {
SQLException se = (SQLException) pae.getCause();
FFDCFilter.processException(se, getClass().getName(), "593", this);
throw AdapterUtil.translateSQLException(se, this, false, getClass());
}
}
logWriter = out; // Keep the value only if successful on the DataSource.
} | java | final void reallySetLogWriter(final PrintWriter out) throws ResourceException {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "setting the logWriter to:", out);
if (dataSourceOrDriver != null) {
try {
AccessController.doPrivileged(new PrivilegedExceptionAction<Void>() {
public Void run() throws SQLException {
if(!Driver.class.equals(type)) {
((CommonDataSource) dataSourceOrDriver).setLogWriter(out);
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "Unable to set logwriter on Driver type");
}
return null;
}
});
} catch (PrivilegedActionException pae) {
SQLException se = (SQLException) pae.getCause();
FFDCFilter.processException(se, getClass().getName(), "593", this);
throw AdapterUtil.translateSQLException(se, this, false, getClass());
}
}
logWriter = out; // Keep the value only if successful on the DataSource.
} | [
"final",
"void",
"reallySetLogWriter",
"(",
"final",
"PrintWriter",
"out",
")",
"throws",
"ResourceException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"setting the logWriter to:\"",
",",
"out",
")",
";",
"if",
"(",
"dataSourceOrDriver",
"!=",
"null",
")",
"{",
"try",
"{",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"PrivilegedExceptionAction",
"<",
"Void",
">",
"(",
")",
"{",
"public",
"Void",
"run",
"(",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"!",
"Driver",
".",
"class",
".",
"equals",
"(",
"type",
")",
")",
"{",
"(",
"(",
"CommonDataSource",
")",
"dataSourceOrDriver",
")",
".",
"setLogWriter",
"(",
"out",
")",
";",
"}",
"else",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Unable to set logwriter on Driver type\"",
")",
";",
"}",
"return",
"null",
";",
"}",
"}",
")",
";",
"}",
"catch",
"(",
"PrivilegedActionException",
"pae",
")",
"{",
"SQLException",
"se",
"=",
"(",
"SQLException",
")",
"pae",
".",
"getCause",
"(",
")",
";",
"FFDCFilter",
".",
"processException",
"(",
"se",
",",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
",",
"\"593\"",
",",
"this",
")",
";",
"throw",
"AdapterUtil",
".",
"translateSQLException",
"(",
"se",
",",
"this",
",",
"false",
",",
"getClass",
"(",
")",
")",
";",
"}",
"}",
"logWriter",
"=",
"out",
";",
"// Keep the value only if successful on the DataSource.",
"}"
] | This method is to be used by RRA code to set logwriter when needed | [
"This",
"method",
"is",
"to",
"be",
"used",
"by",
"RRA",
"code",
"to",
"set",
"logwriter",
"when",
"needed"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSManagedConnectionFactoryImpl.java#L1337-L1362 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSManagedConnectionFactoryImpl.java | WSManagedConnectionFactoryImpl.getLoginTimeout | public final int getLoginTimeout() throws SQLException {
try {
if(!Driver.class.equals(type)) {
return ((CommonDataSource) dataSourceOrDriver).getLoginTimeout();
}
//Return that the default value is being used when using the Driver type
return 0;
} catch (SQLException sqlX) {
FFDCFilter.processException(sqlX, getClass().getName(), "1670", this);
throw AdapterUtil.mapSQLException(sqlX, this);
}
} | java | public final int getLoginTimeout() throws SQLException {
try {
if(!Driver.class.equals(type)) {
return ((CommonDataSource) dataSourceOrDriver).getLoginTimeout();
}
//Return that the default value is being used when using the Driver type
return 0;
} catch (SQLException sqlX) {
FFDCFilter.processException(sqlX, getClass().getName(), "1670", this);
throw AdapterUtil.mapSQLException(sqlX, this);
}
} | [
"public",
"final",
"int",
"getLoginTimeout",
"(",
")",
"throws",
"SQLException",
"{",
"try",
"{",
"if",
"(",
"!",
"Driver",
".",
"class",
".",
"equals",
"(",
"type",
")",
")",
"{",
"return",
"(",
"(",
"CommonDataSource",
")",
"dataSourceOrDriver",
")",
".",
"getLoginTimeout",
"(",
")",
";",
"}",
"//Return that the default value is being used when using the Driver type",
"return",
"0",
";",
"}",
"catch",
"(",
"SQLException",
"sqlX",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"sqlX",
",",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
",",
"\"1670\"",
",",
"this",
")",
";",
"throw",
"AdapterUtil",
".",
"mapSQLException",
"(",
"sqlX",
",",
"this",
")",
";",
"}",
"}"
] | Retrieves the login timeout for the DataSource.
@return the login timeout for the DataSource. | [
"Retrieves",
"the",
"login",
"timeout",
"for",
"the",
"DataSource",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSManagedConnectionFactoryImpl.java#L1422-L1433 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/HpelBasicFormatter.java | HpelBasicFormatter.formatRecord | @Override
public String formatRecord(RepositoryLogRecord record, Locale locale) {
if (null == record) {
throw new IllegalArgumentException("Record cannot be null");
}
StringBuilder sb = new StringBuilder(300);
String lineSeparatorPlusPadding = "";
// Use basic format
createEventHeader(record, sb);
lineSeparatorPlusPadding = svLineSeparatorPlusBasicPadding;
// add the localizedMsg
sb.append(formatMessage(record, locale));
// if we have a stack trace, append that to the formatted output.
if (record.getStackTrace() != null) {
sb.append(lineSeparatorPlusPadding);
sb.append(record.getStackTrace());
}
return sb.toString();
} | java | @Override
public String formatRecord(RepositoryLogRecord record, Locale locale) {
if (null == record) {
throw new IllegalArgumentException("Record cannot be null");
}
StringBuilder sb = new StringBuilder(300);
String lineSeparatorPlusPadding = "";
// Use basic format
createEventHeader(record, sb);
lineSeparatorPlusPadding = svLineSeparatorPlusBasicPadding;
// add the localizedMsg
sb.append(formatMessage(record, locale));
// if we have a stack trace, append that to the formatted output.
if (record.getStackTrace() != null) {
sb.append(lineSeparatorPlusPadding);
sb.append(record.getStackTrace());
}
return sb.toString();
} | [
"@",
"Override",
"public",
"String",
"formatRecord",
"(",
"RepositoryLogRecord",
"record",
",",
"Locale",
"locale",
")",
"{",
"if",
"(",
"null",
"==",
"record",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Record cannot be null\"",
")",
";",
"}",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"300",
")",
";",
"String",
"lineSeparatorPlusPadding",
"=",
"\"\"",
";",
"// Use basic format",
"createEventHeader",
"(",
"record",
",",
"sb",
")",
";",
"lineSeparatorPlusPadding",
"=",
"svLineSeparatorPlusBasicPadding",
";",
"// add the localizedMsg",
"sb",
".",
"append",
"(",
"formatMessage",
"(",
"record",
",",
"locale",
")",
")",
";",
"// if we have a stack trace, append that to the formatted output.",
"if",
"(",
"record",
".",
"getStackTrace",
"(",
")",
"!=",
"null",
")",
"{",
"sb",
".",
"append",
"(",
"lineSeparatorPlusPadding",
")",
";",
"sb",
".",
"append",
"(",
"record",
".",
"getStackTrace",
"(",
")",
")",
";",
"}",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}"
] | Formats a RepositoryLogRecord into a localized basic format output String.
@param record the RepositoryLogRecord to be formatted
@param locale the Locale to use for localization when formatting this record.
@return the formated string output. | [
"Formats",
"a",
"RepositoryLogRecord",
"into",
"a",
"localized",
"basic",
"format",
"output",
"String",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/HpelBasicFormatter.java#L36-L58 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/taglib/GlobalTagLibraryCache.java | GlobalTagLibraryCache.loadTldFromClassloader | private void loadTldFromClassloader(GlobalTagLibConfig globalTagLibConfig, TldParser tldParser) {
for (Iterator itr = globalTagLibConfig.getTldPathList().iterator(); itr.hasNext();) {
TldPathConfig tldPathConfig = (TldPathConfig) itr.next();
InputStream is = globalTagLibConfig.getClassloader().getResourceAsStream(tldPathConfig.getTldPath());
JspInputSource tldInputSource = new JspInputSourceFromInputStreamImpl(is);
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) {
logger.logp(Level.FINE, CLASS_NAME, "loadTldFromClassloader", "tldInputSource.getRelativeURL(): [" + tldInputSource.getRelativeURL() + "]");
logger.logp(Level.FINE, CLASS_NAME, "loadTldFromClassloader", "tldInputSource.getAbsoluteURL(): [" + tldInputSource.getAbsoluteURL() + "]");
logger.logp(Level.FINE, CLASS_NAME, "loadTldFromClassloader", "tldInputSource.getContextURL(): [" + tldInputSource.getContextURL() + "]");
logger.logp(Level.FINE, CLASS_NAME, "loadTldFromClassloader", "globalTagLibConfig.getJarURL(): [" + globalTagLibConfig.getJarURL() + "]");
logger.logp(Level.FINE, CLASS_NAME, "loadTldFromClassloader", "tldPathConfig.getTldPath(): [" + tldPathConfig.getTldPath() + "]");
}
try {
TagLibraryInfoImpl tli = tldParser.parseTLD(tldInputSource, is, globalTagLibConfig.getJarURL().toExternalForm());
if (tli.getReliableURN() != null) {
if (containsKey(tli.getReliableURN()) == false) {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) {
logger.logp(Level.FINE, CLASS_NAME, "loadTldFromClassloader", "Global jar tld loaded for {0}", tli.getReliableURN());
}
tli.setURI(tli.getReliableURN());
put(tli.getReliableURN(), tli);
tldPathConfig.setUri(tli.getReliableURN());
eventListenerList.addAll(tldParser.getEventListenerList());
}
} else {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.WARNING)) {
logger.logp(Level.WARNING, CLASS_NAME, "loadTldFromClassloader", "jsp warning failed to find a uri tag in [" + tldInputSource.getAbsoluteURL() + "]");
}
}
} catch (JspCoreException e) {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.WARNING)) {
logger.logp(Level.WARNING, CLASS_NAME, "loadTldFromClassloader", "jsp warning failed to load tld in jar. uri = [" + tldInputSource.getAbsoluteURL() + "]", e);
}
}
}
} | java | private void loadTldFromClassloader(GlobalTagLibConfig globalTagLibConfig, TldParser tldParser) {
for (Iterator itr = globalTagLibConfig.getTldPathList().iterator(); itr.hasNext();) {
TldPathConfig tldPathConfig = (TldPathConfig) itr.next();
InputStream is = globalTagLibConfig.getClassloader().getResourceAsStream(tldPathConfig.getTldPath());
JspInputSource tldInputSource = new JspInputSourceFromInputStreamImpl(is);
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) {
logger.logp(Level.FINE, CLASS_NAME, "loadTldFromClassloader", "tldInputSource.getRelativeURL(): [" + tldInputSource.getRelativeURL() + "]");
logger.logp(Level.FINE, CLASS_NAME, "loadTldFromClassloader", "tldInputSource.getAbsoluteURL(): [" + tldInputSource.getAbsoluteURL() + "]");
logger.logp(Level.FINE, CLASS_NAME, "loadTldFromClassloader", "tldInputSource.getContextURL(): [" + tldInputSource.getContextURL() + "]");
logger.logp(Level.FINE, CLASS_NAME, "loadTldFromClassloader", "globalTagLibConfig.getJarURL(): [" + globalTagLibConfig.getJarURL() + "]");
logger.logp(Level.FINE, CLASS_NAME, "loadTldFromClassloader", "tldPathConfig.getTldPath(): [" + tldPathConfig.getTldPath() + "]");
}
try {
TagLibraryInfoImpl tli = tldParser.parseTLD(tldInputSource, is, globalTagLibConfig.getJarURL().toExternalForm());
if (tli.getReliableURN() != null) {
if (containsKey(tli.getReliableURN()) == false) {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) {
logger.logp(Level.FINE, CLASS_NAME, "loadTldFromClassloader", "Global jar tld loaded for {0}", tli.getReliableURN());
}
tli.setURI(tli.getReliableURN());
put(tli.getReliableURN(), tli);
tldPathConfig.setUri(tli.getReliableURN());
eventListenerList.addAll(tldParser.getEventListenerList());
}
} else {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.WARNING)) {
logger.logp(Level.WARNING, CLASS_NAME, "loadTldFromClassloader", "jsp warning failed to find a uri tag in [" + tldInputSource.getAbsoluteURL() + "]");
}
}
} catch (JspCoreException e) {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.WARNING)) {
logger.logp(Level.WARNING, CLASS_NAME, "loadTldFromClassloader", "jsp warning failed to load tld in jar. uri = [" + tldInputSource.getAbsoluteURL() + "]", e);
}
}
}
} | [
"private",
"void",
"loadTldFromClassloader",
"(",
"GlobalTagLibConfig",
"globalTagLibConfig",
",",
"TldParser",
"tldParser",
")",
"{",
"for",
"(",
"Iterator",
"itr",
"=",
"globalTagLibConfig",
".",
"getTldPathList",
"(",
")",
".",
"iterator",
"(",
")",
";",
"itr",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"TldPathConfig",
"tldPathConfig",
"=",
"(",
"TldPathConfig",
")",
"itr",
".",
"next",
"(",
")",
";",
"InputStream",
"is",
"=",
"globalTagLibConfig",
".",
"getClassloader",
"(",
")",
".",
"getResourceAsStream",
"(",
"tldPathConfig",
".",
"getTldPath",
"(",
")",
")",
";",
"JspInputSource",
"tldInputSource",
"=",
"new",
"JspInputSourceFromInputStreamImpl",
"(",
"is",
")",
";",
"if",
"(",
"com",
".",
"ibm",
".",
"ejs",
".",
"ras",
".",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"{",
"logger",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"CLASS_NAME",
",",
"\"loadTldFromClassloader\"",
",",
"\"tldInputSource.getRelativeURL(): [\"",
"+",
"tldInputSource",
".",
"getRelativeURL",
"(",
")",
"+",
"\"]\"",
")",
";",
"logger",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"CLASS_NAME",
",",
"\"loadTldFromClassloader\"",
",",
"\"tldInputSource.getAbsoluteURL(): [\"",
"+",
"tldInputSource",
".",
"getAbsoluteURL",
"(",
")",
"+",
"\"]\"",
")",
";",
"logger",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"CLASS_NAME",
",",
"\"loadTldFromClassloader\"",
",",
"\"tldInputSource.getContextURL(): [\"",
"+",
"tldInputSource",
".",
"getContextURL",
"(",
")",
"+",
"\"]\"",
")",
";",
"logger",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"CLASS_NAME",
",",
"\"loadTldFromClassloader\"",
",",
"\"globalTagLibConfig.getJarURL(): [\"",
"+",
"globalTagLibConfig",
".",
"getJarURL",
"(",
")",
"+",
"\"]\"",
")",
";",
"logger",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"CLASS_NAME",
",",
"\"loadTldFromClassloader\"",
",",
"\"tldPathConfig.getTldPath(): [\"",
"+",
"tldPathConfig",
".",
"getTldPath",
"(",
")",
"+",
"\"]\"",
")",
";",
"}",
"try",
"{",
"TagLibraryInfoImpl",
"tli",
"=",
"tldParser",
".",
"parseTLD",
"(",
"tldInputSource",
",",
"is",
",",
"globalTagLibConfig",
".",
"getJarURL",
"(",
")",
".",
"toExternalForm",
"(",
")",
")",
";",
"if",
"(",
"tli",
".",
"getReliableURN",
"(",
")",
"!=",
"null",
")",
"{",
"if",
"(",
"containsKey",
"(",
"tli",
".",
"getReliableURN",
"(",
")",
")",
"==",
"false",
")",
"{",
"if",
"(",
"com",
".",
"ibm",
".",
"ejs",
".",
"ras",
".",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"{",
"logger",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"CLASS_NAME",
",",
"\"loadTldFromClassloader\"",
",",
"\"Global jar tld loaded for {0}\"",
",",
"tli",
".",
"getReliableURN",
"(",
")",
")",
";",
"}",
"tli",
".",
"setURI",
"(",
"tli",
".",
"getReliableURN",
"(",
")",
")",
";",
"put",
"(",
"tli",
".",
"getReliableURN",
"(",
")",
",",
"tli",
")",
";",
"tldPathConfig",
".",
"setUri",
"(",
"tli",
".",
"getReliableURN",
"(",
")",
")",
";",
"eventListenerList",
".",
"addAll",
"(",
"tldParser",
".",
"getEventListenerList",
"(",
")",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"com",
".",
"ibm",
".",
"ejs",
".",
"ras",
".",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"WARNING",
")",
")",
"{",
"logger",
".",
"logp",
"(",
"Level",
".",
"WARNING",
",",
"CLASS_NAME",
",",
"\"loadTldFromClassloader\"",
",",
"\"jsp warning failed to find a uri tag in [\"",
"+",
"tldInputSource",
".",
"getAbsoluteURL",
"(",
")",
"+",
"\"]\"",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"JspCoreException",
"e",
")",
"{",
"if",
"(",
"com",
".",
"ibm",
".",
"ejs",
".",
"ras",
".",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"WARNING",
")",
")",
"{",
"logger",
".",
"logp",
"(",
"Level",
".",
"WARNING",
",",
"CLASS_NAME",
",",
"\"loadTldFromClassloader\"",
",",
"\"jsp warning failed to load tld in jar. uri = [\"",
"+",
"tldInputSource",
".",
"getAbsoluteURL",
"(",
")",
"+",
"\"]\"",
",",
"e",
")",
";",
"}",
"}",
"}",
"}"
] | Added by DJV for Liberty - we don't want to depend on the taglib coming from a jar on our
class path if we can avoid it, so this version uses the classloader specified by the povided
taglib config to find and read the TLDs from that taglib config.
@param globalTagLibConfig The global taglib config from which to parse some TLDs
@param tldParser The parser to used | [
"Added",
"by",
"DJV",
"for",
"Liberty",
"-",
"we",
"don",
"t",
"want",
"to",
"depend",
"on",
"the",
"taglib",
"coming",
"from",
"a",
"jar",
"on",
"our",
"class",
"path",
"if",
"we",
"can",
"avoid",
"it",
"so",
"this",
"version",
"uses",
"the",
"classloader",
"specified",
"by",
"the",
"povided",
"taglib",
"config",
"to",
"find",
"and",
"read",
"the",
"TLDs",
"from",
"that",
"taglib",
"config",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/taglib/GlobalTagLibraryCache.java#L550-L586 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/taglib/GlobalTagLibraryCache.java | GlobalTagLibraryCache.addGlobalTagLibConfig | public void addGlobalTagLibConfig(GlobalTagLibConfig globalTagLibConfig) {
try {
TldParser tldParser = new TldParser(this, configManager, false, globalTagLibConfig.getClassloader());
if (globalTagLibConfig.getClassloader() == null)
loadTldFromJarInputStream(globalTagLibConfig, tldParser);
else
loadTldFromClassloader(globalTagLibConfig, tldParser);
globalTagLibConfigList.add(globalTagLibConfig);
}
catch (JspCoreException e) {
if(com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable(Level.SEVERE)){
logger.logp(Level.SEVERE, CLASS_NAME, "addGlobalTagLibConfig", "failed to create TldParser ", e);
}
}
} | java | public void addGlobalTagLibConfig(GlobalTagLibConfig globalTagLibConfig) {
try {
TldParser tldParser = new TldParser(this, configManager, false, globalTagLibConfig.getClassloader());
if (globalTagLibConfig.getClassloader() == null)
loadTldFromJarInputStream(globalTagLibConfig, tldParser);
else
loadTldFromClassloader(globalTagLibConfig, tldParser);
globalTagLibConfigList.add(globalTagLibConfig);
}
catch (JspCoreException e) {
if(com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable(Level.SEVERE)){
logger.logp(Level.SEVERE, CLASS_NAME, "addGlobalTagLibConfig", "failed to create TldParser ", e);
}
}
} | [
"public",
"void",
"addGlobalTagLibConfig",
"(",
"GlobalTagLibConfig",
"globalTagLibConfig",
")",
"{",
"try",
"{",
"TldParser",
"tldParser",
"=",
"new",
"TldParser",
"(",
"this",
",",
"configManager",
",",
"false",
",",
"globalTagLibConfig",
".",
"getClassloader",
"(",
")",
")",
";",
"if",
"(",
"globalTagLibConfig",
".",
"getClassloader",
"(",
")",
"==",
"null",
")",
"loadTldFromJarInputStream",
"(",
"globalTagLibConfig",
",",
"tldParser",
")",
";",
"else",
"loadTldFromClassloader",
"(",
"globalTagLibConfig",
",",
"tldParser",
")",
";",
"globalTagLibConfigList",
".",
"add",
"(",
"globalTagLibConfig",
")",
";",
"}",
"catch",
"(",
"JspCoreException",
"e",
")",
"{",
"if",
"(",
"com",
".",
"ibm",
".",
"ejs",
".",
"ras",
".",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"SEVERE",
")",
")",
"{",
"logger",
".",
"logp",
"(",
"Level",
".",
"SEVERE",
",",
"CLASS_NAME",
",",
"\"addGlobalTagLibConfig\"",
",",
"\"failed to create TldParser \"",
",",
"e",
")",
";",
"}",
"}",
"}"
] | add some GlobalTabLibConfig to the global tag libs we know about. If the provided
config provides a classloader, we will load the TLDs via that class loaders, otherwise the
JAR URL will be used to find the TLDs.
@param globalTagLibConfig The global tag lib config | [
"add",
"some",
"GlobalTabLibConfig",
"to",
"the",
"global",
"tag",
"libs",
"we",
"know",
"about",
".",
"If",
"the",
"provided",
"config",
"provides",
"a",
"classloader",
"we",
"will",
"load",
"the",
"TLDs",
"via",
"that",
"class",
"loaders",
"otherwise",
"the",
"JAR",
"URL",
"will",
"be",
"used",
"to",
"find",
"the",
"TLDs",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/taglib/GlobalTagLibraryCache.java#L596-L612 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/ClientConnectionManager.java | ClientConnectionManager.getRef | public static synchronized ClientConnectionManager getRef()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getRef");
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getRef", instance);
return instance;
} | java | public static synchronized ClientConnectionManager getRef()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getRef");
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getRef", instance);
return instance;
} | [
"public",
"static",
"synchronized",
"ClientConnectionManager",
"getRef",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"getRef\"",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"getRef\"",
",",
"instance",
")",
";",
"return",
"instance",
";",
"}"
] | Returns a reference to the single instance of this class in existence.
The class must have been previously initilised by a call to the
"initialise" method - otherwise invoking this method will generate a
runtime exception.
This class implements the singleton design pattern.
@return ChannelFramework A reference to the only instance of this class
which exists. | [
"Returns",
"a",
"reference",
"to",
"the",
"single",
"instance",
"of",
"this",
"class",
"in",
"existence",
".",
"The",
"class",
"must",
"have",
"been",
"previously",
"initilised",
"by",
"a",
"call",
"to",
"the",
"initialise",
"method",
"-",
"otherwise",
"invoking",
"this",
"method",
"will",
"generate",
"a",
"runtime",
"exception",
".",
"This",
"class",
"implements",
"the",
"singleton",
"design",
"pattern",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/ClientConnectionManager.java#L131-L138 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/stat/StatsImpl.java | StatsImpl.getStatistic | @Override
public WSStatistic getStatistic(int dataId) {
ArrayList members = copyStatistics();
if (members == null || members.size() <= 0)
return null;
int sz = members.size();
for (int i = 0; i < sz; i++) {
StatisticImpl data = (StatisticImpl) members.get(i);
if (data != null && data.getId() == dataId) {
return data;
}
}
return null;
} | java | @Override
public WSStatistic getStatistic(int dataId) {
ArrayList members = copyStatistics();
if (members == null || members.size() <= 0)
return null;
int sz = members.size();
for (int i = 0; i < sz; i++) {
StatisticImpl data = (StatisticImpl) members.get(i);
if (data != null && data.getId() == dataId) {
return data;
}
}
return null;
} | [
"@",
"Override",
"public",
"WSStatistic",
"getStatistic",
"(",
"int",
"dataId",
")",
"{",
"ArrayList",
"members",
"=",
"copyStatistics",
"(",
")",
";",
"if",
"(",
"members",
"==",
"null",
"||",
"members",
".",
"size",
"(",
")",
"<=",
"0",
")",
"return",
"null",
";",
"int",
"sz",
"=",
"members",
".",
"size",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"sz",
";",
"i",
"++",
")",
"{",
"StatisticImpl",
"data",
"=",
"(",
"StatisticImpl",
")",
"members",
".",
"get",
"(",
"i",
")",
";",
"if",
"(",
"data",
"!=",
"null",
"&&",
"data",
".",
"getId",
"(",
")",
"==",
"dataId",
")",
"{",
"return",
"data",
";",
"}",
"}",
"return",
"null",
";",
"}"
] | get Statistic by data id | [
"get",
"Statistic",
"by",
"data",
"id"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/stat/StatsImpl.java#L194-L208 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/stat/StatsImpl.java | StatsImpl.myupdate | private synchronized void myupdate(WSStats newStats, boolean keepOld, boolean recursiveUpdate) {
if (newStats == null)
return;
StatsImpl newStats1 = (StatsImpl) newStats;
// update the level and description of this collection
this.instrumentationLevel = newStats1.getLevel();
// update data
updateMembers(newStats, keepOld);
// update subcollections
if (recursiveUpdate)
updateSubcollection(newStats, keepOld, recursiveUpdate);
} | java | private synchronized void myupdate(WSStats newStats, boolean keepOld, boolean recursiveUpdate) {
if (newStats == null)
return;
StatsImpl newStats1 = (StatsImpl) newStats;
// update the level and description of this collection
this.instrumentationLevel = newStats1.getLevel();
// update data
updateMembers(newStats, keepOld);
// update subcollections
if (recursiveUpdate)
updateSubcollection(newStats, keepOld, recursiveUpdate);
} | [
"private",
"synchronized",
"void",
"myupdate",
"(",
"WSStats",
"newStats",
",",
"boolean",
"keepOld",
",",
"boolean",
"recursiveUpdate",
")",
"{",
"if",
"(",
"newStats",
"==",
"null",
")",
"return",
";",
"StatsImpl",
"newStats1",
"=",
"(",
"StatsImpl",
")",
"newStats",
";",
"// update the level and description of this collection",
"this",
".",
"instrumentationLevel",
"=",
"newStats1",
".",
"getLevel",
"(",
")",
";",
"// update data",
"updateMembers",
"(",
"newStats",
",",
"keepOld",
")",
";",
"// update subcollections",
"if",
"(",
"recursiveUpdate",
")",
"updateSubcollection",
"(",
"newStats",
",",
"keepOld",
",",
"recursiveUpdate",
")",
";",
"}"
] | Assume we have verified newStats is the same PMI module as this Stats | [
"Assume",
"we",
"have",
"verified",
"newStats",
"is",
"the",
"same",
"PMI",
"module",
"as",
"this",
"Stats"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/stat/StatsImpl.java#L639-L653 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/impl/CheapRangeTable.java | CheapRangeTable.insert | public void insert(SimpleTest test, Object target) {
if (size == ranges.length) {
RangeEntry[] tmp = new RangeEntry[2*size];
System.arraycopy(ranges,0,tmp,0,size);
ranges = tmp;
}
ranges[size] = new RangeEntry(test, target);
size++;
} | java | public void insert(SimpleTest test, Object target) {
if (size == ranges.length) {
RangeEntry[] tmp = new RangeEntry[2*size];
System.arraycopy(ranges,0,tmp,0,size);
ranges = tmp;
}
ranges[size] = new RangeEntry(test, target);
size++;
} | [
"public",
"void",
"insert",
"(",
"SimpleTest",
"test",
",",
"Object",
"target",
")",
"{",
"if",
"(",
"size",
"==",
"ranges",
".",
"length",
")",
"{",
"RangeEntry",
"[",
"]",
"tmp",
"=",
"new",
"RangeEntry",
"[",
"2",
"*",
"size",
"]",
";",
"System",
".",
"arraycopy",
"(",
"ranges",
",",
"0",
",",
"tmp",
",",
"0",
",",
"size",
")",
";",
"ranges",
"=",
"tmp",
";",
"}",
"ranges",
"[",
"size",
"]",
"=",
"new",
"RangeEntry",
"(",
"test",
",",
"target",
")",
";",
"size",
"++",
";",
"}"
] | Insert a range and an associated target into the table.
@param test a SimpleTest of kind==NUMERIC containing the range
@param target The target associated with the range. | [
"Insert",
"a",
"range",
"and",
"an",
"associated",
"target",
"into",
"the",
"table",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/impl/CheapRangeTable.java#L47-L56 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/impl/CheapRangeTable.java | CheapRangeTable.getExact | public Object getExact(SimpleTest test) {
for (int i = 0; i < size; i++) {
if (ranges[i].correspondsTo(test))
return ranges[i].target;
}
return null;
} | java | public Object getExact(SimpleTest test) {
for (int i = 0; i < size; i++) {
if (ranges[i].correspondsTo(test))
return ranges[i].target;
}
return null;
} | [
"public",
"Object",
"getExact",
"(",
"SimpleTest",
"test",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"size",
";",
"i",
"++",
")",
"{",
"if",
"(",
"ranges",
"[",
"i",
"]",
".",
"correspondsTo",
"(",
"test",
")",
")",
"return",
"ranges",
"[",
"i",
"]",
".",
"target",
";",
"}",
"return",
"null",
";",
"}"
] | Retrieve the Object associated with an exactly defined range | [
"Retrieve",
"the",
"Object",
"associated",
"with",
"an",
"exactly",
"defined",
"range"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/impl/CheapRangeTable.java#L60-L66 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/impl/CheapRangeTable.java | CheapRangeTable.replace | public void replace(SimpleTest test, Object target) {
for (int i = 0; i < size; i++)
if (ranges[i].correspondsTo(test)) {
ranges[i].target = target;
return;
}
throw new IllegalStateException();
} | java | public void replace(SimpleTest test, Object target) {
for (int i = 0; i < size; i++)
if (ranges[i].correspondsTo(test)) {
ranges[i].target = target;
return;
}
throw new IllegalStateException();
} | [
"public",
"void",
"replace",
"(",
"SimpleTest",
"test",
",",
"Object",
"target",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"size",
";",
"i",
"++",
")",
"if",
"(",
"ranges",
"[",
"i",
"]",
".",
"correspondsTo",
"(",
"test",
")",
")",
"{",
"ranges",
"[",
"i",
"]",
".",
"target",
"=",
"target",
";",
"return",
";",
"}",
"throw",
"new",
"IllegalStateException",
"(",
")",
";",
"}"
] | Replace the Object in a range that is known to exist | [
"Replace",
"the",
"Object",
"in",
"a",
"range",
"that",
"is",
"known",
"to",
"exist"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/impl/CheapRangeTable.java#L70-L77 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/impl/CheapRangeTable.java | CheapRangeTable.find | public List find(Number value) { // was NumericValue
List targets = new ArrayList(1);
for (int i = 0; i < size; i++) {
if (ranges[i].contains(value))
targets.add(ranges[i].target);
}
return targets;
} | java | public List find(Number value) { // was NumericValue
List targets = new ArrayList(1);
for (int i = 0; i < size; i++) {
if (ranges[i].contains(value))
targets.add(ranges[i].target);
}
return targets;
} | [
"public",
"List",
"find",
"(",
"Number",
"value",
")",
"{",
"// was NumericValue",
"List",
"targets",
"=",
"new",
"ArrayList",
"(",
"1",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"size",
";",
"i",
"++",
")",
"{",
"if",
"(",
"ranges",
"[",
"i",
"]",
".",
"contains",
"(",
"value",
")",
")",
"targets",
".",
"add",
"(",
"ranges",
"[",
"i",
"]",
".",
"target",
")",
";",
"}",
"return",
"targets",
";",
"}"
] | Find targets associated with all ranges including this value.
@param value Value to search for.
@return List of all targets found. | [
"Find",
"targets",
"associated",
"with",
"all",
"ranges",
"including",
"this",
"value",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/impl/CheapRangeTable.java#L85-L94 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.config/src/com/ibm/ws/config/xml/internal/XMLConfigParser.java | XMLConfigParser.parseServerConfiguration | @FFDCIgnore(XMLStreamException.class)
public boolean parseServerConfiguration(InputStream in, String docLocation, BaseConfiguration config,
MergeBehavior mergeBehavior) throws ConfigParserException, ConfigValidationException {
XMLStreamReader parser = null;
try {
parser = getXMLInputFactory().createXMLStreamReader(docLocation, in);
return parseServerConfiguration(new DepthAwareXMLStreamReader(parser), docLocation, config, mergeBehavior);
} catch (XMLStreamException e) {
throw new ConfigParserException(e);
} finally {
if (parser != null) {
try {
parser.close();
} catch (XMLStreamException e) {
throw new ConfigParserException(e);
}
}
}
} | java | @FFDCIgnore(XMLStreamException.class)
public boolean parseServerConfiguration(InputStream in, String docLocation, BaseConfiguration config,
MergeBehavior mergeBehavior) throws ConfigParserException, ConfigValidationException {
XMLStreamReader parser = null;
try {
parser = getXMLInputFactory().createXMLStreamReader(docLocation, in);
return parseServerConfiguration(new DepthAwareXMLStreamReader(parser), docLocation, config, mergeBehavior);
} catch (XMLStreamException e) {
throw new ConfigParserException(e);
} finally {
if (parser != null) {
try {
parser.close();
} catch (XMLStreamException e) {
throw new ConfigParserException(e);
}
}
}
} | [
"@",
"FFDCIgnore",
"(",
"XMLStreamException",
".",
"class",
")",
"public",
"boolean",
"parseServerConfiguration",
"(",
"InputStream",
"in",
",",
"String",
"docLocation",
",",
"BaseConfiguration",
"config",
",",
"MergeBehavior",
"mergeBehavior",
")",
"throws",
"ConfigParserException",
",",
"ConfigValidationException",
"{",
"XMLStreamReader",
"parser",
"=",
"null",
";",
"try",
"{",
"parser",
"=",
"getXMLInputFactory",
"(",
")",
".",
"createXMLStreamReader",
"(",
"docLocation",
",",
"in",
")",
";",
"return",
"parseServerConfiguration",
"(",
"new",
"DepthAwareXMLStreamReader",
"(",
"parser",
")",
",",
"docLocation",
",",
"config",
",",
"mergeBehavior",
")",
";",
"}",
"catch",
"(",
"XMLStreamException",
"e",
")",
"{",
"throw",
"new",
"ConfigParserException",
"(",
"e",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"parser",
"!=",
"null",
")",
"{",
"try",
"{",
"parser",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"XMLStreamException",
"e",
")",
"{",
"throw",
"new",
"ConfigParserException",
"(",
"e",
")",
";",
"}",
"}",
"}",
"}"
] | private if not for tests | [
"private",
"if",
"not",
"for",
"tests"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.config/src/com/ibm/ws/config/xml/internal/XMLConfigParser.java#L175-L193 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.faulttolerance/src/com/ibm/ws/microprofile/faulttolerance/impl/TimeoutImpl.java | TimeoutImpl.start | public void start(QueuedFuture<?> queuedFuture) {
Runnable timeoutTask = () -> {
queuedFuture.abort(new TimeoutException());
};
start(timeoutTask);
} | java | public void start(QueuedFuture<?> queuedFuture) {
Runnable timeoutTask = () -> {
queuedFuture.abort(new TimeoutException());
};
start(timeoutTask);
} | [
"public",
"void",
"start",
"(",
"QueuedFuture",
"<",
"?",
">",
"queuedFuture",
")",
"{",
"Runnable",
"timeoutTask",
"=",
"(",
")",
"->",
"{",
"queuedFuture",
".",
"abort",
"(",
"new",
"TimeoutException",
"(",
")",
")",
";",
"}",
";",
"start",
"(",
"timeoutTask",
")",
";",
"}"
] | start timer and cancel given future | [
"start",
"timer",
"and",
"cancel",
"given",
"future"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.faulttolerance/src/com/ibm/ws/microprofile/faulttolerance/impl/TimeoutImpl.java#L72-L78 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.faulttolerance/src/com/ibm/ws/microprofile/faulttolerance/impl/TimeoutImpl.java | TimeoutImpl.timeout | private void timeout() {
lock.writeLock().lock();
try {
//if already stopped, do nothing, otherwise check times and run the timeout task
if (!this.stopped) {
long now = System.nanoTime();
long remaining = this.targetEnd - now;
this.timedout = remaining <= FTConstants.MIN_TIMEOUT_NANO;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
debugTime("!Start {0}", this.start);
debugTime("!Target {0}", this.targetEnd);
debugTime("!Now {0}", now);
debugTime("!Remain {0}", remaining);
}
//if we really have timedout then run the timeout task
if (this.timedout) {
debugRelativeTime("Timeout!");
this.timeoutTask.run();
} else {
//this shouldn't be possible but if the timer popped too early, restart it
debugTime("Premature Timeout!", remaining);
start(this.timeoutTask, remaining);
}
}
} finally {
lock.writeLock().unlock();
}
} | java | private void timeout() {
lock.writeLock().lock();
try {
//if already stopped, do nothing, otherwise check times and run the timeout task
if (!this.stopped) {
long now = System.nanoTime();
long remaining = this.targetEnd - now;
this.timedout = remaining <= FTConstants.MIN_TIMEOUT_NANO;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
debugTime("!Start {0}", this.start);
debugTime("!Target {0}", this.targetEnd);
debugTime("!Now {0}", now);
debugTime("!Remain {0}", remaining);
}
//if we really have timedout then run the timeout task
if (this.timedout) {
debugRelativeTime("Timeout!");
this.timeoutTask.run();
} else {
//this shouldn't be possible but if the timer popped too early, restart it
debugTime("Premature Timeout!", remaining);
start(this.timeoutTask, remaining);
}
}
} finally {
lock.writeLock().unlock();
}
} | [
"private",
"void",
"timeout",
"(",
")",
"{",
"lock",
".",
"writeLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"//if already stopped, do nothing, otherwise check times and run the timeout task",
"if",
"(",
"!",
"this",
".",
"stopped",
")",
"{",
"long",
"now",
"=",
"System",
".",
"nanoTime",
"(",
")",
";",
"long",
"remaining",
"=",
"this",
".",
"targetEnd",
"-",
"now",
";",
"this",
".",
"timedout",
"=",
"remaining",
"<=",
"FTConstants",
".",
"MIN_TIMEOUT_NANO",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"debugTime",
"(",
"\"!Start {0}\"",
",",
"this",
".",
"start",
")",
";",
"debugTime",
"(",
"\"!Target {0}\"",
",",
"this",
".",
"targetEnd",
")",
";",
"debugTime",
"(",
"\"!Now {0}\"",
",",
"now",
")",
";",
"debugTime",
"(",
"\"!Remain {0}\"",
",",
"remaining",
")",
";",
"}",
"//if we really have timedout then run the timeout task",
"if",
"(",
"this",
".",
"timedout",
")",
"{",
"debugRelativeTime",
"(",
"\"Timeout!\"",
")",
";",
"this",
".",
"timeoutTask",
".",
"run",
"(",
")",
";",
"}",
"else",
"{",
"//this shouldn't be possible but if the timer popped too early, restart it",
"debugTime",
"(",
"\"Premature Timeout!\"",
",",
"remaining",
")",
";",
"start",
"(",
"this",
".",
"timeoutTask",
",",
"remaining",
")",
";",
"}",
"}",
"}",
"finally",
"{",
"lock",
".",
"writeLock",
"(",
")",
".",
"unlock",
"(",
")",
";",
"}",
"}"
] | This method is run when the timer pops | [
"This",
"method",
"is",
"run",
"when",
"the",
"timer",
"pops"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.faulttolerance/src/com/ibm/ws/microprofile/faulttolerance/impl/TimeoutImpl.java#L83-L112 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.faulttolerance/src/com/ibm/ws/microprofile/faulttolerance/impl/TimeoutImpl.java | TimeoutImpl.start | private void start(Runnable timeoutTask) {
long timeout = timeoutPolicy.getTimeout().toNanos();
start(timeoutTask, timeout);
} | java | private void start(Runnable timeoutTask) {
long timeout = timeoutPolicy.getTimeout().toNanos();
start(timeoutTask, timeout);
} | [
"private",
"void",
"start",
"(",
"Runnable",
"timeoutTask",
")",
"{",
"long",
"timeout",
"=",
"timeoutPolicy",
".",
"getTimeout",
"(",
")",
".",
"toNanos",
"(",
")",
";",
"start",
"(",
"timeoutTask",
",",
"timeout",
")",
";",
"}"
] | Get the timeout from the policy and start the timer
@param timeoutTask | [
"Get",
"the",
"timeout",
"from",
"the",
"policy",
"and",
"start",
"the",
"timer"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.faulttolerance/src/com/ibm/ws/microprofile/faulttolerance/impl/TimeoutImpl.java#L119-L122 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.faulttolerance/src/com/ibm/ws/microprofile/faulttolerance/impl/TimeoutImpl.java | TimeoutImpl.start | private void start(Runnable timeoutTask, long remainingNanos) {
lock.writeLock().lock();
try {
this.timeoutTask = timeoutTask;
this.start = System.nanoTime();
this.targetEnd = start + remainingNanos;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
debugTime(">Start {0}", this.start);
debugTime(">Target {0}", this.targetEnd);
debugTime(">Now {0}", this.start);
debugTime(">Remain {0}", remainingNanos);
}
Runnable task = () -> {
timeout();
};
if (remainingNanos > FTConstants.MIN_TIMEOUT_NANO) {
this.future = scheduledExecutorService.schedule(task, remainingNanos, TimeUnit.NANOSECONDS);
} else {
task.run();
}
} finally {
lock.writeLock().unlock();
}
} | java | private void start(Runnable timeoutTask, long remainingNanos) {
lock.writeLock().lock();
try {
this.timeoutTask = timeoutTask;
this.start = System.nanoTime();
this.targetEnd = start + remainingNanos;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
debugTime(">Start {0}", this.start);
debugTime(">Target {0}", this.targetEnd);
debugTime(">Now {0}", this.start);
debugTime(">Remain {0}", remainingNanos);
}
Runnable task = () -> {
timeout();
};
if (remainingNanos > FTConstants.MIN_TIMEOUT_NANO) {
this.future = scheduledExecutorService.schedule(task, remainingNanos, TimeUnit.NANOSECONDS);
} else {
task.run();
}
} finally {
lock.writeLock().unlock();
}
} | [
"private",
"void",
"start",
"(",
"Runnable",
"timeoutTask",
",",
"long",
"remainingNanos",
")",
"{",
"lock",
".",
"writeLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"this",
".",
"timeoutTask",
"=",
"timeoutTask",
";",
"this",
".",
"start",
"=",
"System",
".",
"nanoTime",
"(",
")",
";",
"this",
".",
"targetEnd",
"=",
"start",
"+",
"remainingNanos",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"debugTime",
"(",
"\">Start {0}\"",
",",
"this",
".",
"start",
")",
";",
"debugTime",
"(",
"\">Target {0}\"",
",",
"this",
".",
"targetEnd",
")",
";",
"debugTime",
"(",
"\">Now {0}\"",
",",
"this",
".",
"start",
")",
";",
"debugTime",
"(",
"\">Remain {0}\"",
",",
"remainingNanos",
")",
";",
"}",
"Runnable",
"task",
"=",
"(",
")",
"->",
"{",
"timeout",
"(",
")",
";",
"}",
";",
"if",
"(",
"remainingNanos",
">",
"FTConstants",
".",
"MIN_TIMEOUT_NANO",
")",
"{",
"this",
".",
"future",
"=",
"scheduledExecutorService",
".",
"schedule",
"(",
"task",
",",
"remainingNanos",
",",
"TimeUnit",
".",
"NANOSECONDS",
")",
";",
"}",
"else",
"{",
"task",
".",
"run",
"(",
")",
";",
"}",
"}",
"finally",
"{",
"lock",
".",
"writeLock",
"(",
")",
".",
"unlock",
"(",
")",
";",
"}",
"}"
] | This is the method which actually starts the timer
WARNING: This method uses System.nanoTime(). nanoTime is a point in time relative to an arbitrary point (fixed at runtime).
As a result, it could be positive or negative and will not bare any relation to the actual time ... it's just a relative measure.
Also, since it could be massively positive or negative, caution must be used when doing comparisons due to the possibility
of numerical overflow e.g. one should use t1 - t0 < 0, not t1 < t0
The reason we use this here is that it not affected by changes to the system clock at runtime
@param timeoutTask
@param remainingNanos | [
"This",
"is",
"the",
"method",
"which",
"actually",
"starts",
"the",
"timer"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.faulttolerance/src/com/ibm/ws/microprofile/faulttolerance/impl/TimeoutImpl.java#L136-L163 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.faulttolerance/src/com/ibm/ws/microprofile/faulttolerance/impl/TimeoutImpl.java | TimeoutImpl.stop | public void stop() {
lock.writeLock().lock();
try {
debugRelativeTime("Stop!");
this.stopped = true;
if (this.future != null && !this.future.isDone()) {
debugRelativeTime("Cancelling");
this.future.cancel(true);
}
this.future = null;
} finally {
lock.writeLock().unlock();
}
} | java | public void stop() {
lock.writeLock().lock();
try {
debugRelativeTime("Stop!");
this.stopped = true;
if (this.future != null && !this.future.isDone()) {
debugRelativeTime("Cancelling");
this.future.cancel(true);
}
this.future = null;
} finally {
lock.writeLock().unlock();
}
} | [
"public",
"void",
"stop",
"(",
")",
"{",
"lock",
".",
"writeLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"debugRelativeTime",
"(",
"\"Stop!\"",
")",
";",
"this",
".",
"stopped",
"=",
"true",
";",
"if",
"(",
"this",
".",
"future",
"!=",
"null",
"&&",
"!",
"this",
".",
"future",
".",
"isDone",
"(",
")",
")",
"{",
"debugRelativeTime",
"(",
"\"Cancelling\"",
")",
";",
"this",
".",
"future",
".",
"cancel",
"(",
"true",
")",
";",
"}",
"this",
".",
"future",
"=",
"null",
";",
"}",
"finally",
"{",
"lock",
".",
"writeLock",
"(",
")",
".",
"unlock",
"(",
")",
";",
"}",
"}"
] | Stop the timeout ... mark it as stopped and cancel the scheduled future task if required | [
"Stop",
"the",
"timeout",
"...",
"mark",
"it",
"as",
"stopped",
"and",
"cancel",
"the",
"scheduled",
"future",
"task",
"if",
"required"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.faulttolerance/src/com/ibm/ws/microprofile/faulttolerance/impl/TimeoutImpl.java#L168-L182 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.faulttolerance/src/com/ibm/ws/microprofile/faulttolerance/impl/TimeoutImpl.java | TimeoutImpl.restart | public void restart() {
lock.writeLock().lock();
try {
if (this.timeoutTask == null) {
throw new IllegalStateException(Tr.formatMessage(tc, "internal.error.CWMFT4999E"));
}
stop();
this.stopped = false;
start(this.timeoutTask);
} finally {
lock.writeLock().unlock();
}
} | java | public void restart() {
lock.writeLock().lock();
try {
if (this.timeoutTask == null) {
throw new IllegalStateException(Tr.formatMessage(tc, "internal.error.CWMFT4999E"));
}
stop();
this.stopped = false;
start(this.timeoutTask);
} finally {
lock.writeLock().unlock();
}
} | [
"public",
"void",
"restart",
"(",
")",
"{",
"lock",
".",
"writeLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"this",
".",
"timeoutTask",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"Tr",
".",
"formatMessage",
"(",
"tc",
",",
"\"internal.error.CWMFT4999E\"",
")",
")",
";",
"}",
"stop",
"(",
")",
";",
"this",
".",
"stopped",
"=",
"false",
";",
"start",
"(",
"this",
".",
"timeoutTask",
")",
";",
"}",
"finally",
"{",
"lock",
".",
"writeLock",
"(",
")",
".",
"unlock",
"(",
")",
";",
"}",
"}"
] | Restart the timer ... stop the timer, reset the stopped flag and then start again with the same timeout policy | [
"Restart",
"the",
"timer",
"...",
"stop",
"the",
"timer",
"reset",
"the",
"stopped",
"flag",
"and",
"then",
"start",
"again",
"with",
"the",
"same",
"timeout",
"policy"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.faulttolerance/src/com/ibm/ws/microprofile/faulttolerance/impl/TimeoutImpl.java#L197-L209 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.faulttolerance/src/com/ibm/ws/microprofile/faulttolerance/impl/TimeoutImpl.java | TimeoutImpl.check | public long check() {
long remaining = 0;
lock.readLock().lock();
try {
if (this.timedout) {
// Note: this clears the interrupted flag if it was set
// Assumption is that the interruption was caused by the Timeout
boolean wasInterrupted = Thread.interrupted();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
if (wasInterrupted) {
Tr.debug(tc, "{0}: Throwing timeout exception and clearing interrupted flag", getDescriptor());
} else {
Tr.debug(tc, "{0}: Throwing timeout exception", getDescriptor());
}
}
throw new TimeoutException(Tr.formatMessage(tc, "timeout.occurred.CWMFT0000E"));
}
long now = System.nanoTime();
remaining = this.targetEnd - now;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
debugTime("?Start ", this.start);
debugTime("?Target", this.targetEnd);
debugTime("?Now ", now);
debugTime("?Remain", remaining);
}
} finally {
lock.readLock().unlock();
}
return remaining;
} | java | public long check() {
long remaining = 0;
lock.readLock().lock();
try {
if (this.timedout) {
// Note: this clears the interrupted flag if it was set
// Assumption is that the interruption was caused by the Timeout
boolean wasInterrupted = Thread.interrupted();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
if (wasInterrupted) {
Tr.debug(tc, "{0}: Throwing timeout exception and clearing interrupted flag", getDescriptor());
} else {
Tr.debug(tc, "{0}: Throwing timeout exception", getDescriptor());
}
}
throw new TimeoutException(Tr.formatMessage(tc, "timeout.occurred.CWMFT0000E"));
}
long now = System.nanoTime();
remaining = this.targetEnd - now;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
debugTime("?Start ", this.start);
debugTime("?Target", this.targetEnd);
debugTime("?Now ", now);
debugTime("?Remain", remaining);
}
} finally {
lock.readLock().unlock();
}
return remaining;
} | [
"public",
"long",
"check",
"(",
")",
"{",
"long",
"remaining",
"=",
"0",
";",
"lock",
".",
"readLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"this",
".",
"timedout",
")",
"{",
"// Note: this clears the interrupted flag if it was set",
"// Assumption is that the interruption was caused by the Timeout",
"boolean",
"wasInterrupted",
"=",
"Thread",
".",
"interrupted",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"if",
"(",
"wasInterrupted",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"{0}: Throwing timeout exception and clearing interrupted flag\"",
",",
"getDescriptor",
"(",
")",
")",
";",
"}",
"else",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"{0}: Throwing timeout exception\"",
",",
"getDescriptor",
"(",
")",
")",
";",
"}",
"}",
"throw",
"new",
"TimeoutException",
"(",
"Tr",
".",
"formatMessage",
"(",
"tc",
",",
"\"timeout.occurred.CWMFT0000E\"",
")",
")",
";",
"}",
"long",
"now",
"=",
"System",
".",
"nanoTime",
"(",
")",
";",
"remaining",
"=",
"this",
".",
"targetEnd",
"-",
"now",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"debugTime",
"(",
"\"?Start \"",
",",
"this",
".",
"start",
")",
";",
"debugTime",
"(",
"\"?Target\"",
",",
"this",
".",
"targetEnd",
")",
";",
"debugTime",
"(",
"\"?Now \"",
",",
"now",
")",
";",
"debugTime",
"(",
"\"?Remain\"",
",",
"remaining",
")",
";",
"}",
"}",
"finally",
"{",
"lock",
".",
"readLock",
"(",
")",
".",
"unlock",
"(",
")",
";",
"}",
"return",
"remaining",
";",
"}"
] | Check if the timedout flag was previously set and throw an exception if it was.
Otherwise, return the remaining timeout time, in nanoseconds.
@return the time remaining, in nanoseconds | [
"Check",
"if",
"the",
"timedout",
"flag",
"was",
"previously",
"set",
"and",
"throw",
"an",
"exception",
"if",
"it",
"was",
".",
"Otherwise",
"return",
"the",
"remaining",
"timeout",
"time",
"in",
"nanoseconds",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.faulttolerance/src/com/ibm/ws/microprofile/faulttolerance/impl/TimeoutImpl.java#L244-L276 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.faulttolerance/src/com/ibm/ws/microprofile/faulttolerance/impl/TimeoutImpl.java | TimeoutImpl.debugTime | @Trivial
private void debugTime(String message, long nanos) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
FTDebug.debugTime(tc, getDescriptor(), message, nanos);
}
} | java | @Trivial
private void debugTime(String message, long nanos) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
FTDebug.debugTime(tc, getDescriptor(), message, nanos);
}
} | [
"@",
"Trivial",
"private",
"void",
"debugTime",
"(",
"String",
"message",
",",
"long",
"nanos",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"FTDebug",
".",
"debugTime",
"(",
"tc",
",",
"getDescriptor",
"(",
")",
",",
"message",
",",
"nanos",
")",
";",
"}",
"}"
] | Output a debug message showing a given relative time, converted from nanos to seconds
@param message
@param nanos | [
"Output",
"a",
"debug",
"message",
"showing",
"a",
"given",
"relative",
"time",
"converted",
"from",
"nanos",
"to",
"seconds"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.faulttolerance/src/com/ibm/ws/microprofile/faulttolerance/impl/TimeoutImpl.java#L307-L312 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.service/src/com/ibm/wsspi/kernel/service/utils/FilterUtils.java | FilterUtils.createPropertyFilter | public static String createPropertyFilter(String name, String value) {
assert name.matches("[^=><~()]+");
StringBuilder builder = new StringBuilder(name.length() + 3 + (value == null ? 0 : value.length() * 2));
builder.append('(').append(name).append('=');
int begin = 0;
if (value != null) {
for (int i = 0; i < value.length(); i++) {
if ("\\*()".indexOf(value.charAt(i)) != -1) {
builder.append(value, begin, i).append('\\');
begin = i;
}
}
return builder.append(value, begin, value.length()).append(')').toString();
} else {
return builder.append(')').toString();
}
} | java | public static String createPropertyFilter(String name, String value) {
assert name.matches("[^=><~()]+");
StringBuilder builder = new StringBuilder(name.length() + 3 + (value == null ? 0 : value.length() * 2));
builder.append('(').append(name).append('=');
int begin = 0;
if (value != null) {
for (int i = 0; i < value.length(); i++) {
if ("\\*()".indexOf(value.charAt(i)) != -1) {
builder.append(value, begin, i).append('\\');
begin = i;
}
}
return builder.append(value, begin, value.length()).append(')').toString();
} else {
return builder.append(')').toString();
}
} | [
"public",
"static",
"String",
"createPropertyFilter",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"assert",
"name",
".",
"matches",
"(",
"\"[^=><~()]+\"",
")",
";",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
"name",
".",
"length",
"(",
")",
"+",
"3",
"+",
"(",
"value",
"==",
"null",
"?",
"0",
":",
"value",
".",
"length",
"(",
")",
"*",
"2",
")",
")",
";",
"builder",
".",
"append",
"(",
"'",
"'",
")",
".",
"append",
"(",
"name",
")",
".",
"append",
"(",
"'",
"'",
")",
";",
"int",
"begin",
"=",
"0",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"value",
".",
"length",
"(",
")",
";",
"i",
"++",
")",
"{",
"if",
"(",
"\"\\\\*()\"",
".",
"indexOf",
"(",
"value",
".",
"charAt",
"(",
"i",
")",
")",
"!=",
"-",
"1",
")",
"{",
"builder",
".",
"append",
"(",
"value",
",",
"begin",
",",
"i",
")",
".",
"append",
"(",
"'",
"'",
")",
";",
"begin",
"=",
"i",
";",
"}",
"}",
"return",
"builder",
".",
"append",
"(",
"value",
",",
"begin",
",",
"value",
".",
"length",
"(",
")",
")",
".",
"append",
"(",
"'",
"'",
")",
".",
"toString",
"(",
")",
";",
"}",
"else",
"{",
"return",
"builder",
".",
"append",
"(",
"'",
"'",
")",
".",
"toString",
"(",
")",
";",
"}",
"}"
] | Creates a filter string that matches an attribute value exactly.
Characters in the value with special meaning will be escaped.
@param name a valid attribute name
@param value the exact attribute value | [
"Creates",
"a",
"filter",
"string",
"that",
"matches",
"an",
"attribute",
"value",
"exactly",
".",
"Characters",
"in",
"the",
"value",
"with",
"special",
"meaning",
"will",
"be",
"escaped",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.service/src/com/ibm/wsspi/kernel/service/utils/FilterUtils.java#L25-L44 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/InstallUtils.java | InstallUtils.delete | public static void delete(final File f) {
if (f != null && f.exists()) {
// Why do we have to specify a return type for the run method and paramatize
// PrivilegedExceptionAction to it, this method should have a void return type ideally.
AccessController.doPrivileged(new PrivilegedAction<Object>() {
@Override
public Object run() {
if (!f.delete()) {
logger.log(Level.INFO, Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("LOG_CANNOT_DELETE_FILE",
f.getAbsolutePath()));
f.deleteOnExit();
}
return null;
}
});
}
} | java | public static void delete(final File f) {
if (f != null && f.exists()) {
// Why do we have to specify a return type for the run method and paramatize
// PrivilegedExceptionAction to it, this method should have a void return type ideally.
AccessController.doPrivileged(new PrivilegedAction<Object>() {
@Override
public Object run() {
if (!f.delete()) {
logger.log(Level.INFO, Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("LOG_CANNOT_DELETE_FILE",
f.getAbsolutePath()));
f.deleteOnExit();
}
return null;
}
});
}
} | [
"public",
"static",
"void",
"delete",
"(",
"final",
"File",
"f",
")",
"{",
"if",
"(",
"f",
"!=",
"null",
"&&",
"f",
".",
"exists",
"(",
")",
")",
"{",
"// Why do we have to specify a return type for the run method and paramatize",
"// PrivilegedExceptionAction to it, this method should have a void return type ideally.",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"PrivilegedAction",
"<",
"Object",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Object",
"run",
"(",
")",
"{",
"if",
"(",
"!",
"f",
".",
"delete",
"(",
")",
")",
"{",
"logger",
".",
"log",
"(",
"Level",
".",
"INFO",
",",
"Messages",
".",
"INSTALL_KERNEL_MESSAGES",
".",
"getLogMessage",
"(",
"\"LOG_CANNOT_DELETE_FILE\"",
",",
"f",
".",
"getAbsolutePath",
"(",
")",
")",
")",
";",
"f",
".",
"deleteOnExit",
"(",
")",
";",
"}",
"return",
"null",
";",
"}",
"}",
")",
";",
"}",
"}"
] | Java 2 security APIs for deleteOnExit | [
"Java",
"2",
"security",
"APIs",
"for",
"deleteOnExit"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/InstallUtils.java#L788-L805 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/InstallUtils.java | InstallUtils.getFileIputStream | public static FileInputStream getFileIputStream(final File file) throws FileNotFoundException {
try {
return AccessController.doPrivileged(
new PrivilegedExceptionAction<FileInputStream>() {
@Override
public FileInputStream run() throws FileNotFoundException {
return new FileInputStream(file);
}
});
} catch (PrivilegedActionException e) {
// Creating a FileOutputStream can only return a FileNotFoundException
throw (FileNotFoundException) e.getCause();
}
} | java | public static FileInputStream getFileIputStream(final File file) throws FileNotFoundException {
try {
return AccessController.doPrivileged(
new PrivilegedExceptionAction<FileInputStream>() {
@Override
public FileInputStream run() throws FileNotFoundException {
return new FileInputStream(file);
}
});
} catch (PrivilegedActionException e) {
// Creating a FileOutputStream can only return a FileNotFoundException
throw (FileNotFoundException) e.getCause();
}
} | [
"public",
"static",
"FileInputStream",
"getFileIputStream",
"(",
"final",
"File",
"file",
")",
"throws",
"FileNotFoundException",
"{",
"try",
"{",
"return",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"PrivilegedExceptionAction",
"<",
"FileInputStream",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"FileInputStream",
"run",
"(",
")",
"throws",
"FileNotFoundException",
"{",
"return",
"new",
"FileInputStream",
"(",
"file",
")",
";",
"}",
"}",
")",
";",
"}",
"catch",
"(",
"PrivilegedActionException",
"e",
")",
"{",
"// Creating a FileOutputStream can only return a FileNotFoundException",
"throw",
"(",
"FileNotFoundException",
")",
"e",
".",
"getCause",
"(",
")",
";",
"}",
"}"
] | Java 2 security APIs for FileInputStream | [
"Java",
"2",
"security",
"APIs",
"for",
"FileInputStream"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/InstallUtils.java#L808-L821 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/InstallUtils.java | InstallUtils.getFileLength | public static long getFileLength(final File file) throws FileNotFoundException {
try {
return AccessController.doPrivileged(
new PrivilegedExceptionAction<Long>() {
@Override
public Long run() throws FileNotFoundException {
return file.length();
}
});
} catch (PrivilegedActionException e) {
// Creating a FileOutputStream can only return a FileNotFoundException
throw (FileNotFoundException) e.getCause();
}
} | java | public static long getFileLength(final File file) throws FileNotFoundException {
try {
return AccessController.doPrivileged(
new PrivilegedExceptionAction<Long>() {
@Override
public Long run() throws FileNotFoundException {
return file.length();
}
});
} catch (PrivilegedActionException e) {
// Creating a FileOutputStream can only return a FileNotFoundException
throw (FileNotFoundException) e.getCause();
}
} | [
"public",
"static",
"long",
"getFileLength",
"(",
"final",
"File",
"file",
")",
"throws",
"FileNotFoundException",
"{",
"try",
"{",
"return",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"PrivilegedExceptionAction",
"<",
"Long",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Long",
"run",
"(",
")",
"throws",
"FileNotFoundException",
"{",
"return",
"file",
".",
"length",
"(",
")",
";",
"}",
"}",
")",
";",
"}",
"catch",
"(",
"PrivilegedActionException",
"e",
")",
"{",
"// Creating a FileOutputStream can only return a FileNotFoundException",
"throw",
"(",
"FileNotFoundException",
")",
"e",
".",
"getCause",
"(",
")",
";",
"}",
"}"
] | Java 2 security APIs for file length | [
"Java",
"2",
"security",
"APIs",
"for",
"file",
"length"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/InstallUtils.java#L824-L837 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jndi.url.contexts/src/com/ibm/ws/jndi/url/contexts/javacolon/internal/JavaURLContextFactory.java | JavaURLContextFactory.createJavaURLContext | JavaURLContext createJavaURLContext(Hashtable<?, ?> envmt, Name name) {
return new JavaURLContext(envmt, helperServices, name);
} | java | JavaURLContext createJavaURLContext(Hashtable<?, ?> envmt, Name name) {
return new JavaURLContext(envmt, helperServices, name);
} | [
"JavaURLContext",
"createJavaURLContext",
"(",
"Hashtable",
"<",
"?",
",",
"?",
">",
"envmt",
",",
"Name",
"name",
")",
"{",
"return",
"new",
"JavaURLContext",
"(",
"envmt",
",",
"helperServices",
",",
"name",
")",
";",
"}"
] | This method should only be called by the JavaURLContextReplacer class for
de-serializing an instance of JavaURLContext. The name parameter can be
null. | [
"This",
"method",
"should",
"only",
"be",
"called",
"by",
"the",
"JavaURLContextReplacer",
"class",
"for",
"de",
"-",
"serializing",
"an",
"instance",
"of",
"JavaURLContext",
".",
"The",
"name",
"parameter",
"can",
"be",
"null",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jndi.url.contexts/src/com/ibm/ws/jndi/url/contexts/javacolon/internal/JavaURLContextFactory.java#L103-L105 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.session/src/com/ibm/ws/session/SessionAffinityManager.java | SessionAffinityManager.encodeURL | public String encodeURL(HttpSession session, String url) {
return encodeURL(session, null, url, null);
} | java | public String encodeURL(HttpSession session, String url) {
return encodeURL(session, null, url, null);
} | [
"public",
"String",
"encodeURL",
"(",
"HttpSession",
"session",
",",
"String",
"url",
")",
"{",
"return",
"encodeURL",
"(",
"session",
",",
"null",
",",
"url",
",",
"null",
")",
";",
"}"
] | called from ConvergedHttpSession.encodeURL path | [
"called",
"from",
"ConvergedHttpSession",
".",
"encodeURL",
"path"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.session/src/com/ibm/ws/session/SessionAffinityManager.java#L231-L233 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOSCBodyReadCallback.java | HttpOSCBodyReadCallback.complete | public void complete(VirtualConnection vc, TCPReadRequestContext rsc) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "complete() called: vc=" + vc);
}
HttpOutboundServiceContextImpl mySC = (HttpOutboundServiceContextImpl) vc.getStateMap().get(CallbackIDs.CALLBACK_HTTPOSC);
mySC.continueRead();
} | java | public void complete(VirtualConnection vc, TCPReadRequestContext rsc) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "complete() called: vc=" + vc);
}
HttpOutboundServiceContextImpl mySC = (HttpOutboundServiceContextImpl) vc.getStateMap().get(CallbackIDs.CALLBACK_HTTPOSC);
mySC.continueRead();
} | [
"public",
"void",
"complete",
"(",
"VirtualConnection",
"vc",
",",
"TCPReadRequestContext",
"rsc",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"complete() called: vc=\"",
"+",
"vc",
")",
";",
"}",
"HttpOutboundServiceContextImpl",
"mySC",
"=",
"(",
"HttpOutboundServiceContextImpl",
")",
"vc",
".",
"getStateMap",
"(",
")",
".",
"get",
"(",
"CallbackIDs",
".",
"CALLBACK_HTTPOSC",
")",
";",
"mySC",
".",
"continueRead",
"(",
")",
";",
"}"
] | Called by the channel below us when a read has finished.
@param vc
@param rsc | [
"Called",
"by",
"the",
"channel",
"below",
"us",
"when",
"a",
"read",
"has",
"finished",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOSCBodyReadCallback.java#L55-L62 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOSCBodyReadCallback.java | HttpOSCBodyReadCallback.error | public void error(VirtualConnection vc, TCPReadRequestContext rsc, IOException ioe) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "error() called: vc=" + vc + " ioe=" + ioe);
}
HttpOutboundServiceContextImpl mySC = (HttpOutboundServiceContextImpl) vc.getStateMap().get(CallbackIDs.CALLBACK_HTTPOSC);
// Reading a body from an HTTP/1.0 server that closes the connection
// after completely sending the body will trigger an IOException here.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Socket closure, signaling close.");
}
// only valid if this response is a non-length delimited body
// otherwise pass the exception up to the application channel
// PK18799 - check the stored SC values instead of msg as Proxy may
// change it on the fly
if (!mySC.isChunkedEncoding() && !mySC.isContentLength()) {
mySC.prepareClosure();
mySC.getAppReadCallback().complete(vc);
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "IOException during body read");
}
mySC.setPersistent(false);
mySC.getAppReadCallback().error(vc, ioe);
}
} | java | public void error(VirtualConnection vc, TCPReadRequestContext rsc, IOException ioe) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "error() called: vc=" + vc + " ioe=" + ioe);
}
HttpOutboundServiceContextImpl mySC = (HttpOutboundServiceContextImpl) vc.getStateMap().get(CallbackIDs.CALLBACK_HTTPOSC);
// Reading a body from an HTTP/1.0 server that closes the connection
// after completely sending the body will trigger an IOException here.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Socket closure, signaling close.");
}
// only valid if this response is a non-length delimited body
// otherwise pass the exception up to the application channel
// PK18799 - check the stored SC values instead of msg as Proxy may
// change it on the fly
if (!mySC.isChunkedEncoding() && !mySC.isContentLength()) {
mySC.prepareClosure();
mySC.getAppReadCallback().complete(vc);
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "IOException during body read");
}
mySC.setPersistent(false);
mySC.getAppReadCallback().error(vc, ioe);
}
} | [
"public",
"void",
"error",
"(",
"VirtualConnection",
"vc",
",",
"TCPReadRequestContext",
"rsc",
",",
"IOException",
"ioe",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"error() called: vc=\"",
"+",
"vc",
"+",
"\" ioe=\"",
"+",
"ioe",
")",
";",
"}",
"HttpOutboundServiceContextImpl",
"mySC",
"=",
"(",
"HttpOutboundServiceContextImpl",
")",
"vc",
".",
"getStateMap",
"(",
")",
".",
"get",
"(",
"CallbackIDs",
".",
"CALLBACK_HTTPOSC",
")",
";",
"// Reading a body from an HTTP/1.0 server that closes the connection",
"// after completely sending the body will trigger an IOException here.",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Socket closure, signaling close.\"",
")",
";",
"}",
"// only valid if this response is a non-length delimited body",
"// otherwise pass the exception up to the application channel",
"// PK18799 - check the stored SC values instead of msg as Proxy may",
"// change it on the fly",
"if",
"(",
"!",
"mySC",
".",
"isChunkedEncoding",
"(",
")",
"&&",
"!",
"mySC",
".",
"isContentLength",
"(",
")",
")",
"{",
"mySC",
".",
"prepareClosure",
"(",
")",
";",
"mySC",
".",
"getAppReadCallback",
"(",
")",
".",
"complete",
"(",
"vc",
")",
";",
"}",
"else",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"IOException during body read\"",
")",
";",
"}",
"mySC",
".",
"setPersistent",
"(",
"false",
")",
";",
"mySC",
".",
"getAppReadCallback",
"(",
")",
".",
"error",
"(",
"vc",
",",
"ioe",
")",
";",
"}",
"}"
] | Called by the channel below us when an error occurs during a read.
@param vc
@param rsc
@param ioe | [
"Called",
"by",
"the",
"channel",
"below",
"us",
"when",
"an",
"error",
"occurs",
"during",
"a",
"read",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOSCBodyReadCallback.java#L71-L97 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jca.management.j2ee/src/com/ibm/ws/jca/management/j2ee/internal/MBeanHelper.java | MBeanHelper.logLoudAndClear | public static void logLoudAndClear(String textToLog, String callingClass, String callingMethod) {
final String methodName = "logLoudAndClear";
final boolean trace = TraceComponent.isAnyTracingEnabled();
final String cClass = (callingClass != null && !callingClass.isEmpty()) ? callingClass : "callingClass";
final String cMethod = (callingMethod != null && !callingMethod.isEmpty()) ? callingMethod : "callingMethod";
if (trace && tc.isDebugEnabled())
Tr.debug(tc, "#################################################################################################"
+ "\n #################################################################################################"
+ "#################################################################################################"
+ "\n #################################################################################################"
+ "#################################################################################################"
+ "\n #################################################################################################"
+ "#################################################################################################"
+ "\n #################################################################################################"
+ "#################################################################################################"
+ "\n #################################################################################################"
+ "#################################################################################################"
+ "\n #################################################################################################"
+ "#################################################################################################"
+ "\n #################################################################################################"
+ "#################################################################################################"
+ "\n #################################################################################################"
+ "#################################################################################################"
+ "\n "
+ "\n "
+ cClass + ": " + cMethod + " is using " + className + ": " + methodName + " \n "
+ textToLog
+ "\n "
+ "\n "
+ "#################################################################################################"
+ "\n #################################################################################################"
+ "#################################################################################################"
+ "\n #################################################################################################"
+ "#################################################################################################"
+ "\n #################################################################################################"
+ "#################################################################################################"
+ "\n #################################################################################################"
+ "#################################################################################################"
+ "\n #################################################################################################"
+ "#################################################################################################"
+ "\n #################################################################################################"
+ "#################################################################################################"
+ "\n #################################################################################################"
+ "#################################################################################################"
+ "\n #################################################################################################"
+ "#################################################################################################");
} | java | public static void logLoudAndClear(String textToLog, String callingClass, String callingMethod) {
final String methodName = "logLoudAndClear";
final boolean trace = TraceComponent.isAnyTracingEnabled();
final String cClass = (callingClass != null && !callingClass.isEmpty()) ? callingClass : "callingClass";
final String cMethod = (callingMethod != null && !callingMethod.isEmpty()) ? callingMethod : "callingMethod";
if (trace && tc.isDebugEnabled())
Tr.debug(tc, "#################################################################################################"
+ "\n #################################################################################################"
+ "#################################################################################################"
+ "\n #################################################################################################"
+ "#################################################################################################"
+ "\n #################################################################################################"
+ "#################################################################################################"
+ "\n #################################################################################################"
+ "#################################################################################################"
+ "\n #################################################################################################"
+ "#################################################################################################"
+ "\n #################################################################################################"
+ "#################################################################################################"
+ "\n #################################################################################################"
+ "#################################################################################################"
+ "\n #################################################################################################"
+ "#################################################################################################"
+ "\n "
+ "\n "
+ cClass + ": " + cMethod + " is using " + className + ": " + methodName + " \n "
+ textToLog
+ "\n "
+ "\n "
+ "#################################################################################################"
+ "\n #################################################################################################"
+ "#################################################################################################"
+ "\n #################################################################################################"
+ "#################################################################################################"
+ "\n #################################################################################################"
+ "#################################################################################################"
+ "\n #################################################################################################"
+ "#################################################################################################"
+ "\n #################################################################################################"
+ "#################################################################################################"
+ "\n #################################################################################################"
+ "#################################################################################################"
+ "\n #################################################################################################"
+ "#################################################################################################"
+ "\n #################################################################################################"
+ "#################################################################################################");
} | [
"public",
"static",
"void",
"logLoudAndClear",
"(",
"String",
"textToLog",
",",
"String",
"callingClass",
",",
"String",
"callingMethod",
")",
"{",
"final",
"String",
"methodName",
"=",
"\"logLoudAndClear\"",
";",
"final",
"boolean",
"trace",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"final",
"String",
"cClass",
"=",
"(",
"callingClass",
"!=",
"null",
"&&",
"!",
"callingClass",
".",
"isEmpty",
"(",
")",
")",
"?",
"callingClass",
":",
"\"callingClass\"",
";",
"final",
"String",
"cMethod",
"=",
"(",
"callingMethod",
"!=",
"null",
"&&",
"!",
"callingMethod",
".",
"isEmpty",
"(",
")",
")",
"?",
"callingMethod",
":",
"\"callingMethod\"",
";",
"if",
"(",
"trace",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"#################################################################################################\"",
"+",
"\"\\n #################################################################################################\"",
"+",
"\"#################################################################################################\"",
"+",
"\"\\n #################################################################################################\"",
"+",
"\"#################################################################################################\"",
"+",
"\"\\n #################################################################################################\"",
"+",
"\"#################################################################################################\"",
"+",
"\"\\n #################################################################################################\"",
"+",
"\"#################################################################################################\"",
"+",
"\"\\n #################################################################################################\"",
"+",
"\"#################################################################################################\"",
"+",
"\"\\n #################################################################################################\"",
"+",
"\"#################################################################################################\"",
"+",
"\"\\n #################################################################################################\"",
"+",
"\"#################################################################################################\"",
"+",
"\"\\n #################################################################################################\"",
"+",
"\"#################################################################################################\"",
"+",
"\"\\n \"",
"+",
"\"\\n \"",
"+",
"cClass",
"+",
"\": \"",
"+",
"cMethod",
"+",
"\" is using \"",
"+",
"className",
"+",
"\": \"",
"+",
"methodName",
"+",
"\" \\n \"",
"+",
"textToLog",
"+",
"\"\\n \"",
"+",
"\"\\n \"",
"+",
"\"#################################################################################################\"",
"+",
"\"\\n #################################################################################################\"",
"+",
"\"#################################################################################################\"",
"+",
"\"\\n #################################################################################################\"",
"+",
"\"#################################################################################################\"",
"+",
"\"\\n #################################################################################################\"",
"+",
"\"#################################################################################################\"",
"+",
"\"\\n #################################################################################################\"",
"+",
"\"#################################################################################################\"",
"+",
"\"\\n #################################################################################################\"",
"+",
"\"#################################################################################################\"",
"+",
"\"\\n #################################################################################################\"",
"+",
"\"#################################################################################################\"",
"+",
"\"\\n #################################################################################################\"",
"+",
"\"#################################################################################################\"",
"+",
"\"\\n #################################################################################################\"",
"+",
"\"#################################################################################################\"",
")",
";",
"}"
] | logLoudAndClear Log the provided text in a very distinct way making it easy to find it in the trace.log
This method should be used for testing and debugging proposes only.
This method should not be used in shipped code.
@param textToLog String representation of the test needed to be logged in a distinct way.
@param callingClass Optional String representation of the calling class name to be used for logging.
@param callingMethod Optional String representation of the calling method name to be used for logging. | [
"logLoudAndClear",
"Log",
"the",
"provided",
"text",
"in",
"a",
"very",
"distinct",
"way",
"making",
"it",
"easy",
"to",
"find",
"it",
"in",
"the",
"trace",
".",
"log",
"This",
"method",
"should",
"be",
"used",
"for",
"testing",
"and",
"debugging",
"proposes",
"only",
".",
"This",
"method",
"should",
"not",
"be",
"used",
"in",
"shipped",
"code",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca.management.j2ee/src/com/ibm/ws/jca/management/j2ee/internal/MBeanHelper.java#L105-L151 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/JsMainImpl.java | JsMainImpl.createMessageEngine | private MessagingEngine createMessageEngine(JsMEConfig me) throws Exception {
String thisMethodName = CLASS_NAME + ".createMessageEngine(JsMEConfig)";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, "replace ME name here");
}
JsMessagingEngine engineImpl = null;
bus = new JsBusImpl(me, this, (me.getSIBus().getName()));// getBusProxy(me);
engineImpl = new JsMessagingEngineImpl(this, bus, me);
MessagingEngine engine = new MessagingEngine(me, engineImpl);
_messagingEngines.put(defaultMEUUID, engine);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, thisMethodName, engine.toString());
}
return engine;
} | java | private MessagingEngine createMessageEngine(JsMEConfig me) throws Exception {
String thisMethodName = CLASS_NAME + ".createMessageEngine(JsMEConfig)";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, "replace ME name here");
}
JsMessagingEngine engineImpl = null;
bus = new JsBusImpl(me, this, (me.getSIBus().getName()));// getBusProxy(me);
engineImpl = new JsMessagingEngineImpl(this, bus, me);
MessagingEngine engine = new MessagingEngine(me, engineImpl);
_messagingEngines.put(defaultMEUUID, engine);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, thisMethodName, engine.toString());
}
return engine;
} | [
"private",
"MessagingEngine",
"createMessageEngine",
"(",
"JsMEConfig",
"me",
")",
"throws",
"Exception",
"{",
"String",
"thisMethodName",
"=",
"CLASS_NAME",
"+",
"\".createMessageEngine(JsMEConfig)\"",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"thisMethodName",
",",
"\"replace ME name here\"",
")",
";",
"}",
"JsMessagingEngine",
"engineImpl",
"=",
"null",
";",
"bus",
"=",
"new",
"JsBusImpl",
"(",
"me",
",",
"this",
",",
"(",
"me",
".",
"getSIBus",
"(",
")",
".",
"getName",
"(",
")",
")",
")",
";",
"// getBusProxy(me);",
"engineImpl",
"=",
"new",
"JsMessagingEngineImpl",
"(",
"this",
",",
"bus",
",",
"me",
")",
";",
"MessagingEngine",
"engine",
"=",
"new",
"MessagingEngine",
"(",
"me",
",",
"engineImpl",
")",
";",
"_messagingEngines",
".",
"put",
"(",
"defaultMEUUID",
",",
"engine",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"thisMethodName",
",",
"engine",
".",
"toString",
"(",
")",
")",
";",
"}",
"return",
"engine",
";",
"}"
] | Create a single Message Engine admin object using suppled config object. | [
"Create",
"a",
"single",
"Message",
"Engine",
"admin",
"object",
"using",
"suppled",
"config",
"object",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/JsMainImpl.java#L472-L493 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/JsMainImpl.java | JsMainImpl.getBusProxy | private JsBusImpl getBusProxy(JsMEConfig me) {
String thisMethodName = CLASS_NAME + ".getBusProxy(ConfigObject)";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, "ME Name");
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, thisMethodName);
}
return this.bus;
} | java | private JsBusImpl getBusProxy(JsMEConfig me) {
String thisMethodName = CLASS_NAME + ".getBusProxy(ConfigObject)";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, "ME Name");
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, thisMethodName);
}
return this.bus;
} | [
"private",
"JsBusImpl",
"getBusProxy",
"(",
"JsMEConfig",
"me",
")",
"{",
"String",
"thisMethodName",
"=",
"CLASS_NAME",
"+",
"\".getBusProxy(ConfigObject)\"",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"thisMethodName",
",",
"\"ME Name\"",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"thisMethodName",
")",
";",
"}",
"return",
"this",
".",
"bus",
";",
"}"
] | Returns the runtime configuration of the bus to which the supplied
messaging engine belongs. If the bus runtime configuration does not yet
exist, it is created. In liberty this is default bus configuration
@param me
@return the runtime configuration of the bus to which the supplied
messaging engine belongs. | [
"Returns",
"the",
"runtime",
"configuration",
"of",
"the",
"bus",
"to",
"which",
"the",
"supplied",
"messaging",
"engine",
"belongs",
".",
"If",
"the",
"bus",
"runtime",
"configuration",
"does",
"not",
"yet",
"exist",
"it",
"is",
"created",
".",
"In",
"liberty",
"this",
"is",
"default",
"bus",
"configuration"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/JsMainImpl.java#L504-L517 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/JsMainImpl.java | JsMainImpl.getBusProxy | private JsBusImpl getBusProxy(String name) throws SIBExceptionBusNotFound {
String thisMethodName = CLASS_NAME + ".getBusProxy(String)";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, name);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, thisMethodName);
}
return this.bus;
} | java | private JsBusImpl getBusProxy(String name) throws SIBExceptionBusNotFound {
String thisMethodName = CLASS_NAME + ".getBusProxy(String)";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, name);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, thisMethodName);
}
return this.bus;
} | [
"private",
"JsBusImpl",
"getBusProxy",
"(",
"String",
"name",
")",
"throws",
"SIBExceptionBusNotFound",
"{",
"String",
"thisMethodName",
"=",
"CLASS_NAME",
"+",
"\".getBusProxy(String)\"",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"thisMethodName",
",",
"name",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"thisMethodName",
")",
";",
"}",
"return",
"this",
".",
"bus",
";",
"}"
] | Returns the runtime configuration of the bus to which the named messaging
engine belongs. If the bus runtime configuration does not yet exist, it
is created.
@param name
@return the runtime configuration of the bus to which the named messaging
engine belongs. | [
"Returns",
"the",
"runtime",
"configuration",
"of",
"the",
"bus",
"to",
"which",
"the",
"named",
"messaging",
"engine",
"belongs",
".",
"If",
"the",
"bus",
"runtime",
"configuration",
"does",
"not",
"yet",
"exist",
"it",
"is",
"created",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/JsMainImpl.java#L528-L541 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/JsMainImpl.java | JsMainImpl.getBus | public JsBus getBus(String busName) throws SIBExceptionBusNotFound {
String thisMethodName = CLASS_NAME + ".getBus(String)";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, busName);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, thisMethodName);
}
return this.bus;
} | java | public JsBus getBus(String busName) throws SIBExceptionBusNotFound {
String thisMethodName = CLASS_NAME + ".getBus(String)";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, busName);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, thisMethodName);
}
return this.bus;
} | [
"public",
"JsBus",
"getBus",
"(",
"String",
"busName",
")",
"throws",
"SIBExceptionBusNotFound",
"{",
"String",
"thisMethodName",
"=",
"CLASS_NAME",
"+",
"\".getBus(String)\"",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"thisMethodName",
",",
"busName",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"thisMethodName",
")",
";",
"}",
"return",
"this",
".",
"bus",
";",
"}"
] | Returns the runtime configuration of the named bus. For liberty is always
default bus
@param busName
@return the runtime configuration of the named bus. | [
"Returns",
"the",
"runtime",
"configuration",
"of",
"the",
"named",
"bus",
".",
"For",
"liberty",
"is",
"always",
"default",
"bus"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/JsMainImpl.java#L550-L563 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/JsMainImpl.java | JsMainImpl.getMessagingEngineSet | public Set getMessagingEngineSet(String busName) {
String thisMethodName = CLASS_NAME + ".getMessagingEngineSet(String)";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, busName);
}
Set retSet = new HashSet();
if (meConfig != null) {
String meName = meConfig.getMessagingEngine().getName();
BaseMessagingEngineImpl engineImpl = getMessagingEngine(meName);
retSet.add(engineImpl.getUuid().toString());
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Integer i = new Integer(retSet.size());
SibTr.exit(tc, thisMethodName, i.toString());
}
return retSet;
} | java | public Set getMessagingEngineSet(String busName) {
String thisMethodName = CLASS_NAME + ".getMessagingEngineSet(String)";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, busName);
}
Set retSet = new HashSet();
if (meConfig != null) {
String meName = meConfig.getMessagingEngine().getName();
BaseMessagingEngineImpl engineImpl = getMessagingEngine(meName);
retSet.add(engineImpl.getUuid().toString());
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Integer i = new Integer(retSet.size());
SibTr.exit(tc, thisMethodName, i.toString());
}
return retSet;
} | [
"public",
"Set",
"getMessagingEngineSet",
"(",
"String",
"busName",
")",
"{",
"String",
"thisMethodName",
"=",
"CLASS_NAME",
"+",
"\".getMessagingEngineSet(String)\"",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"thisMethodName",
",",
"busName",
")",
";",
"}",
"Set",
"retSet",
"=",
"new",
"HashSet",
"(",
")",
";",
"if",
"(",
"meConfig",
"!=",
"null",
")",
"{",
"String",
"meName",
"=",
"meConfig",
".",
"getMessagingEngine",
"(",
")",
".",
"getName",
"(",
")",
";",
"BaseMessagingEngineImpl",
"engineImpl",
"=",
"getMessagingEngine",
"(",
"meName",
")",
";",
"retSet",
".",
"add",
"(",
"engineImpl",
".",
"getUuid",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Integer",
"i",
"=",
"new",
"Integer",
"(",
"retSet",
".",
"size",
"(",
")",
")",
";",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"thisMethodName",
",",
"i",
".",
"toString",
"(",
")",
")",
";",
"}",
"return",
"retSet",
";",
"}"
] | Returns the set of messaging engines on the named bus.
@param busName
@return the set of messaging engines on the named bus. | [
"Returns",
"the",
"set",
"of",
"messaging",
"engines",
"on",
"the",
"named",
"bus",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/JsMainImpl.java#L762-L782 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/JsMainImpl.java | JsMainImpl.showMessagingEngines | public String[] showMessagingEngines() {
String thisMethodName = CLASS_NAME + ".showMessagingEngines()";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, this);
}
final String[] list = new String[_messagingEngines.size()];
Enumeration e = listMessagingEngines();
int i = 0;
while (e.hasMoreElements()) {
Object c = e.nextElement();
list[i++] = ((BaseMessagingEngineImpl) c).getBusName() + ":"
+ ((BaseMessagingEngineImpl) c).getName() + ":"
+ ((BaseMessagingEngineImpl) c).getState();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, thisMethodName);
}
return list;
} | java | public String[] showMessagingEngines() {
String thisMethodName = CLASS_NAME + ".showMessagingEngines()";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, this);
}
final String[] list = new String[_messagingEngines.size()];
Enumeration e = listMessagingEngines();
int i = 0;
while (e.hasMoreElements()) {
Object c = e.nextElement();
list[i++] = ((BaseMessagingEngineImpl) c).getBusName() + ":"
+ ((BaseMessagingEngineImpl) c).getName() + ":"
+ ((BaseMessagingEngineImpl) c).getState();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, thisMethodName);
}
return list;
} | [
"public",
"String",
"[",
"]",
"showMessagingEngines",
"(",
")",
"{",
"String",
"thisMethodName",
"=",
"CLASS_NAME",
"+",
"\".showMessagingEngines()\"",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"thisMethodName",
",",
"this",
")",
";",
"}",
"final",
"String",
"[",
"]",
"list",
"=",
"new",
"String",
"[",
"_messagingEngines",
".",
"size",
"(",
")",
"]",
";",
"Enumeration",
"e",
"=",
"listMessagingEngines",
"(",
")",
";",
"int",
"i",
"=",
"0",
";",
"while",
"(",
"e",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"Object",
"c",
"=",
"e",
".",
"nextElement",
"(",
")",
";",
"list",
"[",
"i",
"++",
"]",
"=",
"(",
"(",
"BaseMessagingEngineImpl",
")",
"c",
")",
".",
"getBusName",
"(",
")",
"+",
"\":\"",
"+",
"(",
"(",
"BaseMessagingEngineImpl",
")",
"c",
")",
".",
"getName",
"(",
")",
"+",
"\":\"",
"+",
"(",
"(",
"BaseMessagingEngineImpl",
")",
"c",
")",
".",
"getState",
"(",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"thisMethodName",
")",
";",
"}",
"return",
"list",
";",
"}"
] | Return a readable string of messaging engines in the process
@return String[] | [
"Return",
"a",
"readable",
"string",
"of",
"messaging",
"engines",
"in",
"the",
"process"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/JsMainImpl.java#L794-L818 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/JsMainImpl.java | JsMainImpl.startMessagingEngine | public void startMessagingEngine(String busName, String name)
throws Exception {
String thisMethodName = CLASS_NAME
+ ".startMessagingEngine(String, String)";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, new Object[] { busName, name });
}
BaseMessagingEngineImpl me = (BaseMessagingEngineImpl) getMessagingEngine(
busName, name);
if (me != null) {
me.startConditional();
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Unable to locate engine <bus=" + busName
+ " name=" + name + ">");
throw new Exception("The messaging engine <bus=" + busName
+ " name=" + name + "> does not exist");
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, thisMethodName);
}
} | java | public void startMessagingEngine(String busName, String name)
throws Exception {
String thisMethodName = CLASS_NAME
+ ".startMessagingEngine(String, String)";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, new Object[] { busName, name });
}
BaseMessagingEngineImpl me = (BaseMessagingEngineImpl) getMessagingEngine(
busName, name);
if (me != null) {
me.startConditional();
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Unable to locate engine <bus=" + busName
+ " name=" + name + ">");
throw new Exception("The messaging engine <bus=" + busName
+ " name=" + name + "> does not exist");
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, thisMethodName);
}
} | [
"public",
"void",
"startMessagingEngine",
"(",
"String",
"busName",
",",
"String",
"name",
")",
"throws",
"Exception",
"{",
"String",
"thisMethodName",
"=",
"CLASS_NAME",
"+",
"\".startMessagingEngine(String, String)\"",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"thisMethodName",
",",
"new",
"Object",
"[",
"]",
"{",
"busName",
",",
"name",
"}",
")",
";",
"}",
"BaseMessagingEngineImpl",
"me",
"=",
"(",
"BaseMessagingEngineImpl",
")",
"getMessagingEngine",
"(",
"busName",
",",
"name",
")",
";",
"if",
"(",
"me",
"!=",
"null",
")",
"{",
"me",
".",
"startConditional",
"(",
")",
";",
"}",
"else",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"Unable to locate engine <bus=\"",
"+",
"busName",
"+",
"\" name=\"",
"+",
"name",
"+",
"\">\"",
")",
";",
"throw",
"new",
"Exception",
"(",
"\"The messaging engine <bus=\"",
"+",
"busName",
"+",
"\" name=\"",
"+",
"name",
"+",
"\"> does not exist\"",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"thisMethodName",
")",
";",
"}",
"}"
] | Start a messaging engine
@param busName
@param name | [
"Start",
"a",
"messaging",
"engine"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/JsMainImpl.java#L826-L851 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/JsMainImpl.java | JsMainImpl.isServerStarted | public boolean isServerStarted() {
String thisMethodName = CLASS_NAME + ".isServerStarted()";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, this);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, thisMethodName, new Boolean(_serverStarted));
}
return _serverStarted;
} | java | public boolean isServerStarted() {
String thisMethodName = CLASS_NAME + ".isServerStarted()";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, this);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, thisMethodName, new Boolean(_serverStarted));
}
return _serverStarted;
} | [
"public",
"boolean",
"isServerStarted",
"(",
")",
"{",
"String",
"thisMethodName",
"=",
"CLASS_NAME",
"+",
"\".isServerStarted()\"",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"thisMethodName",
",",
"this",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"thisMethodName",
",",
"new",
"Boolean",
"(",
"_serverStarted",
")",
")",
";",
"}",
"return",
"_serverStarted",
";",
"}"
] | Has the WAS server in which we are contained now started?
@return true if the server is sterted; else false. | [
"Has",
"the",
"WAS",
"server",
"in",
"which",
"we",
"are",
"contained",
"now",
"started?"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/JsMainImpl.java#L980-L993 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/JsMainImpl.java | JsMainImpl.isServerStopping | public boolean isServerStopping() {
String thisMethodName = CLASS_NAME + ".isServerStopping()";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, this);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, thisMethodName, new Boolean(_serverStopping));
}
return _serverStopping;
} | java | public boolean isServerStopping() {
String thisMethodName = CLASS_NAME + ".isServerStopping()";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, this);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, thisMethodName, new Boolean(_serverStopping));
}
return _serverStopping;
} | [
"public",
"boolean",
"isServerStopping",
"(",
")",
"{",
"String",
"thisMethodName",
"=",
"CLASS_NAME",
"+",
"\".isServerStopping()\"",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"thisMethodName",
",",
"this",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"thisMethodName",
",",
"new",
"Boolean",
"(",
"_serverStopping",
")",
")",
";",
"}",
"return",
"_serverStopping",
";",
"}"
] | Is the WAS server in which we are contained stopping?
@return true if the server is stopping; else false. | [
"Is",
"the",
"WAS",
"server",
"in",
"which",
"we",
"are",
"contained",
"stopping?"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/JsMainImpl.java#L1000-L1013 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/JsMainImpl.java | JsMainImpl.isServerInRecoveryMode | public boolean isServerInRecoveryMode() {
String thisMethodName = CLASS_NAME + ".isServerInRecoveryMode()";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, this);
}
boolean ret = false;// (_serverMode == Server.RECOVERY_MODE); TBD
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, thisMethodName, new Boolean(ret));
}
return ret;
} | java | public boolean isServerInRecoveryMode() {
String thisMethodName = CLASS_NAME + ".isServerInRecoveryMode()";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, this);
}
boolean ret = false;// (_serverMode == Server.RECOVERY_MODE); TBD
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, thisMethodName, new Boolean(ret));
}
return ret;
} | [
"public",
"boolean",
"isServerInRecoveryMode",
"(",
")",
"{",
"String",
"thisMethodName",
"=",
"CLASS_NAME",
"+",
"\".isServerInRecoveryMode()\"",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"thisMethodName",
",",
"this",
")",
";",
"}",
"boolean",
"ret",
"=",
"false",
";",
"// (_serverMode == Server.RECOVERY_MODE); TBD",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"thisMethodName",
",",
"new",
"Boolean",
"(",
"ret",
")",
")",
";",
"}",
"return",
"ret",
";",
"}"
] | 250606.3 recovery mode support | [
"250606",
".",
"3",
"recovery",
"mode",
"support"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/JsMainImpl.java#L1057-L1072 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/JsMainImpl.java | JsMainImpl.listDefinedBuses | public List<String> listDefinedBuses() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, "listDefinedBuses", this);
}
List buses = null;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, "listDefinedBuses", buses);
}
return buses;
} | java | public List<String> listDefinedBuses() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, "listDefinedBuses", this);
}
List buses = null;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, "listDefinedBuses", buses);
}
return buses;
} | [
"public",
"List",
"<",
"String",
">",
"listDefinedBuses",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"listDefinedBuses\"",
",",
"this",
")",
";",
"}",
"List",
"buses",
"=",
"null",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"listDefinedBuses\"",
",",
"buses",
")",
";",
"}",
"return",
"buses",
";",
"}"
] | Returns a list of configured buses in this cell. For liberty this method
will return the null value, because no directory structure is maintained
in liberty for a bus.
@return String[] list of buses in cell | [
"Returns",
"a",
"list",
"of",
"configured",
"buses",
"in",
"this",
"cell",
".",
"For",
"liberty",
"this",
"method",
"will",
"return",
"the",
"null",
"value",
"because",
"no",
"directory",
"structure",
"is",
"maintained",
"in",
"liberty",
"for",
"a",
"bus",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/JsMainImpl.java#L1099-L1111 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.common.encoder/src/com/ibm/ws/common/internal/encoder/Base64Coder.java | Base64Coder.base64Decode | public static final String base64Decode(String str, String enc) throws UnsupportedEncodingException {
if (str == null) {
return null;
} else {
byte data[] = getBytes(str);
return base64Decode(new String(data, enc));
}
} | java | public static final String base64Decode(String str, String enc) throws UnsupportedEncodingException {
if (str == null) {
return null;
} else {
byte data[] = getBytes(str);
return base64Decode(new String(data, enc));
}
} | [
"public",
"static",
"final",
"String",
"base64Decode",
"(",
"String",
"str",
",",
"String",
"enc",
")",
"throws",
"UnsupportedEncodingException",
"{",
"if",
"(",
"str",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"byte",
"data",
"[",
"]",
"=",
"getBytes",
"(",
"str",
")",
";",
"return",
"base64Decode",
"(",
"new",
"String",
"(",
"data",
",",
"enc",
")",
")",
";",
"}",
"}"
] | Converts a String with the given encoding to a base64 encoded String.
@param str
@param enc
@return
@throws UnsupportedEncodingException | [
"Converts",
"a",
"String",
"with",
"the",
"given",
"encoding",
"to",
"a",
"base64",
"encoded",
"String",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.common.encoder/src/com/ibm/ws/common/internal/encoder/Base64Coder.java#L265-L273 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.common.encoder/src/com/ibm/ws/common/internal/encoder/Base64Coder.java | Base64Coder.base64Decode | public static final String base64Decode(String str) {
if (str == null) {
return null;
} else {
byte data[] = getBytes(str);
return toString(base64Decode(data));
}
} | java | public static final String base64Decode(String str) {
if (str == null) {
return null;
} else {
byte data[] = getBytes(str);
return toString(base64Decode(data));
}
} | [
"public",
"static",
"final",
"String",
"base64Decode",
"(",
"String",
"str",
")",
"{",
"if",
"(",
"str",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"byte",
"data",
"[",
"]",
"=",
"getBytes",
"(",
"str",
")",
";",
"return",
"toString",
"(",
"base64Decode",
"(",
"data",
")",
")",
";",
"}",
"}"
] | Converts a base64 encoded String to a decoded String.
@param str String, may be {@code null}.
@return base64 encoded String {@code null} if the str was null. | [
"Converts",
"a",
"base64",
"encoded",
"String",
"to",
"a",
"decoded",
"String",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.common.encoder/src/com/ibm/ws/common/internal/encoder/Base64Coder.java#L281-L288 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.common/src/com/ibm/ws/sib/ra/impl/SibRaConsumerSession.java | SibRaConsumerSession.receiveNoWait | public SIBusMessage receiveNoWait(final SITransaction tran)
throws SISessionDroppedException, SIConnectionDroppedException,
SISessionUnavailableException, SIConnectionUnavailableException,
SIConnectionLostException, SILimitExceededException,
SINotAuthorizedException, SIResourceException, SIErrorException,
SIIncorrectCallException {
final String methodName = "receiveNoWait";
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, methodName, tran);
}
checkValid();
final SIBusMessage message = _delegate.receiveNoWait(_parentConnection
.mapTransaction(tran));
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, methodName, message);
}
return message;
} | java | public SIBusMessage receiveNoWait(final SITransaction tran)
throws SISessionDroppedException, SIConnectionDroppedException,
SISessionUnavailableException, SIConnectionUnavailableException,
SIConnectionLostException, SILimitExceededException,
SINotAuthorizedException, SIResourceException, SIErrorException,
SIIncorrectCallException {
final String methodName = "receiveNoWait";
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, methodName, tran);
}
checkValid();
final SIBusMessage message = _delegate.receiveNoWait(_parentConnection
.mapTransaction(tran));
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, methodName, message);
}
return message;
} | [
"public",
"SIBusMessage",
"receiveNoWait",
"(",
"final",
"SITransaction",
"tran",
")",
"throws",
"SISessionDroppedException",
",",
"SIConnectionDroppedException",
",",
"SISessionUnavailableException",
",",
"SIConnectionUnavailableException",
",",
"SIConnectionLostException",
",",
"SILimitExceededException",
",",
"SINotAuthorizedException",
",",
"SIResourceException",
",",
"SIErrorException",
",",
"SIIncorrectCallException",
"{",
"final",
"String",
"methodName",
"=",
"\"receiveNoWait\"",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"this",
",",
"TRACE",
",",
"methodName",
",",
"tran",
")",
";",
"}",
"checkValid",
"(",
")",
";",
"final",
"SIBusMessage",
"message",
"=",
"_delegate",
".",
"receiveNoWait",
"(",
"_parentConnection",
".",
"mapTransaction",
"(",
"tran",
")",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exit",
"(",
"this",
",",
"TRACE",
",",
"methodName",
",",
"message",
")",
";",
"}",
"return",
"message",
";",
"}"
] | Receives a message. Checks that the session is valid. Maps the
transaction parameter before delegating.
@param tran
the transaction to receive the message under
@return the message or <code>null</code> if none was available
@throws SISessionUnavailableException
if the connection is not valid
@throws SIIncorrectCallException
if the transaction parameter is not valid given the current
application and container transactions
@throws SIErrorException
if the delegation fails
@throws SIResourceException
if the delegation fails
@throws SINotAuthorizedException
if the delegation fails
@throws SILimitExceededException
if the delegation fails
@throws SIConnectionLostException
if the delegation fails
@throws SIConnectionUnavailableException
if the delegation fails
@throws SIConnectionDroppedException
if the delegation fails
@throws SISessionDroppedException
if the delegation fails
@throws SIResourceException
if the current container transaction cannot be determined | [
"Receives",
"a",
"message",
".",
"Checks",
"that",
"the",
"session",
"is",
"valid",
".",
"Maps",
"the",
"transaction",
"parameter",
"before",
"delegating",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.common/src/com/ibm/ws/sib/ra/impl/SibRaConsumerSession.java#L123-L145 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.common/src/com/ibm/ws/sib/ra/impl/SibRaConsumerSession.java | SibRaConsumerSession.start | public void start(boolean deliverImmediately)
throws SIConnectionDroppedException, SISessionUnavailableException,
SIConnectionUnavailableException, SIConnectionLostException,
SIResourceException, SIErrorException, SIErrorException {
final String methodName = "start";
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, methodName, Boolean
.valueOf(deliverImmediately));
}
checkValid();
_delegate.start(deliverImmediately);
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, methodName);
}
} | java | public void start(boolean deliverImmediately)
throws SIConnectionDroppedException, SISessionUnavailableException,
SIConnectionUnavailableException, SIConnectionLostException,
SIResourceException, SIErrorException, SIErrorException {
final String methodName = "start";
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, methodName, Boolean
.valueOf(deliverImmediately));
}
checkValid();
_delegate.start(deliverImmediately);
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, methodName);
}
} | [
"public",
"void",
"start",
"(",
"boolean",
"deliverImmediately",
")",
"throws",
"SIConnectionDroppedException",
",",
"SISessionUnavailableException",
",",
"SIConnectionUnavailableException",
",",
"SIConnectionLostException",
",",
"SIResourceException",
",",
"SIErrorException",
",",
"SIErrorException",
"{",
"final",
"String",
"methodName",
"=",
"\"start\"",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"this",
",",
"TRACE",
",",
"methodName",
",",
"Boolean",
".",
"valueOf",
"(",
"deliverImmediately",
")",
")",
";",
"}",
"checkValid",
"(",
")",
";",
"_delegate",
".",
"start",
"(",
"deliverImmediately",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exit",
"(",
"this",
",",
"TRACE",
",",
"methodName",
")",
";",
"}",
"}"
] | Starts message delivery. Checks that the session is valid then delegates.
@param deliverImmediately
whether a thread should be spun off for message delivery
@throws SIConnectionLostException
if the delegation fails
@throws SIErrorException
if the delegation fails
@throws SIErrorException
if the delegation fails
@throws SIResourceException
if the delegation fails
@throws SISessionUnavailableException
if the connection is not valid
@throws SIConnectionUnavailableException
if the delegation fails
@throws SIConnectionDroppedException
if the delegation fails | [
"Starts",
"message",
"delivery",
".",
"Checks",
"that",
"the",
"session",
"is",
"valid",
"then",
"delegates",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.common/src/com/ibm/ws/sib/ra/impl/SibRaConsumerSession.java#L222-L241 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.common/src/com/ibm/ws/sib/ra/impl/SibRaConsumerSession.java | SibRaConsumerSession.stop | public void stop() throws SISessionDroppedException,
SIConnectionDroppedException, SISessionUnavailableException,
SIConnectionUnavailableException, SIConnectionLostException,
SIResourceException, SIErrorException {
final String methodName = "stop";
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, methodName);
}
checkValid();
_delegate.stop();
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, methodName);
}
} | java | public void stop() throws SISessionDroppedException,
SIConnectionDroppedException, SISessionUnavailableException,
SIConnectionUnavailableException, SIConnectionLostException,
SIResourceException, SIErrorException {
final String methodName = "stop";
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, methodName);
}
checkValid();
_delegate.stop();
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, methodName);
}
} | [
"public",
"void",
"stop",
"(",
")",
"throws",
"SISessionDroppedException",
",",
"SIConnectionDroppedException",
",",
"SISessionUnavailableException",
",",
"SIConnectionUnavailableException",
",",
"SIConnectionLostException",
",",
"SIResourceException",
",",
"SIErrorException",
"{",
"final",
"String",
"methodName",
"=",
"\"stop\"",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"this",
",",
"TRACE",
",",
"methodName",
")",
";",
"}",
"checkValid",
"(",
")",
";",
"_delegate",
".",
"stop",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exit",
"(",
"this",
",",
"TRACE",
",",
"methodName",
")",
";",
"}",
"}"
] | Stops message delivery. Checks that the session is valid then delegates.
@throws SIErrorException
if the delegation fails
@throws SIResourceException
if the delegation fails
@throws SIConnectionLostException
if the delegation fails
@throws SISessionUnavailableException
if the session is not valid
@throws SIConnectionUnavailableException
if the delegation fails
@throws SIConnectionDroppedException
if the delegation fails
@throws SISessionDroppedException
if the delegation fails | [
"Stops",
"message",
"delivery",
".",
"Checks",
"that",
"the",
"session",
"is",
"valid",
"then",
"delegates",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.common/src/com/ibm/ws/sib/ra/impl/SibRaConsumerSession.java#L261-L279 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.common/src/com/ibm/ws/sib/ra/impl/SibRaConsumerSession.java | SibRaConsumerSession.unlockAll | @Override
public void unlockAll(boolean incrementUnlockCount)
throws SISessionUnavailableException, SISessionDroppedException,
SIConnectionUnavailableException, SIConnectionDroppedException,
SIResourceException, SIConnectionLostException, SIIncorrectCallException
{
throw new SibRaNotSupportedException(NLS
.getString("ASYNCHRONOUS_METHOD_CWSIV0250"));
} | java | @Override
public void unlockAll(boolean incrementUnlockCount)
throws SISessionUnavailableException, SISessionDroppedException,
SIConnectionUnavailableException, SIConnectionDroppedException,
SIResourceException, SIConnectionLostException, SIIncorrectCallException
{
throw new SibRaNotSupportedException(NLS
.getString("ASYNCHRONOUS_METHOD_CWSIV0250"));
} | [
"@",
"Override",
"public",
"void",
"unlockAll",
"(",
"boolean",
"incrementUnlockCount",
")",
"throws",
"SISessionUnavailableException",
",",
"SISessionDroppedException",
",",
"SIConnectionUnavailableException",
",",
"SIConnectionDroppedException",
",",
"SIResourceException",
",",
"SIConnectionLostException",
",",
"SIIncorrectCallException",
"{",
"throw",
"new",
"SibRaNotSupportedException",
"(",
"NLS",
".",
"getString",
"(",
"\"ASYNCHRONOUS_METHOD_CWSIV0250\"",
")",
")",
";",
"}"
] | Unlocking of messages is not supported.
@throws SibRaNotSupportedException
always | [
"Unlocking",
"of",
"messages",
"is",
"not",
"supported",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.common/src/com/ibm/ws/sib/ra/impl/SibRaConsumerSession.java#L472-L481 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/ClientConversationState.java | ClientConversationState.setConnectionObjectID | public void setConnectionObjectID(int i)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setConnectionObjectID", ""+i);
connectionObjectID = i;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setConnectionObjectID");
} | java | public void setConnectionObjectID(int i)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setConnectionObjectID", ""+i);
connectionObjectID = i;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setConnectionObjectID");
} | [
"public",
"void",
"setConnectionObjectID",
"(",
"int",
"i",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"setConnectionObjectID\"",
",",
"\"\"",
"+",
"i",
")",
";",
"connectionObjectID",
"=",
"i",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"setConnectionObjectID\"",
")",
";",
"}"
] | Sets the Connection ID referring to the SIMPConnection Object on the server.
@param i | [
"Sets",
"the",
"Connection",
"ID",
"referring",
"to",
"the",
"SIMPConnection",
"Object",
"on",
"the",
"server",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/ClientConversationState.java#L101-L108 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/ClientConversationState.java | ClientConversationState.getProxyQueueConversationGroup | public ProxyQueueConversationGroup getProxyQueueConversationGroup()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getProxyQueueConversationGroup");
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getProxyQueueConversationGroup", proxyGroup);
return proxyGroup;
} | java | public ProxyQueueConversationGroup getProxyQueueConversationGroup()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getProxyQueueConversationGroup");
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getProxyQueueConversationGroup", proxyGroup);
return proxyGroup;
} | [
"public",
"ProxyQueueConversationGroup",
"getProxyQueueConversationGroup",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"getProxyQueueConversationGroup\"",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"getProxyQueueConversationGroup\"",
",",
"proxyGroup",
")",
";",
"return",
"proxyGroup",
";",
"}"
] | Gets the proxy queue group associated with this conversation.
@return ProxyQueueConversationGroup | [
"Gets",
"the",
"proxy",
"queue",
"group",
"associated",
"with",
"this",
"conversation",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/ClientConversationState.java#L115-L120 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/ClientConversationState.java | ClientConversationState.getCatConnectionListeners | public CatConnectionListenerGroup getCatConnectionListeners()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getCatConnectionListeners");
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getCatConnectionListeners", catConnectionGroup);
return catConnectionGroup;
} | java | public CatConnectionListenerGroup getCatConnectionListeners()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getCatConnectionListeners");
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getCatConnectionListeners", catConnectionGroup);
return catConnectionGroup;
} | [
"public",
"CatConnectionListenerGroup",
"getCatConnectionListeners",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"getCatConnectionListeners\"",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"getCatConnectionListeners\"",
",",
"catConnectionGroup",
")",
";",
"return",
"catConnectionGroup",
";",
"}"
] | Gets the connection listener group associated with thisconversation
@return CatConnectionListenerGroup | [
"Gets",
"the",
"connection",
"listener",
"group",
"associated",
"with",
"thisconversation"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/ClientConversationState.java#L141-L146 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/ClientConversationState.java | ClientConversationState.getSICoreConnection | public SICoreConnection getSICoreConnection()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getSICoreConnection");
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getSICoreConnection", siCoreConnection);
return siCoreConnection;
} | java | public SICoreConnection getSICoreConnection()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getSICoreConnection");
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getSICoreConnection", siCoreConnection);
return siCoreConnection;
} | [
"public",
"SICoreConnection",
"getSICoreConnection",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"getSICoreConnection\"",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"getSICoreConnection\"",
",",
"siCoreConnection",
")",
";",
"return",
"siCoreConnection",
";",
"}"
] | Returns the SICoreConnection in use with this conversation
@return SICoreConnection | [
"Returns",
"the",
"SICoreConnection",
"in",
"use",
"with",
"this",
"conversation"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/ClientConversationState.java#L153-L158 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/list/Link.java | Link.unlink | public final boolean unlink()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "unlink", _positionString());
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "cursor count = " + _cursorCount);
boolean unlinked = false;
LinkedList parent = _parent;
if (null != parent)
{
synchronized(parent)
{
if (LinkState.LINKED == _state)
{
_state = LinkState.LOGICALLY_UNLINKED;
_tryUnlink();
unlinked = true;
}
else
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "unlink while " + _state);
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "unlink", new Object[] { Boolean.valueOf(unlinked), _positionString()});
return unlinked;
} | java | public final boolean unlink()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "unlink", _positionString());
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "cursor count = " + _cursorCount);
boolean unlinked = false;
LinkedList parent = _parent;
if (null != parent)
{
synchronized(parent)
{
if (LinkState.LINKED == _state)
{
_state = LinkState.LOGICALLY_UNLINKED;
_tryUnlink();
unlinked = true;
}
else
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "unlink while " + _state);
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "unlink", new Object[] { Boolean.valueOf(unlinked), _positionString()});
return unlinked;
} | [
"public",
"final",
"boolean",
"unlink",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"unlink\"",
",",
"_positionString",
"(",
")",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"cursor count = \"",
"+",
"_cursorCount",
")",
";",
"boolean",
"unlinked",
"=",
"false",
";",
"LinkedList",
"parent",
"=",
"_parent",
";",
"if",
"(",
"null",
"!=",
"parent",
")",
"{",
"synchronized",
"(",
"parent",
")",
"{",
"if",
"(",
"LinkState",
".",
"LINKED",
"==",
"_state",
")",
"{",
"_state",
"=",
"LinkState",
".",
"LOGICALLY_UNLINKED",
";",
"_tryUnlink",
"(",
")",
";",
"unlinked",
"=",
"true",
";",
"}",
"else",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"unlink while \"",
"+",
"_state",
")",
";",
"}",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"unlink\"",
",",
"new",
"Object",
"[",
"]",
"{",
"Boolean",
".",
"valueOf",
"(",
"unlinked",
")",
",",
"_positionString",
"(",
")",
"}",
")",
";",
"return",
"unlinked",
";",
"}"
] | Request that the receiver be unlinked from the list. If the receiver is linked it will be
marked as logically unlinked. Note that this will perform a logical unlink, which may result
in a physical unlink | [
"Request",
"that",
"the",
"receiver",
"be",
"unlinked",
"from",
"the",
"list",
".",
"If",
"the",
"receiver",
"is",
"linked",
"it",
"will",
"be",
"marked",
"as",
"logically",
"unlinked",
".",
"Note",
"that",
"this",
"will",
"perform",
"a",
"logical",
"unlink",
"which",
"may",
"result",
"in",
"a",
"physical",
"unlink"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/list/Link.java#L365-L392 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/extension/DefaultExtensionProcessor.java | DefaultExtensionProcessor.isRequestForbidden | private boolean isRequestForbidden(StringBuffer path)
{
boolean requestIsForbidden = false;
String matchString = path.toString();
//PM82876 Start
// The fileName or dirName can have .. , check and fail for ".." in path only which can allow to serve from different location.
if(WCCustomProperties.ALLOW_DOTS_IN_NAME){
if (matchString.indexOf("..") > -1) {
if( (matchString.indexOf("/../") > -1) || (matchString.indexOf("\\..\\") > -1) ||
matchString.startsWith("../") || matchString.endsWith("/..") ||
matchString.startsWith("..\\")|| matchString.endsWith("\\.."))
{
requestIsForbidden = true;
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE))
logger.logp(Level.FINE, CLASS_NAME, "isRequestForbidden", "bad path :" + matchString);
}
}
if ((!requestIsForbidden && (matchString.endsWith("\\") || matchString.endsWith(".") || matchString.endsWith("/")))) {
requestIsForbidden = true;
}
}
else{ //PM82876 End
/**
* Do not allow ".." to appear in a path as it allows one to serve files from anywhere within
* the file system.
* Also check to see if the path or URI ends with '/', '\', or '.' .
* PQ44346 - Allow files on DFS to be served.
*/
if ((matchString.lastIndexOf("..") != -1 && (!matchString.startsWith("/...")))
|| matchString.endsWith("\\")
// PK23475 use matchString instead of RequestURI because RequestURI is not decoded
// || req.getRequestURI().endsWith(".")
|| matchString.endsWith(".")
// PK22928
// || req.getRequestURI().endsWith("/")){
|| matchString.endsWith("/"))
//PK22928
{
requestIsForbidden = true;
}
}
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
logger.logp(Level.FINE, CLASS_NAME,"isRequestForbidden","returning :" + requestIsForbidden + ", matchstring :" + matchString);
return requestIsForbidden;
} | java | private boolean isRequestForbidden(StringBuffer path)
{
boolean requestIsForbidden = false;
String matchString = path.toString();
//PM82876 Start
// The fileName or dirName can have .. , check and fail for ".." in path only which can allow to serve from different location.
if(WCCustomProperties.ALLOW_DOTS_IN_NAME){
if (matchString.indexOf("..") > -1) {
if( (matchString.indexOf("/../") > -1) || (matchString.indexOf("\\..\\") > -1) ||
matchString.startsWith("../") || matchString.endsWith("/..") ||
matchString.startsWith("..\\")|| matchString.endsWith("\\.."))
{
requestIsForbidden = true;
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE))
logger.logp(Level.FINE, CLASS_NAME, "isRequestForbidden", "bad path :" + matchString);
}
}
if ((!requestIsForbidden && (matchString.endsWith("\\") || matchString.endsWith(".") || matchString.endsWith("/")))) {
requestIsForbidden = true;
}
}
else{ //PM82876 End
/**
* Do not allow ".." to appear in a path as it allows one to serve files from anywhere within
* the file system.
* Also check to see if the path or URI ends with '/', '\', or '.' .
* PQ44346 - Allow files on DFS to be served.
*/
if ((matchString.lastIndexOf("..") != -1 && (!matchString.startsWith("/...")))
|| matchString.endsWith("\\")
// PK23475 use matchString instead of RequestURI because RequestURI is not decoded
// || req.getRequestURI().endsWith(".")
|| matchString.endsWith(".")
// PK22928
// || req.getRequestURI().endsWith("/")){
|| matchString.endsWith("/"))
//PK22928
{
requestIsForbidden = true;
}
}
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
logger.logp(Level.FINE, CLASS_NAME,"isRequestForbidden","returning :" + requestIsForbidden + ", matchstring :" + matchString);
return requestIsForbidden;
} | [
"private",
"boolean",
"isRequestForbidden",
"(",
"StringBuffer",
"path",
")",
"{",
"boolean",
"requestIsForbidden",
"=",
"false",
";",
"String",
"matchString",
"=",
"path",
".",
"toString",
"(",
")",
";",
"//PM82876 Start",
"// The fileName or dirName can have .. , check and fail for \"..\" in path only which can allow to serve from different location.",
"if",
"(",
"WCCustomProperties",
".",
"ALLOW_DOTS_IN_NAME",
")",
"{",
"if",
"(",
"matchString",
".",
"indexOf",
"(",
"\"..\"",
")",
">",
"-",
"1",
")",
"{",
"if",
"(",
"(",
"matchString",
".",
"indexOf",
"(",
"\"/../\"",
")",
">",
"-",
"1",
")",
"||",
"(",
"matchString",
".",
"indexOf",
"(",
"\"\\\\..\\\\\"",
")",
">",
"-",
"1",
")",
"||",
"matchString",
".",
"startsWith",
"(",
"\"../\"",
")",
"||",
"matchString",
".",
"endsWith",
"(",
"\"/..\"",
")",
"||",
"matchString",
".",
"startsWith",
"(",
"\"..\\\\\"",
")",
"||",
"matchString",
".",
"endsWith",
"(",
"\"\\\\..\"",
")",
")",
"{",
"requestIsForbidden",
"=",
"true",
";",
"if",
"(",
"com",
".",
"ibm",
".",
"ejs",
".",
"ras",
".",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"logger",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"CLASS_NAME",
",",
"\"isRequestForbidden\"",
",",
"\"bad path :\"",
"+",
"matchString",
")",
";",
"}",
"}",
"if",
"(",
"(",
"!",
"requestIsForbidden",
"&&",
"(",
"matchString",
".",
"endsWith",
"(",
"\"\\\\\"",
")",
"||",
"matchString",
".",
"endsWith",
"(",
"\".\"",
")",
"||",
"matchString",
".",
"endsWith",
"(",
"\"/\"",
")",
")",
")",
")",
"{",
"requestIsForbidden",
"=",
"true",
";",
"}",
"}",
"else",
"{",
"//PM82876 End",
"/**\n\t\t * Do not allow \"..\" to appear in a path as it allows one to serve files from anywhere within\n\t\t * the file system.\n\t\t * Also check to see if the path or URI ends with '/', '\\', or '.' .\n\t\t * PQ44346 - Allow files on DFS to be served.\n\t\t */",
"if",
"(",
"(",
"matchString",
".",
"lastIndexOf",
"(",
"\"..\"",
")",
"!=",
"-",
"1",
"&&",
"(",
"!",
"matchString",
".",
"startsWith",
"(",
"\"/...\"",
")",
")",
")",
"||",
"matchString",
".",
"endsWith",
"(",
"\"\\\\\"",
")",
"// PK23475 use matchString instead of RequestURI because RequestURI is not decoded",
"// || req.getRequestURI().endsWith(\".\")",
"||",
"matchString",
".",
"endsWith",
"(",
"\".\"",
")",
"// PK22928",
"// || req.getRequestURI().endsWith(\"/\")){",
"||",
"matchString",
".",
"endsWith",
"(",
"\"/\"",
")",
")",
"//PK22928",
"{",
"requestIsForbidden",
"=",
"true",
";",
"}",
"}",
"if",
"(",
"com",
".",
"ibm",
".",
"ejs",
".",
"ras",
".",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"logger",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"CLASS_NAME",
",",
"\"isRequestForbidden\"",
",",
"\"returning :\"",
"+",
"requestIsForbidden",
"+",
"\", matchstring :\"",
"+",
"matchString",
")",
";",
"return",
"requestIsForbidden",
";",
"}"
] | returns true if request is forbidden because it contains ".." etc. | [
"returns",
"true",
"if",
"request",
"is",
"forbidden",
"because",
"it",
"contains",
"..",
"etc",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/extension/DefaultExtensionProcessor.java#L1466-L1519 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/extension/DefaultExtensionProcessor.java | DefaultExtensionProcessor.isDirectoryTraverse | private boolean isDirectoryTraverse(StringBuffer path)
{
boolean directoryTraverse = false;
String matchString = path.toString();
//PM82876 Start
if (WCCustomProperties.ALLOW_DOTS_IN_NAME) {
// The fileName can have .. , check for the failing conditions only.
if (matchString.indexOf("..") > -1) {
if( (matchString.indexOf("/../") > -1) || (matchString.indexOf("\\..\\") > -1) ||
matchString.startsWith("../") || matchString.endsWith("/..") ||
matchString.startsWith("..\\")|| matchString.endsWith("\\.."))
{
directoryTraverse = true;
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE))
logger.logp(Level.FINE, CLASS_NAME, "isDirectoryTraverse", "bad path :" + matchString);
}
}
}
else{//PM82876 End
/**
* Do not allow ".." to appear in a path as it allows one to serve files from anywhere within
* the file system.
* Also check to see if the path or URI ends with '/', '\', or '.' .
* PQ44346 - Allow files on DFS to be served.
*/
if ( (matchString.lastIndexOf("..") != -1) && (!matchString.startsWith("/...") ))
{
directoryTraverse = true;
}
}
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
logger.logp(Level.FINE, CLASS_NAME,"isDirectoryTraverse", "returning" + directoryTraverse + " , matchstring :" + matchString);
return directoryTraverse;
} | java | private boolean isDirectoryTraverse(StringBuffer path)
{
boolean directoryTraverse = false;
String matchString = path.toString();
//PM82876 Start
if (WCCustomProperties.ALLOW_DOTS_IN_NAME) {
// The fileName can have .. , check for the failing conditions only.
if (matchString.indexOf("..") > -1) {
if( (matchString.indexOf("/../") > -1) || (matchString.indexOf("\\..\\") > -1) ||
matchString.startsWith("../") || matchString.endsWith("/..") ||
matchString.startsWith("..\\")|| matchString.endsWith("\\.."))
{
directoryTraverse = true;
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE))
logger.logp(Level.FINE, CLASS_NAME, "isDirectoryTraverse", "bad path :" + matchString);
}
}
}
else{//PM82876 End
/**
* Do not allow ".." to appear in a path as it allows one to serve files from anywhere within
* the file system.
* Also check to see if the path or URI ends with '/', '\', or '.' .
* PQ44346 - Allow files on DFS to be served.
*/
if ( (matchString.lastIndexOf("..") != -1) && (!matchString.startsWith("/...") ))
{
directoryTraverse = true;
}
}
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
logger.logp(Level.FINE, CLASS_NAME,"isDirectoryTraverse", "returning" + directoryTraverse + " , matchstring :" + matchString);
return directoryTraverse;
} | [
"private",
"boolean",
"isDirectoryTraverse",
"(",
"StringBuffer",
"path",
")",
"{",
"boolean",
"directoryTraverse",
"=",
"false",
";",
"String",
"matchString",
"=",
"path",
".",
"toString",
"(",
")",
";",
"//PM82876 Start",
"if",
"(",
"WCCustomProperties",
".",
"ALLOW_DOTS_IN_NAME",
")",
"{",
"// The fileName can have .. , check for the failing conditions only.",
"if",
"(",
"matchString",
".",
"indexOf",
"(",
"\"..\"",
")",
">",
"-",
"1",
")",
"{",
"if",
"(",
"(",
"matchString",
".",
"indexOf",
"(",
"\"/../\"",
")",
">",
"-",
"1",
")",
"||",
"(",
"matchString",
".",
"indexOf",
"(",
"\"\\\\..\\\\\"",
")",
">",
"-",
"1",
")",
"||",
"matchString",
".",
"startsWith",
"(",
"\"../\"",
")",
"||",
"matchString",
".",
"endsWith",
"(",
"\"/..\"",
")",
"||",
"matchString",
".",
"startsWith",
"(",
"\"..\\\\\"",
")",
"||",
"matchString",
".",
"endsWith",
"(",
"\"\\\\..\"",
")",
")",
"{",
"directoryTraverse",
"=",
"true",
";",
"if",
"(",
"com",
".",
"ibm",
".",
"ejs",
".",
"ras",
".",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"logger",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"CLASS_NAME",
",",
"\"isDirectoryTraverse\"",
",",
"\"bad path :\"",
"+",
"matchString",
")",
";",
"}",
"}",
"}",
"else",
"{",
"//PM82876 End",
"/**\n * Do not allow \"..\" to appear in a path as it allows one to serve files from anywhere within\n * the file system.\n * Also check to see if the path or URI ends with '/', '\\', or '.' .\n * PQ44346 - Allow files on DFS to be served.\n */",
"if",
"(",
"(",
"matchString",
".",
"lastIndexOf",
"(",
"\"..\"",
")",
"!=",
"-",
"1",
")",
"&&",
"(",
"!",
"matchString",
".",
"startsWith",
"(",
"\"/...\"",
")",
")",
")",
"{",
"directoryTraverse",
"=",
"true",
";",
"}",
"}",
"if",
"(",
"com",
".",
"ibm",
".",
"ejs",
".",
"ras",
".",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"logger",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"CLASS_NAME",
",",
"\"isDirectoryTraverse\"",
",",
"\"returning\"",
"+",
"directoryTraverse",
"+",
"\" , matchstring :\"",
"+",
"matchString",
")",
";",
"return",
"directoryTraverse",
";",
"}"
] | 542155 Add isDirectoryTraverse method - reduced version of isRequestForbidden | [
"542155",
"Add",
"isDirectoryTraverse",
"method",
"-",
"reduced",
"version",
"of",
"isRequestForbidden"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/extension/DefaultExtensionProcessor.java#L1522-L1561 | train |
OpenLiberty/open-liberty | dev/com.ibm.websphere.security/src/com/ibm/ws/security/filemonitor/SecurityFileMonitor.java | SecurityFileMonitor.monitorFiles | public ServiceRegistration<FileMonitor> monitorFiles(Collection<String> paths, long monitorInterval) {
BundleContext bundleContext = actionable.getBundleContext();
final Hashtable<String, Object> fileMonitorProps = new Hashtable<String, Object>();
fileMonitorProps.put(FileMonitor.MONITOR_FILES, paths);
fileMonitorProps.put(FileMonitor.MONITOR_INTERVAL, monitorInterval);
return bundleContext.registerService(FileMonitor.class, this, fileMonitorProps);
} | java | public ServiceRegistration<FileMonitor> monitorFiles(Collection<String> paths, long monitorInterval) {
BundleContext bundleContext = actionable.getBundleContext();
final Hashtable<String, Object> fileMonitorProps = new Hashtable<String, Object>();
fileMonitorProps.put(FileMonitor.MONITOR_FILES, paths);
fileMonitorProps.put(FileMonitor.MONITOR_INTERVAL, monitorInterval);
return bundleContext.registerService(FileMonitor.class, this, fileMonitorProps);
} | [
"public",
"ServiceRegistration",
"<",
"FileMonitor",
">",
"monitorFiles",
"(",
"Collection",
"<",
"String",
">",
"paths",
",",
"long",
"monitorInterval",
")",
"{",
"BundleContext",
"bundleContext",
"=",
"actionable",
".",
"getBundleContext",
"(",
")",
";",
"final",
"Hashtable",
"<",
"String",
",",
"Object",
">",
"fileMonitorProps",
"=",
"new",
"Hashtable",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"fileMonitorProps",
".",
"put",
"(",
"FileMonitor",
".",
"MONITOR_FILES",
",",
"paths",
")",
";",
"fileMonitorProps",
".",
"put",
"(",
"FileMonitor",
".",
"MONITOR_INTERVAL",
",",
"monitorInterval",
")",
";",
"return",
"bundleContext",
".",
"registerService",
"(",
"FileMonitor",
".",
"class",
",",
"this",
",",
"fileMonitorProps",
")",
";",
"}"
] | Registers this file monitor to start monitoring the specified files at the specified interval.
@param paths the paths of the files to monitor.
@param monitorInterval the rate to monitor the files.
@return the <code>FileMonitor</code> service registration. | [
"Registers",
"this",
"file",
"monitor",
"to",
"start",
"monitoring",
"the",
"specified",
"files",
"at",
"the",
"specified",
"interval",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.security/src/com/ibm/ws/security/filemonitor/SecurityFileMonitor.java#L47-L53 | train |
OpenLiberty/open-liberty | dev/com.ibm.websphere.security/src/com/ibm/ws/security/filemonitor/SecurityFileMonitor.java | SecurityFileMonitor.monitorFiles | public ServiceRegistration<FileMonitor> monitorFiles(String ID, Collection<String> paths, long pollingRate, String trigger) {
BundleContext bundleContext = actionable.getBundleContext();
final Hashtable<String, Object> fileMonitorProps = new Hashtable<String, Object>();
fileMonitorProps.put(FileMonitor.MONITOR_FILES, paths);
//Adding INTERNAL parameter MONITOR_IDENTIFICATION_NAME to identify this monitor.
fileMonitorProps.put(com.ibm.ws.kernel.filemonitor.FileMonitor.MONITOR_IDENTIFICATION_NAME, com.ibm.ws.kernel.filemonitor.FileMonitor.SECURITY_MONITOR_IDENTIFICATION_VALUE);
//Adding parameter MONITOR_IDENTIFICATION_CONFIG_ID to identify this monitor by the ID.
fileMonitorProps.put(com.ibm.ws.kernel.filemonitor.FileMonitor.MONITOR_KEYSTORE_CONFIG_ID, ID);
if (!(trigger.equalsIgnoreCase("disabled"))) {
if (trigger.equals("mbean")) {
fileMonitorProps.put(FileMonitor.MONITOR_TYPE, FileMonitor.MONITOR_TYPE_EXTERNAL);
} else {
fileMonitorProps.put(FileMonitor.MONITOR_TYPE, FileMonitor.MONITOR_TYPE_TIMED);
fileMonitorProps.put(FileMonitor.MONITOR_INTERVAL, pollingRate);
}
}
// Don't attempt to register the file monitor if the server is stopping
if (FrameworkState.isStopping())
return null;
return bundleContext.registerService(FileMonitor.class, this, fileMonitorProps);
} | java | public ServiceRegistration<FileMonitor> monitorFiles(String ID, Collection<String> paths, long pollingRate, String trigger) {
BundleContext bundleContext = actionable.getBundleContext();
final Hashtable<String, Object> fileMonitorProps = new Hashtable<String, Object>();
fileMonitorProps.put(FileMonitor.MONITOR_FILES, paths);
//Adding INTERNAL parameter MONITOR_IDENTIFICATION_NAME to identify this monitor.
fileMonitorProps.put(com.ibm.ws.kernel.filemonitor.FileMonitor.MONITOR_IDENTIFICATION_NAME, com.ibm.ws.kernel.filemonitor.FileMonitor.SECURITY_MONITOR_IDENTIFICATION_VALUE);
//Adding parameter MONITOR_IDENTIFICATION_CONFIG_ID to identify this monitor by the ID.
fileMonitorProps.put(com.ibm.ws.kernel.filemonitor.FileMonitor.MONITOR_KEYSTORE_CONFIG_ID, ID);
if (!(trigger.equalsIgnoreCase("disabled"))) {
if (trigger.equals("mbean")) {
fileMonitorProps.put(FileMonitor.MONITOR_TYPE, FileMonitor.MONITOR_TYPE_EXTERNAL);
} else {
fileMonitorProps.put(FileMonitor.MONITOR_TYPE, FileMonitor.MONITOR_TYPE_TIMED);
fileMonitorProps.put(FileMonitor.MONITOR_INTERVAL, pollingRate);
}
}
// Don't attempt to register the file monitor if the server is stopping
if (FrameworkState.isStopping())
return null;
return bundleContext.registerService(FileMonitor.class, this, fileMonitorProps);
} | [
"public",
"ServiceRegistration",
"<",
"FileMonitor",
">",
"monitorFiles",
"(",
"String",
"ID",
",",
"Collection",
"<",
"String",
">",
"paths",
",",
"long",
"pollingRate",
",",
"String",
"trigger",
")",
"{",
"BundleContext",
"bundleContext",
"=",
"actionable",
".",
"getBundleContext",
"(",
")",
";",
"final",
"Hashtable",
"<",
"String",
",",
"Object",
">",
"fileMonitorProps",
"=",
"new",
"Hashtable",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"fileMonitorProps",
".",
"put",
"(",
"FileMonitor",
".",
"MONITOR_FILES",
",",
"paths",
")",
";",
"//Adding INTERNAL parameter MONITOR_IDENTIFICATION_NAME to identify this monitor.",
"fileMonitorProps",
".",
"put",
"(",
"com",
".",
"ibm",
".",
"ws",
".",
"kernel",
".",
"filemonitor",
".",
"FileMonitor",
".",
"MONITOR_IDENTIFICATION_NAME",
",",
"com",
".",
"ibm",
".",
"ws",
".",
"kernel",
".",
"filemonitor",
".",
"FileMonitor",
".",
"SECURITY_MONITOR_IDENTIFICATION_VALUE",
")",
";",
"//Adding parameter MONITOR_IDENTIFICATION_CONFIG_ID to identify this monitor by the ID.",
"fileMonitorProps",
".",
"put",
"(",
"com",
".",
"ibm",
".",
"ws",
".",
"kernel",
".",
"filemonitor",
".",
"FileMonitor",
".",
"MONITOR_KEYSTORE_CONFIG_ID",
",",
"ID",
")",
";",
"if",
"(",
"!",
"(",
"trigger",
".",
"equalsIgnoreCase",
"(",
"\"disabled\"",
")",
")",
")",
"{",
"if",
"(",
"trigger",
".",
"equals",
"(",
"\"mbean\"",
")",
")",
"{",
"fileMonitorProps",
".",
"put",
"(",
"FileMonitor",
".",
"MONITOR_TYPE",
",",
"FileMonitor",
".",
"MONITOR_TYPE_EXTERNAL",
")",
";",
"}",
"else",
"{",
"fileMonitorProps",
".",
"put",
"(",
"FileMonitor",
".",
"MONITOR_TYPE",
",",
"FileMonitor",
".",
"MONITOR_TYPE_TIMED",
")",
";",
"fileMonitorProps",
".",
"put",
"(",
"FileMonitor",
".",
"MONITOR_INTERVAL",
",",
"pollingRate",
")",
";",
"}",
"}",
"// Don't attempt to register the file monitor if the server is stopping",
"if",
"(",
"FrameworkState",
".",
"isStopping",
"(",
")",
")",
"return",
"null",
";",
"return",
"bundleContext",
".",
"registerService",
"(",
"FileMonitor",
".",
"class",
",",
"this",
",",
"fileMonitorProps",
")",
";",
"}"
] | Registers this file monitor to start monitoring the specified files either by mbean
notification or polling rate.
@param id of the config element
@param paths the paths of the files to monitor.
@param pollingRate the rate to pole he file for a change.
@param trigger what trigger the file update notification mbean or poll
@return The <code>FileMonitor</code> service registration. | [
"Registers",
"this",
"file",
"monitor",
"to",
"start",
"monitoring",
"the",
"specified",
"files",
"either",
"by",
"mbean",
"notification",
"or",
"polling",
"rate",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.security/src/com/ibm/ws/security/filemonitor/SecurityFileMonitor.java#L65-L87 | train |
OpenLiberty/open-liberty | dev/com.ibm.websphere.security/src/com/ibm/ws/security/filemonitor/SecurityFileMonitor.java | SecurityFileMonitor.isActionNeeded | private Boolean isActionNeeded(Collection<File> createdFiles, Collection<File> modifiedFiles) {
boolean actionNeeded = false;
for (File createdFile : createdFiles) {
if (currentlyDeletedFiles.contains(createdFile)) {
currentlyDeletedFiles.remove(createdFile);
actionNeeded = true;
}
}
if (modifiedFiles.isEmpty() == false) {
actionNeeded = true;
}
return actionNeeded;
} | java | private Boolean isActionNeeded(Collection<File> createdFiles, Collection<File> modifiedFiles) {
boolean actionNeeded = false;
for (File createdFile : createdFiles) {
if (currentlyDeletedFiles.contains(createdFile)) {
currentlyDeletedFiles.remove(createdFile);
actionNeeded = true;
}
}
if (modifiedFiles.isEmpty() == false) {
actionNeeded = true;
}
return actionNeeded;
} | [
"private",
"Boolean",
"isActionNeeded",
"(",
"Collection",
"<",
"File",
">",
"createdFiles",
",",
"Collection",
"<",
"File",
">",
"modifiedFiles",
")",
"{",
"boolean",
"actionNeeded",
"=",
"false",
";",
"for",
"(",
"File",
"createdFile",
":",
"createdFiles",
")",
"{",
"if",
"(",
"currentlyDeletedFiles",
".",
"contains",
"(",
"createdFile",
")",
")",
"{",
"currentlyDeletedFiles",
".",
"remove",
"(",
"createdFile",
")",
";",
"actionNeeded",
"=",
"true",
";",
"}",
"}",
"if",
"(",
"modifiedFiles",
".",
"isEmpty",
"(",
")",
"==",
"false",
")",
"{",
"actionNeeded",
"=",
"true",
";",
"}",
"return",
"actionNeeded",
";",
"}"
] | Action is needed if a file is modified or if it is recreated after it was deleted.
@param modifiedFiles | [
"Action",
"is",
"needed",
"if",
"a",
"file",
"is",
"modified",
"or",
"if",
"it",
"is",
"recreated",
"after",
"it",
"was",
"deleted",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.security/src/com/ibm/ws/security/filemonitor/SecurityFileMonitor.java#L121-L135 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/JsQueue.java | JsQueue.getQueuedMessages | public QueuedMessage[] getQueuedMessages(java.lang.Integer fromIndexInteger,java.lang.Integer toIndexInteger,java.lang.Integer totalMessagesPerpageInteger) throws Exception {
int fromIndex=fromIndexInteger.intValue();
int toIndex=toIndexInteger.intValue();
int totalMessagesPerpage=totalMessagesPerpageInteger.intValue();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getQueuedMessages fromIndex="+fromIndex+" toIndex= "+toIndex+" totalMsgs= "+totalMessagesPerpage);
List list = new ArrayList();
Iterator iter = _c.getQueuedMessageIterator(fromIndex,toIndex,totalMessagesPerpage);//673411
while (iter != null && iter.hasNext()) {
SIMPQueuedMessageControllable o = (SIMPQueuedMessageControllable) iter.next();
list.add(o);
}
List resultList = new ArrayList();
iter = list.iterator();
int i = 0;
while (iter.hasNext()) {
Object o = iter.next();
QueuedMessage qm = SIBMBeanResultFactory.createSIBQueuedMessage((SIMPQueuedMessageControllable) o);
resultList.add(qm);
}
QueuedMessage[] retValue = (QueuedMessage[])resultList.toArray(new QueuedMessage[0]);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getQueuedMessagesfromIndex="+fromIndex+" toIndex= "+toIndex+" totalMsgs= "+totalMessagesPerpage, retValue);
return retValue;
} | java | public QueuedMessage[] getQueuedMessages(java.lang.Integer fromIndexInteger,java.lang.Integer toIndexInteger,java.lang.Integer totalMessagesPerpageInteger) throws Exception {
int fromIndex=fromIndexInteger.intValue();
int toIndex=toIndexInteger.intValue();
int totalMessagesPerpage=totalMessagesPerpageInteger.intValue();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getQueuedMessages fromIndex="+fromIndex+" toIndex= "+toIndex+" totalMsgs= "+totalMessagesPerpage);
List list = new ArrayList();
Iterator iter = _c.getQueuedMessageIterator(fromIndex,toIndex,totalMessagesPerpage);//673411
while (iter != null && iter.hasNext()) {
SIMPQueuedMessageControllable o = (SIMPQueuedMessageControllable) iter.next();
list.add(o);
}
List resultList = new ArrayList();
iter = list.iterator();
int i = 0;
while (iter.hasNext()) {
Object o = iter.next();
QueuedMessage qm = SIBMBeanResultFactory.createSIBQueuedMessage((SIMPQueuedMessageControllable) o);
resultList.add(qm);
}
QueuedMessage[] retValue = (QueuedMessage[])resultList.toArray(new QueuedMessage[0]);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getQueuedMessagesfromIndex="+fromIndex+" toIndex= "+toIndex+" totalMsgs= "+totalMessagesPerpage, retValue);
return retValue;
} | [
"public",
"QueuedMessage",
"[",
"]",
"getQueuedMessages",
"(",
"java",
".",
"lang",
".",
"Integer",
"fromIndexInteger",
",",
"java",
".",
"lang",
".",
"Integer",
"toIndexInteger",
",",
"java",
".",
"lang",
".",
"Integer",
"totalMessagesPerpageInteger",
")",
"throws",
"Exception",
"{",
"int",
"fromIndex",
"=",
"fromIndexInteger",
".",
"intValue",
"(",
")",
";",
"int",
"toIndex",
"=",
"toIndexInteger",
".",
"intValue",
"(",
")",
";",
"int",
"totalMessagesPerpage",
"=",
"totalMessagesPerpageInteger",
".",
"intValue",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"getQueuedMessages fromIndex=\"",
"+",
"fromIndex",
"+",
"\" toIndex= \"",
"+",
"toIndex",
"+",
"\" totalMsgs= \"",
"+",
"totalMessagesPerpage",
")",
";",
"List",
"list",
"=",
"new",
"ArrayList",
"(",
")",
";",
"Iterator",
"iter",
"=",
"_c",
".",
"getQueuedMessageIterator",
"(",
"fromIndex",
",",
"toIndex",
",",
"totalMessagesPerpage",
")",
";",
"//673411",
"while",
"(",
"iter",
"!=",
"null",
"&&",
"iter",
".",
"hasNext",
"(",
")",
")",
"{",
"SIMPQueuedMessageControllable",
"o",
"=",
"(",
"SIMPQueuedMessageControllable",
")",
"iter",
".",
"next",
"(",
")",
";",
"list",
".",
"add",
"(",
"o",
")",
";",
"}",
"List",
"resultList",
"=",
"new",
"ArrayList",
"(",
")",
";",
"iter",
"=",
"list",
".",
"iterator",
"(",
")",
";",
"int",
"i",
"=",
"0",
";",
"while",
"(",
"iter",
".",
"hasNext",
"(",
")",
")",
"{",
"Object",
"o",
"=",
"iter",
".",
"next",
"(",
")",
";",
"QueuedMessage",
"qm",
"=",
"SIBMBeanResultFactory",
".",
"createSIBQueuedMessage",
"(",
"(",
"SIMPQueuedMessageControllable",
")",
"o",
")",
";",
"resultList",
".",
"add",
"(",
"qm",
")",
";",
"}",
"QueuedMessage",
"[",
"]",
"retValue",
"=",
"(",
"QueuedMessage",
"[",
"]",
")",
"resultList",
".",
"toArray",
"(",
"new",
"QueuedMessage",
"[",
"0",
"]",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"getQueuedMessagesfromIndex=\"",
"+",
"fromIndex",
"+",
"\" toIndex= \"",
"+",
"toIndex",
"+",
"\" totalMsgs= \"",
"+",
"totalMessagesPerpage",
",",
"retValue",
")",
";",
"return",
"retValue",
";",
"}"
] | 673411 -start | [
"673411",
"-",
"start"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/JsQueue.java#L374-L406 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/util/cache/BackgroundLruEvictionStrategy.java | BackgroundLruEvictionStrategy.initializeCacheData | private void initializeCacheData(int cacheSize)
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && (tc.isEntryEnabled() || tcOOM.isEntryEnabled()))
Tr.entry(tc.isEntryEnabled() ? tc : tcOOM,
"initializeCacheData : " + ivCache.getName() + " preferred size = " +
ivPreferredMaxSize);
ivPreferredMaxSize = cacheSize;
// Define an internal upper limit to the cache size. This is similar
// to the 'hard' limit, but would never be enforced; it is merely
// used to determine a point at which the eviction strategy should
// dynamically tune itself to become more aggressive. d112258
ivUpperLimit = (long) (ivPreferredMaxSize * 1.1); // 10% over cache size
// Give the cache a little breathing room (or buffer) below the
// soft limit. By reducing to this far below the soft limit, it
// is less likely that the next sweep will have to do anything.
ivSoftLimitBuffer = ivPreferredMaxSize / 100; // 1% of the Cache Size
if (ivSoftLimitBuffer > 50) // Don't let this get too big.
ivSoftLimitBuffer = 50;
if (isTraceOn && (tc.isEntryEnabled() || tcOOM.isEntryEnabled()))
Tr.exit(tc.isEntryEnabled() ? tc : tcOOM,
"initializeCacheData : " + ivCache.getName() + " preferred size = "
+ ivPreferredMaxSize + " limit = " + ivUpperLimit +
", buffer = " + ivSoftLimitBuffer);
} | java | private void initializeCacheData(int cacheSize)
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && (tc.isEntryEnabled() || tcOOM.isEntryEnabled()))
Tr.entry(tc.isEntryEnabled() ? tc : tcOOM,
"initializeCacheData : " + ivCache.getName() + " preferred size = " +
ivPreferredMaxSize);
ivPreferredMaxSize = cacheSize;
// Define an internal upper limit to the cache size. This is similar
// to the 'hard' limit, but would never be enforced; it is merely
// used to determine a point at which the eviction strategy should
// dynamically tune itself to become more aggressive. d112258
ivUpperLimit = (long) (ivPreferredMaxSize * 1.1); // 10% over cache size
// Give the cache a little breathing room (or buffer) below the
// soft limit. By reducing to this far below the soft limit, it
// is less likely that the next sweep will have to do anything.
ivSoftLimitBuffer = ivPreferredMaxSize / 100; // 1% of the Cache Size
if (ivSoftLimitBuffer > 50) // Don't let this get too big.
ivSoftLimitBuffer = 50;
if (isTraceOn && (tc.isEntryEnabled() || tcOOM.isEntryEnabled()))
Tr.exit(tc.isEntryEnabled() ? tc : tcOOM,
"initializeCacheData : " + ivCache.getName() + " preferred size = "
+ ivPreferredMaxSize + " limit = " + ivUpperLimit +
", buffer = " + ivSoftLimitBuffer);
} | [
"private",
"void",
"initializeCacheData",
"(",
"int",
"cacheSize",
")",
"{",
"final",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
"||",
"tcOOM",
".",
"isEntryEnabled",
"(",
")",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
"?",
"tc",
":",
"tcOOM",
",",
"\"initializeCacheData : \"",
"+",
"ivCache",
".",
"getName",
"(",
")",
"+",
"\" preferred size = \"",
"+",
"ivPreferredMaxSize",
")",
";",
"ivPreferredMaxSize",
"=",
"cacheSize",
";",
"// Define an internal upper limit to the cache size. This is similar",
"// to the 'hard' limit, but would never be enforced; it is merely",
"// used to determine a point at which the eviction strategy should",
"// dynamically tune itself to become more aggressive. d112258",
"ivUpperLimit",
"=",
"(",
"long",
")",
"(",
"ivPreferredMaxSize",
"*",
"1.1",
")",
";",
"// 10% over cache size",
"// Give the cache a little breathing room (or buffer) below the",
"// soft limit. By reducing to this far below the soft limit, it",
"// is less likely that the next sweep will have to do anything.",
"ivSoftLimitBuffer",
"=",
"ivPreferredMaxSize",
"/",
"100",
";",
"// 1% of the Cache Size",
"if",
"(",
"ivSoftLimitBuffer",
">",
"50",
")",
"// Don't let this get too big.",
"ivSoftLimitBuffer",
"=",
"50",
";",
"if",
"(",
"isTraceOn",
"&&",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
"||",
"tcOOM",
".",
"isEntryEnabled",
"(",
")",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
"?",
"tc",
":",
"tcOOM",
",",
"\"initializeCacheData : \"",
"+",
"ivCache",
".",
"getName",
"(",
")",
"+",
"\" preferred size = \"",
"+",
"ivPreferredMaxSize",
"+",
"\" limit = \"",
"+",
"ivUpperLimit",
"+",
"\", buffer = \"",
"+",
"ivSoftLimitBuffer",
")",
";",
"}"
] | Initialize various optimization values used by the eviction strategy that
depend on the cache size.
@param size the size of the cache used to set these values | [
"Initialize",
"various",
"optimization",
"values",
"used",
"by",
"the",
"eviction",
"strategy",
"that",
"depend",
"on",
"the",
"cache",
"size",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/util/cache/BackgroundLruEvictionStrategy.java#L267-L295 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/util/cache/BackgroundLruEvictionStrategy.java | BackgroundLruEvictionStrategy.initializeSweepInterval | private void initializeSweepInterval(long sweepInterval)
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && (tc.isEntryEnabled() || tcOOM.isEntryEnabled()))
Tr.entry(tc.isEntryEnabled() ? tc : tcOOM,
"initializeSweepInterval : " + ivCache.getName() + " preferred size = " +
ivPreferredMaxSize + ", sweep = " + sweepInterval);
ivSweepInterval = sweepInterval;
// Adjust the discard threshold according to the sweepInterval.
// The discard threshold is a value between 2 and 20. d112258
if ((ivSweepInterval * ivDiscardThreshold) > MAX_THRESHOLD_MULTIPLIER)
{
ivDiscardThreshold = (MAX_THRESHOLD_MULTIPLIER / ivSweepInterval);
if (ivDiscardThreshold < 2)
ivDiscardThreshold = 2;
}
// Determine the upper and lower bounds for the discard threshold for
// dynamic tuning of the eviction strategy. The max threshold will allow
// objects to age for up to 1 minute (MAX_THRESHOLD_MULTIPLIER), and
// the min threshold requires that objects age for at least 9 seconds
// (MIN_THRESHOLD_MULTIPLIER). d112258
ivMaxDiscardThreshold = ivDiscardThreshold;
ivMinDiscardThreshold = (MIN_THRESHOLD_MULTIPLIER / ivSweepInterval);
if (ivMinDiscardThreshold < 2)
ivMinDiscardThreshold = 2;
if (isTraceOn && (tc.isEntryEnabled() || tcOOM.isEntryEnabled()))
Tr.exit(tc.isEntryEnabled() ? tc : tcOOM,
"initializeSweepInterval : " + ivCache.getName() + " preferred size = "
+ ivPreferredMaxSize + ", sweep = " + ivSweepInterval +
", threshold = " + ivDiscardThreshold + ", buffer = " +
ivSoftLimitBuffer);
} | java | private void initializeSweepInterval(long sweepInterval)
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && (tc.isEntryEnabled() || tcOOM.isEntryEnabled()))
Tr.entry(tc.isEntryEnabled() ? tc : tcOOM,
"initializeSweepInterval : " + ivCache.getName() + " preferred size = " +
ivPreferredMaxSize + ", sweep = " + sweepInterval);
ivSweepInterval = sweepInterval;
// Adjust the discard threshold according to the sweepInterval.
// The discard threshold is a value between 2 and 20. d112258
if ((ivSweepInterval * ivDiscardThreshold) > MAX_THRESHOLD_MULTIPLIER)
{
ivDiscardThreshold = (MAX_THRESHOLD_MULTIPLIER / ivSweepInterval);
if (ivDiscardThreshold < 2)
ivDiscardThreshold = 2;
}
// Determine the upper and lower bounds for the discard threshold for
// dynamic tuning of the eviction strategy. The max threshold will allow
// objects to age for up to 1 minute (MAX_THRESHOLD_MULTIPLIER), and
// the min threshold requires that objects age for at least 9 seconds
// (MIN_THRESHOLD_MULTIPLIER). d112258
ivMaxDiscardThreshold = ivDiscardThreshold;
ivMinDiscardThreshold = (MIN_THRESHOLD_MULTIPLIER / ivSweepInterval);
if (ivMinDiscardThreshold < 2)
ivMinDiscardThreshold = 2;
if (isTraceOn && (tc.isEntryEnabled() || tcOOM.isEntryEnabled()))
Tr.exit(tc.isEntryEnabled() ? tc : tcOOM,
"initializeSweepInterval : " + ivCache.getName() + " preferred size = "
+ ivPreferredMaxSize + ", sweep = " + ivSweepInterval +
", threshold = " + ivDiscardThreshold + ", buffer = " +
ivSoftLimitBuffer);
} | [
"private",
"void",
"initializeSweepInterval",
"(",
"long",
"sweepInterval",
")",
"{",
"final",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
"||",
"tcOOM",
".",
"isEntryEnabled",
"(",
")",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
"?",
"tc",
":",
"tcOOM",
",",
"\"initializeSweepInterval : \"",
"+",
"ivCache",
".",
"getName",
"(",
")",
"+",
"\" preferred size = \"",
"+",
"ivPreferredMaxSize",
"+",
"\", sweep = \"",
"+",
"sweepInterval",
")",
";",
"ivSweepInterval",
"=",
"sweepInterval",
";",
"// Adjust the discard threshold according to the sweepInterval.",
"// The discard threshold is a value between 2 and 20. d112258",
"if",
"(",
"(",
"ivSweepInterval",
"*",
"ivDiscardThreshold",
")",
">",
"MAX_THRESHOLD_MULTIPLIER",
")",
"{",
"ivDiscardThreshold",
"=",
"(",
"MAX_THRESHOLD_MULTIPLIER",
"/",
"ivSweepInterval",
")",
";",
"if",
"(",
"ivDiscardThreshold",
"<",
"2",
")",
"ivDiscardThreshold",
"=",
"2",
";",
"}",
"// Determine the upper and lower bounds for the discard threshold for",
"// dynamic tuning of the eviction strategy. The max threshold will allow",
"// objects to age for up to 1 minute (MAX_THRESHOLD_MULTIPLIER), and",
"// the min threshold requires that objects age for at least 9 seconds",
"// (MIN_THRESHOLD_MULTIPLIER). d112258",
"ivMaxDiscardThreshold",
"=",
"ivDiscardThreshold",
";",
"ivMinDiscardThreshold",
"=",
"(",
"MIN_THRESHOLD_MULTIPLIER",
"/",
"ivSweepInterval",
")",
";",
"if",
"(",
"ivMinDiscardThreshold",
"<",
"2",
")",
"ivMinDiscardThreshold",
"=",
"2",
";",
"if",
"(",
"isTraceOn",
"&&",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
"||",
"tcOOM",
".",
"isEntryEnabled",
"(",
")",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
"?",
"tc",
":",
"tcOOM",
",",
"\"initializeSweepInterval : \"",
"+",
"ivCache",
".",
"getName",
"(",
")",
"+",
"\" preferred size = \"",
"+",
"ivPreferredMaxSize",
"+",
"\", sweep = \"",
"+",
"ivSweepInterval",
"+",
"\", threshold = \"",
"+",
"ivDiscardThreshold",
"+",
"\", buffer = \"",
"+",
"ivSoftLimitBuffer",
")",
";",
"}"
] | Initialize all of the intervals that are derived from the configurable
sweep interval. Can be called at any time during runtime.
@param sweepInterval the interval between sweeps that this eviction
strategy uses | [
"Initialize",
"all",
"of",
"the",
"intervals",
"that",
"are",
"derived",
"from",
"the",
"configurable",
"sweep",
"interval",
".",
"Can",
"be",
"called",
"at",
"any",
"time",
"during",
"runtime",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/util/cache/BackgroundLruEvictionStrategy.java#L304-L339 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/util/cache/BackgroundLruEvictionStrategy.java | BackgroundLruEvictionStrategy.isTraceEnabled | private boolean isTraceEnabled(boolean debug) // d581579
{
if (debug ? tc.isDebugEnabled() : tc.isEntryEnabled())
{
return true;
}
if (ivCache.numSweeps % NUM_SWEEPS_PER_OOMTRACE == 1 &&
(debug ? tcOOM.isDebugEnabled() : tcOOM.isEntryEnabled()))
{
return true;
}
return false;
} | java | private boolean isTraceEnabled(boolean debug) // d581579
{
if (debug ? tc.isDebugEnabled() : tc.isEntryEnabled())
{
return true;
}
if (ivCache.numSweeps % NUM_SWEEPS_PER_OOMTRACE == 1 &&
(debug ? tcOOM.isDebugEnabled() : tcOOM.isEntryEnabled()))
{
return true;
}
return false;
} | [
"private",
"boolean",
"isTraceEnabled",
"(",
"boolean",
"debug",
")",
"// d581579",
"{",
"if",
"(",
"debug",
"?",
"tc",
".",
"isDebugEnabled",
"(",
")",
":",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"ivCache",
".",
"numSweeps",
"%",
"NUM_SWEEPS_PER_OOMTRACE",
"==",
"1",
"&&",
"(",
"debug",
"?",
"tcOOM",
".",
"isDebugEnabled",
"(",
")",
":",
"tcOOM",
".",
"isEntryEnabled",
"(",
")",
")",
")",
"{",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] | Returns true if trace should be printed. | [
"Returns",
"true",
"if",
"trace",
"should",
"be",
"printed",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/util/cache/BackgroundLruEvictionStrategy.java#L378-L392 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/richclient/framework/impl/CFWIOBaseContext.java | CFWIOBaseContext.getNetworkConnectionInstance | protected NetworkConnection getNetworkConnectionInstance(VirtualConnection vc)
{
if (tc.isEntryEnabled()) SibTr.entry(this, tc, "getNetworkConnectionInstance", vc);
NetworkConnection retConn = null;
if (vc != null)
{
// Default to the connection that we were created from
retConn = conn;
if (vc != ((CFWNetworkConnection) conn).getVirtualConnection())
{
// The connection is different - nothing else to do but create a new instance
retConn = new CFWNetworkConnection(vc);
}
}
if (tc.isEntryEnabled()) SibTr.exit(this, tc, "getNetworkConnectionInstance", retConn);
return retConn;
} | java | protected NetworkConnection getNetworkConnectionInstance(VirtualConnection vc)
{
if (tc.isEntryEnabled()) SibTr.entry(this, tc, "getNetworkConnectionInstance", vc);
NetworkConnection retConn = null;
if (vc != null)
{
// Default to the connection that we were created from
retConn = conn;
if (vc != ((CFWNetworkConnection) conn).getVirtualConnection())
{
// The connection is different - nothing else to do but create a new instance
retConn = new CFWNetworkConnection(vc);
}
}
if (tc.isEntryEnabled()) SibTr.exit(this, tc, "getNetworkConnectionInstance", retConn);
return retConn;
} | [
"protected",
"NetworkConnection",
"getNetworkConnectionInstance",
"(",
"VirtualConnection",
"vc",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"getNetworkConnectionInstance\"",
",",
"vc",
")",
";",
"NetworkConnection",
"retConn",
"=",
"null",
";",
"if",
"(",
"vc",
"!=",
"null",
")",
"{",
"// Default to the connection that we were created from",
"retConn",
"=",
"conn",
";",
"if",
"(",
"vc",
"!=",
"(",
"(",
"CFWNetworkConnection",
")",
"conn",
")",
".",
"getVirtualConnection",
"(",
")",
")",
"{",
"// The connection is different - nothing else to do but create a new instance",
"retConn",
"=",
"new",
"CFWNetworkConnection",
"(",
"vc",
")",
";",
"}",
"}",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"getNetworkConnectionInstance\"",
",",
"retConn",
")",
";",
"return",
"retConn",
";",
"}"
] | This method tries to avoid creating a new instance of a CFWNetworkConnection object by seeing
if the specified virtual connection is the one that we are wrapping in the
CFWNetworkConnection instance that created this context. If it is, we simply return that.
Otherwise we must create a new instance.
@param vc The virtual connection.
@return Returns a NetworkConnection instance that wraps the virtual connection. | [
"This",
"method",
"tries",
"to",
"avoid",
"creating",
"a",
"new",
"instance",
"of",
"a",
"CFWNetworkConnection",
"object",
"by",
"seeing",
"if",
"the",
"specified",
"virtual",
"connection",
"is",
"the",
"one",
"that",
"we",
"are",
"wrapping",
"in",
"the",
"CFWNetworkConnection",
"instance",
"that",
"created",
"this",
"context",
".",
"If",
"it",
"is",
"we",
"simply",
"return",
"that",
".",
"Otherwise",
"we",
"must",
"create",
"a",
"new",
"instance",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/richclient/framework/impl/CFWIOBaseContext.java#L63-L82 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/MessageMap.java | MessageMap.setChoices | private void setChoices(BigInteger multiChoice, JSchema schema) {
JSType topType = (JSType)schema.getJMFType();
if (topType instanceof JSVariant)
setChoices(multiChoice, schema, (JSVariant)topType);
else if (topType instanceof JSTuple)
setChoices(
multiChoice,
topType.getMultiChoiceCount(),
schema,
((JSTuple)topType).getDominatedVariants());
else
// If topType is JSRepeated, JSDynamic, JSEnum, or JSPrimitive there can be no unboxed
// variants at top level.
return;
} | java | private void setChoices(BigInteger multiChoice, JSchema schema) {
JSType topType = (JSType)schema.getJMFType();
if (topType instanceof JSVariant)
setChoices(multiChoice, schema, (JSVariant)topType);
else if (topType instanceof JSTuple)
setChoices(
multiChoice,
topType.getMultiChoiceCount(),
schema,
((JSTuple)topType).getDominatedVariants());
else
// If topType is JSRepeated, JSDynamic, JSEnum, or JSPrimitive there can be no unboxed
// variants at top level.
return;
} | [
"private",
"void",
"setChoices",
"(",
"BigInteger",
"multiChoice",
",",
"JSchema",
"schema",
")",
"{",
"JSType",
"topType",
"=",
"(",
"JSType",
")",
"schema",
".",
"getJMFType",
"(",
")",
";",
"if",
"(",
"topType",
"instanceof",
"JSVariant",
")",
"setChoices",
"(",
"multiChoice",
",",
"schema",
",",
"(",
"JSVariant",
")",
"topType",
")",
";",
"else",
"if",
"(",
"topType",
"instanceof",
"JSTuple",
")",
"setChoices",
"(",
"multiChoice",
",",
"topType",
".",
"getMultiChoiceCount",
"(",
")",
",",
"schema",
",",
"(",
"(",
"JSTuple",
")",
"topType",
")",
".",
"getDominatedVariants",
"(",
")",
")",
";",
"else",
"// If topType is JSRepeated, JSDynamic, JSEnum, or JSPrimitive there can be no unboxed",
"// variants at top level.",
"return",
";",
"}"
] | multichoice code. | [
"multichoice",
"code",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/MessageMap.java#L106-L120 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/MessageMap.java | MessageMap.setChoices | private void setChoices(BigInteger multiChoice, JSchema schema, JSVariant var) {
for (int i = 0; i < var.getCaseCount(); i++) {
BigInteger count = ((JSType)var.getCase(i)).getMultiChoiceCount();
if (multiChoice.compareTo(count) >= 0)
multiChoice = multiChoice.subtract(count);
else {
// We now have the case of our particular Variant in i. We set that in
// choiceCodes and then recursively visit the Variants dominated by ours.
choiceCodes[var.getIndex()] = i;
JSVariant[] subVars = var.getDominatedVariants(i);
setChoices(multiChoice, count, schema, subVars);
return;
}
}
// We should never get here
throw new RuntimeException("Bad multiChoice code");
} | java | private void setChoices(BigInteger multiChoice, JSchema schema, JSVariant var) {
for (int i = 0; i < var.getCaseCount(); i++) {
BigInteger count = ((JSType)var.getCase(i)).getMultiChoiceCount();
if (multiChoice.compareTo(count) >= 0)
multiChoice = multiChoice.subtract(count);
else {
// We now have the case of our particular Variant in i. We set that in
// choiceCodes and then recursively visit the Variants dominated by ours.
choiceCodes[var.getIndex()] = i;
JSVariant[] subVars = var.getDominatedVariants(i);
setChoices(multiChoice, count, schema, subVars);
return;
}
}
// We should never get here
throw new RuntimeException("Bad multiChoice code");
} | [
"private",
"void",
"setChoices",
"(",
"BigInteger",
"multiChoice",
",",
"JSchema",
"schema",
",",
"JSVariant",
"var",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"var",
".",
"getCaseCount",
"(",
")",
";",
"i",
"++",
")",
"{",
"BigInteger",
"count",
"=",
"(",
"(",
"JSType",
")",
"var",
".",
"getCase",
"(",
"i",
")",
")",
".",
"getMultiChoiceCount",
"(",
")",
";",
"if",
"(",
"multiChoice",
".",
"compareTo",
"(",
"count",
")",
">=",
"0",
")",
"multiChoice",
"=",
"multiChoice",
".",
"subtract",
"(",
"count",
")",
";",
"else",
"{",
"// We now have the case of our particular Variant in i. We set that in",
"// choiceCodes and then recursively visit the Variants dominated by ours.",
"choiceCodes",
"[",
"var",
".",
"getIndex",
"(",
")",
"]",
"=",
"i",
";",
"JSVariant",
"[",
"]",
"subVars",
"=",
"var",
".",
"getDominatedVariants",
"(",
"i",
")",
";",
"setChoices",
"(",
"multiChoice",
",",
"count",
",",
"schema",
",",
"subVars",
")",
";",
"return",
";",
"}",
"}",
"// We should never get here",
"throw",
"new",
"RuntimeException",
"(",
"\"Bad multiChoice code\"",
")",
";",
"}"
] | Set the choices implied by the multiChoice code or contribution to a single JSVariant | [
"Set",
"the",
"choices",
"implied",
"by",
"the",
"multiChoice",
"code",
"or",
"contribution",
"to",
"a",
"single",
"JSVariant"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/MessageMap.java#L123-L139 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/MessageMap.java | MessageMap.setChoices | private void setChoices(BigInteger multiChoice, BigInteger radix, JSchema schema, JSVariant[] vars) {
for (int j = 0; j < vars.length; j++) {
radix = radix.divide(vars[j].getMultiChoiceCount());
BigInteger contrib = multiChoice.divide(radix);
multiChoice = multiChoice.remainder(radix);
setChoices(contrib, schema, vars[j]);
}
} | java | private void setChoices(BigInteger multiChoice, BigInteger radix, JSchema schema, JSVariant[] vars) {
for (int j = 0; j < vars.length; j++) {
radix = radix.divide(vars[j].getMultiChoiceCount());
BigInteger contrib = multiChoice.divide(radix);
multiChoice = multiChoice.remainder(radix);
setChoices(contrib, schema, vars[j]);
}
} | [
"private",
"void",
"setChoices",
"(",
"BigInteger",
"multiChoice",
",",
"BigInteger",
"radix",
",",
"JSchema",
"schema",
",",
"JSVariant",
"[",
"]",
"vars",
")",
"{",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"vars",
".",
"length",
";",
"j",
"++",
")",
"{",
"radix",
"=",
"radix",
".",
"divide",
"(",
"vars",
"[",
"j",
"]",
".",
"getMultiChoiceCount",
"(",
")",
")",
";",
"BigInteger",
"contrib",
"=",
"multiChoice",
".",
"divide",
"(",
"radix",
")",
";",
"multiChoice",
"=",
"multiChoice",
".",
"remainder",
"(",
"radix",
")",
";",
"setChoices",
"(",
"contrib",
",",
"schema",
",",
"vars",
"[",
"j",
"]",
")",
";",
"}",
"}"
] | JSVariant whose choices are being set. | [
"JSVariant",
"whose",
"choices",
"are",
"being",
"set",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/MessageMap.java#L144-L151 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/MessageMap.java | MessageMap.getMultiChoice | private static BigInteger getMultiChoice(int[] choices, JSchema schema, JSVariant var) throws JMFUninitializedAccessException {
int choice = choices[var.getIndex()];
if (choice == -1)
throw new JMFUninitializedAccessException(schema.getPathName(var));
BigInteger ans = BigInteger.ZERO;
// First, add the contribution of the cases less than the present one.
for (int i = 0; i < choice; i++)
ans = ans.add(((JSType)var.getCase(i)).getMultiChoiceCount());
// Now compute the contribution of the actual case. Get the subvariants dominated by
// this variant's present case.
JSVariant[] subVars = var.getDominatedVariants(choice);
if (subVars == null)
// There are none: we already have the answer
return ans;
return ans.add(getMultiChoice(choices, schema, subVars));
} | java | private static BigInteger getMultiChoice(int[] choices, JSchema schema, JSVariant var) throws JMFUninitializedAccessException {
int choice = choices[var.getIndex()];
if (choice == -1)
throw new JMFUninitializedAccessException(schema.getPathName(var));
BigInteger ans = BigInteger.ZERO;
// First, add the contribution of the cases less than the present one.
for (int i = 0; i < choice; i++)
ans = ans.add(((JSType)var.getCase(i)).getMultiChoiceCount());
// Now compute the contribution of the actual case. Get the subvariants dominated by
// this variant's present case.
JSVariant[] subVars = var.getDominatedVariants(choice);
if (subVars == null)
// There are none: we already have the answer
return ans;
return ans.add(getMultiChoice(choices, schema, subVars));
} | [
"private",
"static",
"BigInteger",
"getMultiChoice",
"(",
"int",
"[",
"]",
"choices",
",",
"JSchema",
"schema",
",",
"JSVariant",
"var",
")",
"throws",
"JMFUninitializedAccessException",
"{",
"int",
"choice",
"=",
"choices",
"[",
"var",
".",
"getIndex",
"(",
")",
"]",
";",
"if",
"(",
"choice",
"==",
"-",
"1",
")",
"throw",
"new",
"JMFUninitializedAccessException",
"(",
"schema",
".",
"getPathName",
"(",
"var",
")",
")",
";",
"BigInteger",
"ans",
"=",
"BigInteger",
".",
"ZERO",
";",
"// First, add the contribution of the cases less than the present one.",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"choice",
";",
"i",
"++",
")",
"ans",
"=",
"ans",
".",
"(",
"(",
"(",
"JSType",
")",
"var",
".",
"getCase",
"(",
"i",
")",
")",
".",
"getMultiChoiceCount",
"(",
")",
")",
";",
"// Now compute the contribution of the actual case. Get the subvariants dominated by",
"// this variant's present case.",
"JSVariant",
"[",
"]",
"subVars",
"=",
"var",
".",
"getDominatedVariants",
"(",
"choice",
")",
";",
"if",
"(",
"subVars",
"==",
"null",
")",
"// There are none: we already have the answer",
"return",
"ans",
";",
"return",
"ans",
".",
"add",
"(",
"getMultiChoice",
"(",
"choices",
",",
"schema",
",",
"subVars",
")",
")",
";",
"}"
] | Compute the multiChoice code or contribution for an individual variant | [
"Compute",
"the",
"multiChoice",
"code",
"or",
"contribution",
"for",
"an",
"individual",
"variant"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/MessageMap.java#L194-L209 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/MessageMap.java | MessageMap.getMultiChoice | private static BigInteger getMultiChoice(int[] choices, JSchema schema, JSVariant[] vars) throws JMFUninitializedAccessException {
// Mixed-radix-encode the contribution from all the subvariants
BigInteger base = BigInteger.ZERO;
for (int i = 0; i < vars.length; i++)
base = base.multiply(vars[i].getMultiChoiceCount()).add(getMultiChoice(choices, schema, vars[i]));
return base;
} | java | private static BigInteger getMultiChoice(int[] choices, JSchema schema, JSVariant[] vars) throws JMFUninitializedAccessException {
// Mixed-radix-encode the contribution from all the subvariants
BigInteger base = BigInteger.ZERO;
for (int i = 0; i < vars.length; i++)
base = base.multiply(vars[i].getMultiChoiceCount()).add(getMultiChoice(choices, schema, vars[i]));
return base;
} | [
"private",
"static",
"BigInteger",
"getMultiChoice",
"(",
"int",
"[",
"]",
"choices",
",",
"JSchema",
"schema",
",",
"JSVariant",
"[",
"]",
"vars",
")",
"throws",
"JMFUninitializedAccessException",
"{",
"// Mixed-radix-encode the contribution from all the subvariants",
"BigInteger",
"base",
"=",
"BigInteger",
".",
"ZERO",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"vars",
".",
"length",
";",
"i",
"++",
")",
"base",
"=",
"base",
".",
"multiply",
"(",
"vars",
"[",
"i",
"]",
".",
"getMultiChoiceCount",
"(",
")",
")",
".",
"(",
"getMultiChoice",
"(",
"choices",
",",
"schema",
",",
"vars",
"[",
"i",
"]",
")",
")",
";",
"return",
"base",
";",
"}"
] | being calculate. | [
"being",
"calculate",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/MessageMap.java#L214-L220 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/html/HtmlLinkRendererBase.java | HtmlLinkRendererBase.getStyle | protected String getStyle(FacesContext facesContext, UIComponent link)
{
if (link instanceof HtmlCommandLink)
{
return ((HtmlCommandLink)link).getStyle();
}
return (String)link.getAttributes().get(HTML.STYLE_ATTR);
} | java | protected String getStyle(FacesContext facesContext, UIComponent link)
{
if (link instanceof HtmlCommandLink)
{
return ((HtmlCommandLink)link).getStyle();
}
return (String)link.getAttributes().get(HTML.STYLE_ATTR);
} | [
"protected",
"String",
"getStyle",
"(",
"FacesContext",
"facesContext",
",",
"UIComponent",
"link",
")",
"{",
"if",
"(",
"link",
"instanceof",
"HtmlCommandLink",
")",
"{",
"return",
"(",
"(",
"HtmlCommandLink",
")",
"link",
")",
".",
"getStyle",
"(",
")",
";",
"}",
"return",
"(",
"String",
")",
"link",
".",
"getAttributes",
"(",
")",
".",
"get",
"(",
"HTML",
".",
"STYLE_ATTR",
")",
";",
"}"
] | Can be overwritten by derived classes to overrule the style to be used. | [
"Can",
"be",
"overwritten",
"by",
"derived",
"classes",
"to",
"overrule",
"the",
"style",
"to",
"be",
"used",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/html/HtmlLinkRendererBase.java#L161-L170 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/html/HtmlLinkRendererBase.java | HtmlLinkRendererBase.getStyleClass | protected String getStyleClass(FacesContext facesContext, UIComponent link)
{
if (link instanceof HtmlCommandLink)
{
return ((HtmlCommandLink)link).getStyleClass();
}
return (String)link.getAttributes().get(HTML.STYLE_CLASS_ATTR);
} | java | protected String getStyleClass(FacesContext facesContext, UIComponent link)
{
if (link instanceof HtmlCommandLink)
{
return ((HtmlCommandLink)link).getStyleClass();
}
return (String)link.getAttributes().get(HTML.STYLE_CLASS_ATTR);
} | [
"protected",
"String",
"getStyleClass",
"(",
"FacesContext",
"facesContext",
",",
"UIComponent",
"link",
")",
"{",
"if",
"(",
"link",
"instanceof",
"HtmlCommandLink",
")",
"{",
"return",
"(",
"(",
"HtmlCommandLink",
")",
"link",
")",
".",
"getStyleClass",
"(",
")",
";",
"}",
"return",
"(",
"String",
")",
"link",
".",
"getAttributes",
"(",
")",
".",
"get",
"(",
"HTML",
".",
"STYLE_CLASS_ATTR",
")",
";",
"}"
] | Can be overwritten by derived classes to overrule the style class to be used. | [
"Can",
"be",
"overwritten",
"by",
"derived",
"classes",
"to",
"overrule",
"the",
"style",
"class",
"to",
"be",
"used",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/html/HtmlLinkRendererBase.java#L175-L184 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/H2StreamProcessor.java | H2StreamProcessor.completeConnectionPreface | protected void completeConnectionPreface() throws Http2Exception {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "completeConnectionPreface entry: about to send preface SETTINGS frame");
}
FrameSettings settings;
// send out a settings frame with any HTTP2 settings that the user may have changed
if (Constants.SPEC_INITIAL_WINDOW_SIZE != this.streamReadWindowSize) {
settings = new FrameSettings(0, -1, -1, this.muxLink.config.getH2MaxConcurrentStreams(), (int) this.streamReadWindowSize, this.muxLink.config.getH2MaxFrameSize(), -1, false);
} else {
settings = new FrameSettings(0, -1, -1, this.muxLink.config.getH2MaxConcurrentStreams(), -1, this.muxLink.config.getH2MaxFrameSize(), -1, false);
}
this.frameType = FrameTypes.SETTINGS;
this.processNextFrame(settings, Direction.WRITING_OUT);
if (Constants.SPEC_INITIAL_WINDOW_SIZE != muxLink.maxReadWindowSize) {
// the user has changed the max connection read window, so we'll update that now
FrameWindowUpdate wup = new FrameWindowUpdate(0, (int) muxLink.maxReadWindowSize, false);
this.processNextFrame(wup, Direction.WRITING_OUT);
}
} | java | protected void completeConnectionPreface() throws Http2Exception {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "completeConnectionPreface entry: about to send preface SETTINGS frame");
}
FrameSettings settings;
// send out a settings frame with any HTTP2 settings that the user may have changed
if (Constants.SPEC_INITIAL_WINDOW_SIZE != this.streamReadWindowSize) {
settings = new FrameSettings(0, -1, -1, this.muxLink.config.getH2MaxConcurrentStreams(), (int) this.streamReadWindowSize, this.muxLink.config.getH2MaxFrameSize(), -1, false);
} else {
settings = new FrameSettings(0, -1, -1, this.muxLink.config.getH2MaxConcurrentStreams(), -1, this.muxLink.config.getH2MaxFrameSize(), -1, false);
}
this.frameType = FrameTypes.SETTINGS;
this.processNextFrame(settings, Direction.WRITING_OUT);
if (Constants.SPEC_INITIAL_WINDOW_SIZE != muxLink.maxReadWindowSize) {
// the user has changed the max connection read window, so we'll update that now
FrameWindowUpdate wup = new FrameWindowUpdate(0, (int) muxLink.maxReadWindowSize, false);
this.processNextFrame(wup, Direction.WRITING_OUT);
}
} | [
"protected",
"void",
"completeConnectionPreface",
"(",
")",
"throws",
"Http2Exception",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"completeConnectionPreface entry: about to send preface SETTINGS frame\"",
")",
";",
"}",
"FrameSettings",
"settings",
";",
"// send out a settings frame with any HTTP2 settings that the user may have changed",
"if",
"(",
"Constants",
".",
"SPEC_INITIAL_WINDOW_SIZE",
"!=",
"this",
".",
"streamReadWindowSize",
")",
"{",
"settings",
"=",
"new",
"FrameSettings",
"(",
"0",
",",
"-",
"1",
",",
"-",
"1",
",",
"this",
".",
"muxLink",
".",
"config",
".",
"getH2MaxConcurrentStreams",
"(",
")",
",",
"(",
"int",
")",
"this",
".",
"streamReadWindowSize",
",",
"this",
".",
"muxLink",
".",
"config",
".",
"getH2MaxFrameSize",
"(",
")",
",",
"-",
"1",
",",
"false",
")",
";",
"}",
"else",
"{",
"settings",
"=",
"new",
"FrameSettings",
"(",
"0",
",",
"-",
"1",
",",
"-",
"1",
",",
"this",
".",
"muxLink",
".",
"config",
".",
"getH2MaxConcurrentStreams",
"(",
")",
",",
"-",
"1",
",",
"this",
".",
"muxLink",
".",
"config",
".",
"getH2MaxFrameSize",
"(",
")",
",",
"-",
"1",
",",
"false",
")",
";",
"}",
"this",
".",
"frameType",
"=",
"FrameTypes",
".",
"SETTINGS",
";",
"this",
".",
"processNextFrame",
"(",
"settings",
",",
"Direction",
".",
"WRITING_OUT",
")",
";",
"if",
"(",
"Constants",
".",
"SPEC_INITIAL_WINDOW_SIZE",
"!=",
"muxLink",
".",
"maxReadWindowSize",
")",
"{",
"// the user has changed the max connection read window, so we'll update that now",
"FrameWindowUpdate",
"wup",
"=",
"new",
"FrameWindowUpdate",
"(",
"0",
",",
"(",
"int",
")",
"muxLink",
".",
"maxReadWindowSize",
",",
"false",
")",
";",
"this",
".",
"processNextFrame",
"(",
"wup",
",",
"Direction",
".",
"WRITING_OUT",
")",
";",
"}",
"}"
] | Complete the connection preface. At this point, we should have received the client connection preface string.
Now we need to make sure that the client sent a settings frame along with the preface, update our settings,
and send an empty settings frame in response to the client preface.
@throws Http2Exception | [
"Complete",
"the",
"connection",
"preface",
".",
"At",
"this",
"point",
"we",
"should",
"have",
"received",
"the",
"client",
"connection",
"preface",
"string",
".",
"Now",
"we",
"need",
"to",
"make",
"sure",
"that",
"the",
"client",
"sent",
"a",
"settings",
"frame",
"along",
"with",
"the",
"preface",
"update",
"our",
"settings",
"and",
"send",
"an",
"empty",
"settings",
"frame",
"in",
"response",
"to",
"the",
"client",
"preface",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/H2StreamProcessor.java#L161-L181 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/H2StreamProcessor.java | H2StreamProcessor.readWriteTransitionState | private void readWriteTransitionState(Constants.Direction direction) throws Http2Exception {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "readWriteTransitionState: entry: frame type: " + currentFrame.getFrameType() + " state: " + state);
}
if (currentFrame.getFrameType() == FrameTypes.GOAWAY
|| currentFrame.getFrameType() == FrameTypes.RST_STREAM) {
writeFrameSync();
rstStreamSent = true;
this.updateStreamState(StreamState.CLOSED);
if (currentFrame.getFrameType() == FrameTypes.GOAWAY) {
muxLink.closeConnectionLink(null);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "readWriteTransitionState: return: state: " + state);
}
return;
}
switch (state) {
case IDLE:
processIdle(direction);
break;
case RESERVED_LOCAL:
processReservedLocal(direction);
break;
case RESERVED_REMOTE:
processReservedRemote(direction);
break;
case OPEN:
processOpen(direction);
break;
case HALF_CLOSED_REMOTE:
processHalfClosedRemote(direction);
break;
case HALF_CLOSED_LOCAL:
processHalfClosedLocal(direction);
break;
case CLOSED:
processClosed(direction);
break;
default:
break;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "readWriteTransitionState: exit: state: " + state);
}
} | java | private void readWriteTransitionState(Constants.Direction direction) throws Http2Exception {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "readWriteTransitionState: entry: frame type: " + currentFrame.getFrameType() + " state: " + state);
}
if (currentFrame.getFrameType() == FrameTypes.GOAWAY
|| currentFrame.getFrameType() == FrameTypes.RST_STREAM) {
writeFrameSync();
rstStreamSent = true;
this.updateStreamState(StreamState.CLOSED);
if (currentFrame.getFrameType() == FrameTypes.GOAWAY) {
muxLink.closeConnectionLink(null);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "readWriteTransitionState: return: state: " + state);
}
return;
}
switch (state) {
case IDLE:
processIdle(direction);
break;
case RESERVED_LOCAL:
processReservedLocal(direction);
break;
case RESERVED_REMOTE:
processReservedRemote(direction);
break;
case OPEN:
processOpen(direction);
break;
case HALF_CLOSED_REMOTE:
processHalfClosedRemote(direction);
break;
case HALF_CLOSED_LOCAL:
processHalfClosedLocal(direction);
break;
case CLOSED:
processClosed(direction);
break;
default:
break;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "readWriteTransitionState: exit: state: " + state);
}
} | [
"private",
"void",
"readWriteTransitionState",
"(",
"Constants",
".",
"Direction",
"direction",
")",
"throws",
"Http2Exception",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"readWriteTransitionState: entry: frame type: \"",
"+",
"currentFrame",
".",
"getFrameType",
"(",
")",
"+",
"\" state: \"",
"+",
"state",
")",
";",
"}",
"if",
"(",
"currentFrame",
".",
"getFrameType",
"(",
")",
"==",
"FrameTypes",
".",
"GOAWAY",
"||",
"currentFrame",
".",
"getFrameType",
"(",
")",
"==",
"FrameTypes",
".",
"RST_STREAM",
")",
"{",
"writeFrameSync",
"(",
")",
";",
"rstStreamSent",
"=",
"true",
";",
"this",
".",
"updateStreamState",
"(",
"StreamState",
".",
"CLOSED",
")",
";",
"if",
"(",
"currentFrame",
".",
"getFrameType",
"(",
")",
"==",
"FrameTypes",
".",
"GOAWAY",
")",
"{",
"muxLink",
".",
"closeConnectionLink",
"(",
"null",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"readWriteTransitionState: return: state: \"",
"+",
"state",
")",
";",
"}",
"return",
";",
"}",
"switch",
"(",
"state",
")",
"{",
"case",
"IDLE",
":",
"processIdle",
"(",
"direction",
")",
";",
"break",
";",
"case",
"RESERVED_LOCAL",
":",
"processReservedLocal",
"(",
"direction",
")",
";",
"break",
";",
"case",
"RESERVED_REMOTE",
":",
"processReservedRemote",
"(",
"direction",
")",
";",
"break",
";",
"case",
"OPEN",
":",
"processOpen",
"(",
"direction",
")",
";",
"break",
";",
"case",
"HALF_CLOSED_REMOTE",
":",
"processHalfClosedRemote",
"(",
"direction",
")",
";",
"break",
";",
"case",
"HALF_CLOSED_LOCAL",
":",
"processHalfClosedLocal",
"(",
"direction",
")",
";",
"break",
";",
"case",
"CLOSED",
":",
"processClosed",
"(",
"direction",
")",
";",
"break",
";",
"default",
":",
"break",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"readWriteTransitionState: exit: state: \"",
"+",
"state",
")",
";",
"}",
"}"
] | Transitions the stream state, give the previous state and current frame. Handles writes and error processing as needed.
@param Direction.WRITING_OUT or Direction.READING_IN
@throws Http2Exception | [
"Transitions",
"the",
"stream",
"state",
"give",
"the",
"previous",
"state",
"and",
"current",
"frame",
".",
"Handles",
"writes",
"and",
"error",
"processing",
"as",
"needed",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/H2StreamProcessor.java#L549-L606 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/H2StreamProcessor.java | H2StreamProcessor.updateStreamState | private void updateStreamState(StreamState state) {
this.state = state;
if (StreamState.CLOSED.equals(state)) {
setCloseTime(System.currentTimeMillis());
muxLink.closeStream(this);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "current stream state for stream " + this.myID + " : " + this.state);
}
} | java | private void updateStreamState(StreamState state) {
this.state = state;
if (StreamState.CLOSED.equals(state)) {
setCloseTime(System.currentTimeMillis());
muxLink.closeStream(this);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "current stream state for stream " + this.myID + " : " + this.state);
}
} | [
"private",
"void",
"updateStreamState",
"(",
"StreamState",
"state",
")",
"{",
"this",
".",
"state",
"=",
"state",
";",
"if",
"(",
"StreamState",
".",
"CLOSED",
".",
"equals",
"(",
"state",
")",
")",
"{",
"setCloseTime",
"(",
"System",
".",
"currentTimeMillis",
"(",
")",
")",
";",
"muxLink",
".",
"closeStream",
"(",
"this",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"current stream state for stream \"",
"+",
"this",
".",
"myID",
"+",
"\" : \"",
"+",
"this",
".",
"state",
")",
";",
"}",
"}"
] | Update the stream state and provide logging, if enabled
@param state | [
"Update",
"the",
"stream",
"state",
"and",
"provide",
"logging",
"if",
"enabled"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/H2StreamProcessor.java#L613-L622 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/H2StreamProcessor.java | H2StreamProcessor.processSETTINGSFrame | private void processSETTINGSFrame() throws FlowControlException {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "processSETTINGSFrame entry:\n" + currentFrame.toString());
}
// check if this is the first non-ACK settings frame received; if so, update connection init state
if (!connection_preface_settings_rcvd && !((FrameSettings) currentFrame).flagAckSet()) {
connection_preface_settings_rcvd = true;
}
if (((FrameSettings) currentFrame).flagAckSet()) {
// if this is the first ACK frame, update connection init state
if (!connection_preface_settings_ack_rcvd) {
connection_preface_settings_ack_rcvd = true;
}
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "received a new settings frame: updating connection settings and sending out SETTINGS ACK");
}
// if the INITIAL_WINDOW_SIZE has changed, need to change it for this streams, and all the other streams on this connection
if (((FrameSettings) currentFrame).getInitialWindowSize() != -1) {
int newSize = ((FrameSettings) currentFrame).getInitialWindowSize();
muxLink.changeInitialWindowSizeAllStreams(newSize);
}
// update the SETTINGS for this connection
muxLink.getRemoteConnectionSettings().updateSettings((FrameSettings) currentFrame);
muxLink.getVirtualConnection().getStateMap().put("h2_frame_size", muxLink.getRemoteConnectionSettings().getMaxFrameSize());
// immediately send out ACK (an empty SETTINGS frame with the ACK flag set)
currentFrame = new FrameSettings(0, -1, -1, -1, -1, -1, -1, false);
currentFrame.setAckFlag();
try {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "processSETTINGSFrame: stream: " + myID + " frame type: " + currentFrame.getFrameType().toString() + " direction: "
+ Direction.WRITING_OUT
+ " H2InboundLink hc: " + muxLink.hashCode());
}
writeFrameSync();
} catch (FlowControlException e) {
// FlowControlException cannot occur for FrameTypes.SETTINGS, so do nothing here but debug
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "writeSync caught (logically unexpected) FlowControlException: " + e);
}
}
}
// check to see if the current connection should be marked as initialized; if so, notify stream 1 to stop waiting
if (connection_preface_settings_rcvd && connection_preface_settings_ack_rcvd) {
if (muxLink.checkInitAndOpen()) {
muxLink.initLock.countDown();
}
}
} | java | private void processSETTINGSFrame() throws FlowControlException {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "processSETTINGSFrame entry:\n" + currentFrame.toString());
}
// check if this is the first non-ACK settings frame received; if so, update connection init state
if (!connection_preface_settings_rcvd && !((FrameSettings) currentFrame).flagAckSet()) {
connection_preface_settings_rcvd = true;
}
if (((FrameSettings) currentFrame).flagAckSet()) {
// if this is the first ACK frame, update connection init state
if (!connection_preface_settings_ack_rcvd) {
connection_preface_settings_ack_rcvd = true;
}
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "received a new settings frame: updating connection settings and sending out SETTINGS ACK");
}
// if the INITIAL_WINDOW_SIZE has changed, need to change it for this streams, and all the other streams on this connection
if (((FrameSettings) currentFrame).getInitialWindowSize() != -1) {
int newSize = ((FrameSettings) currentFrame).getInitialWindowSize();
muxLink.changeInitialWindowSizeAllStreams(newSize);
}
// update the SETTINGS for this connection
muxLink.getRemoteConnectionSettings().updateSettings((FrameSettings) currentFrame);
muxLink.getVirtualConnection().getStateMap().put("h2_frame_size", muxLink.getRemoteConnectionSettings().getMaxFrameSize());
// immediately send out ACK (an empty SETTINGS frame with the ACK flag set)
currentFrame = new FrameSettings(0, -1, -1, -1, -1, -1, -1, false);
currentFrame.setAckFlag();
try {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "processSETTINGSFrame: stream: " + myID + " frame type: " + currentFrame.getFrameType().toString() + " direction: "
+ Direction.WRITING_OUT
+ " H2InboundLink hc: " + muxLink.hashCode());
}
writeFrameSync();
} catch (FlowControlException e) {
// FlowControlException cannot occur for FrameTypes.SETTINGS, so do nothing here but debug
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "writeSync caught (logically unexpected) FlowControlException: " + e);
}
}
}
// check to see if the current connection should be marked as initialized; if so, notify stream 1 to stop waiting
if (connection_preface_settings_rcvd && connection_preface_settings_ack_rcvd) {
if (muxLink.checkInitAndOpen()) {
muxLink.initLock.countDown();
}
}
} | [
"private",
"void",
"processSETTINGSFrame",
"(",
")",
"throws",
"FlowControlException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"processSETTINGSFrame entry:\\n\"",
"+",
"currentFrame",
".",
"toString",
"(",
")",
")",
";",
"}",
"// check if this is the first non-ACK settings frame received; if so, update connection init state",
"if",
"(",
"!",
"connection_preface_settings_rcvd",
"&&",
"!",
"(",
"(",
"FrameSettings",
")",
"currentFrame",
")",
".",
"flagAckSet",
"(",
")",
")",
"{",
"connection_preface_settings_rcvd",
"=",
"true",
";",
"}",
"if",
"(",
"(",
"(",
"FrameSettings",
")",
"currentFrame",
")",
".",
"flagAckSet",
"(",
")",
")",
"{",
"// if this is the first ACK frame, update connection init state",
"if",
"(",
"!",
"connection_preface_settings_ack_rcvd",
")",
"{",
"connection_preface_settings_ack_rcvd",
"=",
"true",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"received a new settings frame: updating connection settings and sending out SETTINGS ACK\"",
")",
";",
"}",
"// if the INITIAL_WINDOW_SIZE has changed, need to change it for this streams, and all the other streams on this connection",
"if",
"(",
"(",
"(",
"FrameSettings",
")",
"currentFrame",
")",
".",
"getInitialWindowSize",
"(",
")",
"!=",
"-",
"1",
")",
"{",
"int",
"newSize",
"=",
"(",
"(",
"FrameSettings",
")",
"currentFrame",
")",
".",
"getInitialWindowSize",
"(",
")",
";",
"muxLink",
".",
"changeInitialWindowSizeAllStreams",
"(",
"newSize",
")",
";",
"}",
"// update the SETTINGS for this connection",
"muxLink",
".",
"getRemoteConnectionSettings",
"(",
")",
".",
"updateSettings",
"(",
"(",
"FrameSettings",
")",
"currentFrame",
")",
";",
"muxLink",
".",
"getVirtualConnection",
"(",
")",
".",
"getStateMap",
"(",
")",
".",
"put",
"(",
"\"h2_frame_size\"",
",",
"muxLink",
".",
"getRemoteConnectionSettings",
"(",
")",
".",
"getMaxFrameSize",
"(",
")",
")",
";",
"// immediately send out ACK (an empty SETTINGS frame with the ACK flag set)",
"currentFrame",
"=",
"new",
"FrameSettings",
"(",
"0",
",",
"-",
"1",
",",
"-",
"1",
",",
"-",
"1",
",",
"-",
"1",
",",
"-",
"1",
",",
"-",
"1",
",",
"false",
")",
";",
"currentFrame",
".",
"setAckFlag",
"(",
")",
";",
"try",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"processSETTINGSFrame: stream: \"",
"+",
"myID",
"+",
"\" frame type: \"",
"+",
"currentFrame",
".",
"getFrameType",
"(",
")",
".",
"toString",
"(",
")",
"+",
"\" direction: \"",
"+",
"Direction",
".",
"WRITING_OUT",
"+",
"\" H2InboundLink hc: \"",
"+",
"muxLink",
".",
"hashCode",
"(",
")",
")",
";",
"}",
"writeFrameSync",
"(",
")",
";",
"}",
"catch",
"(",
"FlowControlException",
"e",
")",
"{",
"// FlowControlException cannot occur for FrameTypes.SETTINGS, so do nothing here but debug",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"writeSync caught (logically unexpected) FlowControlException: \"",
"+",
"e",
")",
";",
"}",
"}",
"}",
"// check to see if the current connection should be marked as initialized; if so, notify stream 1 to stop waiting",
"if",
"(",
"connection_preface_settings_rcvd",
"&&",
"connection_preface_settings_ack_rcvd",
")",
"{",
"if",
"(",
"muxLink",
".",
"checkInitAndOpen",
"(",
")",
")",
"{",
"muxLink",
".",
"initLock",
".",
"countDown",
"(",
")",
";",
"}",
"}",
"}"
] | Helper method to process a SETTINGS frame received from the client. Since the protocol utilizes SETTINGS frames for
initialization, some special logic is needed.
@throws FlowControlException | [
"Helper",
"method",
"to",
"process",
"a",
"SETTINGS",
"frame",
"received",
"from",
"the",
"client",
".",
"Since",
"the",
"protocol",
"utilizes",
"SETTINGS",
"frames",
"for",
"initialization",
"some",
"special",
"logic",
"is",
"needed",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/H2StreamProcessor.java#L638-L694 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/H2StreamProcessor.java | H2StreamProcessor.updateStreamReadWindow | private void updateStreamReadWindow() throws Http2Exception {
if (currentFrame instanceof FrameData) {
long frameSize = currentFrame.getPayloadLength();
streamReadWindowSize -= frameSize; // decrement stream read window
muxLink.connectionReadWindowSize -= frameSize; // decrement connection read window
// if the stream or connection windows become too small, update the windows
// TODO: decide how often we should update the read window via WINDOW_UPDATE
if (streamReadWindowSize < (muxLink.maxReadWindowSize / 2) ||
muxLink.connectionReadWindowSize < (muxLink.maxReadWindowSize / 2)) {
int windowChange = (int) (muxLink.maxReadWindowSize - this.streamReadWindowSize);
Frame savedFrame = currentFrame; // save off the current frame
if (!this.isStreamClosed()) {
currentFrame = new FrameWindowUpdate(myID, windowChange, false);
writeFrameSync();
currentFrame = savedFrame;
}
long windowSizeIncrement = muxLink.getRemoteConnectionSettings().getMaxFrameSize();
FrameWindowUpdate wuf = new FrameWindowUpdate(0, (int) windowSizeIncrement, false);
this.muxLink.getStream(0).processNextFrame(wuf, Direction.WRITING_OUT);
}
}
} | java | private void updateStreamReadWindow() throws Http2Exception {
if (currentFrame instanceof FrameData) {
long frameSize = currentFrame.getPayloadLength();
streamReadWindowSize -= frameSize; // decrement stream read window
muxLink.connectionReadWindowSize -= frameSize; // decrement connection read window
// if the stream or connection windows become too small, update the windows
// TODO: decide how often we should update the read window via WINDOW_UPDATE
if (streamReadWindowSize < (muxLink.maxReadWindowSize / 2) ||
muxLink.connectionReadWindowSize < (muxLink.maxReadWindowSize / 2)) {
int windowChange = (int) (muxLink.maxReadWindowSize - this.streamReadWindowSize);
Frame savedFrame = currentFrame; // save off the current frame
if (!this.isStreamClosed()) {
currentFrame = new FrameWindowUpdate(myID, windowChange, false);
writeFrameSync();
currentFrame = savedFrame;
}
long windowSizeIncrement = muxLink.getRemoteConnectionSettings().getMaxFrameSize();
FrameWindowUpdate wuf = new FrameWindowUpdate(0, (int) windowSizeIncrement, false);
this.muxLink.getStream(0).processNextFrame(wuf, Direction.WRITING_OUT);
}
}
} | [
"private",
"void",
"updateStreamReadWindow",
"(",
")",
"throws",
"Http2Exception",
"{",
"if",
"(",
"currentFrame",
"instanceof",
"FrameData",
")",
"{",
"long",
"frameSize",
"=",
"currentFrame",
".",
"getPayloadLength",
"(",
")",
";",
"streamReadWindowSize",
"-=",
"frameSize",
";",
"// decrement stream read window",
"muxLink",
".",
"connectionReadWindowSize",
"-=",
"frameSize",
";",
"// decrement connection read window",
"// if the stream or connection windows become too small, update the windows",
"// TODO: decide how often we should update the read window via WINDOW_UPDATE",
"if",
"(",
"streamReadWindowSize",
"<",
"(",
"muxLink",
".",
"maxReadWindowSize",
"/",
"2",
")",
"||",
"muxLink",
".",
"connectionReadWindowSize",
"<",
"(",
"muxLink",
".",
"maxReadWindowSize",
"/",
"2",
")",
")",
"{",
"int",
"windowChange",
"=",
"(",
"int",
")",
"(",
"muxLink",
".",
"maxReadWindowSize",
"-",
"this",
".",
"streamReadWindowSize",
")",
";",
"Frame",
"savedFrame",
"=",
"currentFrame",
";",
"// save off the current frame",
"if",
"(",
"!",
"this",
".",
"isStreamClosed",
"(",
")",
")",
"{",
"currentFrame",
"=",
"new",
"FrameWindowUpdate",
"(",
"myID",
",",
"windowChange",
",",
"false",
")",
";",
"writeFrameSync",
"(",
")",
";",
"currentFrame",
"=",
"savedFrame",
";",
"}",
"long",
"windowSizeIncrement",
"=",
"muxLink",
".",
"getRemoteConnectionSettings",
"(",
")",
".",
"getMaxFrameSize",
"(",
")",
";",
"FrameWindowUpdate",
"wuf",
"=",
"new",
"FrameWindowUpdate",
"(",
"0",
",",
"(",
"int",
")",
"windowSizeIncrement",
",",
"false",
")",
";",
"this",
".",
"muxLink",
".",
"getStream",
"(",
"0",
")",
".",
"processNextFrame",
"(",
"wuf",
",",
"Direction",
".",
"WRITING_OUT",
")",
";",
"}",
"}",
"}"
] | If this stream is receiving a DATA frame, the local read window needs to be updated. If the read window drops below a threshold,
a WINDOW_UPDATE frame will be sent for both the connection and stream to update the windows. | [
"If",
"this",
"stream",
"is",
"receiving",
"a",
"DATA",
"frame",
"the",
"local",
"read",
"window",
"needs",
"to",
"be",
"updated",
".",
"If",
"the",
"read",
"window",
"drops",
"below",
"a",
"threshold",
"a",
"WINDOW_UPDATE",
"frame",
"will",
"be",
"sent",
"for",
"both",
"the",
"connection",
"and",
"stream",
"to",
"update",
"the",
"windows",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/H2StreamProcessor.java#L756-L779 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/H2StreamProcessor.java | H2StreamProcessor.updateInitialWindowsUpdateSize | protected void updateInitialWindowsUpdateSize(int newSize) throws FlowControlException {
// this method should only be called by the thread that came in on processNewFrame.
// newSize should be treated as an unsigned 32-bit int
if (myID == 0) {
// the control stream doesn't care about initial window size updates
return;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "updateInitialWindowsUpdateSize entry: stream {0} newSize: {1}", myID, newSize);
}
long diff = newSize - streamWindowUpdateWriteInitialSize;
streamWindowUpdateWriteInitialSize = newSize;
streamWindowUpdateWriteLimit += diff;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "streamWindowUpdateWriteInitialSize updated to: " + streamWindowUpdateWriteInitialSize);
Tr.debug(tc, "streamWindowUpdateWriteLimit updated to: " + streamWindowUpdateWriteLimit);
}
// if any data frames were waiting for a window update, write them out now
flushDataWaitingForWindowUpdate();
} | java | protected void updateInitialWindowsUpdateSize(int newSize) throws FlowControlException {
// this method should only be called by the thread that came in on processNewFrame.
// newSize should be treated as an unsigned 32-bit int
if (myID == 0) {
// the control stream doesn't care about initial window size updates
return;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "updateInitialWindowsUpdateSize entry: stream {0} newSize: {1}", myID, newSize);
}
long diff = newSize - streamWindowUpdateWriteInitialSize;
streamWindowUpdateWriteInitialSize = newSize;
streamWindowUpdateWriteLimit += diff;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "streamWindowUpdateWriteInitialSize updated to: " + streamWindowUpdateWriteInitialSize);
Tr.debug(tc, "streamWindowUpdateWriteLimit updated to: " + streamWindowUpdateWriteLimit);
}
// if any data frames were waiting for a window update, write them out now
flushDataWaitingForWindowUpdate();
} | [
"protected",
"void",
"updateInitialWindowsUpdateSize",
"(",
"int",
"newSize",
")",
"throws",
"FlowControlException",
"{",
"// this method should only be called by the thread that came in on processNewFrame.",
"// newSize should be treated as an unsigned 32-bit int",
"if",
"(",
"myID",
"==",
"0",
")",
"{",
"// the control stream doesn't care about initial window size updates",
"return",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"updateInitialWindowsUpdateSize entry: stream {0} newSize: {1}\"",
",",
"myID",
",",
"newSize",
")",
";",
"}",
"long",
"diff",
"=",
"newSize",
"-",
"streamWindowUpdateWriteInitialSize",
";",
"streamWindowUpdateWriteInitialSize",
"=",
"newSize",
";",
"streamWindowUpdateWriteLimit",
"+=",
"diff",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"streamWindowUpdateWriteInitialSize updated to: \"",
"+",
"streamWindowUpdateWriteInitialSize",
")",
";",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"streamWindowUpdateWriteLimit updated to: \"",
"+",
"streamWindowUpdateWriteLimit",
")",
";",
"}",
"// if any data frames were waiting for a window update, write them out now",
"flushDataWaitingForWindowUpdate",
"(",
")",
";",
"}"
] | Updates the initial window size for this stream. If any data frames are waiting for an increased window size,
write them out if the new window size allows it.
@param newSize - new window size
@throws FlowControlException | [
"Updates",
"the",
"initial",
"window",
"size",
"for",
"this",
"stream",
".",
"If",
"any",
"data",
"frames",
"are",
"waiting",
"for",
"an",
"increased",
"window",
"size",
"write",
"them",
"out",
"if",
"the",
"new",
"window",
"size",
"allows",
"it",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/H2StreamProcessor.java#L801-L826 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/H2StreamProcessor.java | H2StreamProcessor.processIdle | private void processIdle(Constants.Direction direction) throws Http2Exception {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "processIdle entry: stream " + myID);
}
// Can only receive HEADERS or PRIORITY frame in Idle state
if (direction == Constants.Direction.READ_IN) {
if (frameType == FrameTypes.HEADERS) {
// check to see if too many client streams are currently open for this stream's h2 connection
muxLink.incrementActiveClientStreams();
if (muxLink.getActiveClientStreams() > muxLink.getLocalConnectionSettings().getMaxConcurrentStreams()) {
RefusedStreamException rse = new RefusedStreamException("too many client-initiated streams are currently active; rejecting this stream");
rse.setConnectionError(false);
throw rse;
}
processHeadersPriority();
getHeadersFromFrame();
if (currentFrame.flagEndHeadersSet()) {
processCompleteHeaders(false);
setHeadersComplete();
} else {
muxLink.setContinuationExpected(true);
}
if (currentFrame.flagEndStreamSet()) {
endStream = true;
updateStreamState(StreamState.HALF_CLOSED_REMOTE);
if (currentFrame.flagEndHeadersSet()) {
setReadyForRead();
}
} else {
updateStreamState(StreamState.OPEN);
}
}
} else {
// send out a HEADER frame and update the stream state to OPEN
if (frameType == FrameTypes.HEADERS) {
updateStreamState(StreamState.OPEN);
}
writeFrameSync();
}
} | java | private void processIdle(Constants.Direction direction) throws Http2Exception {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "processIdle entry: stream " + myID);
}
// Can only receive HEADERS or PRIORITY frame in Idle state
if (direction == Constants.Direction.READ_IN) {
if (frameType == FrameTypes.HEADERS) {
// check to see if too many client streams are currently open for this stream's h2 connection
muxLink.incrementActiveClientStreams();
if (muxLink.getActiveClientStreams() > muxLink.getLocalConnectionSettings().getMaxConcurrentStreams()) {
RefusedStreamException rse = new RefusedStreamException("too many client-initiated streams are currently active; rejecting this stream");
rse.setConnectionError(false);
throw rse;
}
processHeadersPriority();
getHeadersFromFrame();
if (currentFrame.flagEndHeadersSet()) {
processCompleteHeaders(false);
setHeadersComplete();
} else {
muxLink.setContinuationExpected(true);
}
if (currentFrame.flagEndStreamSet()) {
endStream = true;
updateStreamState(StreamState.HALF_CLOSED_REMOTE);
if (currentFrame.flagEndHeadersSet()) {
setReadyForRead();
}
} else {
updateStreamState(StreamState.OPEN);
}
}
} else {
// send out a HEADER frame and update the stream state to OPEN
if (frameType == FrameTypes.HEADERS) {
updateStreamState(StreamState.OPEN);
}
writeFrameSync();
}
} | [
"private",
"void",
"processIdle",
"(",
"Constants",
".",
"Direction",
"direction",
")",
"throws",
"Http2Exception",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"processIdle entry: stream \"",
"+",
"myID",
")",
";",
"}",
"// Can only receive HEADERS or PRIORITY frame in Idle state",
"if",
"(",
"direction",
"==",
"Constants",
".",
"Direction",
".",
"READ_IN",
")",
"{",
"if",
"(",
"frameType",
"==",
"FrameTypes",
".",
"HEADERS",
")",
"{",
"// check to see if too many client streams are currently open for this stream's h2 connection",
"muxLink",
".",
"incrementActiveClientStreams",
"(",
")",
";",
"if",
"(",
"muxLink",
".",
"getActiveClientStreams",
"(",
")",
">",
"muxLink",
".",
"getLocalConnectionSettings",
"(",
")",
".",
"getMaxConcurrentStreams",
"(",
")",
")",
"{",
"RefusedStreamException",
"rse",
"=",
"new",
"RefusedStreamException",
"(",
"\"too many client-initiated streams are currently active; rejecting this stream\"",
")",
";",
"rse",
".",
"setConnectionError",
"(",
"false",
")",
";",
"throw",
"rse",
";",
"}",
"processHeadersPriority",
"(",
")",
";",
"getHeadersFromFrame",
"(",
")",
";",
"if",
"(",
"currentFrame",
".",
"flagEndHeadersSet",
"(",
")",
")",
"{",
"processCompleteHeaders",
"(",
"false",
")",
";",
"setHeadersComplete",
"(",
")",
";",
"}",
"else",
"{",
"muxLink",
".",
"setContinuationExpected",
"(",
"true",
")",
";",
"}",
"if",
"(",
"currentFrame",
".",
"flagEndStreamSet",
"(",
")",
")",
"{",
"endStream",
"=",
"true",
";",
"updateStreamState",
"(",
"StreamState",
".",
"HALF_CLOSED_REMOTE",
")",
";",
"if",
"(",
"currentFrame",
".",
"flagEndHeadersSet",
"(",
")",
")",
"{",
"setReadyForRead",
"(",
")",
";",
"}",
"}",
"else",
"{",
"updateStreamState",
"(",
"StreamState",
".",
"OPEN",
")",
";",
"}",
"}",
"}",
"else",
"{",
"// send out a HEADER frame and update the stream state to OPEN",
"if",
"(",
"frameType",
"==",
"FrameTypes",
".",
"HEADERS",
")",
"{",
"updateStreamState",
"(",
"StreamState",
".",
"OPEN",
")",
";",
"}",
"writeFrameSync",
"(",
")",
";",
"}",
"}"
] | Perform operations to transition into IDLE state
@param direction
@throws CompressionException
@throws FlowControlException
@throws ProtocolException | [
"Perform",
"operations",
"to",
"transition",
"into",
"IDLE",
"state"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/H2StreamProcessor.java#L928-L971 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/H2StreamProcessor.java | H2StreamProcessor.isWindowLimitExceeded | private boolean isWindowLimitExceeded(FrameData dataFrame) {
if (streamWindowUpdateWriteLimit - dataFrame.getPayloadLength() < 0 ||
muxLink.getWorkQ().getConnectionWriteLimit() - dataFrame.getPayloadLength() < 0) {
// would exceed window update limit
String s = "Cannot write Data Frame because it would exceed the stream window update limit."
+ "streamWindowUpdateWriteLimit: " + streamWindowUpdateWriteLimit
+ "\nstreamWindowUpdateWriteInitialSize: " + streamWindowUpdateWriteInitialSize
+ "\nconnection window size: " + muxLink.getWorkQ().getConnectionWriteLimit()
+ "\nframe size: " + dataFrame.getPayloadLength();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, s);
}
return true;
}
return false;
} | java | private boolean isWindowLimitExceeded(FrameData dataFrame) {
if (streamWindowUpdateWriteLimit - dataFrame.getPayloadLength() < 0 ||
muxLink.getWorkQ().getConnectionWriteLimit() - dataFrame.getPayloadLength() < 0) {
// would exceed window update limit
String s = "Cannot write Data Frame because it would exceed the stream window update limit."
+ "streamWindowUpdateWriteLimit: " + streamWindowUpdateWriteLimit
+ "\nstreamWindowUpdateWriteInitialSize: " + streamWindowUpdateWriteInitialSize
+ "\nconnection window size: " + muxLink.getWorkQ().getConnectionWriteLimit()
+ "\nframe size: " + dataFrame.getPayloadLength();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, s);
}
return true;
}
return false;
} | [
"private",
"boolean",
"isWindowLimitExceeded",
"(",
"FrameData",
"dataFrame",
")",
"{",
"if",
"(",
"streamWindowUpdateWriteLimit",
"-",
"dataFrame",
".",
"getPayloadLength",
"(",
")",
"<",
"0",
"||",
"muxLink",
".",
"getWorkQ",
"(",
")",
".",
"getConnectionWriteLimit",
"(",
")",
"-",
"dataFrame",
".",
"getPayloadLength",
"(",
")",
"<",
"0",
")",
"{",
"// would exceed window update limit",
"String",
"s",
"=",
"\"Cannot write Data Frame because it would exceed the stream window update limit.\"",
"+",
"\"streamWindowUpdateWriteLimit: \"",
"+",
"streamWindowUpdateWriteLimit",
"+",
"\"\\nstreamWindowUpdateWriteInitialSize: \"",
"+",
"streamWindowUpdateWriteInitialSize",
"+",
"\"\\nconnection window size: \"",
"+",
"muxLink",
".",
"getWorkQ",
"(",
")",
".",
"getConnectionWriteLimit",
"(",
")",
"+",
"\"\\nframe size: \"",
"+",
"dataFrame",
".",
"getPayloadLength",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"s",
")",
";",
"}",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] | Check to see if a writing out a frame will cause the stream or connection window to go exceeded
@return true if the write window would be exceeded by writing the frame | [
"Check",
"to",
"see",
"if",
"a",
"writing",
"out",
"a",
"frame",
"will",
"cause",
"the",
"stream",
"or",
"connection",
"window",
"to",
"go",
"exceeded"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/H2StreamProcessor.java#L1120-L1135 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/H2StreamProcessor.java | H2StreamProcessor.sendRequestToWc | public void sendRequestToWc(FramePPHeaders frame) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "H2StreamProcessor.sendRequestToWc()");
}
if (null == frame) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "H2StreamProcessor.sendRequestToWc(): Frame is null");
}
} else {
// Make the headers frame look like it just came in
WsByteBuffer buf = frame.buildFrameForWrite();
TCPReadRequestContext readi = h2HttpInboundLinkWrap.getConnectionContext().getReadInterface();
readi.setBuffer(buf);
// Call the synchronized method to handle the frame
try {
processNextFrame(frame, Constants.Direction.READ_IN);
} catch (Http2Exception he) {
// ProcessNextFrame() sends a reset/goaway if an error occurs, nothing left but to clean up
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "H2StreamProcessor.sendRequestToWc(): ProcessNextFrame() error, Exception: " + he);
}
// Free the buffer
buf.release();
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "H2StreamProcessor.sendRequestToWc()");
}
} | java | public void sendRequestToWc(FramePPHeaders frame) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "H2StreamProcessor.sendRequestToWc()");
}
if (null == frame) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "H2StreamProcessor.sendRequestToWc(): Frame is null");
}
} else {
// Make the headers frame look like it just came in
WsByteBuffer buf = frame.buildFrameForWrite();
TCPReadRequestContext readi = h2HttpInboundLinkWrap.getConnectionContext().getReadInterface();
readi.setBuffer(buf);
// Call the synchronized method to handle the frame
try {
processNextFrame(frame, Constants.Direction.READ_IN);
} catch (Http2Exception he) {
// ProcessNextFrame() sends a reset/goaway if an error occurs, nothing left but to clean up
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "H2StreamProcessor.sendRequestToWc(): ProcessNextFrame() error, Exception: " + he);
}
// Free the buffer
buf.release();
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "H2StreamProcessor.sendRequestToWc()");
}
} | [
"public",
"void",
"sendRequestToWc",
"(",
"FramePPHeaders",
"frame",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"H2StreamProcessor.sendRequestToWc()\"",
")",
";",
"}",
"if",
"(",
"null",
"==",
"frame",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"H2StreamProcessor.sendRequestToWc(): Frame is null\"",
")",
";",
"}",
"}",
"else",
"{",
"// Make the headers frame look like it just came in",
"WsByteBuffer",
"buf",
"=",
"frame",
".",
"buildFrameForWrite",
"(",
")",
";",
"TCPReadRequestContext",
"readi",
"=",
"h2HttpInboundLinkWrap",
".",
"getConnectionContext",
"(",
")",
".",
"getReadInterface",
"(",
")",
";",
"readi",
".",
"setBuffer",
"(",
"buf",
")",
";",
"// Call the synchronized method to handle the frame",
"try",
"{",
"processNextFrame",
"(",
"frame",
",",
"Constants",
".",
"Direction",
".",
"READ_IN",
")",
";",
"}",
"catch",
"(",
"Http2Exception",
"he",
")",
"{",
"// ProcessNextFrame() sends a reset/goaway if an error occurs, nothing left but to clean up",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"H2StreamProcessor.sendRequestToWc(): ProcessNextFrame() error, Exception: \"",
"+",
"he",
")",
";",
"}",
"// Free the buffer",
"buf",
".",
"release",
"(",
")",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"H2StreamProcessor.sendRequestToWc()\"",
")",
";",
"}",
"}"
] | Send an artificially created H2 request from a push_promise up to the WebContainer | [
"Send",
"an",
"artificially",
"created",
"H2",
"request",
"from",
"a",
"push_promise",
"up",
"to",
"the",
"WebContainer"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/H2StreamProcessor.java#L1140-L1174 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/H2StreamProcessor.java | H2StreamProcessor.setHeadersComplete | private void setHeadersComplete() {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "completed headers have been received stream " + myID);
}
headersCompleted = true;
muxLink.setContinuationExpected(false);
} | java | private void setHeadersComplete() {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "completed headers have been received stream " + myID);
}
headersCompleted = true;
muxLink.setContinuationExpected(false);
} | [
"private",
"void",
"setHeadersComplete",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"completed headers have been received stream \"",
"+",
"myID",
")",
";",
"}",
"headersCompleted",
"=",
"true",
";",
"muxLink",
".",
"setContinuationExpected",
"(",
"false",
")",
";",
"}"
] | Call when all header block fragments for a header block have been received | [
"Call",
"when",
"all",
"header",
"block",
"fragments",
"for",
"a",
"header",
"block",
"have",
"been",
"received"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/H2StreamProcessor.java#L1348-L1354 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/H2StreamProcessor.java | H2StreamProcessor.getHeadersFromFrame | private void getHeadersFromFrame() {
byte[] hbf = null;
if (currentFrame.getFrameType() == FrameTypes.HEADERS || currentFrame.getFrameType() == FrameTypes.PUSHPROMISEHEADERS) {
hbf = ((FrameHeaders) currentFrame).getHeaderBlockFragment();
} else if (currentFrame.getFrameType() == FrameTypes.CONTINUATION) {
hbf = ((FrameContinuation) currentFrame).getHeaderBlockFragment();
}
if (hbf != null) {
if (headerBlock == null) {
headerBlock = new ArrayList<byte[]>();
}
headerBlock.add(hbf);
}
} | java | private void getHeadersFromFrame() {
byte[] hbf = null;
if (currentFrame.getFrameType() == FrameTypes.HEADERS || currentFrame.getFrameType() == FrameTypes.PUSHPROMISEHEADERS) {
hbf = ((FrameHeaders) currentFrame).getHeaderBlockFragment();
} else if (currentFrame.getFrameType() == FrameTypes.CONTINUATION) {
hbf = ((FrameContinuation) currentFrame).getHeaderBlockFragment();
}
if (hbf != null) {
if (headerBlock == null) {
headerBlock = new ArrayList<byte[]>();
}
headerBlock.add(hbf);
}
} | [
"private",
"void",
"getHeadersFromFrame",
"(",
")",
"{",
"byte",
"[",
"]",
"hbf",
"=",
"null",
";",
"if",
"(",
"currentFrame",
".",
"getFrameType",
"(",
")",
"==",
"FrameTypes",
".",
"HEADERS",
"||",
"currentFrame",
".",
"getFrameType",
"(",
")",
"==",
"FrameTypes",
".",
"PUSHPROMISEHEADERS",
")",
"{",
"hbf",
"=",
"(",
"(",
"FrameHeaders",
")",
"currentFrame",
")",
".",
"getHeaderBlockFragment",
"(",
")",
";",
"}",
"else",
"if",
"(",
"currentFrame",
".",
"getFrameType",
"(",
")",
"==",
"FrameTypes",
".",
"CONTINUATION",
")",
"{",
"hbf",
"=",
"(",
"(",
"FrameContinuation",
")",
"currentFrame",
")",
".",
"getHeaderBlockFragment",
"(",
")",
";",
"}",
"if",
"(",
"hbf",
"!=",
"null",
")",
"{",
"if",
"(",
"headerBlock",
"==",
"null",
")",
"{",
"headerBlock",
"=",
"new",
"ArrayList",
"<",
"byte",
"[",
"]",
">",
"(",
")",
";",
"}",
"headerBlock",
".",
"add",
"(",
"hbf",
")",
";",
"}",
"}"
] | Appends the header block fragment in the current header frame to this stream's incomplete header block | [
"Appends",
"the",
"header",
"block",
"fragment",
"in",
"the",
"current",
"header",
"frame",
"to",
"this",
"stream",
"s",
"incomplete",
"header",
"block"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/H2StreamProcessor.java#L1372-L1386 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/H2StreamProcessor.java | H2StreamProcessor.getBodyFromFrame | private void getBodyFromFrame() {
if (dataPayload == null) {
dataPayload = new ArrayList<byte[]>();
}
if (currentFrame.getFrameType() == FrameTypes.DATA) {
dataPayload.add(((FrameData) currentFrame).getData());
}
} | java | private void getBodyFromFrame() {
if (dataPayload == null) {
dataPayload = new ArrayList<byte[]>();
}
if (currentFrame.getFrameType() == FrameTypes.DATA) {
dataPayload.add(((FrameData) currentFrame).getData());
}
} | [
"private",
"void",
"getBodyFromFrame",
"(",
")",
"{",
"if",
"(",
"dataPayload",
"==",
"null",
")",
"{",
"dataPayload",
"=",
"new",
"ArrayList",
"<",
"byte",
"[",
"]",
">",
"(",
")",
";",
"}",
"if",
"(",
"currentFrame",
".",
"getFrameType",
"(",
")",
"==",
"FrameTypes",
".",
"DATA",
")",
"{",
"dataPayload",
".",
"add",
"(",
"(",
"(",
"FrameData",
")",
"currentFrame",
")",
".",
"getData",
"(",
")",
")",
";",
"}",
"}"
] | Grab the data from the current frame | [
"Grab",
"the",
"data",
"from",
"the",
"current",
"frame"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/H2StreamProcessor.java#L1523-L1530 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/H2StreamProcessor.java | H2StreamProcessor.processCompleteData | private void processCompleteData() throws ProtocolException {
WsByteBufferPoolManager bufManager = HttpDispatcher.getBufferManager();
WsByteBuffer buf = bufManager.allocate(getByteCount(dataPayload));
for (byte[] bytes : dataPayload) {
buf.put(bytes);
}
buf.flip();
if (expectedContentLength != -1 && buf.limit() != expectedContentLength) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "processCompleteData release buffer and throw ProtocolException");
}
buf.release();
ProtocolException pe = new ProtocolException("content-length header did not match the expected amount of data received");
pe.setConnectionError(false); // stream error
throw pe;
}
moveDataIntoReadBufferArray(buf);
} | java | private void processCompleteData() throws ProtocolException {
WsByteBufferPoolManager bufManager = HttpDispatcher.getBufferManager();
WsByteBuffer buf = bufManager.allocate(getByteCount(dataPayload));
for (byte[] bytes : dataPayload) {
buf.put(bytes);
}
buf.flip();
if (expectedContentLength != -1 && buf.limit() != expectedContentLength) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "processCompleteData release buffer and throw ProtocolException");
}
buf.release();
ProtocolException pe = new ProtocolException("content-length header did not match the expected amount of data received");
pe.setConnectionError(false); // stream error
throw pe;
}
moveDataIntoReadBufferArray(buf);
} | [
"private",
"void",
"processCompleteData",
"(",
")",
"throws",
"ProtocolException",
"{",
"WsByteBufferPoolManager",
"bufManager",
"=",
"HttpDispatcher",
".",
"getBufferManager",
"(",
")",
";",
"WsByteBuffer",
"buf",
"=",
"bufManager",
".",
"allocate",
"(",
"getByteCount",
"(",
"dataPayload",
")",
")",
";",
"for",
"(",
"byte",
"[",
"]",
"bytes",
":",
"dataPayload",
")",
"{",
"buf",
".",
"put",
"(",
"bytes",
")",
";",
"}",
"buf",
".",
"flip",
"(",
")",
";",
"if",
"(",
"expectedContentLength",
"!=",
"-",
"1",
"&&",
"buf",
".",
"limit",
"(",
")",
"!=",
"expectedContentLength",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"processCompleteData release buffer and throw ProtocolException\"",
")",
";",
"}",
"buf",
".",
"release",
"(",
")",
";",
"ProtocolException",
"pe",
"=",
"new",
"ProtocolException",
"(",
"\"content-length header did not match the expected amount of data received\"",
")",
";",
"pe",
".",
"setConnectionError",
"(",
"false",
")",
";",
"// stream error",
"throw",
"pe",
";",
"}",
"moveDataIntoReadBufferArray",
"(",
"buf",
")",
";",
"}"
] | Put the data payload for this stream into the read buffer that will be passed to the webcontainer.
This should only be called when this stream has received an end of stream flag.
@throws ProtocolException | [
"Put",
"the",
"data",
"payload",
"for",
"this",
"stream",
"into",
"the",
"read",
"buffer",
"that",
"will",
"be",
"passed",
"to",
"the",
"webcontainer",
".",
"This",
"should",
"only",
"be",
"called",
"when",
"this",
"stream",
"has",
"received",
"an",
"end",
"of",
"stream",
"flag",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/H2StreamProcessor.java#L1538-L1555 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/H2StreamProcessor.java | H2StreamProcessor.setReadyForRead | private void setReadyForRead() throws ProtocolException {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "setReadyForRead entry: stream id:" + myID);
}
muxLink.updateHighestStreamId(myID);
if (headersCompleted) {
ExecutorService executorService = CHFWBundle.getExecutorService();
Http2Ready readyThread = new Http2Ready(h2HttpInboundLinkWrap);
executorService.execute(readyThread);
}
} | java | private void setReadyForRead() throws ProtocolException {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "setReadyForRead entry: stream id:" + myID);
}
muxLink.updateHighestStreamId(myID);
if (headersCompleted) {
ExecutorService executorService = CHFWBundle.getExecutorService();
Http2Ready readyThread = new Http2Ready(h2HttpInboundLinkWrap);
executorService.execute(readyThread);
}
} | [
"private",
"void",
"setReadyForRead",
"(",
")",
"throws",
"ProtocolException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"setReadyForRead entry: stream id:\"",
"+",
"myID",
")",
";",
"}",
"muxLink",
".",
"updateHighestStreamId",
"(",
"myID",
")",
";",
"if",
"(",
"headersCompleted",
")",
"{",
"ExecutorService",
"executorService",
"=",
"CHFWBundle",
".",
"getExecutorService",
"(",
")",
";",
"Http2Ready",
"readyThread",
"=",
"new",
"Http2Ready",
"(",
"h2HttpInboundLinkWrap",
")",
";",
"executorService",
".",
"execute",
"(",
"readyThread",
")",
";",
"}",
"}"
] | Tell the HTTP inbound link that we have data ready for it to read
@throws ProtocolException | [
"Tell",
"the",
"HTTP",
"inbound",
"link",
"that",
"we",
"have",
"data",
"ready",
"for",
"it",
"to",
"read"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/H2StreamProcessor.java#L1562-L1572 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/H2StreamProcessor.java | H2StreamProcessor.moveDataIntoReadBufferArray | private void moveDataIntoReadBufferArray(WsByteBuffer newReadBuffer) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "moveDataIntoReadBufferArray entry: stream " + myID + " buffer: " + newReadBuffer);
}
// move the data that is to be sent up the channel into the currentReadReady byte array, and update the currentReadSize
if (newReadBuffer != null) {
int size = newReadBuffer.remaining(); // limit - pos
if (size > 0) {
streamReadReady.add(newReadBuffer);
streamReadSize += size;
this.readLatch.countDown();
}
}
} | java | private void moveDataIntoReadBufferArray(WsByteBuffer newReadBuffer) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "moveDataIntoReadBufferArray entry: stream " + myID + " buffer: " + newReadBuffer);
}
// move the data that is to be sent up the channel into the currentReadReady byte array, and update the currentReadSize
if (newReadBuffer != null) {
int size = newReadBuffer.remaining(); // limit - pos
if (size > 0) {
streamReadReady.add(newReadBuffer);
streamReadSize += size;
this.readLatch.countDown();
}
}
} | [
"private",
"void",
"moveDataIntoReadBufferArray",
"(",
"WsByteBuffer",
"newReadBuffer",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"moveDataIntoReadBufferArray entry: stream \"",
"+",
"myID",
"+",
"\" buffer: \"",
"+",
"newReadBuffer",
")",
";",
"}",
"// move the data that is to be sent up the channel into the currentReadReady byte array, and update the currentReadSize",
"if",
"(",
"newReadBuffer",
"!=",
"null",
")",
"{",
"int",
"size",
"=",
"newReadBuffer",
".",
"remaining",
"(",
")",
";",
"// limit - pos",
"if",
"(",
"size",
">",
"0",
")",
"{",
"streamReadReady",
".",
"add",
"(",
"newReadBuffer",
")",
";",
"streamReadSize",
"+=",
"size",
";",
"this",
".",
"readLatch",
".",
"countDown",
"(",
")",
";",
"}",
"}",
"}"
] | Add a buffer to the list of buffers that will be sent to the WebContainer when a read is requested
@param newReadBuffer | [
"Add",
"a",
"buffer",
"to",
"the",
"list",
"of",
"buffers",
"that",
"will",
"be",
"sent",
"to",
"the",
"WebContainer",
"when",
"a",
"read",
"is",
"requested"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/H2StreamProcessor.java#L1611-L1625 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/H2StreamProcessor.java | H2StreamProcessor.read | @SuppressWarnings("unchecked")
public VirtualConnection read(long numBytes, WsByteBuffer[] requestBuffers) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "read entry: stream " + myID + " request: " + requestBuffers + " num bytes requested: " + numBytes);
}
long streamByteCount = streamReadSize; // number of bytes available on this stream
long requestByteCount = bytesRemaining(requestBuffers); // total capacity of the caller byte array
int reqArrayIndex = 0; // keep track of where we are in the caller's array
// if at least numBytes are ready to be processed as part of the HTTP Request/Response, then load it up
if (numBytes > streamReadSize || requestBuffers == null) {
if (this.headersCompleted) {
return h2HttpInboundLinkWrap.getVirtualConnection();
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "read exit: stream " + myID + " more bytes requested than available for read: " + numBytes + " > " + streamReadSize);
}
return null;
}
}
if (streamByteCount < requestByteCount) {
// the byte count requested exceeds the caller array capacity
actualReadCount = streamByteCount;
} else {
actualReadCount = requestByteCount;
}
// copy bytes from this stream into the caller arrays
for (int bytesRead = 0; bytesRead < actualReadCount; bytesRead++) {
// find the first buffer from the caller that has remaining capacity
while ((requestBuffers[reqArrayIndex].position() == requestBuffers[reqArrayIndex].limit())) {
reqArrayIndex++;
}
// find the next stream buffer that has data
while (!streamReadReady.isEmpty() && !streamReadReady.get(0).hasRemaining()) {
streamReadReady.get(0).release();
streamReadReady.remove(0);
}
requestBuffers[reqArrayIndex].put(streamReadReady.get(0).get());
}
// put stream array back in shape
streamReadSize = 0;
readLatch = new CountDownLatch(1);
for (WsByteBuffer buffer : ((ArrayList<WsByteBuffer>) streamReadReady.clone())) {
streamReadReady.clear();
if (buffer.hasRemaining()) {
moveDataIntoReadBufferArray(buffer.slice());
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "read exit: " + streamId());
}
// return the vc since this was a successful read
return h2HttpInboundLinkWrap.getVirtualConnection();
} | java | @SuppressWarnings("unchecked")
public VirtualConnection read(long numBytes, WsByteBuffer[] requestBuffers) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "read entry: stream " + myID + " request: " + requestBuffers + " num bytes requested: " + numBytes);
}
long streamByteCount = streamReadSize; // number of bytes available on this stream
long requestByteCount = bytesRemaining(requestBuffers); // total capacity of the caller byte array
int reqArrayIndex = 0; // keep track of where we are in the caller's array
// if at least numBytes are ready to be processed as part of the HTTP Request/Response, then load it up
if (numBytes > streamReadSize || requestBuffers == null) {
if (this.headersCompleted) {
return h2HttpInboundLinkWrap.getVirtualConnection();
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "read exit: stream " + myID + " more bytes requested than available for read: " + numBytes + " > " + streamReadSize);
}
return null;
}
}
if (streamByteCount < requestByteCount) {
// the byte count requested exceeds the caller array capacity
actualReadCount = streamByteCount;
} else {
actualReadCount = requestByteCount;
}
// copy bytes from this stream into the caller arrays
for (int bytesRead = 0; bytesRead < actualReadCount; bytesRead++) {
// find the first buffer from the caller that has remaining capacity
while ((requestBuffers[reqArrayIndex].position() == requestBuffers[reqArrayIndex].limit())) {
reqArrayIndex++;
}
// find the next stream buffer that has data
while (!streamReadReady.isEmpty() && !streamReadReady.get(0).hasRemaining()) {
streamReadReady.get(0).release();
streamReadReady.remove(0);
}
requestBuffers[reqArrayIndex].put(streamReadReady.get(0).get());
}
// put stream array back in shape
streamReadSize = 0;
readLatch = new CountDownLatch(1);
for (WsByteBuffer buffer : ((ArrayList<WsByteBuffer>) streamReadReady.clone())) {
streamReadReady.clear();
if (buffer.hasRemaining()) {
moveDataIntoReadBufferArray(buffer.slice());
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "read exit: " + streamId());
}
// return the vc since this was a successful read
return h2HttpInboundLinkWrap.getVirtualConnection();
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"VirtualConnection",
"read",
"(",
"long",
"numBytes",
",",
"WsByteBuffer",
"[",
"]",
"requestBuffers",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"read entry: stream \"",
"+",
"myID",
"+",
"\" request: \"",
"+",
"requestBuffers",
"+",
"\" num bytes requested: \"",
"+",
"numBytes",
")",
";",
"}",
"long",
"streamByteCount",
"=",
"streamReadSize",
";",
"// number of bytes available on this stream",
"long",
"requestByteCount",
"=",
"bytesRemaining",
"(",
"requestBuffers",
")",
";",
"// total capacity of the caller byte array",
"int",
"reqArrayIndex",
"=",
"0",
";",
"// keep track of where we are in the caller's array",
"// if at least numBytes are ready to be processed as part of the HTTP Request/Response, then load it up",
"if",
"(",
"numBytes",
">",
"streamReadSize",
"||",
"requestBuffers",
"==",
"null",
")",
"{",
"if",
"(",
"this",
".",
"headersCompleted",
")",
"{",
"return",
"h2HttpInboundLinkWrap",
".",
"getVirtualConnection",
"(",
")",
";",
"}",
"else",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"read exit: stream \"",
"+",
"myID",
"+",
"\" more bytes requested than available for read: \"",
"+",
"numBytes",
"+",
"\" > \"",
"+",
"streamReadSize",
")",
";",
"}",
"return",
"null",
";",
"}",
"}",
"if",
"(",
"streamByteCount",
"<",
"requestByteCount",
")",
"{",
"// the byte count requested exceeds the caller array capacity",
"actualReadCount",
"=",
"streamByteCount",
";",
"}",
"else",
"{",
"actualReadCount",
"=",
"requestByteCount",
";",
"}",
"// copy bytes from this stream into the caller arrays",
"for",
"(",
"int",
"bytesRead",
"=",
"0",
";",
"bytesRead",
"<",
"actualReadCount",
";",
"bytesRead",
"++",
")",
"{",
"// find the first buffer from the caller that has remaining capacity",
"while",
"(",
"(",
"requestBuffers",
"[",
"reqArrayIndex",
"]",
".",
"position",
"(",
")",
"==",
"requestBuffers",
"[",
"reqArrayIndex",
"]",
".",
"limit",
"(",
")",
")",
")",
"{",
"reqArrayIndex",
"++",
";",
"}",
"// find the next stream buffer that has data",
"while",
"(",
"!",
"streamReadReady",
".",
"isEmpty",
"(",
")",
"&&",
"!",
"streamReadReady",
".",
"get",
"(",
"0",
")",
".",
"hasRemaining",
"(",
")",
")",
"{",
"streamReadReady",
".",
"get",
"(",
"0",
")",
".",
"release",
"(",
")",
";",
"streamReadReady",
".",
"remove",
"(",
"0",
")",
";",
"}",
"requestBuffers",
"[",
"reqArrayIndex",
"]",
".",
"put",
"(",
"streamReadReady",
".",
"get",
"(",
"0",
")",
".",
"get",
"(",
")",
")",
";",
"}",
"// put stream array back in shape",
"streamReadSize",
"=",
"0",
";",
"readLatch",
"=",
"new",
"CountDownLatch",
"(",
"1",
")",
";",
"for",
"(",
"WsByteBuffer",
"buffer",
":",
"(",
"(",
"ArrayList",
"<",
"WsByteBuffer",
">",
")",
"streamReadReady",
".",
"clone",
"(",
")",
")",
")",
"{",
"streamReadReady",
".",
"clear",
"(",
")",
";",
"if",
"(",
"buffer",
".",
"hasRemaining",
"(",
")",
")",
"{",
"moveDataIntoReadBufferArray",
"(",
"buffer",
".",
"slice",
"(",
")",
")",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"read exit: \"",
"+",
"streamId",
"(",
")",
")",
";",
"}",
"// return the vc since this was a successful read",
"return",
"h2HttpInboundLinkWrap",
".",
"getVirtualConnection",
"(",
")",
";",
"}"
] | Read the HTTP header and data bytes for this stream
@param numBytes the number of bytes to read
@param requestBuffers an array of buffers to copy the read data into
@return this stream's VirtualConnection or null if too many bytes were requested | [
"Read",
"the",
"HTTP",
"header",
"and",
"data",
"bytes",
"for",
"this",
"stream"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/H2StreamProcessor.java#L1634-L1694 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/H2StreamProcessor.java | H2StreamProcessor.isStreamClosed | public boolean isStreamClosed() {
if (this.myID == 0 && !endStream) {
return false;
}
if (state == StreamState.CLOSED) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "isStreamClosed stream closed; " + streamId());
}
return true;
}
boolean rc = muxLink.checkIfGoAwaySendingOrClosing();
if (rc == true) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "isStreamClosed stream closed via muxLink check; " + streamId());
}
}
return rc;
} | java | public boolean isStreamClosed() {
if (this.myID == 0 && !endStream) {
return false;
}
if (state == StreamState.CLOSED) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "isStreamClosed stream closed; " + streamId());
}
return true;
}
boolean rc = muxLink.checkIfGoAwaySendingOrClosing();
if (rc == true) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "isStreamClosed stream closed via muxLink check; " + streamId());
}
}
return rc;
} | [
"public",
"boolean",
"isStreamClosed",
"(",
")",
"{",
"if",
"(",
"this",
".",
"myID",
"==",
"0",
"&&",
"!",
"endStream",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"state",
"==",
"StreamState",
".",
"CLOSED",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"isStreamClosed stream closed; \"",
"+",
"streamId",
"(",
")",
")",
";",
"}",
"return",
"true",
";",
"}",
"boolean",
"rc",
"=",
"muxLink",
".",
"checkIfGoAwaySendingOrClosing",
"(",
")",
";",
"if",
"(",
"rc",
"==",
"true",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"isStreamClosed stream closed via muxLink check; \"",
"+",
"streamId",
"(",
")",
")",
";",
"}",
"}",
"return",
"rc",
";",
"}"
] | Check if the current stream should be closed
@return true if the stream should stop processing | [
"Check",
"if",
"the",
"current",
"stream",
"should",
"be",
"closed"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/H2StreamProcessor.java#L1836-L1857 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/H2StreamProcessor.java | H2StreamProcessor.getByteCount | private int getByteCount(ArrayList<byte[]> listOfByteArrays) {
int count = 0;
for (byte[] byteArray : listOfByteArrays) {
if (byteArray != null) {
count += byteArray.length;
}
}
return count;
} | java | private int getByteCount(ArrayList<byte[]> listOfByteArrays) {
int count = 0;
for (byte[] byteArray : listOfByteArrays) {
if (byteArray != null) {
count += byteArray.length;
}
}
return count;
} | [
"private",
"int",
"getByteCount",
"(",
"ArrayList",
"<",
"byte",
"[",
"]",
">",
"listOfByteArrays",
")",
"{",
"int",
"count",
"=",
"0",
";",
"for",
"(",
"byte",
"[",
"]",
"byteArray",
":",
"listOfByteArrays",
")",
"{",
"if",
"(",
"byteArray",
"!=",
"null",
")",
"{",
"count",
"+=",
"byteArray",
".",
"length",
";",
"}",
"}",
"return",
"count",
";",
"}"
] | Get the number of bytes in this list of byte arrays
@param listOfByteArrays
@return the total byte count for this list of byte arrays | [
"Get",
"the",
"number",
"of",
"bytes",
"in",
"this",
"list",
"of",
"byte",
"arrays"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/H2StreamProcessor.java#L1917-L1925 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/util/UniqueIDUtils.java | UniqueIDUtils.generateIncUuid | public static String generateIncUuid(Object caller)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "generateIncUuid", "Caller="+caller);
java.util.Date time = new java.util.Date();
int hash = caller.hashCode();
long millis = time.getTime();
byte[] data = new byte[] {(byte)(hash>>24),
(byte)(hash>>16),
(byte)(hash>>8),
(byte)(hash),
(byte)(millis>>24),
(byte)(millis>>16),
(byte)(millis>>8),
(byte)(millis)};
String digits = "0123456789ABCDEF";
StringBuffer retval = new StringBuffer(data.length*2);
for (int i = 0; i < data.length; i++)
{
retval.append(digits.charAt((data[i] >> 4) & 0xf));
retval.append(digits.charAt(data[i] & 0xf));
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "generateIncUuid", "return="+retval);
return retval.toString();
} | java | public static String generateIncUuid(Object caller)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "generateIncUuid", "Caller="+caller);
java.util.Date time = new java.util.Date();
int hash = caller.hashCode();
long millis = time.getTime();
byte[] data = new byte[] {(byte)(hash>>24),
(byte)(hash>>16),
(byte)(hash>>8),
(byte)(hash),
(byte)(millis>>24),
(byte)(millis>>16),
(byte)(millis>>8),
(byte)(millis)};
String digits = "0123456789ABCDEF";
StringBuffer retval = new StringBuffer(data.length*2);
for (int i = 0; i < data.length; i++)
{
retval.append(digits.charAt((data[i] >> 4) & 0xf));
retval.append(digits.charAt(data[i] & 0xf));
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "generateIncUuid", "return="+retval);
return retval.toString();
} | [
"public",
"static",
"String",
"generateIncUuid",
"(",
"Object",
"caller",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"generateIncUuid\"",
",",
"\"Caller=\"",
"+",
"caller",
")",
";",
"java",
".",
"util",
".",
"Date",
"time",
"=",
"new",
"java",
".",
"util",
".",
"Date",
"(",
")",
";",
"int",
"hash",
"=",
"caller",
".",
"hashCode",
"(",
")",
";",
"long",
"millis",
"=",
"time",
".",
"getTime",
"(",
")",
";",
"byte",
"[",
"]",
"data",
"=",
"new",
"byte",
"[",
"]",
"{",
"(",
"byte",
")",
"(",
"hash",
">>",
"24",
")",
",",
"(",
"byte",
")",
"(",
"hash",
">>",
"16",
")",
",",
"(",
"byte",
")",
"(",
"hash",
">>",
"8",
")",
",",
"(",
"byte",
")",
"(",
"hash",
")",
",",
"(",
"byte",
")",
"(",
"millis",
">>",
"24",
")",
",",
"(",
"byte",
")",
"(",
"millis",
">>",
"16",
")",
",",
"(",
"byte",
")",
"(",
"millis",
">>",
"8",
")",
",",
"(",
"byte",
")",
"(",
"millis",
")",
"}",
";",
"String",
"digits",
"=",
"\"0123456789ABCDEF\"",
";",
"StringBuffer",
"retval",
"=",
"new",
"StringBuffer",
"(",
"data",
".",
"length",
"*",
"2",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"data",
".",
"length",
";",
"i",
"++",
")",
"{",
"retval",
".",
"append",
"(",
"digits",
".",
"charAt",
"(",
"(",
"data",
"[",
"i",
"]",
">>",
"4",
")",
"&",
"0xf",
")",
")",
";",
"retval",
".",
"append",
"(",
"digits",
".",
"charAt",
"(",
"data",
"[",
"i",
"]",
"&",
"0xf",
")",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"generateIncUuid\"",
",",
"\"return=\"",
"+",
"retval",
")",
";",
"return",
"retval",
".",
"toString",
"(",
")",
";",
"}"
] | The UUID for this incarnation of ME is generated
using the hashcode of this object and the least
significant four bytes of the current time in
milliseconds.
@param caller The calling object used in the generation of the incarnation UUID
@return The generated incarnation UUID | [
"The",
"UUID",
"for",
"this",
"incarnation",
"of",
"ME",
"is",
"generated",
"using",
"the",
"hashcode",
"of",
"this",
"object",
"and",
"the",
"least",
"significant",
"four",
"bytes",
"of",
"the",
"current",
"time",
"in",
"milliseconds",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/util/UniqueIDUtils.java#L34-L63 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.utils/src/com/ibm/ws/sib/utils/ras/SibTr.java | SibTr.getMEName | public static String getMEName(Object o) {
String meName;
if (!threadLocalStack.isEmpty()) {
meName = threadLocalStack.peek();
} else {
meName = DEFAULT_ME_NAME;
}
String str = "";
if (o != null) {
str = "/" + Integer.toHexString(System.identityHashCode(o));
}
// Defect 91793 to avoid SIBMessage in Systemout.log starting with [:]
return "";
} | java | public static String getMEName(Object o) {
String meName;
if (!threadLocalStack.isEmpty()) {
meName = threadLocalStack.peek();
} else {
meName = DEFAULT_ME_NAME;
}
String str = "";
if (o != null) {
str = "/" + Integer.toHexString(System.identityHashCode(o));
}
// Defect 91793 to avoid SIBMessage in Systemout.log starting with [:]
return "";
} | [
"public",
"static",
"String",
"getMEName",
"(",
"Object",
"o",
")",
"{",
"String",
"meName",
";",
"if",
"(",
"!",
"threadLocalStack",
".",
"isEmpty",
"(",
")",
")",
"{",
"meName",
"=",
"threadLocalStack",
".",
"peek",
"(",
")",
";",
"}",
"else",
"{",
"meName",
"=",
"DEFAULT_ME_NAME",
";",
"}",
"String",
"str",
"=",
"\"\"",
";",
"if",
"(",
"o",
"!=",
"null",
")",
"{",
"str",
"=",
"\"/\"",
"+",
"Integer",
".",
"toHexString",
"(",
"System",
".",
"identityHashCode",
"(",
"o",
")",
")",
";",
"}",
"// Defect 91793 to avoid SIBMessage in Systemout.log starting with [:] ",
"return",
"\"\"",
";",
"}"
] | Get Jetstream ME name to be printed in trace message
@param o The object whose identityHashCode should also be appended
@return the Name of messaging engine if set, default name otherwise | [
"Get",
"Jetstream",
"ME",
"name",
"to",
"be",
"printed",
"in",
"trace",
"message"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.utils/src/com/ibm/ws/sib/utils/ras/SibTr.java#L331-L347 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.