repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
partition
stringclasses
1 value
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/ParseUtil.java
ParseUtil.convertRange
static Selector convertRange(Selector expr, Selector bound1, Selector bound2) { return new OperatorImpl(Operator.AND, new OperatorImpl(Operator.GE, (Selector) expr.clone(), bound1), new OperatorImpl(Operator.LE, (Selector) expr.clone(), bound2)); }
java
static Selector convertRange(Selector expr, Selector bound1, Selector bound2) { return new OperatorImpl(Operator.AND, new OperatorImpl(Operator.GE, (Selector) expr.clone(), bound1), new OperatorImpl(Operator.LE, (Selector) expr.clone(), bound2)); }
[ "static", "Selector", "convertRange", "(", "Selector", "expr", ",", "Selector", "bound1", ",", "Selector", "bound2", ")", "{", "return", "new", "OperatorImpl", "(", "Operator", ".", "AND", ",", "new", "OperatorImpl", "(", "Operator", ".", "GE", ",", "(", "Selector", ")", "expr", ".", "clone", "(", ")", ",", "bound1", ")", ",", "new", "OperatorImpl", "(", "Operator", ".", "LE", ",", "(", "Selector", ")", "expr", ".", "clone", "(", ")", ",", "bound2", ")", ")", ";", "}" ]
Convert a partially parsed BETWEEN expression into its more primitive form as a conjunction of inequalities. @param expr the expression whose range is being tested @param bound1 the lower bound @param bound2 the upper bound @return a Selector representing the BETWEEN expression its more primitive form
[ "Convert", "a", "partially", "parsed", "BETWEEN", "expression", "into", "its", "more", "primitive", "form", "as", "a", "conjunction", "of", "inequalities", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/ParseUtil.java#L124-L128
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/ParseUtil.java
ParseUtil.convertLike
static Selector convertLike(Selector arg, String pattern, String escape) { try { pattern = reduceStringLiteralToken(pattern); boolean escaped = false; char esc = 0; if (escape != null) { escape = reduceStringLiteralToken(escape); if (escape.length() != 1) return null; escaped = true; esc = escape.charAt(0); } return Matching.getInstance().createLikeOperator(arg, pattern, escaped, esc); } catch (Exception e) { // No FFDC Code Needed. // FFDC driven by wrapper class. FFDC.processException(cclass, "com.ibm.ws.sib.matchspace.selector.impl.ParseUtil.convertLike", e, "1:183:1.19"); // This should never occur as to get into this we should be missing // the sib.matchspace jar file, but we are already in it. throw new RuntimeException(e); } }
java
static Selector convertLike(Selector arg, String pattern, String escape) { try { pattern = reduceStringLiteralToken(pattern); boolean escaped = false; char esc = 0; if (escape != null) { escape = reduceStringLiteralToken(escape); if (escape.length() != 1) return null; escaped = true; esc = escape.charAt(0); } return Matching.getInstance().createLikeOperator(arg, pattern, escaped, esc); } catch (Exception e) { // No FFDC Code Needed. // FFDC driven by wrapper class. FFDC.processException(cclass, "com.ibm.ws.sib.matchspace.selector.impl.ParseUtil.convertLike", e, "1:183:1.19"); // This should never occur as to get into this we should be missing // the sib.matchspace jar file, but we are already in it. throw new RuntimeException(e); } }
[ "static", "Selector", "convertLike", "(", "Selector", "arg", ",", "String", "pattern", ",", "String", "escape", ")", "{", "try", "{", "pattern", "=", "reduceStringLiteralToken", "(", "pattern", ")", ";", "boolean", "escaped", "=", "false", ";", "char", "esc", "=", "0", ";", "if", "(", "escape", "!=", "null", ")", "{", "escape", "=", "reduceStringLiteralToken", "(", "escape", ")", ";", "if", "(", "escape", ".", "length", "(", ")", "!=", "1", ")", "return", "null", ";", "escaped", "=", "true", ";", "esc", "=", "escape", ".", "charAt", "(", "0", ")", ";", "}", "return", "Matching", ".", "getInstance", "(", ")", ".", "createLikeOperator", "(", "arg", ",", "pattern", ",", "escaped", ",", "esc", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "// No FFDC Code Needed.", "// FFDC driven by wrapper class.", "FFDC", ".", "processException", "(", "cclass", ",", "\"com.ibm.ws.sib.matchspace.selector.impl.ParseUtil.convertLike\"", ",", "e", ",", "\"1:183:1.19\"", ")", ";", "// This should never occur as to get into this we should be missing", "// the sib.matchspace jar file, but we are already in it.", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "}" ]
Convert a partially parsed LIKE expression, in which the pattern and escape are in the form of token images, to the proper Selector expression to represent the LIKE expression @param arg the argument of the like @param pattern the pattern image (still containing leading and trailing ') @param escape the escape (still containing leading and trailing ') or null @return an appropriate Selector or null if the pattern and/or escape are syntactically invalid
[ "Convert", "a", "partially", "parsed", "LIKE", "expression", "in", "which", "the", "pattern", "and", "escape", "are", "in", "the", "form", "of", "token", "images", "to", "the", "proper", "Selector", "expression", "to", "represent", "the", "LIKE", "expression" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/ParseUtil.java#L139-L167
train
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer.security.admin/src/com/ibm/ws/webcontainer/security/admin/internal/WebAdminSecurityCollaboratorImpl.java
WebAdminSecurityCollaboratorImpl.getSecurityMetadata
@Override public SecurityMetadata getSecurityMetadata() { SecurityMetadata sm = super.getSecurityMetadata(); if (sm == null) { return getDefaultAdminSecurityMetadata(); } else { return sm; } }
java
@Override public SecurityMetadata getSecurityMetadata() { SecurityMetadata sm = super.getSecurityMetadata(); if (sm == null) { return getDefaultAdminSecurityMetadata(); } else { return sm; } }
[ "@", "Override", "public", "SecurityMetadata", "getSecurityMetadata", "(", ")", "{", "SecurityMetadata", "sm", "=", "super", ".", "getSecurityMetadata", "(", ")", ";", "if", "(", "sm", "==", "null", ")", "{", "return", "getDefaultAdminSecurityMetadata", "(", ")", ";", "}", "else", "{", "return", "sm", ";", "}", "}" ]
Get the effective SecurityMetadata for this application. First, try to defer to the application collaborator to see if the application provides data. If so, use it. Otherwise, fallback to the default SecurityMetadata. {@inheritDoc}
[ "Get", "the", "effective", "SecurityMetadata", "for", "this", "application", ".", "First", "try", "to", "defer", "to", "the", "application", "collaborator", "to", "see", "if", "the", "application", "provides", "data", ".", "If", "so", "use", "it", ".", "Otherwise", "fallback", "to", "the", "default", "SecurityMetadata", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security.admin/src/com/ibm/ws/webcontainer/security/admin/internal/WebAdminSecurityCollaboratorImpl.java#L128-L136
train
OpenLiberty/open-liberty
dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/transport/iiop/security/ServerSecurityInterceptor.java
ServerSecurityInterceptor.buildPolicyErrorMessage
private void buildPolicyErrorMessage(String msgKey, String defaultMessage, Object... arg1) { /* The message need to be logged only for level below 'Warning' */ if (TraceComponent.isAnyTracingEnabled() && tc.isWarningEnabled()) { String messageFromBundle = Tr.formatMessage(tc, msgKey, arg1); Tr.error(tc, messageFromBundle); } }
java
private void buildPolicyErrorMessage(String msgKey, String defaultMessage, Object... arg1) { /* The message need to be logged only for level below 'Warning' */ if (TraceComponent.isAnyTracingEnabled() && tc.isWarningEnabled()) { String messageFromBundle = Tr.formatMessage(tc, msgKey, arg1); Tr.error(tc, messageFromBundle); } }
[ "private", "void", "buildPolicyErrorMessage", "(", "String", "msgKey", ",", "String", "defaultMessage", ",", "Object", "...", "arg1", ")", "{", "/* The message need to be logged only for level below 'Warning' */", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isWarningEnabled", "(", ")", ")", "{", "String", "messageFromBundle", "=", "Tr", ".", "formatMessage", "(", "tc", ",", "msgKey", ",", "arg1", ")", ";", "Tr", ".", "error", "(", "tc", ",", "messageFromBundle", ")", ";", "}", "}" ]
Receives the message key like "CSIv2_COMMON_AUTH_LAYER_DISABLED" from this key we extract the message from the NLS message bundle which contains the message along with the CWWKS message code. Example: CSIv2_CLIENT_POLICY_DOESNT_EXIST_FAILED=CWWKS9568E: The client security policy does not exist. @param msgCode
[ "Receives", "the", "message", "key", "like", "CSIv2_COMMON_AUTH_LAYER_DISABLED", "from", "this", "key", "we", "extract", "the", "message", "from", "the", "NLS", "message", "bundle", "which", "contains", "the", "message", "along", "with", "the", "CWWKS", "message", "code", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/transport/iiop/security/ServerSecurityInterceptor.java#L340-L346
train
OpenLiberty/open-liberty
dev/com.ibm.ws.security.social/src/com/ibm/ws/security/social/web/SelectionPageGenerator.java
SelectionPageGenerator.displaySelectionPage
public void displaySelectionPage(HttpServletRequest request, HttpServletResponse response, SocialTaiRequest socialTaiRequest) throws IOException { setRequestAndConfigInformation(request, response, socialTaiRequest); if (selectableConfigs == null || selectableConfigs.isEmpty()) { sendDisplayError(response, "SIGN_IN_NO_CONFIGS", new Object[0]); return; } generateOrSendToAppropriateSelectionPage(response); }
java
public void displaySelectionPage(HttpServletRequest request, HttpServletResponse response, SocialTaiRequest socialTaiRequest) throws IOException { setRequestAndConfigInformation(request, response, socialTaiRequest); if (selectableConfigs == null || selectableConfigs.isEmpty()) { sendDisplayError(response, "SIGN_IN_NO_CONFIGS", new Object[0]); return; } generateOrSendToAppropriateSelectionPage(response); }
[ "public", "void", "displaySelectionPage", "(", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ",", "SocialTaiRequest", "socialTaiRequest", ")", "throws", "IOException", "{", "setRequestAndConfigInformation", "(", "request", ",", "response", ",", "socialTaiRequest", ")", ";", "if", "(", "selectableConfigs", "==", "null", "||", "selectableConfigs", ".", "isEmpty", "(", ")", ")", "{", "sendDisplayError", "(", "response", ",", "\"SIGN_IN_NO_CONFIGS\"", ",", "new", "Object", "[", "0", "]", ")", ";", "return", ";", "}", "generateOrSendToAppropriateSelectionPage", "(", "response", ")", ";", "}" ]
Generates the sign in page to allow a user to select from the configured social login services. If no services are configured, the user is redirected to an error page. @param request @param response @param socialTaiRequest @throws IOException
[ "Generates", "the", "sign", "in", "page", "to", "allow", "a", "user", "to", "select", "from", "the", "configured", "social", "login", "services", ".", "If", "no", "services", "are", "configured", "the", "user", "is", "redirected", "to", "an", "error", "page", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.social/src/com/ibm/ws/security/social/web/SelectionPageGenerator.java#L89-L96
train
OpenLiberty/open-liberty
dev/com.ibm.ws.security.social/src/com/ibm/ws/security/social/web/SelectionPageGenerator.java
SelectionPageGenerator.createJavascript
String createJavascript() { StringBuilder html = new StringBuilder(); html.append("<script>\n"); html.append("function " + createCookieFunctionName + "(value) {\n"); html.append("document.cookie = \"" + ClientConstants.LOGIN_HINT + "=\" + value;\n"); html.append("}\n"); html.append("</script>\n"); return html.toString(); }
java
String createJavascript() { StringBuilder html = new StringBuilder(); html.append("<script>\n"); html.append("function " + createCookieFunctionName + "(value) {\n"); html.append("document.cookie = \"" + ClientConstants.LOGIN_HINT + "=\" + value;\n"); html.append("}\n"); html.append("</script>\n"); return html.toString(); }
[ "String", "createJavascript", "(", ")", "{", "StringBuilder", "html", "=", "new", "StringBuilder", "(", ")", ";", "html", ".", "append", "(", "\"<script>\\n\"", ")", ";", "html", ".", "append", "(", "\"function \"", "+", "createCookieFunctionName", "+", "\"(value) {\\n\"", ")", ";", "html", ".", "append", "(", "\"document.cookie = \\\"\"", "+", "ClientConstants", ".", "LOGIN_HINT", "+", "\"=\\\" + value;\\n\"", ")", ";", "html", ".", "append", "(", "\"}\\n\"", ")", ";", "html", ".", "append", "(", "\"</script>\\n\"", ")", ";", "return", "html", ".", "toString", "(", ")", ";", "}" ]
Creates a JavaScript function for creating a social_login_hint cookie with the value provided to the function. Each provider button should be configured to call this function when the button is clicked, allowing the login hint to be passed around in a cookie instead of a request parameter.
[ "Creates", "a", "JavaScript", "function", "for", "creating", "a", "social_login_hint", "cookie", "with", "the", "value", "provided", "to", "the", "function", ".", "Each", "provider", "button", "should", "be", "configured", "to", "call", "this", "function", "when", "the", "button", "is", "clicked", "allowing", "the", "login", "hint", "to", "be", "passed", "around", "in", "a", "cookie", "instead", "of", "a", "request", "parameter", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.social/src/com/ibm/ws/security/social/web/SelectionPageGenerator.java#L268-L276
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/GenericMessageImpl.java
GenericMessageImpl.parseMessage
public boolean parseMessage(WsByteBuffer buffer, boolean bExtractValue) throws Exception { final boolean bTrace = TraceComponent.isAnyTracingEnabled(); boolean rc = false; if (!isFirstLineComplete()) { if (bTrace && tc.isDebugEnabled()) { Tr.debug(tc, "Parsing First Line"); } rc = parseLine(buffer); } // if we've read the first line, then parse the headers // Note: we may come in with it true or it might be set to true above if (isFirstLineComplete()) { // keep parsing headers until that returns the "finished" response rc = parseHeaders(buffer, bExtractValue); } if (bTrace && tc.isDebugEnabled()) { Tr.debug(tc, "parseMessage returning " + rc); } return rc; }
java
public boolean parseMessage(WsByteBuffer buffer, boolean bExtractValue) throws Exception { final boolean bTrace = TraceComponent.isAnyTracingEnabled(); boolean rc = false; if (!isFirstLineComplete()) { if (bTrace && tc.isDebugEnabled()) { Tr.debug(tc, "Parsing First Line"); } rc = parseLine(buffer); } // if we've read the first line, then parse the headers // Note: we may come in with it true or it might be set to true above if (isFirstLineComplete()) { // keep parsing headers until that returns the "finished" response rc = parseHeaders(buffer, bExtractValue); } if (bTrace && tc.isDebugEnabled()) { Tr.debug(tc, "parseMessage returning " + rc); } return rc; }
[ "public", "boolean", "parseMessage", "(", "WsByteBuffer", "buffer", ",", "boolean", "bExtractValue", ")", "throws", "Exception", "{", "final", "boolean", "bTrace", "=", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", ";", "boolean", "rc", "=", "false", ";", "if", "(", "!", "isFirstLineComplete", "(", ")", ")", "{", "if", "(", "bTrace", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Parsing First Line\"", ")", ";", "}", "rc", "=", "parseLine", "(", "buffer", ")", ";", "}", "// if we've read the first line, then parse the headers", "// Note: we may come in with it true or it might be set to true above", "if", "(", "isFirstLineComplete", "(", ")", ")", "{", "// keep parsing headers until that returns the \"finished\" response", "rc", "=", "parseHeaders", "(", "buffer", ",", "bExtractValue", ")", ";", "}", "if", "(", "bTrace", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"parseMessage returning \"", "+", "rc", ")", ";", "}", "return", "rc", ";", "}" ]
Parse a message from the input buffer. The input flag is whether or not to save the header value immediately or delay the extraction until the header value is queried. @param buffer @param bExtractValue @return boolean (true means parsed entire message) @throws Exception
[ "Parse", "a", "message", "from", "the", "input", "buffer", ".", "The", "input", "flag", "is", "whether", "or", "not", "to", "save", "the", "header", "value", "immediately", "or", "delay", "the", "extraction", "until", "the", "header", "value", "is", "queried", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/GenericMessageImpl.java#L328-L349
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/GenericMessageImpl.java
GenericMessageImpl.marshallMessage
public WsByteBuffer[] marshallMessage() throws MessageSentException { final boolean bTrace = TraceComponent.isAnyTracingEnabled(); if (bTrace && tc.isEntryEnabled()) { Tr.entry(tc, "marshallMessage"); } preMarshallMessage(); WsByteBuffer[] marshalledObj = hasFirstLineChanged() ? marshallLine() : null; headerComplianceCheck(); marshalledObj = marshallHeaders(marshalledObj); postMarshallMessage(); if (bTrace && tc.isEntryEnabled()) { Tr.exit(tc, "marshallMessage"); } return marshalledObj; }
java
public WsByteBuffer[] marshallMessage() throws MessageSentException { final boolean bTrace = TraceComponent.isAnyTracingEnabled(); if (bTrace && tc.isEntryEnabled()) { Tr.entry(tc, "marshallMessage"); } preMarshallMessage(); WsByteBuffer[] marshalledObj = hasFirstLineChanged() ? marshallLine() : null; headerComplianceCheck(); marshalledObj = marshallHeaders(marshalledObj); postMarshallMessage(); if (bTrace && tc.isEntryEnabled()) { Tr.exit(tc, "marshallMessage"); } return marshalledObj; }
[ "public", "WsByteBuffer", "[", "]", "marshallMessage", "(", ")", "throws", "MessageSentException", "{", "final", "boolean", "bTrace", "=", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", ";", "if", "(", "bTrace", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "entry", "(", "tc", ",", "\"marshallMessage\"", ")", ";", "}", "preMarshallMessage", "(", ")", ";", "WsByteBuffer", "[", "]", "marshalledObj", "=", "hasFirstLineChanged", "(", ")", "?", "marshallLine", "(", ")", ":", "null", ";", "headerComplianceCheck", "(", ")", ";", "marshalledObj", "=", "marshallHeaders", "(", "marshalledObj", ")", ";", "postMarshallMessage", "(", ")", ";", "if", "(", "bTrace", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "exit", "(", "tc", ",", "\"marshallMessage\"", ")", ";", "}", "return", "marshalledObj", ";", "}" ]
Marshall a message. @return WsByteBuffer[] @throws MessageSentException
[ "Marshall", "a", "message", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/GenericMessageImpl.java#L357-L373
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jaxrs.2.0.common/src/org/apache/cxf/jaxrs/model/URITemplate.java
URITemplate.createTemplate
public static URITemplate createTemplate(Path path, List<Parameter> params, String classNameandPath) { return createTemplate(path == null ? null : path.value(), params, classNameandPath); }
java
public static URITemplate createTemplate(Path path, List<Parameter> params, String classNameandPath) { return createTemplate(path == null ? null : path.value(), params, classNameandPath); }
[ "public", "static", "URITemplate", "createTemplate", "(", "Path", "path", ",", "List", "<", "Parameter", ">", "params", ",", "String", "classNameandPath", ")", "{", "return", "createTemplate", "(", "path", "==", "null", "?", "null", ":", "path", ".", "value", "(", ")", ",", "params", ",", "classNameandPath", ")", ";", "}" ]
Liberty Change start
[ "Liberty", "Change", "start" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxrs.2.0.common/src/org/apache/cxf/jaxrs/model/URITemplate.java#L362-L365
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jsp/src/org/apache/jasper/compiler/ELParser.java
ELParser.isELReserved
private boolean isELReserved(String id) { int i = 0; int j = reservedWords.length; while (i < j) { int k = (i + j) / 2; int result = reservedWords[k].compareTo(id); if (result == 0) { return true; } if (result < 0) { i = k + 1; } else { j = k; } } return false; }
java
private boolean isELReserved(String id) { int i = 0; int j = reservedWords.length; while (i < j) { int k = (i + j) / 2; int result = reservedWords[k].compareTo(id); if (result == 0) { return true; } if (result < 0) { i = k + 1; } else { j = k; } } return false; }
[ "private", "boolean", "isELReserved", "(", "String", "id", ")", "{", "int", "i", "=", "0", ";", "int", "j", "=", "reservedWords", ".", "length", ";", "while", "(", "i", "<", "j", ")", "{", "int", "k", "=", "(", "i", "+", "j", ")", "/", "2", ";", "int", "result", "=", "reservedWords", "[", "k", "]", ".", "compareTo", "(", "id", ")", ";", "if", "(", "result", "==", "0", ")", "{", "return", "true", ";", "}", "if", "(", "result", "<", "0", ")", "{", "i", "=", "k", "+", "1", ";", "}", "else", "{", "j", "=", "k", ";", "}", "}", "return", "false", ";", "}" ]
Test if an id is a reserved word in EL
[ "Test", "if", "an", "id", "is", "a", "reserved", "word", "in", "EL" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsp/src/org/apache/jasper/compiler/ELParser.java#L155-L171
train
OpenLiberty/open-liberty
dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/internal/classloader/BootstrapChildFirstURLClassloader.java
BootstrapChildFirstURLClassloader.loadClass
@Override protected synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { synchronized (getClassLoadingLock(name)) { Class<?> result = null; if (name == null || name.length() == 0) return null; result = findLoadedClass(name); if (result == null) { if (name.regionMatches(0, BootstrapChildFirstJarClassloader.KERNEL_BOOT_CLASS_PREFIX, 0, BootstrapChildFirstJarClassloader.KERNEL_BOOT_PREFIX_LENGTH)) { result = super.loadClass(name, resolve); } else { try { // Try to load the class from this classpath result = findClass(name); } catch (ClassNotFoundException cnfe) { result = super.loadClass(name, resolve); } } } return result; } }
java
@Override protected synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { synchronized (getClassLoadingLock(name)) { Class<?> result = null; if (name == null || name.length() == 0) return null; result = findLoadedClass(name); if (result == null) { if (name.regionMatches(0, BootstrapChildFirstJarClassloader.KERNEL_BOOT_CLASS_PREFIX, 0, BootstrapChildFirstJarClassloader.KERNEL_BOOT_PREFIX_LENGTH)) { result = super.loadClass(name, resolve); } else { try { // Try to load the class from this classpath result = findClass(name); } catch (ClassNotFoundException cnfe) { result = super.loadClass(name, resolve); } } } return result; } }
[ "@", "Override", "protected", "synchronized", "Class", "<", "?", ">", "loadClass", "(", "String", "name", ",", "boolean", "resolve", ")", "throws", "ClassNotFoundException", "{", "synchronized", "(", "getClassLoadingLock", "(", "name", ")", ")", "{", "Class", "<", "?", ">", "result", "=", "null", ";", "if", "(", "name", "==", "null", "||", "name", ".", "length", "(", ")", "==", "0", ")", "return", "null", ";", "result", "=", "findLoadedClass", "(", "name", ")", ";", "if", "(", "result", "==", "null", ")", "{", "if", "(", "name", ".", "regionMatches", "(", "0", ",", "BootstrapChildFirstJarClassloader", ".", "KERNEL_BOOT_CLASS_PREFIX", ",", "0", ",", "BootstrapChildFirstJarClassloader", ".", "KERNEL_BOOT_PREFIX_LENGTH", ")", ")", "{", "result", "=", "super", ".", "loadClass", "(", "name", ",", "resolve", ")", ";", "}", "else", "{", "try", "{", "// Try to load the class from this classpath", "result", "=", "findClass", "(", "name", ")", ";", "}", "catch", "(", "ClassNotFoundException", "cnfe", ")", "{", "result", "=", "super", ".", "loadClass", "(", "name", ",", "resolve", ")", ";", "}", "}", "}", "return", "result", ";", "}", "}" ]
Any changes must be made to both sources
[ "Any", "changes", "must", "be", "made", "to", "both", "sources" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/internal/classloader/BootstrapChildFirstURLClassloader.java#L50-L75
train
OpenLiberty/open-liberty
dev/com.ibm.ws.artifact.zip/src/com/ibm/ws/artifact/zip/internal/ZipFileContainerUtils.java
ZipFileContainerUtils.allocateOffsets
private static List<Integer> allocateOffsets(List<List<Integer>> offsetsStorage) { if ( offsetsStorage.isEmpty() ) { return new ArrayList<Integer>(); } else { return ( offsetsStorage.remove(0) ); } }
java
private static List<Integer> allocateOffsets(List<List<Integer>> offsetsStorage) { if ( offsetsStorage.isEmpty() ) { return new ArrayList<Integer>(); } else { return ( offsetsStorage.remove(0) ); } }
[ "private", "static", "List", "<", "Integer", ">", "allocateOffsets", "(", "List", "<", "List", "<", "Integer", ">", ">", "offsetsStorage", ")", "{", "if", "(", "offsetsStorage", ".", "isEmpty", "(", ")", ")", "{", "return", "new", "ArrayList", "<", "Integer", ">", "(", ")", ";", "}", "else", "{", "return", "(", "offsetsStorage", ".", "remove", "(", "0", ")", ")", ";", "}", "}" ]
Allocate an offsets list. If no discarded list is available, allocate a new list. Otherwise, use one of the discarded lists. @param offsetsStorage Storage of discarded offset lists. @return An allocated offsets list.
[ "Allocate", "an", "offsets", "list", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.artifact.zip/src/com/ibm/ws/artifact/zip/internal/ZipFileContainerUtils.java#L225-L231
train
OpenLiberty/open-liberty
dev/com.ibm.ws.artifact.zip/src/com/ibm/ws/artifact/zip/internal/ZipFileContainerUtils.java
ZipFileContainerUtils.releaseOffsets
private static int[] releaseOffsets(List<List<Integer>> offsetsStorage, List<Integer> offsets) { int numValues = offsets.size(); int[] extractedValues; if ( numValues == 0 ) { extractedValues = EMPTY_OFFSETS_ARRAY; } else { extractedValues = new int[numValues]; for ( int valueNo = 0; valueNo < numValues; valueNo++ ) { extractedValues[valueNo] = offsets.get(valueNo).intValue(); } } offsets.clear(); offsetsStorage.add(offsets); return extractedValues; }
java
private static int[] releaseOffsets(List<List<Integer>> offsetsStorage, List<Integer> offsets) { int numValues = offsets.size(); int[] extractedValues; if ( numValues == 0 ) { extractedValues = EMPTY_OFFSETS_ARRAY; } else { extractedValues = new int[numValues]; for ( int valueNo = 0; valueNo < numValues; valueNo++ ) { extractedValues[valueNo] = offsets.get(valueNo).intValue(); } } offsets.clear(); offsetsStorage.add(offsets); return extractedValues; }
[ "private", "static", "int", "[", "]", "releaseOffsets", "(", "List", "<", "List", "<", "Integer", ">", ">", "offsetsStorage", ",", "List", "<", "Integer", ">", "offsets", ")", "{", "int", "numValues", "=", "offsets", ".", "size", "(", ")", ";", "int", "[", "]", "extractedValues", ";", "if", "(", "numValues", "==", "0", ")", "{", "extractedValues", "=", "EMPTY_OFFSETS_ARRAY", ";", "}", "else", "{", "extractedValues", "=", "new", "int", "[", "numValues", "]", ";", "for", "(", "int", "valueNo", "=", "0", ";", "valueNo", "<", "numValues", ";", "valueNo", "++", ")", "{", "extractedValues", "[", "valueNo", "]", "=", "offsets", ".", "get", "(", "valueNo", ")", ".", "intValue", "(", ")", ";", "}", "}", "offsets", ".", "clear", "(", ")", ";", "offsetsStorage", ".", "add", "(", "offsets", ")", ";", "return", "extractedValues", ";", "}" ]
Release an offsets list to storage. Answer the offsets list converted to a raw array of integers. @param offsetsStorage Storage into which to place the offset list. @param offsets The offset list which is to be released to storage. @return The offset list converted to a raw list of integers.
[ "Release", "an", "offsets", "list", "to", "storage", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.artifact.zip/src/com/ibm/ws/artifact/zip/internal/ZipFileContainerUtils.java#L244-L262
train
OpenLiberty/open-liberty
dev/com.ibm.ws.artifact.zip/src/com/ibm/ws/artifact/zip/internal/ZipFileContainerUtils.java
ZipFileContainerUtils.collectIteratorData
@Trivial public static Map<String, IteratorData> collectIteratorData(ZipEntryData[] zipEntryData) { Map<String, IteratorData> allNestingData = new HashMap<String, IteratorData>(); // Re-use offset lists. There can be a lot of these // created for a busy tree. Offset lists are only needed // for entries from the current entry back to the root. List<List<Integer>> offsetsStorage = new ArrayList<List<Integer>>(32); String r_lastPath = ""; // Root int r_lastPathLen = 0; List<Integer> offsets = EMPTY_OFFSETS; int nestingDepth = 0; List<String> r_pathStack = new ArrayList<String>(32); List<List<Integer>> offsetsStack = new ArrayList<List<Integer>>(32); for ( int nextOffset = 0; nextOffset < zipEntryData.length; nextOffset++ ) { String r_nextPath = zipEntryData[nextOffset].r_getPath(); int r_nextPathLen = r_nextPath.length(); // The next path may be on a different branch. // // Backup until a common branch is located, emitting nesting data // for each branch we cross. while ( !isChildOf(r_nextPath, r_nextPathLen, r_lastPath, r_lastPathLen) ) { if ( offsets != EMPTY_OFFSETS ) { allNestingData.put( r_lastPath, new IteratorData( r_lastPath, releaseOffsets(offsetsStorage, offsets) ) ); } nestingDepth--; r_lastPath = r_pathStack.remove(nestingDepth); r_lastPathLen = r_lastPath.length(); offsets = offsetsStack.remove(nestingDepth); } // The entry is now guaranteed to be on the // same branch as the last entry. // // But, the entry be more than one nesting level // deeper than the last entry. // // Create and add new offset collections for each // new nesting level. There may be additional // entries for the new nesting levels besides the // entry. Integer nextOffsetObj = Integer.valueOf(nextOffset); int lastSlashLoc = r_lastPathLen + 1; while ( lastSlashLoc != -1 ) { int nextSlashLoc = r_nextPath.indexOf('/', lastSlashLoc); String r_nextPartialPath; int r_nextPartialPathLen; if ( nextSlashLoc == -1 ) { r_nextPartialPath = r_nextPath; r_nextPartialPathLen = r_nextPathLen; lastSlashLoc = nextSlashLoc; } else { r_nextPartialPath = r_nextPath.substring(0, nextSlashLoc); r_nextPartialPathLen = nextSlashLoc; lastSlashLoc = nextSlashLoc + 1; } if ( offsets == EMPTY_OFFSETS ) { offsets = allocateOffsets(offsetsStorage); } offsets.add(nextOffsetObj); nestingDepth++; r_pathStack.add(r_lastPath); offsetsStack.add(offsets); r_lastPath = r_nextPartialPath; r_lastPathLen = r_nextPartialPathLen; offsets = EMPTY_OFFSETS; } } // Usually, we are left some nestings beneath the root. // // Finish off each of those nestings. while ( nestingDepth > 0 ) { if ( offsets != EMPTY_OFFSETS ) { allNestingData.put( r_lastPath, new IteratorData( r_lastPath, releaseOffsets(offsetsStorage, offsets) ) ); } nestingDepth--; r_lastPath = r_pathStack.remove(nestingDepth); offsets = offsetsStack.remove(nestingDepth); } // If root data remains, finish that off too. if ( offsets != EMPTY_OFFSETS ) { allNestingData.put( r_lastPath, new IteratorData( r_lastPath, releaseOffsets(offsetsStorage, offsets) ) ); } return allNestingData; }
java
@Trivial public static Map<String, IteratorData> collectIteratorData(ZipEntryData[] zipEntryData) { Map<String, IteratorData> allNestingData = new HashMap<String, IteratorData>(); // Re-use offset lists. There can be a lot of these // created for a busy tree. Offset lists are only needed // for entries from the current entry back to the root. List<List<Integer>> offsetsStorage = new ArrayList<List<Integer>>(32); String r_lastPath = ""; // Root int r_lastPathLen = 0; List<Integer> offsets = EMPTY_OFFSETS; int nestingDepth = 0; List<String> r_pathStack = new ArrayList<String>(32); List<List<Integer>> offsetsStack = new ArrayList<List<Integer>>(32); for ( int nextOffset = 0; nextOffset < zipEntryData.length; nextOffset++ ) { String r_nextPath = zipEntryData[nextOffset].r_getPath(); int r_nextPathLen = r_nextPath.length(); // The next path may be on a different branch. // // Backup until a common branch is located, emitting nesting data // for each branch we cross. while ( !isChildOf(r_nextPath, r_nextPathLen, r_lastPath, r_lastPathLen) ) { if ( offsets != EMPTY_OFFSETS ) { allNestingData.put( r_lastPath, new IteratorData( r_lastPath, releaseOffsets(offsetsStorage, offsets) ) ); } nestingDepth--; r_lastPath = r_pathStack.remove(nestingDepth); r_lastPathLen = r_lastPath.length(); offsets = offsetsStack.remove(nestingDepth); } // The entry is now guaranteed to be on the // same branch as the last entry. // // But, the entry be more than one nesting level // deeper than the last entry. // // Create and add new offset collections for each // new nesting level. There may be additional // entries for the new nesting levels besides the // entry. Integer nextOffsetObj = Integer.valueOf(nextOffset); int lastSlashLoc = r_lastPathLen + 1; while ( lastSlashLoc != -1 ) { int nextSlashLoc = r_nextPath.indexOf('/', lastSlashLoc); String r_nextPartialPath; int r_nextPartialPathLen; if ( nextSlashLoc == -1 ) { r_nextPartialPath = r_nextPath; r_nextPartialPathLen = r_nextPathLen; lastSlashLoc = nextSlashLoc; } else { r_nextPartialPath = r_nextPath.substring(0, nextSlashLoc); r_nextPartialPathLen = nextSlashLoc; lastSlashLoc = nextSlashLoc + 1; } if ( offsets == EMPTY_OFFSETS ) { offsets = allocateOffsets(offsetsStorage); } offsets.add(nextOffsetObj); nestingDepth++; r_pathStack.add(r_lastPath); offsetsStack.add(offsets); r_lastPath = r_nextPartialPath; r_lastPathLen = r_nextPartialPathLen; offsets = EMPTY_OFFSETS; } } // Usually, we are left some nestings beneath the root. // // Finish off each of those nestings. while ( nestingDepth > 0 ) { if ( offsets != EMPTY_OFFSETS ) { allNestingData.put( r_lastPath, new IteratorData( r_lastPath, releaseOffsets(offsetsStorage, offsets) ) ); } nestingDepth--; r_lastPath = r_pathStack.remove(nestingDepth); offsets = offsetsStack.remove(nestingDepth); } // If root data remains, finish that off too. if ( offsets != EMPTY_OFFSETS ) { allNestingData.put( r_lastPath, new IteratorData( r_lastPath, releaseOffsets(offsetsStorage, offsets) ) ); } return allNestingData; }
[ "@", "Trivial", "public", "static", "Map", "<", "String", ",", "IteratorData", ">", "collectIteratorData", "(", "ZipEntryData", "[", "]", "zipEntryData", ")", "{", "Map", "<", "String", ",", "IteratorData", ">", "allNestingData", "=", "new", "HashMap", "<", "String", ",", "IteratorData", ">", "(", ")", ";", "// Re-use offset lists. There can be a lot of these", "// created for a busy tree. Offset lists are only needed", "// for entries from the current entry back to the root.", "List", "<", "List", "<", "Integer", ">", ">", "offsetsStorage", "=", "new", "ArrayList", "<", "List", "<", "Integer", ">", ">", "(", "32", ")", ";", "String", "r_lastPath", "=", "\"\"", ";", "// Root", "int", "r_lastPathLen", "=", "0", ";", "List", "<", "Integer", ">", "offsets", "=", "EMPTY_OFFSETS", ";", "int", "nestingDepth", "=", "0", ";", "List", "<", "String", ">", "r_pathStack", "=", "new", "ArrayList", "<", "String", ">", "(", "32", ")", ";", "List", "<", "List", "<", "Integer", ">", ">", "offsetsStack", "=", "new", "ArrayList", "<", "List", "<", "Integer", ">", ">", "(", "32", ")", ";", "for", "(", "int", "nextOffset", "=", "0", ";", "nextOffset", "<", "zipEntryData", ".", "length", ";", "nextOffset", "++", ")", "{", "String", "r_nextPath", "=", "zipEntryData", "[", "nextOffset", "]", ".", "r_getPath", "(", ")", ";", "int", "r_nextPathLen", "=", "r_nextPath", ".", "length", "(", ")", ";", "// The next path may be on a different branch.", "//", "// Backup until a common branch is located, emitting nesting data", "// for each branch we cross.", "while", "(", "!", "isChildOf", "(", "r_nextPath", ",", "r_nextPathLen", ",", "r_lastPath", ",", "r_lastPathLen", ")", ")", "{", "if", "(", "offsets", "!=", "EMPTY_OFFSETS", ")", "{", "allNestingData", ".", "put", "(", "r_lastPath", ",", "new", "IteratorData", "(", "r_lastPath", ",", "releaseOffsets", "(", "offsetsStorage", ",", "offsets", ")", ")", ")", ";", "}", "nestingDepth", "--", ";", "r_lastPath", "=", "r_pathStack", ".", "remove", "(", "nestingDepth", ")", ";", "r_lastPathLen", "=", "r_lastPath", ".", "length", "(", ")", ";", "offsets", "=", "offsetsStack", ".", "remove", "(", "nestingDepth", ")", ";", "}", "// The entry is now guaranteed to be on the", "// same branch as the last entry.", "//", "// But, the entry be more than one nesting level", "// deeper than the last entry.", "//", "// Create and add new offset collections for each", "// new nesting level. There may be additional", "// entries for the new nesting levels besides the", "// entry.", "Integer", "nextOffsetObj", "=", "Integer", ".", "valueOf", "(", "nextOffset", ")", ";", "int", "lastSlashLoc", "=", "r_lastPathLen", "+", "1", ";", "while", "(", "lastSlashLoc", "!=", "-", "1", ")", "{", "int", "nextSlashLoc", "=", "r_nextPath", ".", "indexOf", "(", "'", "'", ",", "lastSlashLoc", ")", ";", "String", "r_nextPartialPath", ";", "int", "r_nextPartialPathLen", ";", "if", "(", "nextSlashLoc", "==", "-", "1", ")", "{", "r_nextPartialPath", "=", "r_nextPath", ";", "r_nextPartialPathLen", "=", "r_nextPathLen", ";", "lastSlashLoc", "=", "nextSlashLoc", ";", "}", "else", "{", "r_nextPartialPath", "=", "r_nextPath", ".", "substring", "(", "0", ",", "nextSlashLoc", ")", ";", "r_nextPartialPathLen", "=", "nextSlashLoc", ";", "lastSlashLoc", "=", "nextSlashLoc", "+", "1", ";", "}", "if", "(", "offsets", "==", "EMPTY_OFFSETS", ")", "{", "offsets", "=", "allocateOffsets", "(", "offsetsStorage", ")", ";", "}", "offsets", ".", "add", "(", "nextOffsetObj", ")", ";", "nestingDepth", "++", ";", "r_pathStack", ".", "add", "(", "r_lastPath", ")", ";", "offsetsStack", ".", "add", "(", "offsets", ")", ";", "r_lastPath", "=", "r_nextPartialPath", ";", "r_lastPathLen", "=", "r_nextPartialPathLen", ";", "offsets", "=", "EMPTY_OFFSETS", ";", "}", "}", "// Usually, we are left some nestings beneath the root.", "//", "// Finish off each of those nestings.", "while", "(", "nestingDepth", ">", "0", ")", "{", "if", "(", "offsets", "!=", "EMPTY_OFFSETS", ")", "{", "allNestingData", ".", "put", "(", "r_lastPath", ",", "new", "IteratorData", "(", "r_lastPath", ",", "releaseOffsets", "(", "offsetsStorage", ",", "offsets", ")", ")", ")", ";", "}", "nestingDepth", "--", ";", "r_lastPath", "=", "r_pathStack", ".", "remove", "(", "nestingDepth", ")", ";", "offsets", "=", "offsetsStack", ".", "remove", "(", "nestingDepth", ")", ";", "}", "// If root data remains, finish that off too.", "if", "(", "offsets", "!=", "EMPTY_OFFSETS", ")", "{", "allNestingData", ".", "put", "(", "r_lastPath", ",", "new", "IteratorData", "(", "r_lastPath", ",", "releaseOffsets", "(", "offsetsStorage", ",", "offsets", ")", ")", ")", ";", "}", "return", "allNestingData", ";", "}" ]
Collect the iterator data for a collection of zip entries. Keys of the entries must be paths stripped of leading and trailing slashes. The entries must be in ascending order per {@link PathUtils#PATH_COMPARATOR}. Only place data for paths which have no children. In particular, leaf entries, which should be most of the entries of the enclosing zip file, have no children. See {@link IteratorData} for additional details. @param zipEntryData The data for which to collect iterator data. @return A table of iterator data for the zip entries.
[ "Collect", "the", "iterator", "data", "for", "a", "collection", "of", "zip", "entries", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.artifact.zip/src/com/ibm/ws/artifact/zip/internal/ZipFileContainerUtils.java#L280-L390
train
OpenLiberty/open-liberty
dev/com.ibm.ws.artifact.zip/src/com/ibm/ws/artifact/zip/internal/ZipFileContainerUtils.java
ZipFileContainerUtils.collectZipEntries
@Trivial public static ZipEntryData[] collectZipEntries(ZipFile zipFile) { final List<ZipEntryData> entriesList = new ArrayList<ZipEntryData>(); final Enumeration<? extends ZipEntry> zipEntries = zipFile.entries(); while ( zipEntries.hasMoreElements() ) { entriesList.add( createZipEntryData( zipEntries.nextElement() ) ); } ZipEntryData[] entryData = entriesList.toArray( new ZipEntryData[ entriesList.size() ] ); Arrays.sort(entryData, ZIP_ENTRY_DATA_COMPARATOR); return entryData; }
java
@Trivial public static ZipEntryData[] collectZipEntries(ZipFile zipFile) { final List<ZipEntryData> entriesList = new ArrayList<ZipEntryData>(); final Enumeration<? extends ZipEntry> zipEntries = zipFile.entries(); while ( zipEntries.hasMoreElements() ) { entriesList.add( createZipEntryData( zipEntries.nextElement() ) ); } ZipEntryData[] entryData = entriesList.toArray( new ZipEntryData[ entriesList.size() ] ); Arrays.sort(entryData, ZIP_ENTRY_DATA_COMPARATOR); return entryData; }
[ "@", "Trivial", "public", "static", "ZipEntryData", "[", "]", "collectZipEntries", "(", "ZipFile", "zipFile", ")", "{", "final", "List", "<", "ZipEntryData", ">", "entriesList", "=", "new", "ArrayList", "<", "ZipEntryData", ">", "(", ")", ";", "final", "Enumeration", "<", "?", "extends", "ZipEntry", ">", "zipEntries", "=", "zipFile", ".", "entries", "(", ")", ";", "while", "(", "zipEntries", ".", "hasMoreElements", "(", ")", ")", "{", "entriesList", ".", "add", "(", "createZipEntryData", "(", "zipEntries", ".", "nextElement", "(", ")", ")", ")", ";", "}", "ZipEntryData", "[", "]", "entryData", "=", "entriesList", ".", "toArray", "(", "new", "ZipEntryData", "[", "entriesList", ".", "size", "(", ")", "]", ")", ";", "Arrays", ".", "sort", "(", "entryData", ",", "ZIP_ENTRY_DATA_COMPARATOR", ")", ";", "return", "entryData", ";", "}" ]
Collect data for the entries of a zip file. Intermediate / implied paths are not added to the result. Answer the zip entries sorted using the path comparator. See {@link PathUtils#PATH_COMPARATOR}. @param zipFile The zip file for which to collect entry data. @return Sorted data for entries of the zip file.
[ "Collect", "data", "for", "the", "entries", "of", "a", "zip", "file", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.artifact.zip/src/com/ibm/ws/artifact/zip/internal/ZipFileContainerUtils.java#L558-L572
train
OpenLiberty/open-liberty
dev/com.ibm.ws.artifact.zip/src/com/ibm/ws/artifact/zip/internal/ZipFileContainerUtils.java
ZipFileContainerUtils.setLocations
@Trivial public static Map<String, ZipEntryData> setLocations(ZipEntryData[] entryData) { Map<String, ZipEntryData> entryDataMap = new HashMap<String, ZipEntryData>(entryData.length); for ( int entryNo = 0; entryNo < entryData.length; entryNo++ ) { ZipEntryData entry = entryData[entryNo]; entry.setOffset(entryNo); entryDataMap.put(entry.r_path, entry); } return entryDataMap; }
java
@Trivial public static Map<String, ZipEntryData> setLocations(ZipEntryData[] entryData) { Map<String, ZipEntryData> entryDataMap = new HashMap<String, ZipEntryData>(entryData.length); for ( int entryNo = 0; entryNo < entryData.length; entryNo++ ) { ZipEntryData entry = entryData[entryNo]; entry.setOffset(entryNo); entryDataMap.put(entry.r_path, entry); } return entryDataMap; }
[ "@", "Trivial", "public", "static", "Map", "<", "String", ",", "ZipEntryData", ">", "setLocations", "(", "ZipEntryData", "[", "]", "entryData", ")", "{", "Map", "<", "String", ",", "ZipEntryData", ">", "entryDataMap", "=", "new", "HashMap", "<", "String", ",", "ZipEntryData", ">", "(", "entryData", ".", "length", ")", ";", "for", "(", "int", "entryNo", "=", "0", ";", "entryNo", "<", "entryData", ".", "length", ";", "entryNo", "++", ")", "{", "ZipEntryData", "entry", "=", "entryData", "[", "entryNo", "]", ";", "entry", ".", "setOffset", "(", "entryNo", ")", ";", "entryDataMap", ".", "put", "(", "entry", ".", "r_path", ",", "entry", ")", ";", "}", "return", "entryDataMap", ";", "}" ]
Create a table of entry data using the relative paths of the entries as keys. As a side effect, set the offset of each entry data to its location int he entry data array. @param entryData The array of entry data to place in a table. @return The table of entry data.
[ "Create", "a", "table", "of", "entry", "data", "using", "the", "relative", "paths", "of", "the", "entries", "as", "keys", ".", "As", "a", "side", "effect", "set", "the", "offset", "of", "each", "entry", "data", "to", "its", "location", "int", "he", "entry", "data", "array", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.artifact.zip/src/com/ibm/ws/artifact/zip/internal/ZipFileContainerUtils.java#L583-L594
train
OpenLiberty/open-liberty
dev/com.ibm.ws.artifact.zip/src/com/ibm/ws/artifact/zip/internal/ZipFileContainerUtils.java
ZipFileContainerUtils.locatePath
@Trivial public static int locatePath(ZipEntryData[] entryData, final String r_path) { ZipEntryData targetData = new SearchZipEntryData(r_path); // Given: // // 0 gp // 1 gp/p1 // 2 gp/p1/c1 // 3 gp/p2/c2 // // A search for "a" answers "-1" (inexact; insertion point is 0) // A search for "gp" answers "0" (exact) // A search for "gp/p1/c1" answers "2" (exact) // A search for "gp/p1/c0" answers "-3" (inexact; insertion point is 2) // A search for "z" answers "-5" (inexact; insertion point is 4) return Arrays.binarySearch( entryData, targetData, ZipFileContainerUtils.ZIP_ENTRY_DATA_COMPARATOR); }
java
@Trivial public static int locatePath(ZipEntryData[] entryData, final String r_path) { ZipEntryData targetData = new SearchZipEntryData(r_path); // Given: // // 0 gp // 1 gp/p1 // 2 gp/p1/c1 // 3 gp/p2/c2 // // A search for "a" answers "-1" (inexact; insertion point is 0) // A search for "gp" answers "0" (exact) // A search for "gp/p1/c1" answers "2" (exact) // A search for "gp/p1/c0" answers "-3" (inexact; insertion point is 2) // A search for "z" answers "-5" (inexact; insertion point is 4) return Arrays.binarySearch( entryData, targetData, ZipFileContainerUtils.ZIP_ENTRY_DATA_COMPARATOR); }
[ "@", "Trivial", "public", "static", "int", "locatePath", "(", "ZipEntryData", "[", "]", "entryData", ",", "final", "String", "r_path", ")", "{", "ZipEntryData", "targetData", "=", "new", "SearchZipEntryData", "(", "r_path", ")", ";", "// Given:", "//", "// 0 gp", "// 1 gp/p1", "// 2 gp/p1/c1", "// 3 gp/p2/c2", "//", "// A search for \"a\" answers \"-1\" (inexact; insertion point is 0)", "// A search for \"gp\" answers \"0\" (exact)", "// A search for \"gp/p1/c1\" answers \"2\" (exact)", "// A search for \"gp/p1/c0\" answers \"-3\" (inexact; insertion point is 2)", "// A search for \"z\" answers \"-5\" (inexact; insertion point is 4)", "return", "Arrays", ".", "binarySearch", "(", "entryData", ",", "targetData", ",", "ZipFileContainerUtils", ".", "ZIP_ENTRY_DATA_COMPARATOR", ")", ";", "}" ]
Locate a path in a collection of entries. Answer the offset of the entry which has the specified path. If the path is not found, answer -1 times ( the insertion point of the path minus one ). @param entryData The entries which are to be searched. @param r_path The path to fine in the entries. @return The offset to the path.
[ "Locate", "a", "path", "in", "a", "collection", "of", "entries", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.artifact.zip/src/com/ibm/ws/artifact/zip/internal/ZipFileContainerUtils.java#L608-L629
train
OpenLiberty/open-liberty
dev/com.ibm.ws.artifact.zip/src/com/ibm/ws/artifact/zip/internal/ZipFileContainerUtils.java
ZipFileContainerUtils.stripPath
@Trivial private static String stripPath(String path) { int pathLen = path.length(); if ( pathLen == 0 ) { return path; } else if ( pathLen == 1 ) { if ( path.charAt(0) == '/' ) { return ""; } else { return path; } } else { if ( path.charAt(0) == '/' ) { if ( path.charAt(pathLen - 1) == '/' ) { return path.substring(1, pathLen - 1); } else { return path.substring(1, pathLen); } } else { if ( path.charAt(pathLen - 1) == '/' ) { return path.substring(0, pathLen - 1); } else { return path; } } } }
java
@Trivial private static String stripPath(String path) { int pathLen = path.length(); if ( pathLen == 0 ) { return path; } else if ( pathLen == 1 ) { if ( path.charAt(0) == '/' ) { return ""; } else { return path; } } else { if ( path.charAt(0) == '/' ) { if ( path.charAt(pathLen - 1) == '/' ) { return path.substring(1, pathLen - 1); } else { return path.substring(1, pathLen); } } else { if ( path.charAt(pathLen - 1) == '/' ) { return path.substring(0, pathLen - 1); } else { return path; } } } }
[ "@", "Trivial", "private", "static", "String", "stripPath", "(", "String", "path", ")", "{", "int", "pathLen", "=", "path", ".", "length", "(", ")", ";", "if", "(", "pathLen", "==", "0", ")", "{", "return", "path", ";", "}", "else", "if", "(", "pathLen", "==", "1", ")", "{", "if", "(", "path", ".", "charAt", "(", "0", ")", "==", "'", "'", ")", "{", "return", "\"\"", ";", "}", "else", "{", "return", "path", ";", "}", "}", "else", "{", "if", "(", "path", ".", "charAt", "(", "0", ")", "==", "'", "'", ")", "{", "if", "(", "path", ".", "charAt", "(", "pathLen", "-", "1", ")", "==", "'", "'", ")", "{", "return", "path", ".", "substring", "(", "1", ",", "pathLen", "-", "1", ")", ";", "}", "else", "{", "return", "path", ".", "substring", "(", "1", ",", "pathLen", ")", ";", "}", "}", "else", "{", "if", "(", "path", ".", "charAt", "(", "pathLen", "-", "1", ")", "==", "'", "'", ")", "{", "return", "path", ".", "substring", "(", "0", ",", "pathLen", "-", "1", ")", ";", "}", "else", "{", "return", "path", ";", "}", "}", "}", "}" ]
Paths used in the zip entry table are adjusted to never have a leading slash and to never have a trailing slash. @param path The path which is to be adjusted. @return The path with leading and trailing slashes removed.
[ "Paths", "used", "in", "the", "zip", "entry", "table", "are", "adjusted", "to", "never", "have", "a", "leading", "slash", "and", "to", "never", "have", "a", "trailing", "slash", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.artifact.zip/src/com/ibm/ws/artifact/zip/internal/ZipFileContainerUtils.java#L641-L670
train
OpenLiberty/open-liberty
dev/com.ibm.websphere.rest.handler/src/com/ibm/wsspi/rest/config/ConfigBasedRESTHandler.java
ConfigBasedRESTHandler.getDeepestNestedElementName
private static String getDeepestNestedElementName(String configDisplayId) { int start = configDisplayId.lastIndexOf("]/"); if (start > 1) { int end = configDisplayId.indexOf('[', start += 2); if (end > start) return configDisplayId.substring(start, end); } return null; }
java
private static String getDeepestNestedElementName(String configDisplayId) { int start = configDisplayId.lastIndexOf("]/"); if (start > 1) { int end = configDisplayId.indexOf('[', start += 2); if (end > start) return configDisplayId.substring(start, end); } return null; }
[ "private", "static", "String", "getDeepestNestedElementName", "(", "String", "configDisplayId", ")", "{", "int", "start", "=", "configDisplayId", ".", "lastIndexOf", "(", "\"]/\"", ")", ";", "if", "(", "start", ">", "1", ")", "{", "int", "end", "=", "configDisplayId", ".", "indexOf", "(", "'", "'", ",", "start", "+=", "2", ")", ";", "if", "(", "end", ">", "start", ")", "return", "configDisplayId", ".", "substring", "(", "start", ",", "end", ")", ";", "}", "return", "null", ";", "}" ]
Returns the most deeply nested element name. @param configDisplayId config.displayId @return the most deeply nested element name. Null if there are not any nested elements.
[ "Returns", "the", "most", "deeply", "nested", "element", "name", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.rest.handler/src/com/ibm/wsspi/rest/config/ConfigBasedRESTHandler.java#L86-L94
train
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/persistent/filemgr/FileManagerImpl.java
FileManagerImpl.dump_memory
public void dump_memory(Writer out) throws IOException { int qlist_num; out.write("First quick size: " + first_quick_size + "\n"); out.write("Last quick size: " + last_quick_size + "\n"); out.write("Grain size: " + grain_size + "\n"); out.write("Acceptable waste: " + acceptable_waste + "\n"); out.write("Tail pointer in memory: " + tail_ptr + "\n"); out.write("First allocatable byte: " + start() + "\n\n"); out.write("Free lists from memory structures\n"); for (qlist_num = 0; qlist_num <= last_ql_index; qlist_num++) { out.write(qlist_num + ": "); out.write("Length = " + ql_heads[qlist_num].length + "; "); print_memory_freelist(out, ql_heads[qlist_num].first_block); }; out.write("Nonempty free lists: " + nonempty_lists + "\n"); out.write("Tail pointer in memory: " + tail_ptr + "\n"); out.write("First allocatable byte: " + start() + "\n\n"); }
java
public void dump_memory(Writer out) throws IOException { int qlist_num; out.write("First quick size: " + first_quick_size + "\n"); out.write("Last quick size: " + last_quick_size + "\n"); out.write("Grain size: " + grain_size + "\n"); out.write("Acceptable waste: " + acceptable_waste + "\n"); out.write("Tail pointer in memory: " + tail_ptr + "\n"); out.write("First allocatable byte: " + start() + "\n\n"); out.write("Free lists from memory structures\n"); for (qlist_num = 0; qlist_num <= last_ql_index; qlist_num++) { out.write(qlist_num + ": "); out.write("Length = " + ql_heads[qlist_num].length + "; "); print_memory_freelist(out, ql_heads[qlist_num].first_block); }; out.write("Nonempty free lists: " + nonempty_lists + "\n"); out.write("Tail pointer in memory: " + tail_ptr + "\n"); out.write("First allocatable byte: " + start() + "\n\n"); }
[ "public", "void", "dump_memory", "(", "Writer", "out", ")", "throws", "IOException", "{", "int", "qlist_num", ";", "out", ".", "write", "(", "\"First quick size: \"", "+", "first_quick_size", "+", "\"\\n\"", ")", ";", "out", ".", "write", "(", "\"Last quick size: \"", "+", "last_quick_size", "+", "\"\\n\"", ")", ";", "out", ".", "write", "(", "\"Grain size: \"", "+", "grain_size", "+", "\"\\n\"", ")", ";", "out", ".", "write", "(", "\"Acceptable waste: \"", "+", "acceptable_waste", "+", "\"\\n\"", ")", ";", "out", ".", "write", "(", "\"Tail pointer in memory: \"", "+", "tail_ptr", "+", "\"\\n\"", ")", ";", "out", ".", "write", "(", "\"First allocatable byte: \"", "+", "start", "(", ")", "+", "\"\\n\\n\"", ")", ";", "out", ".", "write", "(", "\"Free lists from memory structures\\n\"", ")", ";", "for", "(", "qlist_num", "=", "0", ";", "qlist_num", "<=", "last_ql_index", ";", "qlist_num", "++", ")", "{", "out", ".", "write", "(", "qlist_num", "+", "\": \"", ")", ";", "out", ".", "write", "(", "\"Length = \"", "+", "ql_heads", "[", "qlist_num", "]", ".", "length", "+", "\"; \"", ")", ";", "print_memory_freelist", "(", "out", ",", "ql_heads", "[", "qlist_num", "]", ".", "first_block", ")", ";", "}", ";", "out", ".", "write", "(", "\"Nonempty free lists: \"", "+", "nonempty_lists", "+", "\"\\n\"", ")", ";", "out", ".", "write", "(", "\"Tail pointer in memory: \"", "+", "tail_ptr", "+", "\"\\n\"", ")", ";", "out", ".", "write", "(", "\"First allocatable byte: \"", "+", "start", "(", ")", "+", "\"\\n\\n\"", ")", ";", "}" ]
Outputs storage information stored in main memory. Debugging interface, writes interesting stuff to stdout.
[ "Outputs", "storage", "information", "stored", "in", "main", "memory", ".", "Debugging", "interface", "writes", "interesting", "stuff", "to", "stdout", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/persistent/filemgr/FileManagerImpl.java#L828-L850
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/richclient/impl/JFapChannelFactory.java
JFapChannelFactory.createChannel
protected Channel createChannel(ChannelData config) throws ChannelException { if (tc.isEntryEnabled()) SibTr.entry(this, tc, "createChannel", config); Channel retChannel; if (config.isInbound()) { if (tc.isDebugEnabled()) SibTr.debug(this, tc, "createChannel", "inbound"); try { Class clazz = Class.forName(JFapChannelConstants.INBOUND_CHANNEL_CLASS); Constructor contruct = clazz.getConstructor(new Class[] { ChannelFactoryData.class, ChannelData.class }); retChannel = (Channel) contruct.newInstance(new Object[] { channelFactoryData, config }); } catch (Exception e) { FFDCFilter.processException(e, "com.ibm.ws.sib.jfapchannel.impl.JFapChannelFactory.createChannel", JFapChannelConstants.JFAPCHANNELFACT_CREATECHANNEL_01, this); if (tc.isDebugEnabled()) SibTr.debug(this, tc, "Unable to instantiate inbound channel", e); // Rethrow as a channel exception throw new ChannelException(e); } } else { retChannel = new JFapChannelOutbound(channelFactoryData, config); } if (tc.isEntryEnabled()) SibTr.exit(this, tc, "createChannel", retChannel); return retChannel; }
java
protected Channel createChannel(ChannelData config) throws ChannelException { if (tc.isEntryEnabled()) SibTr.entry(this, tc, "createChannel", config); Channel retChannel; if (config.isInbound()) { if (tc.isDebugEnabled()) SibTr.debug(this, tc, "createChannel", "inbound"); try { Class clazz = Class.forName(JFapChannelConstants.INBOUND_CHANNEL_CLASS); Constructor contruct = clazz.getConstructor(new Class[] { ChannelFactoryData.class, ChannelData.class }); retChannel = (Channel) contruct.newInstance(new Object[] { channelFactoryData, config }); } catch (Exception e) { FFDCFilter.processException(e, "com.ibm.ws.sib.jfapchannel.impl.JFapChannelFactory.createChannel", JFapChannelConstants.JFAPCHANNELFACT_CREATECHANNEL_01, this); if (tc.isDebugEnabled()) SibTr.debug(this, tc, "Unable to instantiate inbound channel", e); // Rethrow as a channel exception throw new ChannelException(e); } } else { retChannel = new JFapChannelOutbound(channelFactoryData, config); } if (tc.isEntryEnabled()) SibTr.exit(this, tc, "createChannel", retChannel); return retChannel; }
[ "protected", "Channel", "createChannel", "(", "ChannelData", "config", ")", "throws", "ChannelException", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "this", ",", "tc", ",", "\"createChannel\"", ",", "config", ")", ";", "Channel", "retChannel", ";", "if", "(", "config", ".", "isInbound", "(", ")", ")", "{", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "SibTr", ".", "debug", "(", "this", ",", "tc", ",", "\"createChannel\"", ",", "\"inbound\"", ")", ";", "try", "{", "Class", "clazz", "=", "Class", ".", "forName", "(", "JFapChannelConstants", ".", "INBOUND_CHANNEL_CLASS", ")", ";", "Constructor", "contruct", "=", "clazz", ".", "getConstructor", "(", "new", "Class", "[", "]", "{", "ChannelFactoryData", ".", "class", ",", "ChannelData", ".", "class", "}", ")", ";", "retChannel", "=", "(", "Channel", ")", "contruct", ".", "newInstance", "(", "new", "Object", "[", "]", "{", "channelFactoryData", ",", "config", "}", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "FFDCFilter", ".", "processException", "(", "e", ",", "\"com.ibm.ws.sib.jfapchannel.impl.JFapChannelFactory.createChannel\"", ",", "JFapChannelConstants", ".", "JFAPCHANNELFACT_CREATECHANNEL_01", ",", "this", ")", ";", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "SibTr", ".", "debug", "(", "this", ",", "tc", ",", "\"Unable to instantiate inbound channel\"", ",", "e", ")", ";", "// Rethrow as a channel exception", "throw", "new", "ChannelException", "(", "e", ")", ";", "}", "}", "else", "{", "retChannel", "=", "new", "JFapChannelOutbound", "(", "channelFactoryData", ",", "config", ")", ";", "}", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "this", ",", "tc", ",", "\"createChannel\"", ",", "retChannel", ")", ";", "return", "retChannel", ";", "}" ]
Creates a new channel. Uses channel configuration to determine if the channel should be inbound or outbound. @see BaseChannelFactory#createChannel(com.ibm.websphere.channelfw.ChannelData)
[ "Creates", "a", "new", "channel", ".", "Uses", "channel", "configuration", "to", "determine", "if", "the", "channel", "should", "be", "inbound", "or", "outbound", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/richclient/impl/JFapChannelFactory.java#L60-L102
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/richclient/impl/JFapChannelFactory.java
JFapChannelFactory.getDeviceInterface
public Class[] getDeviceInterface() // F177053 { if (tc.isEntryEnabled()) SibTr.entry(this, tc, "getDeviceInterface"); // F177053 // Start D232185 if (devSideInterfaceClasses == null) { devSideInterfaceClasses = new Class[1]; devSideInterfaceClasses[0] = com.ibm.wsspi.tcpchannel.TCPConnectionContext.class; // f167363, F184828, F189000 } // End D232185 if (tc.isEntryEnabled()) SibTr.exit(this, tc, "getDeviceInterface", devSideInterfaceClasses); // F177053 return devSideInterfaceClasses; }
java
public Class[] getDeviceInterface() // F177053 { if (tc.isEntryEnabled()) SibTr.entry(this, tc, "getDeviceInterface"); // F177053 // Start D232185 if (devSideInterfaceClasses == null) { devSideInterfaceClasses = new Class[1]; devSideInterfaceClasses[0] = com.ibm.wsspi.tcpchannel.TCPConnectionContext.class; // f167363, F184828, F189000 } // End D232185 if (tc.isEntryEnabled()) SibTr.exit(this, tc, "getDeviceInterface", devSideInterfaceClasses); // F177053 return devSideInterfaceClasses; }
[ "public", "Class", "[", "]", "getDeviceInterface", "(", ")", "// F177053", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "this", ",", "tc", ",", "\"getDeviceInterface\"", ")", ";", "// F177053", "// Start D232185", "if", "(", "devSideInterfaceClasses", "==", "null", ")", "{", "devSideInterfaceClasses", "=", "new", "Class", "[", "1", "]", ";", "devSideInterfaceClasses", "[", "0", "]", "=", "com", ".", "ibm", ".", "wsspi", ".", "tcpchannel", ".", "TCPConnectionContext", ".", "class", ";", "// f167363, F184828, F189000", "}", "// End D232185", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "this", ",", "tc", ",", "\"getDeviceInterface\"", ",", "devSideInterfaceClasses", ")", ";", "// F177053", "return", "devSideInterfaceClasses", ";", "}" ]
Returns the device side interfaces which our channels can work with. This is always the TCPServiceContext.
[ "Returns", "the", "device", "side", "interfaces", "which", "our", "channels", "can", "work", "with", ".", "This", "is", "always", "the", "TCPServiceContext", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/richclient/impl/JFapChannelFactory.java#L108-L122
train
OpenLiberty/open-liberty
dev/com.ibm.ws.security.wim.core/src/com/ibm/ws/security/wim/RepositoryManager.java
RepositoryManager.addRepository
private void addRepository(String repositoryId, RepositoryWrapper repositoryHolder) { repositories.put(repositoryId, repositoryHolder); try { numRepos = getNumberOfRepositories(); } catch (WIMException e) { // okay } }
java
private void addRepository(String repositoryId, RepositoryWrapper repositoryHolder) { repositories.put(repositoryId, repositoryHolder); try { numRepos = getNumberOfRepositories(); } catch (WIMException e) { // okay } }
[ "private", "void", "addRepository", "(", "String", "repositoryId", ",", "RepositoryWrapper", "repositoryHolder", ")", "{", "repositories", ".", "put", "(", "repositoryId", ",", "repositoryHolder", ")", ";", "try", "{", "numRepos", "=", "getNumberOfRepositories", "(", ")", ";", "}", "catch", "(", "WIMException", "e", ")", "{", "// okay", "}", "}" ]
Pair adding to the repositories map and resetting the numRepos int. @param repositoryId @param repositoryHolder
[ "Pair", "adding", "to", "the", "repositories", "map", "and", "resetting", "the", "numRepos", "int", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.core/src/com/ibm/ws/security/wim/RepositoryManager.java#L77-L84
train
OpenLiberty/open-liberty
dev/com.ibm.ws.security.wim.core/src/com/ibm/ws/security/wim/RepositoryManager.java
RepositoryManager.getRepositoryIdByUniqueName
protected String getRepositoryIdByUniqueName(String uniqueName) throws WIMException { boolean isDn = UniqueNameHelper.isDN(uniqueName) != null; if (isDn) uniqueName = UniqueNameHelper.getValidUniqueName(uniqueName).trim(); String repo = null; int repoMatch = -1; int bestMatch = -1; for (Map.Entry<String, RepositoryWrapper> entry : repositories.entrySet()) { repoMatch = entry.getValue().isUniqueNameForRepository(uniqueName, isDn); if (repoMatch == Integer.MAX_VALUE) { return entry.getKey(); } else if (repoMatch > bestMatch) { repo = entry.getKey(); bestMatch = repoMatch; } } if (repo != null) { return repo; } AuditManager auditManager = new AuditManager(); Audit.audit(Audit.EventID.SECURITY_MEMBER_MGMT_01, auditManager.getRESTRequest(), auditManager.getRequestType(), auditManager.getRepositoryId(), uniqueName, vmmService.getConfigManager().getDefaultRealmName(), null, Integer.valueOf("204")); throw new InvalidUniqueNameException(WIMMessageKey.ENTITY_NOT_IN_REALM_SCOPE, Tr.formatMessage( tc, WIMMessageKey.ENTITY_NOT_IN_REALM_SCOPE, WIMMessageHelper.generateMsgParms(uniqueName, "defined"))); }
java
protected String getRepositoryIdByUniqueName(String uniqueName) throws WIMException { boolean isDn = UniqueNameHelper.isDN(uniqueName) != null; if (isDn) uniqueName = UniqueNameHelper.getValidUniqueName(uniqueName).trim(); String repo = null; int repoMatch = -1; int bestMatch = -1; for (Map.Entry<String, RepositoryWrapper> entry : repositories.entrySet()) { repoMatch = entry.getValue().isUniqueNameForRepository(uniqueName, isDn); if (repoMatch == Integer.MAX_VALUE) { return entry.getKey(); } else if (repoMatch > bestMatch) { repo = entry.getKey(); bestMatch = repoMatch; } } if (repo != null) { return repo; } AuditManager auditManager = new AuditManager(); Audit.audit(Audit.EventID.SECURITY_MEMBER_MGMT_01, auditManager.getRESTRequest(), auditManager.getRequestType(), auditManager.getRepositoryId(), uniqueName, vmmService.getConfigManager().getDefaultRealmName(), null, Integer.valueOf("204")); throw new InvalidUniqueNameException(WIMMessageKey.ENTITY_NOT_IN_REALM_SCOPE, Tr.formatMessage( tc, WIMMessageKey.ENTITY_NOT_IN_REALM_SCOPE, WIMMessageHelper.generateMsgParms(uniqueName, "defined"))); }
[ "protected", "String", "getRepositoryIdByUniqueName", "(", "String", "uniqueName", ")", "throws", "WIMException", "{", "boolean", "isDn", "=", "UniqueNameHelper", ".", "isDN", "(", "uniqueName", ")", "!=", "null", ";", "if", "(", "isDn", ")", "uniqueName", "=", "UniqueNameHelper", ".", "getValidUniqueName", "(", "uniqueName", ")", ".", "trim", "(", ")", ";", "String", "repo", "=", "null", ";", "int", "repoMatch", "=", "-", "1", ";", "int", "bestMatch", "=", "-", "1", ";", "for", "(", "Map", ".", "Entry", "<", "String", ",", "RepositoryWrapper", ">", "entry", ":", "repositories", ".", "entrySet", "(", ")", ")", "{", "repoMatch", "=", "entry", ".", "getValue", "(", ")", ".", "isUniqueNameForRepository", "(", "uniqueName", ",", "isDn", ")", ";", "if", "(", "repoMatch", "==", "Integer", ".", "MAX_VALUE", ")", "{", "return", "entry", ".", "getKey", "(", ")", ";", "}", "else", "if", "(", "repoMatch", ">", "bestMatch", ")", "{", "repo", "=", "entry", ".", "getKey", "(", ")", ";", "bestMatch", "=", "repoMatch", ";", "}", "}", "if", "(", "repo", "!=", "null", ")", "{", "return", "repo", ";", "}", "AuditManager", "auditManager", "=", "new", "AuditManager", "(", ")", ";", "Audit", ".", "audit", "(", "Audit", ".", "EventID", ".", "SECURITY_MEMBER_MGMT_01", ",", "auditManager", ".", "getRESTRequest", "(", ")", ",", "auditManager", ".", "getRequestType", "(", ")", ",", "auditManager", ".", "getRepositoryId", "(", ")", ",", "uniqueName", ",", "vmmService", ".", "getConfigManager", "(", ")", ".", "getDefaultRealmName", "(", ")", ",", "null", ",", "Integer", ".", "valueOf", "(", "\"204\"", ")", ")", ";", "throw", "new", "InvalidUniqueNameException", "(", "WIMMessageKey", ".", "ENTITY_NOT_IN_REALM_SCOPE", ",", "Tr", ".", "formatMessage", "(", "tc", ",", "WIMMessageKey", ".", "ENTITY_NOT_IN_REALM_SCOPE", ",", "WIMMessageHelper", ".", "generateMsgParms", "(", "uniqueName", ",", "\"defined\"", ")", ")", ")", ";", "}" ]
Returns the id of the repository to which the uniqueName belongs to. @throws InvalidUniqueNameException
[ "Returns", "the", "id", "of", "the", "repository", "to", "which", "the", "uniqueName", "belongs", "to", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.core/src/com/ibm/ws/security/wim/RepositoryManager.java#L137-L167
train
OpenLiberty/open-liberty
dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/FileFailureScope.java
FileFailureScope.isSameExecutionZone
@Override public boolean isSameExecutionZone(FailureScope anotherScope) { if (tc.isEntryEnabled()) Tr.entry(tc, "isSameExecutionZone", anotherScope); boolean isSameZone = equals(anotherScope); if (tc.isEntryEnabled()) Tr.exit(tc, "isSameExecutionZone", new Boolean(isSameZone)); return isSameZone; }
java
@Override public boolean isSameExecutionZone(FailureScope anotherScope) { if (tc.isEntryEnabled()) Tr.entry(tc, "isSameExecutionZone", anotherScope); boolean isSameZone = equals(anotherScope); if (tc.isEntryEnabled()) Tr.exit(tc, "isSameExecutionZone", new Boolean(isSameZone)); return isSameZone; }
[ "@", "Override", "public", "boolean", "isSameExecutionZone", "(", "FailureScope", "anotherScope", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "tc", ",", "\"isSameExecutionZone\"", ",", "anotherScope", ")", ";", "boolean", "isSameZone", "=", "equals", "(", "anotherScope", ")", ";", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"isSameExecutionZone\"", ",", "new", "Boolean", "(", "isSameZone", ")", ")", ";", "return", "isSameZone", ";", "}" ]
Returns true if this failure scope represents the same general recovery scope as the input parameter. For instance, if more than one FailureScope was created which referenced the same server, they would be in the same execution zone. @param anotherScope Failure scope to test @return boolean Flag indicating if the target failure scope represents the same logical failure scope as the specified failure scope.
[ "Returns", "true", "if", "this", "failure", "scope", "represents", "the", "same", "general", "recovery", "scope", "as", "the", "input", "parameter", ".", "For", "instance", "if", "more", "than", "one", "FailureScope", "was", "created", "which", "referenced", "the", "same", "server", "they", "would", "be", "in", "the", "same", "execution", "zone", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/FileFailureScope.java#L257-L269
train
OpenLiberty/open-liberty
dev/com.ibm.ws.security.common/src/com/ibm/ws/security/common/web/WebUtils.java
WebUtils.encodeCookie
public static String encodeCookie(String string) { if (string == null) { return null; } string = string.replaceAll("%", "%25"); string = string.replaceAll(";", "%3B"); string = string.replaceAll(",", "%2C"); return string; }
java
public static String encodeCookie(String string) { if (string == null) { return null; } string = string.replaceAll("%", "%25"); string = string.replaceAll(";", "%3B"); string = string.replaceAll(",", "%2C"); return string; }
[ "public", "static", "String", "encodeCookie", "(", "String", "string", ")", "{", "if", "(", "string", "==", "null", ")", "{", "return", "null", ";", "}", "string", "=", "string", ".", "replaceAll", "(", "\"%\"", ",", "\"%25\"", ")", ";", "string", "=", "string", ".", "replaceAll", "(", "\";\"", ",", "\"%3B\"", ")", ";", "string", "=", "string", ".", "replaceAll", "(", "\",\"", ",", "\"%2C\"", ")", ";", "return", "string", ";", "}" ]
Encodes the given string so that it can be used as an HTTP cookie value. @param string the string to convert
[ "Encodes", "the", "given", "string", "so", "that", "it", "can", "be", "used", "as", "an", "HTTP", "cookie", "value", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.common/src/com/ibm/ws/security/common/web/WebUtils.java#L98-L106
train
OpenLiberty/open-liberty
dev/com.ibm.ws.security.common/src/com/ibm/ws/security/common/web/WebUtils.java
WebUtils.decodeCookie
public static String decodeCookie(String string) { if (string == null) { return null; } string = string.replaceAll("%2C", ","); string = string.replaceAll("%3B", ";"); string = string.replaceAll("%25", "%"); return string; }
java
public static String decodeCookie(String string) { if (string == null) { return null; } string = string.replaceAll("%2C", ","); string = string.replaceAll("%3B", ";"); string = string.replaceAll("%25", "%"); return string; }
[ "public", "static", "String", "decodeCookie", "(", "String", "string", ")", "{", "if", "(", "string", "==", "null", ")", "{", "return", "null", ";", "}", "string", "=", "string", ".", "replaceAll", "(", "\"%2C\"", ",", "\",\"", ")", ";", "string", "=", "string", ".", "replaceAll", "(", "\"%3B\"", ",", "\";\"", ")", ";", "string", "=", "string", ".", "replaceAll", "(", "\"%25\"", ",", "\"%\"", ")", ";", "return", "string", ";", "}" ]
Decodes the given string from percent encoding. @param string the string to convert
[ "Decodes", "the", "given", "string", "from", "percent", "encoding", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.common/src/com/ibm/ws/security/common/web/WebUtils.java#L114-L122
train
OpenLiberty/open-liberty
dev/com.ibm.ws.security.common/src/com/ibm/ws/security/common/web/WebUtils.java
WebUtils.getRequestStringForTrace
@Trivial public static String getRequestStringForTrace(HttpServletRequest request, String[] secretStrings) { if (request == null || request.getRequestURL() == null) { return "[]"; } StringBuffer sb = new StringBuffer("[" + stripSecretsFromUrl(request.getRequestURL().toString(), secretStrings) + "]"); String query = request.getQueryString(); if (query != null) { String queryString = stripSecretsFromUrl(query, secretStrings); if (queryString != null) { sb.append(", queryString[" + queryString + "]"); } } else { Map<String, String[]> pMap = request.getParameterMap(); String paramString = stripSecretsFromParameters(pMap, secretStrings); if (paramString != null) { sb.append(", parameters[" + paramString + "]"); } } return sb.toString(); }
java
@Trivial public static String getRequestStringForTrace(HttpServletRequest request, String[] secretStrings) { if (request == null || request.getRequestURL() == null) { return "[]"; } StringBuffer sb = new StringBuffer("[" + stripSecretsFromUrl(request.getRequestURL().toString(), secretStrings) + "]"); String query = request.getQueryString(); if (query != null) { String queryString = stripSecretsFromUrl(query, secretStrings); if (queryString != null) { sb.append(", queryString[" + queryString + "]"); } } else { Map<String, String[]> pMap = request.getParameterMap(); String paramString = stripSecretsFromParameters(pMap, secretStrings); if (paramString != null) { sb.append(", parameters[" + paramString + "]"); } } return sb.toString(); }
[ "@", "Trivial", "public", "static", "String", "getRequestStringForTrace", "(", "HttpServletRequest", "request", ",", "String", "[", "]", "secretStrings", ")", "{", "if", "(", "request", "==", "null", "||", "request", ".", "getRequestURL", "(", ")", "==", "null", ")", "{", "return", "\"[]\"", ";", "}", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", "\"[\"", "+", "stripSecretsFromUrl", "(", "request", ".", "getRequestURL", "(", ")", ".", "toString", "(", ")", ",", "secretStrings", ")", "+", "\"]\"", ")", ";", "String", "query", "=", "request", ".", "getQueryString", "(", ")", ";", "if", "(", "query", "!=", "null", ")", "{", "String", "queryString", "=", "stripSecretsFromUrl", "(", "query", ",", "secretStrings", ")", ";", "if", "(", "queryString", "!=", "null", ")", "{", "sb", ".", "append", "(", "\", queryString[\"", "+", "queryString", "+", "\"]\"", ")", ";", "}", "}", "else", "{", "Map", "<", "String", ",", "String", "[", "]", ">", "pMap", "=", "request", ".", "getParameterMap", "(", ")", ";", "String", "paramString", "=", "stripSecretsFromParameters", "(", "pMap", ",", "secretStrings", ")", ";", "if", "(", "paramString", "!=", "null", ")", "{", "sb", ".", "append", "(", "\", parameters[\"", "+", "paramString", "+", "\"]\"", ")", ";", "}", "}", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
information and returns a string for tracing
[ "information", "and", "returns", "a", "string", "for", "tracing" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.common/src/com/ibm/ws/security/common/web/WebUtils.java#L431-L453
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DynamicConfigManager.java
DynamicConfigManager.deleteAbstractAliasDestinationHandler
public void deleteAbstractAliasDestinationHandler(AbstractAliasDestinationHandler abstractAliasDestinationHandler) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "deleteAbstractAliasDestinationHandler"); //The destination is an alias or a foreign destination, so its not persisted //It is removed immediately from the appropriate index if(abstractAliasDestinationHandler instanceof BusHandler) { _foreignBusIndex.remove(abstractAliasDestinationHandler); } else { _destinationIndex.remove(abstractAliasDestinationHandler); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "deleteAbstractAliasDestinationHandler"); }
java
public void deleteAbstractAliasDestinationHandler(AbstractAliasDestinationHandler abstractAliasDestinationHandler) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "deleteAbstractAliasDestinationHandler"); //The destination is an alias or a foreign destination, so its not persisted //It is removed immediately from the appropriate index if(abstractAliasDestinationHandler instanceof BusHandler) { _foreignBusIndex.remove(abstractAliasDestinationHandler); } else { _destinationIndex.remove(abstractAliasDestinationHandler); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "deleteAbstractAliasDestinationHandler"); }
[ "public", "void", "deleteAbstractAliasDestinationHandler", "(", "AbstractAliasDestinationHandler", "abstractAliasDestinationHandler", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"deleteAbstractAliasDestinationHandler\"", ")", ";", "//The destination is an alias or a foreign destination, so its not persisted", "//It is removed immediately from the appropriate index", "if", "(", "abstractAliasDestinationHandler", "instanceof", "BusHandler", ")", "{", "_foreignBusIndex", ".", "remove", "(", "abstractAliasDestinationHandler", ")", ";", "}", "else", "{", "_destinationIndex", ".", "remove", "(", "abstractAliasDestinationHandler", ")", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"deleteAbstractAliasDestinationHandler\"", ")", ";", "}" ]
Delete the abstract alias destination handler @param abstractAliasDestinationHandler
[ "Delete", "the", "abstract", "alias", "destination", "handler" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DynamicConfigManager.java#L455-L473
train
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/HTODDependencyTable.java
HTODDependencyTable.add
public int add(Object dependency, ValueSet valueSet, Object entry) { int returnCode = HTODDynacache.NO_EXCEPTION; dependencyNotUpdatedTable.remove(dependency); valueSet.add(entry); if (valueSet.size() > this.delayOffloadEntriesLimit) { if (this.type == DEP_ID_TABLE) { returnCode = this.htod.writeValueSet(HTODDynacache.DEP_ID_DATA, dependency, valueSet, HTODDynacache.ALL); // valueSet may be empty after writeValueSet this.htod.cache.getCacheStatisticsListener().depIdsOffloadedToDisk(dependency); if (tc.isDebugEnabled()) Tr.debug(tc, "***** add dependency id=" + dependency + " size=" + valueSet.size()); } else { returnCode = this.htod.writeValueSet(HTODDynacache.TEMPLATE_ID_DATA, dependency, valueSet, HTODDynacache.ALL); // valueSet may be empty after writeValueSet this.htod.cache.getCacheStatisticsListener().templatesOffloadedToDisk(dependency); if (tc.isDebugEnabled()) Tr.debug(tc, "***** add dependency id=" + dependency + " size=" + valueSet.size()); } dependencyToEntryTable.remove(dependency); if (returnCode == HTODDynacache.DISK_SIZE_OVER_LIMIT_EXCEPTION && valueSet.size() > 0) { this.htod.delCacheEntry(valueSet, CachePerf.DISK_OVERFLOW, CachePerf.LOCAL, !Cache.FROM_DEPID_TEMPLATE_INVALIDATION, HTODInvalidationBuffer.FIRE_EVENT); returnCode = HTODDynacache.NO_EXCEPTION; } } return returnCode; }
java
public int add(Object dependency, ValueSet valueSet, Object entry) { int returnCode = HTODDynacache.NO_EXCEPTION; dependencyNotUpdatedTable.remove(dependency); valueSet.add(entry); if (valueSet.size() > this.delayOffloadEntriesLimit) { if (this.type == DEP_ID_TABLE) { returnCode = this.htod.writeValueSet(HTODDynacache.DEP_ID_DATA, dependency, valueSet, HTODDynacache.ALL); // valueSet may be empty after writeValueSet this.htod.cache.getCacheStatisticsListener().depIdsOffloadedToDisk(dependency); if (tc.isDebugEnabled()) Tr.debug(tc, "***** add dependency id=" + dependency + " size=" + valueSet.size()); } else { returnCode = this.htod.writeValueSet(HTODDynacache.TEMPLATE_ID_DATA, dependency, valueSet, HTODDynacache.ALL); // valueSet may be empty after writeValueSet this.htod.cache.getCacheStatisticsListener().templatesOffloadedToDisk(dependency); if (tc.isDebugEnabled()) Tr.debug(tc, "***** add dependency id=" + dependency + " size=" + valueSet.size()); } dependencyToEntryTable.remove(dependency); if (returnCode == HTODDynacache.DISK_SIZE_OVER_LIMIT_EXCEPTION && valueSet.size() > 0) { this.htod.delCacheEntry(valueSet, CachePerf.DISK_OVERFLOW, CachePerf.LOCAL, !Cache.FROM_DEPID_TEMPLATE_INVALIDATION, HTODInvalidationBuffer.FIRE_EVENT); returnCode = HTODDynacache.NO_EXCEPTION; } } return returnCode; }
[ "public", "int", "add", "(", "Object", "dependency", ",", "ValueSet", "valueSet", ",", "Object", "entry", ")", "{", "int", "returnCode", "=", "HTODDynacache", ".", "NO_EXCEPTION", ";", "dependencyNotUpdatedTable", ".", "remove", "(", "dependency", ")", ";", "valueSet", ".", "add", "(", "entry", ")", ";", "if", "(", "valueSet", ".", "size", "(", ")", ">", "this", ".", "delayOffloadEntriesLimit", ")", "{", "if", "(", "this", ".", "type", "==", "DEP_ID_TABLE", ")", "{", "returnCode", "=", "this", ".", "htod", ".", "writeValueSet", "(", "HTODDynacache", ".", "DEP_ID_DATA", ",", "dependency", ",", "valueSet", ",", "HTODDynacache", ".", "ALL", ")", ";", "// valueSet may be empty after writeValueSet", "this", ".", "htod", ".", "cache", ".", "getCacheStatisticsListener", "(", ")", ".", "depIdsOffloadedToDisk", "(", "dependency", ")", ";", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "tc", ",", "\"***** add dependency id=\"", "+", "dependency", "+", "\" size=\"", "+", "valueSet", ".", "size", "(", ")", ")", ";", "}", "else", "{", "returnCode", "=", "this", ".", "htod", ".", "writeValueSet", "(", "HTODDynacache", ".", "TEMPLATE_ID_DATA", ",", "dependency", ",", "valueSet", ",", "HTODDynacache", ".", "ALL", ")", ";", "// valueSet may be empty after writeValueSet", "this", ".", "htod", ".", "cache", ".", "getCacheStatisticsListener", "(", ")", ".", "templatesOffloadedToDisk", "(", "dependency", ")", ";", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "tc", ",", "\"***** add dependency id=\"", "+", "dependency", "+", "\" size=\"", "+", "valueSet", ".", "size", "(", ")", ")", ";", "}", "dependencyToEntryTable", ".", "remove", "(", "dependency", ")", ";", "if", "(", "returnCode", "==", "HTODDynacache", ".", "DISK_SIZE_OVER_LIMIT_EXCEPTION", "&&", "valueSet", ".", "size", "(", ")", ">", "0", ")", "{", "this", ".", "htod", ".", "delCacheEntry", "(", "valueSet", ",", "CachePerf", ".", "DISK_OVERFLOW", ",", "CachePerf", ".", "LOCAL", ",", "!", "Cache", ".", "FROM_DEPID_TEMPLATE_INVALIDATION", ",", "HTODInvalidationBuffer", ".", "FIRE_EVENT", ")", ";", "returnCode", "=", "HTODDynacache", ".", "NO_EXCEPTION", ";", "}", "}", "return", "returnCode", ";", "}" ]
This adds a entry to the ValueSet for the specified dependency. The dependency is found in the dependencyToEntryTable. @param dependency The dependency. @param valueSet containing all entries for this dependency. @param entry The new entry to add.
[ "This", "adds", "a", "entry", "to", "the", "ValueSet", "for", "the", "specified", "dependency", ".", "The", "dependency", "is", "found", "in", "the", "dependencyToEntryTable", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/HTODDependencyTable.java#L70-L95
train
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/HTODDependencyTable.java
HTODDependencyTable.add
public int add(Object dependency, ValueSet valueSet) { int returnCode = HTODDynacache.NO_EXCEPTION; if (dependencyToEntryTable.size() >= this.maxSize) { returnCode = reduceTableSize(); } dependencyNotUpdatedTable.put(dependency, valueSet); dependencyToEntryTable.put(dependency, valueSet); return returnCode; }
java
public int add(Object dependency, ValueSet valueSet) { int returnCode = HTODDynacache.NO_EXCEPTION; if (dependencyToEntryTable.size() >= this.maxSize) { returnCode = reduceTableSize(); } dependencyNotUpdatedTable.put(dependency, valueSet); dependencyToEntryTable.put(dependency, valueSet); return returnCode; }
[ "public", "int", "add", "(", "Object", "dependency", ",", "ValueSet", "valueSet", ")", "{", "int", "returnCode", "=", "HTODDynacache", ".", "NO_EXCEPTION", ";", "if", "(", "dependencyToEntryTable", ".", "size", "(", ")", ">=", "this", ".", "maxSize", ")", "{", "returnCode", "=", "reduceTableSize", "(", ")", ";", "}", "dependencyNotUpdatedTable", ".", "put", "(", "dependency", ",", "valueSet", ")", ";", "dependencyToEntryTable", ".", "put", "(", "dependency", ",", "valueSet", ")", ";", "return", "returnCode", ";", "}" ]
This adds a new dependency with its valueSet to the DependencyToEntryTable. @param dependency The dependency. @param valueSet containing all entries for this dependency.
[ "This", "adds", "a", "new", "dependency", "with", "its", "valueSet", "to", "the", "DependencyToEntryTable", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/HTODDependencyTable.java#L103-L111
train
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/HTODDependencyTable.java
HTODDependencyTable.replace
public int replace(Object dependency, ValueSet valueSet) { int returnCode = HTODDynacache.NO_EXCEPTION; dependencyNotUpdatedTable.remove(dependency); if (valueSet != null && valueSet.size() > this.delayOffloadEntriesLimit) { dependencyToEntryTable.remove(dependency); if (this.type == DEP_ID_TABLE) { returnCode = this.htod.writeValueSet(HTODDynacache.DEP_ID_DATA, dependency, valueSet, HTODDynacache.ALL); // valueSet may be empty after writeValueSet this.htod.cache.getCacheStatisticsListener().depIdsOffloadedToDisk(dependency); //System.out.println("***** replace dependency id=" + dependency + " size=" + valueSet.size()); } else { returnCode = this.htod.writeValueSet(HTODDynacache.TEMPLATE_ID_DATA, dependency, valueSet, HTODDynacache.ALL); // valueSet may be empty after writeValueSet this.htod.cache.getCacheStatisticsListener().templatesOffloadedToDisk(dependency); //System.out.println("***** replace template id=" + dependency + " size=" + valueSet.size()); } } else { if (valueSet.size() > 0) { dependencyToEntryTable.put(dependency, valueSet); } else { dependencyToEntryTable.remove(dependency); } } if (returnCode == HTODDynacache.DISK_SIZE_OVER_LIMIT_EXCEPTION && valueSet.size() > 0) { this.htod.delCacheEntry(valueSet, CachePerf.DISK_OVERFLOW, CachePerf.LOCAL, !Cache.FROM_DEPID_TEMPLATE_INVALIDATION, HTODInvalidationBuffer.FIRE_EVENT); returnCode = HTODDynacache.NO_EXCEPTION; } return returnCode; }
java
public int replace(Object dependency, ValueSet valueSet) { int returnCode = HTODDynacache.NO_EXCEPTION; dependencyNotUpdatedTable.remove(dependency); if (valueSet != null && valueSet.size() > this.delayOffloadEntriesLimit) { dependencyToEntryTable.remove(dependency); if (this.type == DEP_ID_TABLE) { returnCode = this.htod.writeValueSet(HTODDynacache.DEP_ID_DATA, dependency, valueSet, HTODDynacache.ALL); // valueSet may be empty after writeValueSet this.htod.cache.getCacheStatisticsListener().depIdsOffloadedToDisk(dependency); //System.out.println("***** replace dependency id=" + dependency + " size=" + valueSet.size()); } else { returnCode = this.htod.writeValueSet(HTODDynacache.TEMPLATE_ID_DATA, dependency, valueSet, HTODDynacache.ALL); // valueSet may be empty after writeValueSet this.htod.cache.getCacheStatisticsListener().templatesOffloadedToDisk(dependency); //System.out.println("***** replace template id=" + dependency + " size=" + valueSet.size()); } } else { if (valueSet.size() > 0) { dependencyToEntryTable.put(dependency, valueSet); } else { dependencyToEntryTable.remove(dependency); } } if (returnCode == HTODDynacache.DISK_SIZE_OVER_LIMIT_EXCEPTION && valueSet.size() > 0) { this.htod.delCacheEntry(valueSet, CachePerf.DISK_OVERFLOW, CachePerf.LOCAL, !Cache.FROM_DEPID_TEMPLATE_INVALIDATION, HTODInvalidationBuffer.FIRE_EVENT); returnCode = HTODDynacache.NO_EXCEPTION; } return returnCode; }
[ "public", "int", "replace", "(", "Object", "dependency", ",", "ValueSet", "valueSet", ")", "{", "int", "returnCode", "=", "HTODDynacache", ".", "NO_EXCEPTION", ";", "dependencyNotUpdatedTable", ".", "remove", "(", "dependency", ")", ";", "if", "(", "valueSet", "!=", "null", "&&", "valueSet", ".", "size", "(", ")", ">", "this", ".", "delayOffloadEntriesLimit", ")", "{", "dependencyToEntryTable", ".", "remove", "(", "dependency", ")", ";", "if", "(", "this", ".", "type", "==", "DEP_ID_TABLE", ")", "{", "returnCode", "=", "this", ".", "htod", ".", "writeValueSet", "(", "HTODDynacache", ".", "DEP_ID_DATA", ",", "dependency", ",", "valueSet", ",", "HTODDynacache", ".", "ALL", ")", ";", "// valueSet may be empty after writeValueSet", "this", ".", "htod", ".", "cache", ".", "getCacheStatisticsListener", "(", ")", ".", "depIdsOffloadedToDisk", "(", "dependency", ")", ";", "//System.out.println(\"***** replace dependency id=\" + dependency + \" size=\" + valueSet.size());", "}", "else", "{", "returnCode", "=", "this", ".", "htod", ".", "writeValueSet", "(", "HTODDynacache", ".", "TEMPLATE_ID_DATA", ",", "dependency", ",", "valueSet", ",", "HTODDynacache", ".", "ALL", ")", ";", "// valueSet may be empty after writeValueSet", "this", ".", "htod", ".", "cache", ".", "getCacheStatisticsListener", "(", ")", ".", "templatesOffloadedToDisk", "(", "dependency", ")", ";", "//System.out.println(\"***** replace template id=\" + dependency + \" size=\" + valueSet.size());", "}", "}", "else", "{", "if", "(", "valueSet", ".", "size", "(", ")", ">", "0", ")", "{", "dependencyToEntryTable", ".", "put", "(", "dependency", ",", "valueSet", ")", ";", "}", "else", "{", "dependencyToEntryTable", ".", "remove", "(", "dependency", ")", ";", "}", "}", "if", "(", "returnCode", "==", "HTODDynacache", ".", "DISK_SIZE_OVER_LIMIT_EXCEPTION", "&&", "valueSet", ".", "size", "(", ")", ">", "0", ")", "{", "this", ".", "htod", ".", "delCacheEntry", "(", "valueSet", ",", "CachePerf", ".", "DISK_OVERFLOW", ",", "CachePerf", ".", "LOCAL", ",", "!", "Cache", ".", "FROM_DEPID_TEMPLATE_INVALIDATION", ",", "HTODInvalidationBuffer", ".", "FIRE_EVENT", ")", ";", "returnCode", "=", "HTODDynacache", ".", "NO_EXCEPTION", ";", "}", "return", "returnCode", ";", "}" ]
This replaces the existing dependency with new valueSet in DependencyToEntryTable. @param dependency The dependency. @param valueSet containing new entries for this dependency.
[ "This", "replaces", "the", "existing", "dependency", "with", "new", "valueSet", "in", "DependencyToEntryTable", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/HTODDependencyTable.java#L132-L160
train
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/HTODDependencyTable.java
HTODDependencyTable.removeEntry
public Result removeEntry(Object dependency, Object entry) { Result result = this.htod.getFromResultPool(); ValueSet valueSet = (ValueSet) dependencyToEntryTable.get(dependency); if (valueSet == null) { return result; } result.bExist = HTODDynacache.EXIST; valueSet.remove(entry); dependencyNotUpdatedTable.remove(dependency); if (valueSet.isEmpty()) { dependencyToEntryTable.remove(dependency); if (this.type == DEP_ID_TABLE) { result.returnCode = this.htod.delValueSet(HTODDynacache.DEP_ID_DATA, dependency); } else { result.returnCode = this.htod.delValueSet(HTODDynacache.TEMPLATE_ID_DATA, dependency); } } return result; }
java
public Result removeEntry(Object dependency, Object entry) { Result result = this.htod.getFromResultPool(); ValueSet valueSet = (ValueSet) dependencyToEntryTable.get(dependency); if (valueSet == null) { return result; } result.bExist = HTODDynacache.EXIST; valueSet.remove(entry); dependencyNotUpdatedTable.remove(dependency); if (valueSet.isEmpty()) { dependencyToEntryTable.remove(dependency); if (this.type == DEP_ID_TABLE) { result.returnCode = this.htod.delValueSet(HTODDynacache.DEP_ID_DATA, dependency); } else { result.returnCode = this.htod.delValueSet(HTODDynacache.TEMPLATE_ID_DATA, dependency); } } return result; }
[ "public", "Result", "removeEntry", "(", "Object", "dependency", ",", "Object", "entry", ")", "{", "Result", "result", "=", "this", ".", "htod", ".", "getFromResultPool", "(", ")", ";", "ValueSet", "valueSet", "=", "(", "ValueSet", ")", "dependencyToEntryTable", ".", "get", "(", "dependency", ")", ";", "if", "(", "valueSet", "==", "null", ")", "{", "return", "result", ";", "}", "result", ".", "bExist", "=", "HTODDynacache", ".", "EXIST", ";", "valueSet", ".", "remove", "(", "entry", ")", ";", "dependencyNotUpdatedTable", ".", "remove", "(", "dependency", ")", ";", "if", "(", "valueSet", ".", "isEmpty", "(", ")", ")", "{", "dependencyToEntryTable", ".", "remove", "(", "dependency", ")", ";", "if", "(", "this", ".", "type", "==", "DEP_ID_TABLE", ")", "{", "result", ".", "returnCode", "=", "this", ".", "htod", ".", "delValueSet", "(", "HTODDynacache", ".", "DEP_ID_DATA", ",", "dependency", ")", ";", "}", "else", "{", "result", ".", "returnCode", "=", "this", ".", "htod", ".", "delValueSet", "(", "HTODDynacache", ".", "TEMPLATE_ID_DATA", ",", "dependency", ")", ";", "}", "}", "return", "result", ";", "}" ]
This removes the specified entry from the specified dependency. @param dependency The dependency. @param result
[ "This", "removes", "the", "specified", "entry", "from", "the", "specified", "dependency", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/HTODDependencyTable.java#L179-L199
train
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/HTODDependencyTable.java
HTODDependencyTable.getEntries
public ValueSet getEntries(Object dependency) { ValueSet valueSet = (ValueSet) dependencyToEntryTable.get(dependency); return valueSet; }
java
public ValueSet getEntries(Object dependency) { ValueSet valueSet = (ValueSet) dependencyToEntryTable.get(dependency); return valueSet; }
[ "public", "ValueSet", "getEntries", "(", "Object", "dependency", ")", "{", "ValueSet", "valueSet", "=", "(", "ValueSet", ")", "dependencyToEntryTable", ".", "get", "(", "dependency", ")", ";", "return", "valueSet", ";", "}" ]
This returns the ValueSet for the specified dependency from the DependencyToEntryTable. @param dependency The dependency to get the entries for. @return The ValueSet containing all entries for this dependency.
[ "This", "returns", "the", "ValueSet", "for", "the", "specified", "dependency", "from", "the", "DependencyToEntryTable", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/HTODDependencyTable.java#L233-L237
train
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/HTODDependencyTable.java
HTODDependencyTable.reduceTableSize
private int reduceTableSize() { int returnCode = HTODDynacache.NO_EXCEPTION; int count = this.entryRemove; if (count > 0) { int removeSize = 5; while (count > 0) { int minSize = Integer.MAX_VALUE; Iterator<Map.Entry<Object,Set<Object>>> e = dependencyToEntryTable.entrySet().iterator(); while (e.hasNext()) { Map.Entry entry = (Map.Entry) e.next(); Object id = entry.getKey(); ValueSet vs = (ValueSet) entry.getValue(); int vsSize = vs.size(); if (vsSize < removeSize) { if (this.type == DEP_ID_TABLE) { returnCode = this.htod.writeValueSet(HTODDynacache.DEP_ID_DATA, id, vs, HTODDynacache.ALL); // valueSet may be empty after writeValueSet this.htod.cache.getCacheStatisticsListener().depIdsOffloadedToDisk(id); Tr.debug(tc, " reduceTableSize dependency id=" + id + " vs=" + vs.size() + " returnCode="+returnCode); } else { returnCode = this.htod.writeValueSet(HTODDynacache.TEMPLATE_ID_DATA, id, vs, HTODDynacache.ALL); // valueSet may be empty after writeValueSet this.htod.cache.getCacheStatisticsListener().templatesOffloadedToDisk(id); Tr.debug(tc,"reduceTableSize template id=" + id + " vs=" + vs.size() + " returnCode="+returnCode); } dependencyToEntryTable.remove(id); dependencyNotUpdatedTable.remove(id); count--; if (returnCode == HTODDynacache.DISK_EXCEPTION) { return returnCode; } else if (returnCode == HTODDynacache.DISK_SIZE_OVER_LIMIT_EXCEPTION) { this.htod.delCacheEntry(vs, CachePerf.DISK_OVERFLOW, CachePerf.LOCAL, !Cache.FROM_DEPID_TEMPLATE_INVALIDATION, HTODInvalidationBuffer.FIRE_EVENT); returnCode = HTODDynacache.NO_EXCEPTION; return returnCode; } } else { minSize = vsSize < minSize ? vsSize : minSize; } if (count == 0) { break; } } removeSize = minSize; removeSize += 3; } } return returnCode; }
java
private int reduceTableSize() { int returnCode = HTODDynacache.NO_EXCEPTION; int count = this.entryRemove; if (count > 0) { int removeSize = 5; while (count > 0) { int minSize = Integer.MAX_VALUE; Iterator<Map.Entry<Object,Set<Object>>> e = dependencyToEntryTable.entrySet().iterator(); while (e.hasNext()) { Map.Entry entry = (Map.Entry) e.next(); Object id = entry.getKey(); ValueSet vs = (ValueSet) entry.getValue(); int vsSize = vs.size(); if (vsSize < removeSize) { if (this.type == DEP_ID_TABLE) { returnCode = this.htod.writeValueSet(HTODDynacache.DEP_ID_DATA, id, vs, HTODDynacache.ALL); // valueSet may be empty after writeValueSet this.htod.cache.getCacheStatisticsListener().depIdsOffloadedToDisk(id); Tr.debug(tc, " reduceTableSize dependency id=" + id + " vs=" + vs.size() + " returnCode="+returnCode); } else { returnCode = this.htod.writeValueSet(HTODDynacache.TEMPLATE_ID_DATA, id, vs, HTODDynacache.ALL); // valueSet may be empty after writeValueSet this.htod.cache.getCacheStatisticsListener().templatesOffloadedToDisk(id); Tr.debug(tc,"reduceTableSize template id=" + id + " vs=" + vs.size() + " returnCode="+returnCode); } dependencyToEntryTable.remove(id); dependencyNotUpdatedTable.remove(id); count--; if (returnCode == HTODDynacache.DISK_EXCEPTION) { return returnCode; } else if (returnCode == HTODDynacache.DISK_SIZE_OVER_LIMIT_EXCEPTION) { this.htod.delCacheEntry(vs, CachePerf.DISK_OVERFLOW, CachePerf.LOCAL, !Cache.FROM_DEPID_TEMPLATE_INVALIDATION, HTODInvalidationBuffer.FIRE_EVENT); returnCode = HTODDynacache.NO_EXCEPTION; return returnCode; } } else { minSize = vsSize < minSize ? vsSize : minSize; } if (count == 0) { break; } } removeSize = minSize; removeSize += 3; } } return returnCode; }
[ "private", "int", "reduceTableSize", "(", ")", "{", "int", "returnCode", "=", "HTODDynacache", ".", "NO_EXCEPTION", ";", "int", "count", "=", "this", ".", "entryRemove", ";", "if", "(", "count", ">", "0", ")", "{", "int", "removeSize", "=", "5", ";", "while", "(", "count", ">", "0", ")", "{", "int", "minSize", "=", "Integer", ".", "MAX_VALUE", ";", "Iterator", "<", "Map", ".", "Entry", "<", "Object", ",", "Set", "<", "Object", ">", ">", ">", "e", "=", "dependencyToEntryTable", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "e", ".", "hasNext", "(", ")", ")", "{", "Map", ".", "Entry", "entry", "=", "(", "Map", ".", "Entry", ")", "e", ".", "next", "(", ")", ";", "Object", "id", "=", "entry", ".", "getKey", "(", ")", ";", "ValueSet", "vs", "=", "(", "ValueSet", ")", "entry", ".", "getValue", "(", ")", ";", "int", "vsSize", "=", "vs", ".", "size", "(", ")", ";", "if", "(", "vsSize", "<", "removeSize", ")", "{", "if", "(", "this", ".", "type", "==", "DEP_ID_TABLE", ")", "{", "returnCode", "=", "this", ".", "htod", ".", "writeValueSet", "(", "HTODDynacache", ".", "DEP_ID_DATA", ",", "id", ",", "vs", ",", "HTODDynacache", ".", "ALL", ")", ";", "// valueSet may be empty after writeValueSet", "this", ".", "htod", ".", "cache", ".", "getCacheStatisticsListener", "(", ")", ".", "depIdsOffloadedToDisk", "(", "id", ")", ";", "Tr", ".", "debug", "(", "tc", ",", "\" reduceTableSize dependency id=\"", "+", "id", "+", "\" vs=\"", "+", "vs", ".", "size", "(", ")", "+", "\" returnCode=\"", "+", "returnCode", ")", ";", "}", "else", "{", "returnCode", "=", "this", ".", "htod", ".", "writeValueSet", "(", "HTODDynacache", ".", "TEMPLATE_ID_DATA", ",", "id", ",", "vs", ",", "HTODDynacache", ".", "ALL", ")", ";", "// valueSet may be empty after writeValueSet", "this", ".", "htod", ".", "cache", ".", "getCacheStatisticsListener", "(", ")", ".", "templatesOffloadedToDisk", "(", "id", ")", ";", "Tr", ".", "debug", "(", "tc", ",", "\"reduceTableSize template id=\"", "+", "id", "+", "\" vs=\"", "+", "vs", ".", "size", "(", ")", "+", "\" returnCode=\"", "+", "returnCode", ")", ";", "}", "dependencyToEntryTable", ".", "remove", "(", "id", ")", ";", "dependencyNotUpdatedTable", ".", "remove", "(", "id", ")", ";", "count", "--", ";", "if", "(", "returnCode", "==", "HTODDynacache", ".", "DISK_EXCEPTION", ")", "{", "return", "returnCode", ";", "}", "else", "if", "(", "returnCode", "==", "HTODDynacache", ".", "DISK_SIZE_OVER_LIMIT_EXCEPTION", ")", "{", "this", ".", "htod", ".", "delCacheEntry", "(", "vs", ",", "CachePerf", ".", "DISK_OVERFLOW", ",", "CachePerf", ".", "LOCAL", ",", "!", "Cache", ".", "FROM_DEPID_TEMPLATE_INVALIDATION", ",", "HTODInvalidationBuffer", ".", "FIRE_EVENT", ")", ";", "returnCode", "=", "HTODDynacache", ".", "NO_EXCEPTION", ";", "return", "returnCode", ";", "}", "}", "else", "{", "minSize", "=", "vsSize", "<", "minSize", "?", "vsSize", ":", "minSize", ";", "}", "if", "(", "count", "==", "0", ")", "{", "break", ";", "}", "}", "removeSize", "=", "minSize", ";", "removeSize", "+=", "3", ";", "}", "}", "return", "returnCode", ";", "}" ]
This reduces the DependencyToEntryTable size by offloading some dependencies to the disk.
[ "This", "reduces", "the", "DependencyToEntryTable", "size", "by", "offloading", "some", "dependencies", "to", "the", "disk", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/HTODDependencyTable.java#L265-L316
train
OpenLiberty/open-liberty
dev/com.ibm.ws.javaee.ddmetadata/src/com/ibm/ws/javaee/ddmetadata/generator/ComponentImplGenerator.java
ComponentImplGenerator.getClassName
private static String getClassName(String implClassName) { implClassName = implClassName.substring(0, implClassName.length() - 4); return implClassName + "ComponentImpl"; }
java
private static String getClassName(String implClassName) { implClassName = implClassName.substring(0, implClassName.length() - 4); return implClassName + "ComponentImpl"; }
[ "private", "static", "String", "getClassName", "(", "String", "implClassName", ")", "{", "implClassName", "=", "implClassName", ".", "substring", "(", "0", ",", "implClassName", ".", "length", "(", ")", "-", "4", ")", ";", "return", "implClassName", "+", "\"ComponentImpl\"", ";", "}" ]
The model interface type has a name ending in 'Type'. For the moment, modify it here.
[ "The", "model", "interface", "type", "has", "a", "name", "ending", "in", "Type", ".", "For", "the", "moment", "modify", "it", "here", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.javaee.ddmetadata/src/com/ibm/ws/javaee/ddmetadata/generator/ComponentImplGenerator.java#L45-L48
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/StoppableThreadCache.java
StoppableThreadCache.registerThread
public void registerThread(StoppableThread thread) { if (tc.isEntryEnabled()) SibTr.entry(tc, "registerThread", thread); synchronized (this) { _threadCache.add(thread); } if (tc.isEntryEnabled()) SibTr.exit(tc, "registerThread"); }
java
public void registerThread(StoppableThread thread) { if (tc.isEntryEnabled()) SibTr.entry(tc, "registerThread", thread); synchronized (this) { _threadCache.add(thread); } if (tc.isEntryEnabled()) SibTr.exit(tc, "registerThread"); }
[ "public", "void", "registerThread", "(", "StoppableThread", "thread", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"registerThread\"", ",", "thread", ")", ";", "synchronized", "(", "this", ")", "{", "_threadCache", ".", "add", "(", "thread", ")", ";", "}", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"registerThread\"", ")", ";", "}" ]
Registers a new thread for stopping
[ "Registers", "a", "new", "thread", "for", "stopping" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/StoppableThreadCache.java#L56-L68
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/StoppableThreadCache.java
StoppableThreadCache.deregisterThread
public void deregisterThread(StoppableThread thread) { if (tc.isEntryEnabled()) SibTr.entry(tc, "deregisterThread", thread); synchronized (this) { _threadCache.remove(thread); } if (tc.isEntryEnabled()) SibTr.exit(tc, "deregisterThread"); }
java
public void deregisterThread(StoppableThread thread) { if (tc.isEntryEnabled()) SibTr.entry(tc, "deregisterThread", thread); synchronized (this) { _threadCache.remove(thread); } if (tc.isEntryEnabled()) SibTr.exit(tc, "deregisterThread"); }
[ "public", "void", "deregisterThread", "(", "StoppableThread", "thread", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"deregisterThread\"", ",", "thread", ")", ";", "synchronized", "(", "this", ")", "{", "_threadCache", ".", "remove", "(", "thread", ")", ";", "}", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"deregisterThread\"", ")", ";", "}" ]
Deregisters a thread for stopping
[ "Deregisters", "a", "thread", "for", "stopping" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/StoppableThreadCache.java#L73-L85
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/StoppableThreadCache.java
StoppableThreadCache.stopAllThreads
public void stopAllThreads() { if (tc.isEntryEnabled()) SibTr.entry(tc, "stopAllThreads"); synchronized (this) { Iterator iterator = ((ArrayList)_threadCache.clone()).iterator(); while (iterator.hasNext()) { StoppableThread thread = (StoppableThread)iterator.next(); if (tc.isDebugEnabled()) SibTr.debug(tc, "Attempting to stop thread " + thread); // Stop the thread thread.stopThread(this); // Remove from the iterator iterator.remove(); // Remove from the cache _threadCache.remove(thread); } } if (tc.isEntryEnabled()) SibTr.exit(tc, "stopAllThreads"); }
java
public void stopAllThreads() { if (tc.isEntryEnabled()) SibTr.entry(tc, "stopAllThreads"); synchronized (this) { Iterator iterator = ((ArrayList)_threadCache.clone()).iterator(); while (iterator.hasNext()) { StoppableThread thread = (StoppableThread)iterator.next(); if (tc.isDebugEnabled()) SibTr.debug(tc, "Attempting to stop thread " + thread); // Stop the thread thread.stopThread(this); // Remove from the iterator iterator.remove(); // Remove from the cache _threadCache.remove(thread); } } if (tc.isEntryEnabled()) SibTr.exit(tc, "stopAllThreads"); }
[ "public", "void", "stopAllThreads", "(", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"stopAllThreads\"", ")", ";", "synchronized", "(", "this", ")", "{", "Iterator", "iterator", "=", "(", "(", "ArrayList", ")", "_threadCache", ".", "clone", "(", ")", ")", ".", "iterator", "(", ")", ";", "while", "(", "iterator", ".", "hasNext", "(", ")", ")", "{", "StoppableThread", "thread", "=", "(", "StoppableThread", ")", "iterator", ".", "next", "(", ")", ";", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "SibTr", ".", "debug", "(", "tc", ",", "\"Attempting to stop thread \"", "+", "thread", ")", ";", "// Stop the thread ", "thread", ".", "stopThread", "(", "this", ")", ";", "// Remove from the iterator", "iterator", ".", "remove", "(", ")", ";", "// Remove from the cache", "_threadCache", ".", "remove", "(", "thread", ")", ";", "}", "}", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"stopAllThreads\"", ")", ";", "}" ]
Stops all the stoppable threads that haven't already been stopped
[ "Stops", "all", "the", "stoppable", "threads", "that", "haven", "t", "already", "been", "stopped" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/StoppableThreadCache.java#L90-L117
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/StoppableThreadCache.java
StoppableThreadCache.getThreads
public ArrayList getThreads() { if (tc.isEntryEnabled()) { SibTr.entry(tc, "getThreads"); SibTr.exit(tc, "getThreads", _threadCache); } return _threadCache; }
java
public ArrayList getThreads() { if (tc.isEntryEnabled()) { SibTr.entry(tc, "getThreads"); SibTr.exit(tc, "getThreads", _threadCache); } return _threadCache; }
[ "public", "ArrayList", "getThreads", "(", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "entry", "(", "tc", ",", "\"getThreads\"", ")", ";", "SibTr", ".", "exit", "(", "tc", ",", "\"getThreads\"", ",", "_threadCache", ")", ";", "}", "return", "_threadCache", ";", "}" ]
Unit test hook to check on connected threads
[ "Unit", "test", "hook", "to", "check", "on", "connected", "threads" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/StoppableThreadCache.java#L122-L130
train
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.core/src/com/ibm/ws/collector/manager/buffer/SimpleRotatingSoftQueue.java
SimpleRotatingSoftQueue.getAndUpdateTail
private int getAndUpdateTail() { int retMe; do { retMe = tailIndex.get(); } while (tailIndex.compareAndSet(retMe, getNext(retMe)) == false); return retMe; }
java
private int getAndUpdateTail() { int retMe; do { retMe = tailIndex.get(); } while (tailIndex.compareAndSet(retMe, getNext(retMe)) == false); return retMe; }
[ "private", "int", "getAndUpdateTail", "(", ")", "{", "int", "retMe", ";", "do", "{", "retMe", "=", "tailIndex", ".", "get", "(", ")", ";", "}", "while", "(", "tailIndex", ".", "compareAndSet", "(", "retMe", ",", "getNext", "(", "retMe", ")", ")", "==", "false", ")", ";", "return", "retMe", ";", "}" ]
Atomically update and return the tailIndex. Guarantees that two threads won't simultaneously update the same slot in the array.
[ "Atomically", "update", "and", "return", "the", "tailIndex", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.core/src/com/ibm/ws/collector/manager/buffer/SimpleRotatingSoftQueue.java#L60-L68
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/expiry/ExpiryIndex.java
ExpiryIndex.put
public boolean put(ExpirableReference expirable) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "put", "ObjId=" + expirable.getID() + " ET=" + expirable.getExpiryTime()); boolean reply = tree.insert(expirable); if (reply) { size++; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "put", "reply=" + reply); return reply; }
java
public boolean put(ExpirableReference expirable) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "put", "ObjId=" + expirable.getID() + " ET=" + expirable.getExpiryTime()); boolean reply = tree.insert(expirable); if (reply) { size++; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "put", "reply=" + reply); return reply; }
[ "public", "boolean", "put", "(", "ExpirableReference", "expirable", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "this", ",", "tc", ",", "\"put\"", ",", "\"ObjId=\"", "+", "expirable", ".", "getID", "(", ")", "+", "\" ET=\"", "+", "expirable", ".", "getExpiryTime", "(", ")", ")", ";", "boolean", "reply", "=", "tree", ".", "insert", "(", "expirable", ")", ";", "if", "(", "reply", ")", "{", "size", "++", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "this", ",", "tc", ",", "\"put\"", ",", "\"reply=\"", "+", "reply", ")", ";", "return", "reply", ";", "}" ]
Add an ExpirableReference to the expiry index. @param expirable an ExpirableReference. @return true if the object was added to the index successfully.
[ "Add", "an", "ExpirableReference", "to", "the", "expiry", "index", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/expiry/ExpiryIndex.java#L55-L67
train
OpenLiberty/open-liberty
dev/com.ibm.ws.product.utility/src/com/ibm/ws/product/utility/extension/VersionUtils.java
VersionUtils.getAllProductInfo
protected static Map<String, ProductInfo> getAllProductInfo(File wlpInstallationDirectory) throws VersionParsingException { File versionPropertyDirectory = new File(wlpInstallationDirectory, ProductInfo.VERSION_PROPERTY_DIRECTORY); if (!versionPropertyDirectory.exists()) { throw new VersionParsingException(CommandUtils.getMessage("ERROR_NO_PROPERTIES_DIRECTORY", versionPropertyDirectory.getAbsoluteFile())); } if (!versionPropertyDirectory.isDirectory()) { throw new VersionParsingException(CommandUtils.getMessage("ERROR_NOT_PROPERTIES_DIRECTORY", versionPropertyDirectory.getAbsoluteFile())); } if (!versionPropertyDirectory.canRead()) { throw new VersionParsingException(CommandUtils.getMessage("ERROR_UNABLE_READ_PROPERTIES_DIRECTORY", versionPropertyDirectory.getAbsoluteFile())); } Map<String, ProductInfo> productIdToVersionPropertiesMap; try { productIdToVersionPropertiesMap = ProductInfo.getAllProductInfo(wlpInstallationDirectory); } catch (IllegalArgumentException e) { throw new VersionParsingException(CommandUtils.getMessage("ERROR_UNABLE_READ_PROPERTIES_DIRECTORY", versionPropertyDirectory.getAbsoluteFile())); } catch (ProductInfoParseException e) { String missingKey = e.getMissingKey(); if (missingKey != null) { throw new VersionParsingException(CommandUtils.getMessage("version.missing.key", missingKey, e.getFile().getAbsoluteFile())); } throw new VersionParsingException(CommandUtils.getMessage("ERROR_UNABLE_READ_FILE", e.getFile().getAbsoluteFile(), e.getCause().getMessage())); } catch (DuplicateProductInfoException e) { throw new VersionParsingException(CommandUtils.getMessage("version.duplicated.productId", ProductInfo.COM_IBM_WEBSPHERE_PRODUCTID_KEY, e.getProductInfo1().getFile().getAbsoluteFile(), e.getProductInfo2().getFile().getAbsoluteFile())); } catch (ProductInfoReplaceException e) { ProductInfo productInfo = e.getProductInfo(); String replacesId = productInfo.getReplacesId(); if (replacesId.equals(productInfo.getId())) { throw new VersionParsingException(CommandUtils.getMessage("version.replaced.product.can.not.itself", productInfo.getFile().getAbsoluteFile())); } throw new VersionParsingException(CommandUtils.getMessage("version.replaced.product.not.exist", replacesId, productInfo.getFile().getAbsoluteFile())); } if (productIdToVersionPropertiesMap.isEmpty()) { throw new VersionParsingException(CommandUtils.getMessage("ERROR_NO_PROPERTIES_FILE", versionPropertyDirectory.getAbsoluteFile())); } return productIdToVersionPropertiesMap; }
java
protected static Map<String, ProductInfo> getAllProductInfo(File wlpInstallationDirectory) throws VersionParsingException { File versionPropertyDirectory = new File(wlpInstallationDirectory, ProductInfo.VERSION_PROPERTY_DIRECTORY); if (!versionPropertyDirectory.exists()) { throw new VersionParsingException(CommandUtils.getMessage("ERROR_NO_PROPERTIES_DIRECTORY", versionPropertyDirectory.getAbsoluteFile())); } if (!versionPropertyDirectory.isDirectory()) { throw new VersionParsingException(CommandUtils.getMessage("ERROR_NOT_PROPERTIES_DIRECTORY", versionPropertyDirectory.getAbsoluteFile())); } if (!versionPropertyDirectory.canRead()) { throw new VersionParsingException(CommandUtils.getMessage("ERROR_UNABLE_READ_PROPERTIES_DIRECTORY", versionPropertyDirectory.getAbsoluteFile())); } Map<String, ProductInfo> productIdToVersionPropertiesMap; try { productIdToVersionPropertiesMap = ProductInfo.getAllProductInfo(wlpInstallationDirectory); } catch (IllegalArgumentException e) { throw new VersionParsingException(CommandUtils.getMessage("ERROR_UNABLE_READ_PROPERTIES_DIRECTORY", versionPropertyDirectory.getAbsoluteFile())); } catch (ProductInfoParseException e) { String missingKey = e.getMissingKey(); if (missingKey != null) { throw new VersionParsingException(CommandUtils.getMessage("version.missing.key", missingKey, e.getFile().getAbsoluteFile())); } throw new VersionParsingException(CommandUtils.getMessage("ERROR_UNABLE_READ_FILE", e.getFile().getAbsoluteFile(), e.getCause().getMessage())); } catch (DuplicateProductInfoException e) { throw new VersionParsingException(CommandUtils.getMessage("version.duplicated.productId", ProductInfo.COM_IBM_WEBSPHERE_PRODUCTID_KEY, e.getProductInfo1().getFile().getAbsoluteFile(), e.getProductInfo2().getFile().getAbsoluteFile())); } catch (ProductInfoReplaceException e) { ProductInfo productInfo = e.getProductInfo(); String replacesId = productInfo.getReplacesId(); if (replacesId.equals(productInfo.getId())) { throw new VersionParsingException(CommandUtils.getMessage("version.replaced.product.can.not.itself", productInfo.getFile().getAbsoluteFile())); } throw new VersionParsingException(CommandUtils.getMessage("version.replaced.product.not.exist", replacesId, productInfo.getFile().getAbsoluteFile())); } if (productIdToVersionPropertiesMap.isEmpty()) { throw new VersionParsingException(CommandUtils.getMessage("ERROR_NO_PROPERTIES_FILE", versionPropertyDirectory.getAbsoluteFile())); } return productIdToVersionPropertiesMap; }
[ "protected", "static", "Map", "<", "String", ",", "ProductInfo", ">", "getAllProductInfo", "(", "File", "wlpInstallationDirectory", ")", "throws", "VersionParsingException", "{", "File", "versionPropertyDirectory", "=", "new", "File", "(", "wlpInstallationDirectory", ",", "ProductInfo", ".", "VERSION_PROPERTY_DIRECTORY", ")", ";", "if", "(", "!", "versionPropertyDirectory", ".", "exists", "(", ")", ")", "{", "throw", "new", "VersionParsingException", "(", "CommandUtils", ".", "getMessage", "(", "\"ERROR_NO_PROPERTIES_DIRECTORY\"", ",", "versionPropertyDirectory", ".", "getAbsoluteFile", "(", ")", ")", ")", ";", "}", "if", "(", "!", "versionPropertyDirectory", ".", "isDirectory", "(", ")", ")", "{", "throw", "new", "VersionParsingException", "(", "CommandUtils", ".", "getMessage", "(", "\"ERROR_NOT_PROPERTIES_DIRECTORY\"", ",", "versionPropertyDirectory", ".", "getAbsoluteFile", "(", ")", ")", ")", ";", "}", "if", "(", "!", "versionPropertyDirectory", ".", "canRead", "(", ")", ")", "{", "throw", "new", "VersionParsingException", "(", "CommandUtils", ".", "getMessage", "(", "\"ERROR_UNABLE_READ_PROPERTIES_DIRECTORY\"", ",", "versionPropertyDirectory", ".", "getAbsoluteFile", "(", ")", ")", ")", ";", "}", "Map", "<", "String", ",", "ProductInfo", ">", "productIdToVersionPropertiesMap", ";", "try", "{", "productIdToVersionPropertiesMap", "=", "ProductInfo", ".", "getAllProductInfo", "(", "wlpInstallationDirectory", ")", ";", "}", "catch", "(", "IllegalArgumentException", "e", ")", "{", "throw", "new", "VersionParsingException", "(", "CommandUtils", ".", "getMessage", "(", "\"ERROR_UNABLE_READ_PROPERTIES_DIRECTORY\"", ",", "versionPropertyDirectory", ".", "getAbsoluteFile", "(", ")", ")", ")", ";", "}", "catch", "(", "ProductInfoParseException", "e", ")", "{", "String", "missingKey", "=", "e", ".", "getMissingKey", "(", ")", ";", "if", "(", "missingKey", "!=", "null", ")", "{", "throw", "new", "VersionParsingException", "(", "CommandUtils", ".", "getMessage", "(", "\"version.missing.key\"", ",", "missingKey", ",", "e", ".", "getFile", "(", ")", ".", "getAbsoluteFile", "(", ")", ")", ")", ";", "}", "throw", "new", "VersionParsingException", "(", "CommandUtils", ".", "getMessage", "(", "\"ERROR_UNABLE_READ_FILE\"", ",", "e", ".", "getFile", "(", ")", ".", "getAbsoluteFile", "(", ")", ",", "e", ".", "getCause", "(", ")", ".", "getMessage", "(", ")", ")", ")", ";", "}", "catch", "(", "DuplicateProductInfoException", "e", ")", "{", "throw", "new", "VersionParsingException", "(", "CommandUtils", ".", "getMessage", "(", "\"version.duplicated.productId\"", ",", "ProductInfo", ".", "COM_IBM_WEBSPHERE_PRODUCTID_KEY", ",", "e", ".", "getProductInfo1", "(", ")", ".", "getFile", "(", ")", ".", "getAbsoluteFile", "(", ")", ",", "e", ".", "getProductInfo2", "(", ")", ".", "getFile", "(", ")", ".", "getAbsoluteFile", "(", ")", ")", ")", ";", "}", "catch", "(", "ProductInfoReplaceException", "e", ")", "{", "ProductInfo", "productInfo", "=", "e", ".", "getProductInfo", "(", ")", ";", "String", "replacesId", "=", "productInfo", ".", "getReplacesId", "(", ")", ";", "if", "(", "replacesId", ".", "equals", "(", "productInfo", ".", "getId", "(", ")", ")", ")", "{", "throw", "new", "VersionParsingException", "(", "CommandUtils", ".", "getMessage", "(", "\"version.replaced.product.can.not.itself\"", ",", "productInfo", ".", "getFile", "(", ")", ".", "getAbsoluteFile", "(", ")", ")", ")", ";", "}", "throw", "new", "VersionParsingException", "(", "CommandUtils", ".", "getMessage", "(", "\"version.replaced.product.not.exist\"", ",", "replacesId", ",", "productInfo", ".", "getFile", "(", ")", ".", "getAbsoluteFile", "(", ")", ")", ")", ";", "}", "if", "(", "productIdToVersionPropertiesMap", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "VersionParsingException", "(", "CommandUtils", ".", "getMessage", "(", "\"ERROR_NO_PROPERTIES_FILE\"", ",", "versionPropertyDirectory", ".", "getAbsoluteFile", "(", ")", ")", ")", ";", "}", "return", "productIdToVersionPropertiesMap", ";", "}" ]
This method will create a map of product ID to the VersionProperties for that product. @param ex The execution context that this is being run in @return A map of product IDs to VersionProperties. @throws VersionParsingException If something goes wrong parsing the version files
[ "This", "method", "will", "create", "a", "map", "of", "product", "ID", "to", "the", "VersionProperties", "for", "that", "product", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.product.utility/src/com/ibm/ws/product/utility/extension/VersionUtils.java#L33-L74
train
OpenLiberty/open-liberty
dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/util/CanonicalStore.java
CanonicalStore.remove
public boolean remove(V value) { // peek at what is in the map K key = value.getKey(); Ref<V> ref = map.get(key); // only try to remove the mapping if it matches the provided class loader return (ref != null && ref.get() == value) ? map.remove(key, ref) : false; }
java
public boolean remove(V value) { // peek at what is in the map K key = value.getKey(); Ref<V> ref = map.get(key); // only try to remove the mapping if it matches the provided class loader return (ref != null && ref.get() == value) ? map.remove(key, ref) : false; }
[ "public", "boolean", "remove", "(", "V", "value", ")", "{", "// peek at what is in the map", "K", "key", "=", "value", ".", "getKey", "(", ")", ";", "Ref", "<", "V", ">", "ref", "=", "map", ".", "get", "(", "key", ")", ";", "// only try to remove the mapping if it matches the provided class loader", "return", "(", "ref", "!=", "null", "&&", "ref", ".", "get", "(", ")", "==", "value", ")", "?", "map", ".", "remove", "(", "key", ",", "ref", ")", ":", "false", ";", "}" ]
Remove any mapping for the provided id @param id
[ "Remove", "any", "mapping", "for", "the", "provided", "id" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/util/CanonicalStore.java#L55-L61
train
OpenLiberty/open-liberty
dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/util/CanonicalStore.java
CanonicalStore.retrieveOrCreate
public V retrieveOrCreate(K key, Factory<V> factory) { // Clean up stale entries on every put. // This should avoid a slow memory leak of reference objects. this.cleanUpStaleEntries(); return retrieveOrCreate(key, factory, new FutureRef<V>()); }
java
public V retrieveOrCreate(K key, Factory<V> factory) { // Clean up stale entries on every put. // This should avoid a slow memory leak of reference objects. this.cleanUpStaleEntries(); return retrieveOrCreate(key, factory, new FutureRef<V>()); }
[ "public", "V", "retrieveOrCreate", "(", "K", "key", ",", "Factory", "<", "V", ">", "factory", ")", "{", "// Clean up stale entries on every put.", "// This should avoid a slow memory leak of reference objects.", "this", ".", "cleanUpStaleEntries", "(", ")", ";", "return", "retrieveOrCreate", "(", "key", ",", "factory", ",", "new", "FutureRef", "<", "V", ">", "(", ")", ")", ";", "}" ]
Create a value for the given key iff one has not already been stored. This method is safe to be called concurrently from multiple threads. It will ensure that only one thread succeeds to create the value for the given key. @return the created/retrieved {@link AppClassLoader}
[ "Create", "a", "value", "for", "the", "given", "key", "iff", "one", "has", "not", "already", "been", "stored", ".", "This", "method", "is", "safe", "to", "be", "called", "concurrently", "from", "multiple", "threads", ".", "It", "will", "ensure", "that", "only", "one", "thread", "succeeds", "to", "create", "the", "value", "for", "the", "given", "key", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/util/CanonicalStore.java#L70-L75
train
OpenLiberty/open-liberty
dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/util/CanonicalStore.java
CanonicalStore.cleanUpStaleEntries
void cleanUpStaleEntries() { for (KeyedRef<K, V> ref = q.poll(); ref != null; ref = q.poll()) { map.remove(ref.getKey(), ref); // CONCURRENT remove() operation } }
java
void cleanUpStaleEntries() { for (KeyedRef<K, V> ref = q.poll(); ref != null; ref = q.poll()) { map.remove(ref.getKey(), ref); // CONCURRENT remove() operation } }
[ "void", "cleanUpStaleEntries", "(", ")", "{", "for", "(", "KeyedRef", "<", "K", ",", "V", ">", "ref", "=", "q", ".", "poll", "(", ")", ";", "ref", "!=", "null", ";", "ref", "=", "q", ".", "poll", "(", ")", ")", "{", "map", ".", "remove", "(", "ref", ".", "getKey", "(", ")", ",", "ref", ")", ";", "// CONCURRENT remove() operation", "}", "}" ]
clean up stale entries
[ "clean", "up", "stale", "entries" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/util/CanonicalStore.java#L106-L110
train
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/util/ArrayEnumeration.java
ArrayEnumeration.nextElement
public Object nextElement() { if (_array == null) { return null; } else { synchronized(this){ if (_index < _array.length) { Object obj = _array[_index]; _index++; return obj; } else { return null; } } } }
java
public Object nextElement() { if (_array == null) { return null; } else { synchronized(this){ if (_index < _array.length) { Object obj = _array[_index]; _index++; return obj; } else { return null; } } } }
[ "public", "Object", "nextElement", "(", ")", "{", "if", "(", "_array", "==", "null", ")", "{", "return", "null", ";", "}", "else", "{", "synchronized", "(", "this", ")", "{", "if", "(", "_index", "<", "_array", ".", "length", ")", "{", "Object", "obj", "=", "_array", "[", "_index", "]", ";", "_index", "++", ";", "return", "obj", ";", "}", "else", "{", "return", "null", ";", "}", "}", "}", "}" ]
nextElement method comment.
[ "nextElement", "method", "comment", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/util/ArrayEnumeration.java#L48-L69
train
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/viewer/LogViewer.java
LogViewer.execute
public int execute(String[] args) { Map<String, LevelDetails> levels = readLevels(System.getProperty("logviewer.custom.levels")); String[] header = readHeader(System.getProperty("logviewer.custom.header")); return execute(args, levels, header); }
java
public int execute(String[] args) { Map<String, LevelDetails> levels = readLevels(System.getProperty("logviewer.custom.levels")); String[] header = readHeader(System.getProperty("logviewer.custom.header")); return execute(args, levels, header); }
[ "public", "int", "execute", "(", "String", "[", "]", "args", ")", "{", "Map", "<", "String", ",", "LevelDetails", ">", "levels", "=", "readLevels", "(", "System", ".", "getProperty", "(", "\"logviewer.custom.levels\"", ")", ")", ";", "String", "[", "]", "header", "=", "readHeader", "(", "System", ".", "getProperty", "(", "\"logviewer.custom.header\"", ")", ")", ";", "return", "execute", "(", "args", ",", "levels", ",", "header", ")", ";", "}" ]
Runs LogViewer using values in System Properties to find custom levels and header. @param args - command line arguments to LogViewer @return code indicating status of the execution: 0 on success, 1 otherwise.
[ "Runs", "LogViewer", "using", "values", "in", "System", "Properties", "to", "find", "custom", "levels", "and", "header", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/viewer/LogViewer.java#L271-L276
train
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/viewer/LogViewer.java
LogViewer.execute
public int execute(String[] args, Map<String, LevelDetails> levels, String[] header) { levelString = getLevelsString(levels); RepositoryReaderImpl logRepository; try { // Parse the command line arguments and validate arguments if (parseCmdLineArgs(args) || validateSettings()) { return 0; } // Setup custom header here since parseCmdLineArgs may alter the formatter. if (header != null) { theFormatter.setCustomHeader(header); } // Call HPEL repository API to get log entries logRepository = new RepositoryReaderImpl(binaryRepositoryDir); if (mainInstanceId != null) { // Verify requested instance ID. ServerInstanceLogRecordList silrl = logRepository.getLogListForServerInstance(mainInstanceId); if (silrl == null || silrl.getStartTime() == null || !silrl.getStartTime().equals(mainInstanceId) || (subInstanceId != null && !subInstanceId.isEmpty() && !silrl.getChildren().containsKey(subInstanceId))) { throw new IllegalArgumentException(getLocalizedString("LVM_ERROR_INSTANCEID")); } } // Create the output stream (either an output file or Console) PrintStream outps = createOutputStream(); /* * Create a filter object with our search criteria, passing null for startDate and stopDate as we will * be using the API to search by date for efficiency. */ LogViewerFilter searchCriteria = new LogViewerFilter(startDate, stopDate, minLevel, maxLevel, includeLoggers, excludeLoggers, hexThreadID, message, excludeMessages, extensions); //Determine if we just display instances or start displaying records based on the -listInstances option if (listInstances) { Iterable<ServerInstanceLogRecordList> results = logRepository.getLogLists(); displayInstances(outps, results); } else { Properties initialProps = logRepository.getLogListForCurrentServerInstance().getHeader(); if (initialProps != null) { boolean isZOS = "Y".equalsIgnoreCase(initialProps.getProperty(ServerInstanceLogRecordList.HEADER_ISZOS)); //instanceId is required for z/OS. If it was not provided, then list the possible instances if (isZOS && !latestInstance && mainInstanceId == null) { Iterable<ServerInstanceLogRecordList> results = logRepository.getLogLists(); displayInstances(outps, results); } else { displayRecords(outps, searchCriteria, logRepository, mainInstanceId, subInstanceId); } } } } catch (IllegalArgumentException e) { System.err.println(e.getMessage()); return 1; } return 0; }
java
public int execute(String[] args, Map<String, LevelDetails> levels, String[] header) { levelString = getLevelsString(levels); RepositoryReaderImpl logRepository; try { // Parse the command line arguments and validate arguments if (parseCmdLineArgs(args) || validateSettings()) { return 0; } // Setup custom header here since parseCmdLineArgs may alter the formatter. if (header != null) { theFormatter.setCustomHeader(header); } // Call HPEL repository API to get log entries logRepository = new RepositoryReaderImpl(binaryRepositoryDir); if (mainInstanceId != null) { // Verify requested instance ID. ServerInstanceLogRecordList silrl = logRepository.getLogListForServerInstance(mainInstanceId); if (silrl == null || silrl.getStartTime() == null || !silrl.getStartTime().equals(mainInstanceId) || (subInstanceId != null && !subInstanceId.isEmpty() && !silrl.getChildren().containsKey(subInstanceId))) { throw new IllegalArgumentException(getLocalizedString("LVM_ERROR_INSTANCEID")); } } // Create the output stream (either an output file or Console) PrintStream outps = createOutputStream(); /* * Create a filter object with our search criteria, passing null for startDate and stopDate as we will * be using the API to search by date for efficiency. */ LogViewerFilter searchCriteria = new LogViewerFilter(startDate, stopDate, minLevel, maxLevel, includeLoggers, excludeLoggers, hexThreadID, message, excludeMessages, extensions); //Determine if we just display instances or start displaying records based on the -listInstances option if (listInstances) { Iterable<ServerInstanceLogRecordList> results = logRepository.getLogLists(); displayInstances(outps, results); } else { Properties initialProps = logRepository.getLogListForCurrentServerInstance().getHeader(); if (initialProps != null) { boolean isZOS = "Y".equalsIgnoreCase(initialProps.getProperty(ServerInstanceLogRecordList.HEADER_ISZOS)); //instanceId is required for z/OS. If it was not provided, then list the possible instances if (isZOS && !latestInstance && mainInstanceId == null) { Iterable<ServerInstanceLogRecordList> results = logRepository.getLogLists(); displayInstances(outps, results); } else { displayRecords(outps, searchCriteria, logRepository, mainInstanceId, subInstanceId); } } } } catch (IllegalArgumentException e) { System.err.println(e.getMessage()); return 1; } return 0; }
[ "public", "int", "execute", "(", "String", "[", "]", "args", ",", "Map", "<", "String", ",", "LevelDetails", ">", "levels", ",", "String", "[", "]", "header", ")", "{", "levelString", "=", "getLevelsString", "(", "levels", ")", ";", "RepositoryReaderImpl", "logRepository", ";", "try", "{", "// Parse the command line arguments and validate arguments", "if", "(", "parseCmdLineArgs", "(", "args", ")", "||", "validateSettings", "(", ")", ")", "{", "return", "0", ";", "}", "// Setup custom header here since parseCmdLineArgs may alter the formatter.", "if", "(", "header", "!=", "null", ")", "{", "theFormatter", ".", "setCustomHeader", "(", "header", ")", ";", "}", "// Call HPEL repository API to get log entries", "logRepository", "=", "new", "RepositoryReaderImpl", "(", "binaryRepositoryDir", ")", ";", "if", "(", "mainInstanceId", "!=", "null", ")", "{", "// Verify requested instance ID.", "ServerInstanceLogRecordList", "silrl", "=", "logRepository", ".", "getLogListForServerInstance", "(", "mainInstanceId", ")", ";", "if", "(", "silrl", "==", "null", "||", "silrl", ".", "getStartTime", "(", ")", "==", "null", "||", "!", "silrl", ".", "getStartTime", "(", ")", ".", "equals", "(", "mainInstanceId", ")", "||", "(", "subInstanceId", "!=", "null", "&&", "!", "subInstanceId", ".", "isEmpty", "(", ")", "&&", "!", "silrl", ".", "getChildren", "(", ")", ".", "containsKey", "(", "subInstanceId", ")", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "getLocalizedString", "(", "\"LVM_ERROR_INSTANCEID\"", ")", ")", ";", "}", "}", "// Create the output stream (either an output file or Console)", "PrintStream", "outps", "=", "createOutputStream", "(", ")", ";", "/*\n * Create a filter object with our search criteria, passing null for startDate and stopDate as we will\n * be using the API to search by date for efficiency.\n */", "LogViewerFilter", "searchCriteria", "=", "new", "LogViewerFilter", "(", "startDate", ",", "stopDate", ",", "minLevel", ",", "maxLevel", ",", "includeLoggers", ",", "excludeLoggers", ",", "hexThreadID", ",", "message", ",", "excludeMessages", ",", "extensions", ")", ";", "//Determine if we just display instances or start displaying records based on the -listInstances option", "if", "(", "listInstances", ")", "{", "Iterable", "<", "ServerInstanceLogRecordList", ">", "results", "=", "logRepository", ".", "getLogLists", "(", ")", ";", "displayInstances", "(", "outps", ",", "results", ")", ";", "}", "else", "{", "Properties", "initialProps", "=", "logRepository", ".", "getLogListForCurrentServerInstance", "(", ")", ".", "getHeader", "(", ")", ";", "if", "(", "initialProps", "!=", "null", ")", "{", "boolean", "isZOS", "=", "\"Y\"", ".", "equalsIgnoreCase", "(", "initialProps", ".", "getProperty", "(", "ServerInstanceLogRecordList", ".", "HEADER_ISZOS", ")", ")", ";", "//instanceId is required for z/OS. If it was not provided, then list the possible instances", "if", "(", "isZOS", "&&", "!", "latestInstance", "&&", "mainInstanceId", "==", "null", ")", "{", "Iterable", "<", "ServerInstanceLogRecordList", ">", "results", "=", "logRepository", ".", "getLogLists", "(", ")", ";", "displayInstances", "(", "outps", ",", "results", ")", ";", "}", "else", "{", "displayRecords", "(", "outps", ",", "searchCriteria", ",", "logRepository", ",", "mainInstanceId", ",", "subInstanceId", ")", ";", "}", "}", "}", "}", "catch", "(", "IllegalArgumentException", "e", ")", "{", "System", ".", "err", ".", "println", "(", "e", ".", "getMessage", "(", ")", ")", ";", "return", "1", ";", "}", "return", "0", ";", "}" ]
Runs LogViewer. @param args command line arguments to LogViewer @param levels map of custom level names to their attributes @param header custom header template as an array of strings @return code indicating status of the execution: 0 on success, 1 otherwise.
[ "Runs", "LogViewer", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/viewer/LogViewer.java#L286-L349
train
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/viewer/LogViewer.java
LogViewer.collectAllKids
private long collectAllKids(ArrayList<DisplayInstance> result, ServerInstanceLogRecordList list) { long timestamp = -1; RepositoryLogRecord first = list.iterator().next(); if (first != null) { timestamp = first.getMillis(); } for (Entry<String, ServerInstanceLogRecordList> kid : list.getChildren().entrySet()) { ArrayList<DisplayInstance> kidResult = new ArrayList<DisplayInstance>(); long curTimestamp = collectAllKids(kidResult, kid.getValue()); // Add this kid only if there's a record among its descendants if (curTimestamp > 0) { result.add(new DisplayInstance(kid.getKey(), Long.toString(list.getStartTime().getTime()), curTimestamp, kidResult)); if (timestamp < curTimestamp) { timestamp = curTimestamp; } } } return timestamp; }
java
private long collectAllKids(ArrayList<DisplayInstance> result, ServerInstanceLogRecordList list) { long timestamp = -1; RepositoryLogRecord first = list.iterator().next(); if (first != null) { timestamp = first.getMillis(); } for (Entry<String, ServerInstanceLogRecordList> kid : list.getChildren().entrySet()) { ArrayList<DisplayInstance> kidResult = new ArrayList<DisplayInstance>(); long curTimestamp = collectAllKids(kidResult, kid.getValue()); // Add this kid only if there's a record among its descendants if (curTimestamp > 0) { result.add(new DisplayInstance(kid.getKey(), Long.toString(list.getStartTime().getTime()), curTimestamp, kidResult)); if (timestamp < curTimestamp) { timestamp = curTimestamp; } } } return timestamp; }
[ "private", "long", "collectAllKids", "(", "ArrayList", "<", "DisplayInstance", ">", "result", ",", "ServerInstanceLogRecordList", "list", ")", "{", "long", "timestamp", "=", "-", "1", ";", "RepositoryLogRecord", "first", "=", "list", ".", "iterator", "(", ")", ".", "next", "(", ")", ";", "if", "(", "first", "!=", "null", ")", "{", "timestamp", "=", "first", ".", "getMillis", "(", ")", ";", "}", "for", "(", "Entry", "<", "String", ",", "ServerInstanceLogRecordList", ">", "kid", ":", "list", ".", "getChildren", "(", ")", ".", "entrySet", "(", ")", ")", "{", "ArrayList", "<", "DisplayInstance", ">", "kidResult", "=", "new", "ArrayList", "<", "DisplayInstance", ">", "(", ")", ";", "long", "curTimestamp", "=", "collectAllKids", "(", "kidResult", ",", "kid", ".", "getValue", "(", ")", ")", ";", "// Add this kid only if there's a record among its descendants", "if", "(", "curTimestamp", ">", "0", ")", "{", "result", ".", "add", "(", "new", "DisplayInstance", "(", "kid", ".", "getKey", "(", ")", ",", "Long", ".", "toString", "(", "list", ".", "getStartTime", "(", ")", ".", "getTime", "(", ")", ")", ",", "curTimestamp", ",", "kidResult", ")", ")", ";", "if", "(", "timestamp", "<", "curTimestamp", ")", "{", "timestamp", "=", "curTimestamp", ";", "}", "}", "}", "return", "timestamp", ";", "}" ]
collects all descendant instances into an array and calculates largest timestamp of their first records. @param result array to add all descendant instances to. @param list the root instance result. @return largest timestamp among first record timestamps.
[ "collects", "all", "descendant", "instances", "into", "an", "array", "and", "calculates", "largest", "timestamp", "of", "their", "first", "records", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/viewer/LogViewer.java#L1022-L1043
train
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/viewer/LogViewer.java
LogViewer.createLevelByString
private Level createLevelByString(String levelString) throws IllegalArgumentException { try { return Level.parse(levelString.toUpperCase()); //return WsLevel.parse(levelString.toUpperCase()); } catch (Exception npe) { throw new IllegalArgumentException(getLocalizedParmString("CWTRA0013E", new Object[] { levelString })); } }
java
private Level createLevelByString(String levelString) throws IllegalArgumentException { try { return Level.parse(levelString.toUpperCase()); //return WsLevel.parse(levelString.toUpperCase()); } catch (Exception npe) { throw new IllegalArgumentException(getLocalizedParmString("CWTRA0013E", new Object[] { levelString })); } }
[ "private", "Level", "createLevelByString", "(", "String", "levelString", ")", "throws", "IllegalArgumentException", "{", "try", "{", "return", "Level", ".", "parse", "(", "levelString", ".", "toUpperCase", "(", ")", ")", ";", "//return WsLevel.parse(levelString.toUpperCase());", "}", "catch", "(", "Exception", "npe", ")", "{", "throw", "new", "IllegalArgumentException", "(", "getLocalizedParmString", "(", "\"CWTRA0013E\"", ",", "new", "Object", "[", "]", "{", "levelString", "}", ")", ")", ";", "}", "}" ]
This method creates a java.util.Level object from a string with the level name. @param levelString - a String representing the name of the Level. @return a Level object
[ "This", "method", "creates", "a", "java", ".", "util", ".", "Level", "object", "from", "a", "string", "with", "the", "level", "name", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/viewer/LogViewer.java#L1409-L1417
train
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/viewer/LogViewer.java
LogViewer.setInstanceId
void setInstanceId(String instanceId) throws IllegalArgumentException { if (instanceId != null && !"".equals(instanceId)) { subInstanceId = getSubProcessInstanceId(instanceId); try { long id = getProcessInstanceId(instanceId); mainInstanceId = id < 0 ? null : new Date(id); } catch (NumberFormatException nfe) { throw new IllegalArgumentException(getLocalizedString("LVM_ERROR_INSTANCEID"), nfe); } } }
java
void setInstanceId(String instanceId) throws IllegalArgumentException { if (instanceId != null && !"".equals(instanceId)) { subInstanceId = getSubProcessInstanceId(instanceId); try { long id = getProcessInstanceId(instanceId); mainInstanceId = id < 0 ? null : new Date(id); } catch (NumberFormatException nfe) { throw new IllegalArgumentException(getLocalizedString("LVM_ERROR_INSTANCEID"), nfe); } } }
[ "void", "setInstanceId", "(", "String", "instanceId", ")", "throws", "IllegalArgumentException", "{", "if", "(", "instanceId", "!=", "null", "&&", "!", "\"\"", ".", "equals", "(", "instanceId", ")", ")", "{", "subInstanceId", "=", "getSubProcessInstanceId", "(", "instanceId", ")", ";", "try", "{", "long", "id", "=", "getProcessInstanceId", "(", "instanceId", ")", ";", "mainInstanceId", "=", "id", "<", "0", "?", "null", ":", "new", "Date", "(", "id", ")", ";", "}", "catch", "(", "NumberFormatException", "nfe", ")", "{", "throw", "new", "IllegalArgumentException", "(", "getLocalizedString", "(", "\"LVM_ERROR_INSTANCEID\"", ")", ",", "nfe", ")", ";", "}", "}", "}" ]
Parses the instanceId into the requested main process instanceId and the subprocess instanceid. The main process instanceId must be a long value as the main instance Id is a timestamp. @param instanceId - the instanceId requested by the user
[ "Parses", "the", "instanceId", "into", "the", "requested", "main", "process", "instanceId", "and", "the", "subprocess", "instanceid", ".", "The", "main", "process", "instanceId", "must", "be", "a", "long", "value", "as", "the", "main", "instance", "Id", "is", "a", "timestamp", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/viewer/LogViewer.java#L1425-L1437
train
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/viewer/LogViewer.java
LogViewer.listRepositoryChoices
protected File[] listRepositoryChoices() { // check current location String currentDir = System.getProperty("log.repository.root"); if (currentDir == null) currentDir = System.getProperty("user.dir"); File logDir = new File(currentDir); if (logDir.isDirectory()) { File[] result = RepositoryReaderImpl.listRepositories(logDir); if (result.length == 0 && (RepositoryReaderImpl.containsLogFiles(logDir) || tailInterval > 0)) { return new File[] { logDir }; } else { return result; } } else { return new File[] {}; } }
java
protected File[] listRepositoryChoices() { // check current location String currentDir = System.getProperty("log.repository.root"); if (currentDir == null) currentDir = System.getProperty("user.dir"); File logDir = new File(currentDir); if (logDir.isDirectory()) { File[] result = RepositoryReaderImpl.listRepositories(logDir); if (result.length == 0 && (RepositoryReaderImpl.containsLogFiles(logDir) || tailInterval > 0)) { return new File[] { logDir }; } else { return result; } } else { return new File[] {}; } }
[ "protected", "File", "[", "]", "listRepositoryChoices", "(", ")", "{", "// check current location", "String", "currentDir", "=", "System", ".", "getProperty", "(", "\"log.repository.root\"", ")", ";", "if", "(", "currentDir", "==", "null", ")", "currentDir", "=", "System", ".", "getProperty", "(", "\"user.dir\"", ")", ";", "File", "logDir", "=", "new", "File", "(", "currentDir", ")", ";", "if", "(", "logDir", ".", "isDirectory", "(", ")", ")", "{", "File", "[", "]", "result", "=", "RepositoryReaderImpl", ".", "listRepositories", "(", "logDir", ")", ";", "if", "(", "result", ".", "length", "==", "0", "&&", "(", "RepositoryReaderImpl", ".", "containsLogFiles", "(", "logDir", ")", "||", "tailInterval", ">", "0", ")", ")", "{", "return", "new", "File", "[", "]", "{", "logDir", "}", ";", "}", "else", "{", "return", "result", ";", "}", "}", "else", "{", "return", "new", "File", "[", "]", "{", "}", ";", "}", "}" ]
Lists directories containing HPEL repositories. It is called when repository is not specified explicitly in the arguments @return List of files which can be used as repositories
[ "Lists", "directories", "containing", "HPEL", "repositories", ".", "It", "is", "called", "when", "repository", "is", "not", "specified", "explicitly", "in", "the", "arguments" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/viewer/LogViewer.java#L1764-L1780
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/wsspi/http/channel/compression/GzipInputHandler.java
GzipInputHandler.skipPast
private int skipPast(byte[] data, int pos, byte target) { int index = pos; while (index < data.length) { if (target == data[index++]) { return index; } } return index; }
java
private int skipPast(byte[] data, int pos, byte target) { int index = pos; while (index < data.length) { if (target == data[index++]) { return index; } } return index; }
[ "private", "int", "skipPast", "(", "byte", "[", "]", "data", ",", "int", "pos", ",", "byte", "target", ")", "{", "int", "index", "=", "pos", ";", "while", "(", "index", "<", "data", ".", "length", ")", "{", "if", "(", "target", "==", "data", "[", "index", "++", "]", ")", "{", "return", "index", ";", "}", "}", "return", "index", ";", "}" ]
Skip until it runs out of input data or finds the target byte. @param data @param pos @param target @return pos
[ "Skip", "until", "it", "runs", "out", "of", "input", "data", "or", "finds", "the", "target", "byte", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/wsspi/http/channel/compression/GzipInputHandler.java#L166-L174
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/wsspi/http/channel/compression/GzipInputHandler.java
GzipInputHandler.parseTrailer
private int parseTrailer(byte[] input, int inOffset, List<WsByteBuffer> list) throws DataFormatException { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Parsing trailer, offset=" + this.parseOffset + " val=" + this.parseInt); } int offset = inOffset; long val = 0L; // bytes are in lowest order first while (8 > this.parseOffset && offset < input.length) { switch (this.parseOffset) { // even bytes are just going to save the first byte of an int case 0: case 2: case 4: case 6: this.parseFirstByte = input[offset] & 0xff; break; // bytes 1 and 5 are the 2nd byte of that int case 1: case 5: this.parseInt = ((input[offset] & 0xff) << 8) | this.parseFirstByte; break; // 3 and 7 mark the final bytes of the 2 int values case 3: // reached the end of the checksum int val = ((input[offset] & 0xff) << 8) | this.parseFirstByte; val = (val << 16) | this.parseInt; if (this.checksum.getValue() != val) { String msg = "Checksum does not match; crc=" + this.checksum.getValue() + " trailer=" + val; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, msg); } release(list); throw new DataFormatException(msg); } break; case 7: // reached the end of the "num bytes" int val = ((input[offset] & 0xff) << 8) | this.parseFirstByte; val = (val << 16) | this.parseInt; if (this.inflater.getBytesWritten() != val) { String msg = "BytesWritten does not match; inflater=" + this.inflater.getBytesWritten() + " trailer=" + val; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, msg); } release(list); throw new DataFormatException(msg); } // having fully parsed the trailer, if we are going to re-enter decompression, then we need to reset this.resetNeededToProceed = true; break; default: break; } offset++; this.parseOffset++; } return offset; }
java
private int parseTrailer(byte[] input, int inOffset, List<WsByteBuffer> list) throws DataFormatException { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Parsing trailer, offset=" + this.parseOffset + " val=" + this.parseInt); } int offset = inOffset; long val = 0L; // bytes are in lowest order first while (8 > this.parseOffset && offset < input.length) { switch (this.parseOffset) { // even bytes are just going to save the first byte of an int case 0: case 2: case 4: case 6: this.parseFirstByte = input[offset] & 0xff; break; // bytes 1 and 5 are the 2nd byte of that int case 1: case 5: this.parseInt = ((input[offset] & 0xff) << 8) | this.parseFirstByte; break; // 3 and 7 mark the final bytes of the 2 int values case 3: // reached the end of the checksum int val = ((input[offset] & 0xff) << 8) | this.parseFirstByte; val = (val << 16) | this.parseInt; if (this.checksum.getValue() != val) { String msg = "Checksum does not match; crc=" + this.checksum.getValue() + " trailer=" + val; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, msg); } release(list); throw new DataFormatException(msg); } break; case 7: // reached the end of the "num bytes" int val = ((input[offset] & 0xff) << 8) | this.parseFirstByte; val = (val << 16) | this.parseInt; if (this.inflater.getBytesWritten() != val) { String msg = "BytesWritten does not match; inflater=" + this.inflater.getBytesWritten() + " trailer=" + val; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, msg); } release(list); throw new DataFormatException(msg); } // having fully parsed the trailer, if we are going to re-enter decompression, then we need to reset this.resetNeededToProceed = true; break; default: break; } offset++; this.parseOffset++; } return offset; }
[ "private", "int", "parseTrailer", "(", "byte", "[", "]", "input", ",", "int", "inOffset", ",", "List", "<", "WsByteBuffer", ">", "list", ")", "throws", "DataFormatException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Parsing trailer, offset=\"", "+", "this", ".", "parseOffset", "+", "\" val=\"", "+", "this", ".", "parseInt", ")", ";", "}", "int", "offset", "=", "inOffset", ";", "long", "val", "=", "0L", ";", "// bytes are in lowest order first", "while", "(", "8", ">", "this", ".", "parseOffset", "&&", "offset", "<", "input", ".", "length", ")", "{", "switch", "(", "this", ".", "parseOffset", ")", "{", "// even bytes are just going to save the first byte of an int", "case", "0", ":", "case", "2", ":", "case", "4", ":", "case", "6", ":", "this", ".", "parseFirstByte", "=", "input", "[", "offset", "]", "&", "0xff", ";", "break", ";", "// bytes 1 and 5 are the 2nd byte of that int", "case", "1", ":", "case", "5", ":", "this", ".", "parseInt", "=", "(", "(", "input", "[", "offset", "]", "&", "0xff", ")", "<<", "8", ")", "|", "this", ".", "parseFirstByte", ";", "break", ";", "// 3 and 7 mark the final bytes of the 2 int values", "case", "3", ":", "// reached the end of the checksum int", "val", "=", "(", "(", "input", "[", "offset", "]", "&", "0xff", ")", "<<", "8", ")", "|", "this", ".", "parseFirstByte", ";", "val", "=", "(", "val", "<<", "16", ")", "|", "this", ".", "parseInt", ";", "if", "(", "this", ".", "checksum", ".", "getValue", "(", ")", "!=", "val", ")", "{", "String", "msg", "=", "\"Checksum does not match; crc=\"", "+", "this", ".", "checksum", ".", "getValue", "(", ")", "+", "\" trailer=\"", "+", "val", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "msg", ")", ";", "}", "release", "(", "list", ")", ";", "throw", "new", "DataFormatException", "(", "msg", ")", ";", "}", "break", ";", "case", "7", ":", "// reached the end of the \"num bytes\" int", "val", "=", "(", "(", "input", "[", "offset", "]", "&", "0xff", ")", "<<", "8", ")", "|", "this", ".", "parseFirstByte", ";", "val", "=", "(", "val", "<<", "16", ")", "|", "this", ".", "parseInt", ";", "if", "(", "this", ".", "inflater", ".", "getBytesWritten", "(", ")", "!=", "val", ")", "{", "String", "msg", "=", "\"BytesWritten does not match; inflater=\"", "+", "this", ".", "inflater", ".", "getBytesWritten", "(", ")", "+", "\" trailer=\"", "+", "val", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "msg", ")", ";", "}", "release", "(", "list", ")", ";", "throw", "new", "DataFormatException", "(", "msg", ")", ";", "}", "// having fully parsed the trailer, if we are going to re-enter decompression, then we need to reset", "this", ".", "resetNeededToProceed", "=", "true", ";", "break", ";", "default", ":", "break", ";", "}", "offset", "++", ";", "this", ".", "parseOffset", "++", ";", "}", "return", "offset", ";", "}" ]
Parse past the GZIP trailer information. This is the two ints for the CRC32 checksum validation. @param input @param inOffset @param list @return new offset @throws DataFormatException - if the trailer data is wrong
[ "Parse", "past", "the", "GZIP", "trailer", "information", ".", "This", "is", "the", "two", "ints", "for", "the", "CRC32", "checksum", "validation", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/wsspi/http/channel/compression/GzipInputHandler.java#L327-L386
train
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/wsspi/channelfw/base/OutboundConnectorLink.java
OutboundConnectorLink.logClosedException
public void logClosedException(Exception e) { // Note: this may be a normal occurance so don't log error, just debug. if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Connection closed with exception: " + e.getMessage()); } }
java
public void logClosedException(Exception e) { // Note: this may be a normal occurance so don't log error, just debug. if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Connection closed with exception: " + e.getMessage()); } }
[ "public", "void", "logClosedException", "(", "Exception", "e", ")", "{", "// Note: this may be a normal occurance so don't log error, just debug.", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Connection closed with exception: \"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}" ]
This logs the error if the connection was closed by a higher level channel with an error. @param e
[ "This", "logs", "the", "error", "if", "the", "connection", "was", "closed", "by", "a", "higher", "level", "channel", "with", "an", "error", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/wsspi/channelfw/base/OutboundConnectorLink.java#L129-L134
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/ra/inbound/impl/SibRaAbstractConsumerSession.java
SibRaAbstractConsumerSession.outOfScope
void outOfScope() { final String methodName = "outOfScope"; if (TRACE.isEntryEnabled()) { SibTr.entry(this, TRACE, methodName); } _outOfScope = true; try { // Close cloned connection so that it, and any resource created // from it, also throw SIObjectClosedException _connectionClone.close(); } catch (final SIException exception) { FFDCFilter .processException( exception, "com.ibm.ws.sib.ra.inbound.impl.SibRaAbstractConsumerSession.outOfScope", FFDC_PROBE_1, this); if (TRACE.isEventEnabled()) { SibTr.exception(this, TRACE, exception); } // Swallow exception } catch (final SIErrorException exception) { FFDCFilter .processException( exception, "com.ibm.ws.sib.ra.inbound.impl.SibRaAbstractConsumerSession.outOfScope", FFDC_PROBE_2, this); if (TRACE.isEventEnabled()) { SibTr.exception(this, TRACE, exception); } // Swallow exception } if (TRACE.isEntryEnabled()) { SibTr.exit(this, TRACE, methodName); } }
java
void outOfScope() { final String methodName = "outOfScope"; if (TRACE.isEntryEnabled()) { SibTr.entry(this, TRACE, methodName); } _outOfScope = true; try { // Close cloned connection so that it, and any resource created // from it, also throw SIObjectClosedException _connectionClone.close(); } catch (final SIException exception) { FFDCFilter .processException( exception, "com.ibm.ws.sib.ra.inbound.impl.SibRaAbstractConsumerSession.outOfScope", FFDC_PROBE_1, this); if (TRACE.isEventEnabled()) { SibTr.exception(this, TRACE, exception); } // Swallow exception } catch (final SIErrorException exception) { FFDCFilter .processException( exception, "com.ibm.ws.sib.ra.inbound.impl.SibRaAbstractConsumerSession.outOfScope", FFDC_PROBE_2, this); if (TRACE.isEventEnabled()) { SibTr.exception(this, TRACE, exception); } // Swallow exception } if (TRACE.isEntryEnabled()) { SibTr.exit(this, TRACE, methodName); } }
[ "void", "outOfScope", "(", ")", "{", "final", "String", "methodName", "=", "\"outOfScope\"", ";", "if", "(", "TRACE", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "entry", "(", "this", ",", "TRACE", ",", "methodName", ")", ";", "}", "_outOfScope", "=", "true", ";", "try", "{", "// Close cloned connection so that it, and any resource created", "// from it, also throw SIObjectClosedException", "_connectionClone", ".", "close", "(", ")", ";", "}", "catch", "(", "final", "SIException", "exception", ")", "{", "FFDCFilter", ".", "processException", "(", "exception", ",", "\"com.ibm.ws.sib.ra.inbound.impl.SibRaAbstractConsumerSession.outOfScope\"", ",", "FFDC_PROBE_1", ",", "this", ")", ";", "if", "(", "TRACE", ".", "isEventEnabled", "(", ")", ")", "{", "SibTr", ".", "exception", "(", "this", ",", "TRACE", ",", "exception", ")", ";", "}", "// Swallow exception", "}", "catch", "(", "final", "SIErrorException", "exception", ")", "{", "FFDCFilter", ".", "processException", "(", "exception", ",", "\"com.ibm.ws.sib.ra.inbound.impl.SibRaAbstractConsumerSession.outOfScope\"", ",", "FFDC_PROBE_2", ",", "this", ")", ";", "if", "(", "TRACE", ".", "isEventEnabled", "(", ")", ")", "{", "SibTr", ".", "exception", "(", "this", ",", "TRACE", ",", "exception", ")", ";", "}", "// Swallow exception", "}", "if", "(", "TRACE", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "exit", "(", "this", ",", "TRACE", ",", "methodName", ")", ";", "}", "}" ]
Called to indicate that this session is now out of scope.
[ "Called", "to", "indicate", "that", "this", "session", "is", "now", "out", "of", "scope", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/ra/inbound/impl/SibRaAbstractConsumerSession.java#L192-L237
train
OpenLiberty/open-liberty
dev/com.ibm.ws.security.appbnd/src/com/ibm/ws/security/appbnd/internal/delegation/DefaultDelegationProvider.java
DefaultDelegationProvider.createAppToSecurityRolesMapping
public void createAppToSecurityRolesMapping(String appName, Collection<SecurityRole> securityRoles) { //only add it if we don't have a cached copy appToSecurityRolesMap.putIfAbsent(appName, securityRoles); }
java
public void createAppToSecurityRolesMapping(String appName, Collection<SecurityRole> securityRoles) { //only add it if we don't have a cached copy appToSecurityRolesMap.putIfAbsent(appName, securityRoles); }
[ "public", "void", "createAppToSecurityRolesMapping", "(", "String", "appName", ",", "Collection", "<", "SecurityRole", ">", "securityRoles", ")", "{", "//only add it if we don't have a cached copy", "appToSecurityRolesMap", ".", "putIfAbsent", "(", "appName", ",", "securityRoles", ")", ";", "}" ]
Creates the application to security roles mapping for a given application. @param appName the name of the application for which the mappings belong to. @param securityRoles the security roles of the application.
[ "Creates", "the", "application", "to", "security", "roles", "mapping", "for", "a", "given", "application", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.appbnd/src/com/ibm/ws/security/appbnd/internal/delegation/DefaultDelegationProvider.java#L196-L199
train
OpenLiberty/open-liberty
dev/com.ibm.ws.security.appbnd/src/com/ibm/ws/security/appbnd/internal/delegation/DefaultDelegationProvider.java
DefaultDelegationProvider.removeRoleToRunAsMapping
public void removeRoleToRunAsMapping(String appName) { Map<String, RunAs> roleToRunAsMap = roleToRunAsMappingPerApp.get(appName); if (roleToRunAsMap != null) { roleToRunAsMap.clear(); } appToSecurityRolesMap.remove(appName); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Updated the appToSecurityRolesMap: " + appToSecurityRolesMap.toString()); } removeRoleToWarningMapping(appName); }
java
public void removeRoleToRunAsMapping(String appName) { Map<String, RunAs> roleToRunAsMap = roleToRunAsMappingPerApp.get(appName); if (roleToRunAsMap != null) { roleToRunAsMap.clear(); } appToSecurityRolesMap.remove(appName); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Updated the appToSecurityRolesMap: " + appToSecurityRolesMap.toString()); } removeRoleToWarningMapping(appName); }
[ "public", "void", "removeRoleToRunAsMapping", "(", "String", "appName", ")", "{", "Map", "<", "String", ",", "RunAs", ">", "roleToRunAsMap", "=", "roleToRunAsMappingPerApp", ".", "get", "(", "appName", ")", ";", "if", "(", "roleToRunAsMap", "!=", "null", ")", "{", "roleToRunAsMap", ".", "clear", "(", ")", ";", "}", "appToSecurityRolesMap", ".", "remove", "(", "appName", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Updated the appToSecurityRolesMap: \"", "+", "appToSecurityRolesMap", ".", "toString", "(", ")", ")", ";", "}", "removeRoleToWarningMapping", "(", "appName", ")", ";", "}" ]
Removes the role to RunAs mappings for a given application. @param appName the name of the application for which the mappings belong to.
[ "Removes", "the", "role", "to", "RunAs", "mappings", "for", "a", "given", "application", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.appbnd/src/com/ibm/ws/security/appbnd/internal/delegation/DefaultDelegationProvider.java#L206-L218
train
OpenLiberty/open-liberty
dev/com.ibm.ws.security.appbnd/src/com/ibm/ws/security/appbnd/internal/delegation/DefaultDelegationProvider.java
DefaultDelegationProvider.removeRoleToWarningMapping
public void removeRoleToWarningMapping(String appName) { Map<String, Boolean> roleToWarningMap = roleToWarningMappingPerApp.get(appName); if (roleToWarningMap != null) { roleToWarningMap.clear(); } roleToWarningMappingPerApp.remove(appName); }
java
public void removeRoleToWarningMapping(String appName) { Map<String, Boolean> roleToWarningMap = roleToWarningMappingPerApp.get(appName); if (roleToWarningMap != null) { roleToWarningMap.clear(); } roleToWarningMappingPerApp.remove(appName); }
[ "public", "void", "removeRoleToWarningMapping", "(", "String", "appName", ")", "{", "Map", "<", "String", ",", "Boolean", ">", "roleToWarningMap", "=", "roleToWarningMappingPerApp", ".", "get", "(", "appName", ")", ";", "if", "(", "roleToWarningMap", "!=", "null", ")", "{", "roleToWarningMap", ".", "clear", "(", ")", ";", "}", "roleToWarningMappingPerApp", ".", "remove", "(", "appName", ")", ";", "}" ]
Removes the role to warning mappings for a given application. @param appName the name of the application for which the mappings belong to.
[ "Removes", "the", "role", "to", "warning", "mappings", "for", "a", "given", "application", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.appbnd/src/com/ibm/ws/security/appbnd/internal/delegation/DefaultDelegationProvider.java#L225-L231
train
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.hpel/src/com/ibm/ejs/ras/hpel/HpelSystemStream.java
HpelSystemStream.determineHandlers
private static void determineHandlers() { /* * find the handlers that we are dispatching to */ if (textHandler != null && !logRepositoryConfiguration.isTextEnabled()) textHandler = null ; // Don't do this work if only text and text is not enabled (if so, it will always be null) 666241.1 if (binaryHandler != null && !logRepositoryConfiguration.isTextEnabled()) return ; Handler[] handlers = Logger.getLogger("").getHandlers(); for (Handler handler : handlers) { String name = handler.getClass().getName(); if (BINLOGGER_HANDLER_NAME.equals(name)) { binaryHandler = (LogRecordHandler) handler; } else if (TEXTLOGGER_HANDLER_NAME.equals(name)) { textHandler = (LogRecordTextHandler) handler; } } }
java
private static void determineHandlers() { /* * find the handlers that we are dispatching to */ if (textHandler != null && !logRepositoryConfiguration.isTextEnabled()) textHandler = null ; // Don't do this work if only text and text is not enabled (if so, it will always be null) 666241.1 if (binaryHandler != null && !logRepositoryConfiguration.isTextEnabled()) return ; Handler[] handlers = Logger.getLogger("").getHandlers(); for (Handler handler : handlers) { String name = handler.getClass().getName(); if (BINLOGGER_HANDLER_NAME.equals(name)) { binaryHandler = (LogRecordHandler) handler; } else if (TEXTLOGGER_HANDLER_NAME.equals(name)) { textHandler = (LogRecordTextHandler) handler; } } }
[ "private", "static", "void", "determineHandlers", "(", ")", "{", "/*\n * find the handlers that we are dispatching to\n */", "if", "(", "textHandler", "!=", "null", "&&", "!", "logRepositoryConfiguration", ".", "isTextEnabled", "(", ")", ")", "textHandler", "=", "null", ";", "// Don't do this work if only text and text is not enabled (if so, it will always be null) 666241.1", "if", "(", "binaryHandler", "!=", "null", "&&", "!", "logRepositoryConfiguration", ".", "isTextEnabled", "(", ")", ")", "return", ";", "Handler", "[", "]", "handlers", "=", "Logger", ".", "getLogger", "(", "\"\"", ")", ".", "getHandlers", "(", ")", ";", "for", "(", "Handler", "handler", ":", "handlers", ")", "{", "String", "name", "=", "handler", ".", "getClass", "(", ")", ".", "getName", "(", ")", ";", "if", "(", "BINLOGGER_HANDLER_NAME", ".", "equals", "(", "name", ")", ")", "{", "binaryHandler", "=", "(", "LogRecordHandler", ")", "handler", ";", "}", "else", "if", "(", "TEXTLOGGER_HANDLER_NAME", ".", "equals", "(", "name", ")", ")", "{", "textHandler", "=", "(", "LogRecordTextHandler", ")", "handler", ";", "}", "}", "}" ]
determine two handlers needed by the repository
[ "determine", "two", "handlers", "needed", "by", "the", "repository" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/ejs/ras/hpel/HpelSystemStream.java#L1040-L1058
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AnycastOutputHandler.java
AnycastOutputHandler.close
public void close() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "close"); Enumeration streams = null; synchronized (this) { synchronized (streamTable) { closed = true; closeBrowserSessionsInternal(); streams = streamTable.elements(); } } // since already set closed to true, no more AOStreams will be created and added to the streamTable, // even if there is an // asynchronous stream creation in progress (the itemStream will be created, but no AOStream will // be added to the streamTable). while (streams.hasMoreElements()) { StreamInfo sinfo = (StreamInfo) streams.nextElement(); if (sinfo.stream != null) { sinfo.stream.close(); } } synchronized (streamTable) { streamTable.clear(); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "close"); }
java
public void close() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "close"); Enumeration streams = null; synchronized (this) { synchronized (streamTable) { closed = true; closeBrowserSessionsInternal(); streams = streamTable.elements(); } } // since already set closed to true, no more AOStreams will be created and added to the streamTable, // even if there is an // asynchronous stream creation in progress (the itemStream will be created, but no AOStream will // be added to the streamTable). while (streams.hasMoreElements()) { StreamInfo sinfo = (StreamInfo) streams.nextElement(); if (sinfo.stream != null) { sinfo.stream.close(); } } synchronized (streamTable) { streamTable.clear(); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "close"); }
[ "public", "void", "close", "(", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"close\"", ")", ";", "Enumeration", "streams", "=", "null", ";", "synchronized", "(", "this", ")", "{", "synchronized", "(", "streamTable", ")", "{", "closed", "=", "true", ";", "closeBrowserSessionsInternal", "(", ")", ";", "streams", "=", "streamTable", ".", "elements", "(", ")", ";", "}", "}", "// since already set closed to true, no more AOStreams will be created and added to the streamTable,", "// even if there is an", "// asynchronous stream creation in progress (the itemStream will be created, but no AOStream will", "// be added to the streamTable).", "while", "(", "streams", ".", "hasMoreElements", "(", ")", ")", "{", "StreamInfo", "sinfo", "=", "(", "StreamInfo", ")", "streams", ".", "nextElement", "(", ")", ";", "if", "(", "sinfo", ".", "stream", "!=", "null", ")", "{", "sinfo", ".", "stream", ".", "close", "(", ")", ";", "}", "}", "synchronized", "(", "streamTable", ")", "{", "streamTable", ".", "clear", "(", ")", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"close\"", ")", ";", "}" ]
Cleans up the non-persistent state. No methods on the ControlHandler interface should be called after this is called.
[ "Cleans", "up", "the", "non", "-", "persistent", "state", ".", "No", "methods", "on", "the", "ControlHandler", "interface", "should", "be", "called", "after", "this", "is", "called", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AnycastOutputHandler.java#L912-L944
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AnycastOutputHandler.java
AnycastOutputHandler.cleanup
public boolean cleanup(boolean flushStreams, boolean redriveDeletionThread) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "cleanup", new Object[]{Boolean.valueOf(flushStreams), Boolean.valueOf(redriveDeletionThread)}); boolean retvalue = false; // first check if already finishedCloseAndFlush, since this call can be redriven synchronized (streamTable) { if (finishedCloseAndFlush) { retvalue = true; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "cleanup", Boolean.valueOf(retvalue)); return retvalue; } } if (!flushStreams) { // Simply cleanup the non-persistent state. The persistent state will get cleaned up when // the caller deletes everything from the AOContainerItemStream close(); retvalue = true; } else { // have to flush all the streams closeAndFlush(redriveDeletionThread); synchronized (streamTable) { retvalue = finishedCloseAndFlush; } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "cleanup", Boolean.valueOf(retvalue)); return retvalue; }
java
public boolean cleanup(boolean flushStreams, boolean redriveDeletionThread) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "cleanup", new Object[]{Boolean.valueOf(flushStreams), Boolean.valueOf(redriveDeletionThread)}); boolean retvalue = false; // first check if already finishedCloseAndFlush, since this call can be redriven synchronized (streamTable) { if (finishedCloseAndFlush) { retvalue = true; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "cleanup", Boolean.valueOf(retvalue)); return retvalue; } } if (!flushStreams) { // Simply cleanup the non-persistent state. The persistent state will get cleaned up when // the caller deletes everything from the AOContainerItemStream close(); retvalue = true; } else { // have to flush all the streams closeAndFlush(redriveDeletionThread); synchronized (streamTable) { retvalue = finishedCloseAndFlush; } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "cleanup", Boolean.valueOf(retvalue)); return retvalue; }
[ "public", "boolean", "cleanup", "(", "boolean", "flushStreams", ",", "boolean", "redriveDeletionThread", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"cleanup\"", ",", "new", "Object", "[", "]", "{", "Boolean", ".", "valueOf", "(", "flushStreams", ")", ",", "Boolean", ".", "valueOf", "(", "redriveDeletionThread", ")", "}", ")", ";", "boolean", "retvalue", "=", "false", ";", "// first check if already finishedCloseAndFlush, since this call can be redriven", "synchronized", "(", "streamTable", ")", "{", "if", "(", "finishedCloseAndFlush", ")", "{", "retvalue", "=", "true", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"cleanup\"", ",", "Boolean", ".", "valueOf", "(", "retvalue", ")", ")", ";", "return", "retvalue", ";", "}", "}", "if", "(", "!", "flushStreams", ")", "{", "// Simply cleanup the non-persistent state. The persistent state will get cleaned up when", "// the caller deletes everything from the AOContainerItemStream", "close", "(", ")", ";", "retvalue", "=", "true", ";", "}", "else", "{", "// have to flush all the streams", "closeAndFlush", "(", "redriveDeletionThread", ")", ";", "synchronized", "(", "streamTable", ")", "{", "retvalue", "=", "finishedCloseAndFlush", ";", "}", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"cleanup\"", ",", "Boolean", ".", "valueOf", "(", "retvalue", ")", ")", ";", "return", "retvalue", ";", "}" ]
Cleanup the state in this AnycastOutputHandler. Called when this localisation is being deleted. @param flushStreams If true, need to flush the streams, else do not need to flush all streams. The cleanup may be asynchronous in the former case. @param redriveDeletionThread If the cleanup is asynchronous, this class needs to do something when the cleanup terminates. If true, it will redrive the AsynchDeletionThread, else it will itself delete its container item stream. @return true, if finished cleaning up, else false (will redrive the AsynchDeletionThread when finishes cleaning up
[ "Cleanup", "the", "state", "in", "this", "AnycastOutputHandler", ".", "Called", "when", "this", "localisation", "is", "being", "deleted", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AnycastOutputHandler.java#L998-L1034
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AnycastOutputHandler.java
AnycastOutputHandler.getAOStream
public final AOStream getAOStream(String streamKey, SIBUuid12 streamId) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getAOStream", new Object[]{streamKey, streamId}); StreamInfo streamInfo = getStreamInfo(streamKey, streamId); if (streamInfo != null) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getAOStream", streamInfo.stream); return streamInfo.stream; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getAOStream", null); return null; }
java
public final AOStream getAOStream(String streamKey, SIBUuid12 streamId) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getAOStream", new Object[]{streamKey, streamId}); StreamInfo streamInfo = getStreamInfo(streamKey, streamId); if (streamInfo != null) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getAOStream", streamInfo.stream); return streamInfo.stream; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getAOStream", null); return null; }
[ "public", "final", "AOStream", "getAOStream", "(", "String", "streamKey", ",", "SIBUuid12", "streamId", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"getAOStream\"", ",", "new", "Object", "[", "]", "{", "streamKey", ",", "streamId", "}", ")", ";", "StreamInfo", "streamInfo", "=", "getStreamInfo", "(", "streamKey", ",", "streamId", ")", ";", "if", "(", "streamInfo", "!=", "null", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"getAOStream\"", ",", "streamInfo", ".", "stream", ")", ";", "return", "streamInfo", ".", "stream", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"getAOStream\"", ",", "null", ")", ";", "return", "null", ";", "}" ]
for unit testing
[ "for", "unit", "testing" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AnycastOutputHandler.java#L1108-L1122
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AnycastOutputHandler.java
AnycastOutputHandler.handleControlBrowseStatus
private final void handleControlBrowseStatus(SIBUuid8 remoteME, SIBUuid12 gatheringTargetDestUuid, long browseId, int status) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "handleControlBrowseStatus", new Object[] {remoteME, gatheringTargetDestUuid, Long.valueOf(browseId), Integer.valueOf(status)}); // first we see if there is an existing AOBrowseSession AOBrowserSessionKey key = new AOBrowserSessionKey(remoteME, gatheringTargetDestUuid, browseId); AOBrowserSession session = (AOBrowserSession) browserSessionTable.get(key); if (session != null) { if (status == SIMPConstants.BROWSE_CLOSE) { session.close(); browserSessionTable.remove(key); } else if (status == SIMPConstants.BROWSE_ALIVE) { session.keepAlive(); } } else { // session == null. ignore the status message } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "handleControlBrowseStatus"); }
java
private final void handleControlBrowseStatus(SIBUuid8 remoteME, SIBUuid12 gatheringTargetDestUuid, long browseId, int status) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "handleControlBrowseStatus", new Object[] {remoteME, gatheringTargetDestUuid, Long.valueOf(browseId), Integer.valueOf(status)}); // first we see if there is an existing AOBrowseSession AOBrowserSessionKey key = new AOBrowserSessionKey(remoteME, gatheringTargetDestUuid, browseId); AOBrowserSession session = (AOBrowserSession) browserSessionTable.get(key); if (session != null) { if (status == SIMPConstants.BROWSE_CLOSE) { session.close(); browserSessionTable.remove(key); } else if (status == SIMPConstants.BROWSE_ALIVE) { session.keepAlive(); } } else { // session == null. ignore the status message } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "handleControlBrowseStatus"); }
[ "private", "final", "void", "handleControlBrowseStatus", "(", "SIBUuid8", "remoteME", ",", "SIBUuid12", "gatheringTargetDestUuid", ",", "long", "browseId", ",", "int", "status", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"handleControlBrowseStatus\"", ",", "new", "Object", "[", "]", "{", "remoteME", ",", "gatheringTargetDestUuid", ",", "Long", ".", "valueOf", "(", "browseId", ")", ",", "Integer", ".", "valueOf", "(", "status", ")", "}", ")", ";", "// first we see if there is an existing AOBrowseSession", "AOBrowserSessionKey", "key", "=", "new", "AOBrowserSessionKey", "(", "remoteME", ",", "gatheringTargetDestUuid", ",", "browseId", ")", ";", "AOBrowserSession", "session", "=", "(", "AOBrowserSession", ")", "browserSessionTable", ".", "get", "(", "key", ")", ";", "if", "(", "session", "!=", "null", ")", "{", "if", "(", "status", "==", "SIMPConstants", ".", "BROWSE_CLOSE", ")", "{", "session", ".", "close", "(", ")", ";", "browserSessionTable", ".", "remove", "(", "key", ")", ";", "}", "else", "if", "(", "status", "==", "SIMPConstants", ".", "BROWSE_ALIVE", ")", "{", "session", ".", "keepAlive", "(", ")", ";", "}", "}", "else", "{", "// session == null. ignore the status message", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"handleControlBrowseStatus\"", ")", ";", "}" ]
Method to handle a ControlBrowseStatus message from an RME @param remoteME The UUID of the RME @param browseId The unique browseId, relative to this RME @param status The status
[ "Method", "to", "handle", "a", "ControlBrowseStatus", "message", "from", "an", "RME" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AnycastOutputHandler.java#L1447-L1475
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AnycastOutputHandler.java
AnycastOutputHandler.removeBrowserSession
public final void removeBrowserSession(AOBrowserSessionKey key) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "removeBrowserSession", key); browserSessionTable.remove(key); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "removeBrowserSession"); }
java
public final void removeBrowserSession(AOBrowserSessionKey key) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "removeBrowserSession", key); browserSessionTable.remove(key); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "removeBrowserSession"); }
[ "public", "final", "void", "removeBrowserSession", "(", "AOBrowserSessionKey", "key", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"removeBrowserSession\"", ",", "key", ")", ";", "browserSessionTable", ".", "remove", "(", "key", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"removeBrowserSession\"", ")", ";", "}" ]
Remove an AOBrowserSession that is already closed @param key The key of the session
[ "Remove", "an", "AOBrowserSession", "that", "is", "already", "closed" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AnycastOutputHandler.java#L1481-L1491
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AnycastOutputHandler.java
AnycastOutputHandler.getStreamInfo
private final StreamInfo getStreamInfo(String streamKey, SIBUuid12 streamId) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getStreamInfo", new Object[]{streamKey, streamId}); StreamInfo sinfo = streamTable.get(streamKey); if ((sinfo != null) && sinfo.streamId.equals(streamId)) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getStreamInfo", sinfo); return sinfo; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getStreamInfo", null); return null; }
java
private final StreamInfo getStreamInfo(String streamKey, SIBUuid12 streamId) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getStreamInfo", new Object[]{streamKey, streamId}); StreamInfo sinfo = streamTable.get(streamKey); if ((sinfo != null) && sinfo.streamId.equals(streamId)) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getStreamInfo", sinfo); return sinfo; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getStreamInfo", null); return null; }
[ "private", "final", "StreamInfo", "getStreamInfo", "(", "String", "streamKey", ",", "SIBUuid12", "streamId", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"getStreamInfo\"", ",", "new", "Object", "[", "]", "{", "streamKey", ",", "streamId", "}", ")", ";", "StreamInfo", "sinfo", "=", "streamTable", ".", "get", "(", "streamKey", ")", ";", "if", "(", "(", "sinfo", "!=", "null", ")", "&&", "sinfo", ".", "streamId", ".", "equals", "(", "streamId", ")", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"getStreamInfo\"", ",", "sinfo", ")", ";", "return", "sinfo", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"getStreamInfo\"", ",", "null", ")", ";", "return", "null", ";", "}" ]
Helper method used to dispatch a message received for a particular stream. Handles its own synchronization @param remoteMEId @param streamId @return the StreamInfo, if there is one that matches the parameters, else null
[ "Helper", "method", "used", "to", "dispatch", "a", "message", "received", "for", "a", "particular", "stream", ".", "Handles", "its", "own", "synchronization" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AnycastOutputHandler.java#L1944-L1957
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AnycastOutputHandler.java
AnycastOutputHandler.streamIsFlushed
public final void streamIsFlushed(AOStream stream) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "streamIsFlushed", stream); // we schedule an asynchronous removal of the persistent data synchronized (streamTable) { String key = SIMPUtils.getRemoteGetKey(stream.getRemoteMEUuid(), stream.getGatheringTargetDestUuid()); StreamInfo sinfo = streamTable.get(key); if ((sinfo != null) && sinfo.streamId.equals(stream.streamId)) { RemovePersistentStream update = null; synchronized (sinfo) { // synchronized since reading sinfo.item update = new RemovePersistentStream(key, sinfo.streamId, sinfo.itemStream, sinfo.item); } doEnqueueWork(update); } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "streamIsFlushed"); }
java
public final void streamIsFlushed(AOStream stream) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "streamIsFlushed", stream); // we schedule an asynchronous removal of the persistent data synchronized (streamTable) { String key = SIMPUtils.getRemoteGetKey(stream.getRemoteMEUuid(), stream.getGatheringTargetDestUuid()); StreamInfo sinfo = streamTable.get(key); if ((sinfo != null) && sinfo.streamId.equals(stream.streamId)) { RemovePersistentStream update = null; synchronized (sinfo) { // synchronized since reading sinfo.item update = new RemovePersistentStream(key, sinfo.streamId, sinfo.itemStream, sinfo.item); } doEnqueueWork(update); } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "streamIsFlushed"); }
[ "public", "final", "void", "streamIsFlushed", "(", "AOStream", "stream", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"streamIsFlushed\"", ",", "stream", ")", ";", "// we schedule an asynchronous removal of the persistent data", "synchronized", "(", "streamTable", ")", "{", "String", "key", "=", "SIMPUtils", ".", "getRemoteGetKey", "(", "stream", ".", "getRemoteMEUuid", "(", ")", ",", "stream", ".", "getGatheringTargetDestUuid", "(", ")", ")", ";", "StreamInfo", "sinfo", "=", "streamTable", ".", "get", "(", "key", ")", ";", "if", "(", "(", "sinfo", "!=", "null", ")", "&&", "sinfo", ".", "streamId", ".", "equals", "(", "stream", ".", "streamId", ")", ")", "{", "RemovePersistentStream", "update", "=", "null", ";", "synchronized", "(", "sinfo", ")", "{", "// synchronized since reading sinfo.item", "update", "=", "new", "RemovePersistentStream", "(", "key", ",", "sinfo", ".", "streamId", ",", "sinfo", ".", "itemStream", ",", "sinfo", ".", "item", ")", ";", "}", "doEnqueueWork", "(", "update", ")", ";", "}", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"streamIsFlushed\"", ")", ";", "}" ]
Callback from a stream, that it has been flushed @param stream
[ "Callback", "from", "a", "stream", "that", "it", "has", "been", "flushed" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AnycastOutputHandler.java#L1963-L1986
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AnycastOutputHandler.java
AnycastOutputHandler.persistLockAndTick
public final AOValue persistLockAndTick(TransactionCommon t, AOStream stream, long tick, SIMPMessage msg, int storagePolicy, long waitTime, long prevTick) throws Exception { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "persistLockAndTick", new Object[] {t, stream, Long.valueOf(tick), msg, Integer.valueOf(storagePolicy), Long.valueOf(waitTime), Long.valueOf(prevTick)}); AOValue retvalue = null; try { Transaction msTran = mp.resolveAndEnlistMsgStoreTransaction(t); msg.persistLock(msTran); long plockId = msg.getLockID(); retvalue = new AOValue(tick, msg, msg.getID(), storagePolicy, plockId, waitTime, prevTick); stream.itemStream.addItem(retvalue, msTran); } catch (Exception e) { // No FFDC code needed retvalue = null; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "persistLockAndTick", e); throw e; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "persistLockAndTick", retvalue); return retvalue; }
java
public final AOValue persistLockAndTick(TransactionCommon t, AOStream stream, long tick, SIMPMessage msg, int storagePolicy, long waitTime, long prevTick) throws Exception { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "persistLockAndTick", new Object[] {t, stream, Long.valueOf(tick), msg, Integer.valueOf(storagePolicy), Long.valueOf(waitTime), Long.valueOf(prevTick)}); AOValue retvalue = null; try { Transaction msTran = mp.resolveAndEnlistMsgStoreTransaction(t); msg.persistLock(msTran); long plockId = msg.getLockID(); retvalue = new AOValue(tick, msg, msg.getID(), storagePolicy, plockId, waitTime, prevTick); stream.itemStream.addItem(retvalue, msTran); } catch (Exception e) { // No FFDC code needed retvalue = null; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "persistLockAndTick", e); throw e; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "persistLockAndTick", retvalue); return retvalue; }
[ "public", "final", "AOValue", "persistLockAndTick", "(", "TransactionCommon", "t", ",", "AOStream", "stream", ",", "long", "tick", ",", "SIMPMessage", "msg", ",", "int", "storagePolicy", ",", "long", "waitTime", ",", "long", "prevTick", ")", "throws", "Exception", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"persistLockAndTick\"", ",", "new", "Object", "[", "]", "{", "t", ",", "stream", ",", "Long", ".", "valueOf", "(", "tick", ")", ",", "msg", ",", "Integer", ".", "valueOf", "(", "storagePolicy", ")", ",", "Long", ".", "valueOf", "(", "waitTime", ")", ",", "Long", ".", "valueOf", "(", "prevTick", ")", "}", ")", ";", "AOValue", "retvalue", "=", "null", ";", "try", "{", "Transaction", "msTran", "=", "mp", ".", "resolveAndEnlistMsgStoreTransaction", "(", "t", ")", ";", "msg", ".", "persistLock", "(", "msTran", ")", ";", "long", "plockId", "=", "msg", ".", "getLockID", "(", ")", ";", "retvalue", "=", "new", "AOValue", "(", "tick", ",", "msg", ",", "msg", ".", "getID", "(", ")", ",", "storagePolicy", ",", "plockId", ",", "waitTime", ",", "prevTick", ")", ";", "stream", ".", "itemStream", ".", "addItem", "(", "retvalue", ",", "msTran", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "// No FFDC code needed", "retvalue", "=", "null", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"persistLockAndTick\"", ",", "e", ")", ";", "throw", "e", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"persistLockAndTick\"", ",", "retvalue", ")", ";", "return", "retvalue", ";", "}" ]
Helper method called by the AOStream when to persistently lock a message and create a persistent tick in the protocol stream @param t the transaction @param stream the stream making this call @param tick the tick in the stream @param msg the message to be persistently locked (it is already non-persitently locked) @param waitTime the time for this request to be satisfied @param prevTick the previous tick of the same priority and QoS in the stream @return The item representing the persistent tick @throws Exception
[ "Helper", "method", "called", "by", "the", "AOStream", "when", "to", "persistently", "lock", "a", "message", "and", "create", "a", "persistent", "tick", "in", "the", "protocol", "stream" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AnycastOutputHandler.java#L2626-L2662
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AnycastOutputHandler.java
AnycastOutputHandler.cleanupTicks
public final void cleanupTicks(StreamInfo sinfo, TransactionCommon t, ArrayList valueTicks) throws MessageStoreException, SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "cleanupTicks", new Object[]{sinfo, t, valueTicks}); try { int length = valueTicks.size(); for (int i=0; i<length; i++) { AOValue storedTick = (AOValue) valueTicks.get(i); // If we are here then we do not know which consumerDispatcher originally // persistently locked the message. We therefore have to use the meUuid in // the AOValue to find/reconstitute the consumerDispatcher associated with it. This // potentially involves creating AIHs which is not ideal. ConsumerDispatcher cd = null; if (storedTick.getSourceMEUuid()==null || storedTick.getSourceMEUuid().equals(getMessageProcessor().getMessagingEngineUuid())) { cd = (ConsumerDispatcher)destinationHandler.getLocalPtoPConsumerManager(); } else { AnycastInputHandler aih = destinationHandler.getAnycastInputHandler(storedTick.getSourceMEUuid(), null, true); cd = aih.getRCD(); } SIMPMessage msg = null; synchronized(storedTick) { msg = (SIMPMessage) cd.getMessageByValue(storedTick); if (msg == null) { storedTick.setToBeFlushed(); } } Transaction msTran = mp.resolveAndEnlistMsgStoreTransaction(t); if (msg!=null && msg.getLockID()==storedTick.getPLockId()) msg.unlockMsg(storedTick.getPLockId(), msTran, true); storedTick.lockItemIfAvailable(controlItemLockID); // should always be successful storedTick.remove(msTran, controlItemLockID); } } catch (MessageStoreException e) { // No FFDC code needed if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "cleanupTicks", e); throw e; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "cleanupTicks"); }
java
public final void cleanupTicks(StreamInfo sinfo, TransactionCommon t, ArrayList valueTicks) throws MessageStoreException, SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "cleanupTicks", new Object[]{sinfo, t, valueTicks}); try { int length = valueTicks.size(); for (int i=0; i<length; i++) { AOValue storedTick = (AOValue) valueTicks.get(i); // If we are here then we do not know which consumerDispatcher originally // persistently locked the message. We therefore have to use the meUuid in // the AOValue to find/reconstitute the consumerDispatcher associated with it. This // potentially involves creating AIHs which is not ideal. ConsumerDispatcher cd = null; if (storedTick.getSourceMEUuid()==null || storedTick.getSourceMEUuid().equals(getMessageProcessor().getMessagingEngineUuid())) { cd = (ConsumerDispatcher)destinationHandler.getLocalPtoPConsumerManager(); } else { AnycastInputHandler aih = destinationHandler.getAnycastInputHandler(storedTick.getSourceMEUuid(), null, true); cd = aih.getRCD(); } SIMPMessage msg = null; synchronized(storedTick) { msg = (SIMPMessage) cd.getMessageByValue(storedTick); if (msg == null) { storedTick.setToBeFlushed(); } } Transaction msTran = mp.resolveAndEnlistMsgStoreTransaction(t); if (msg!=null && msg.getLockID()==storedTick.getPLockId()) msg.unlockMsg(storedTick.getPLockId(), msTran, true); storedTick.lockItemIfAvailable(controlItemLockID); // should always be successful storedTick.remove(msTran, controlItemLockID); } } catch (MessageStoreException e) { // No FFDC code needed if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "cleanupTicks", e); throw e; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "cleanupTicks"); }
[ "public", "final", "void", "cleanupTicks", "(", "StreamInfo", "sinfo", ",", "TransactionCommon", "t", ",", "ArrayList", "valueTicks", ")", "throws", "MessageStoreException", ",", "SIResourceException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"cleanupTicks\"", ",", "new", "Object", "[", "]", "{", "sinfo", ",", "t", ",", "valueTicks", "}", ")", ";", "try", "{", "int", "length", "=", "valueTicks", ".", "size", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "AOValue", "storedTick", "=", "(", "AOValue", ")", "valueTicks", ".", "get", "(", "i", ")", ";", "// If we are here then we do not know which consumerDispatcher originally", "// persistently locked the message. We therefore have to use the meUuid in ", "// the AOValue to find/reconstitute the consumerDispatcher associated with it. This", "// potentially involves creating AIHs which is not ideal.", "ConsumerDispatcher", "cd", "=", "null", ";", "if", "(", "storedTick", ".", "getSourceMEUuid", "(", ")", "==", "null", "||", "storedTick", ".", "getSourceMEUuid", "(", ")", ".", "equals", "(", "getMessageProcessor", "(", ")", ".", "getMessagingEngineUuid", "(", ")", ")", ")", "{", "cd", "=", "(", "ConsumerDispatcher", ")", "destinationHandler", ".", "getLocalPtoPConsumerManager", "(", ")", ";", "}", "else", "{", "AnycastInputHandler", "aih", "=", "destinationHandler", ".", "getAnycastInputHandler", "(", "storedTick", ".", "getSourceMEUuid", "(", ")", ",", "null", ",", "true", ")", ";", "cd", "=", "aih", ".", "getRCD", "(", ")", ";", "}", "SIMPMessage", "msg", "=", "null", ";", "synchronized", "(", "storedTick", ")", "{", "msg", "=", "(", "SIMPMessage", ")", "cd", ".", "getMessageByValue", "(", "storedTick", ")", ";", "if", "(", "msg", "==", "null", ")", "{", "storedTick", ".", "setToBeFlushed", "(", ")", ";", "}", "}", "Transaction", "msTran", "=", "mp", ".", "resolveAndEnlistMsgStoreTransaction", "(", "t", ")", ";", "if", "(", "msg", "!=", "null", "&&", "msg", ".", "getLockID", "(", ")", "==", "storedTick", ".", "getPLockId", "(", ")", ")", "msg", ".", "unlockMsg", "(", "storedTick", ".", "getPLockId", "(", ")", ",", "msTran", ",", "true", ")", ";", "storedTick", ".", "lockItemIfAvailable", "(", "controlItemLockID", ")", ";", "// should always be successful", "storedTick", ".", "remove", "(", "msTran", ",", "controlItemLockID", ")", ";", "}", "}", "catch", "(", "MessageStoreException", "e", ")", "{", "// No FFDC code needed", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"cleanupTicks\"", ",", "e", ")", ";", "throw", "e", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"cleanupTicks\"", ")", ";", "}" ]
Helper method called by the AOStream when a persistent tick representing a persistently locked message should be removed since we are flushing or cleaning up state. @param t the transaction @param sinfo the stream this msgs is on @param storedTick the persistent tick @throws SIResourceException @throws Exception
[ "Helper", "method", "called", "by", "the", "AOStream", "when", "a", "persistent", "tick", "representing", "a", "persistently", "locked", "message", "should", "be", "removed", "since", "we", "are", "flushing", "or", "cleaning", "up", "state", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AnycastOutputHandler.java#L2673-L2731
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AnycastOutputHandler.java
AnycastOutputHandler.writeStartedFlush
public final Item writeStartedFlush(TransactionCommon t, AOStream stream) throws Exception { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "writeStartedFlush"); String key = SIMPUtils.getRemoteGetKey(stream.getRemoteMEUuid(), stream.getGatheringTargetDestUuid()); StreamInfo sinfo = streamTable.get(key); if ((sinfo != null) && sinfo.streamId.equals(stream.streamId)) { AOStartedFlushItem item = new AOStartedFlushItem(key, stream.streamId); Transaction msTran = mp.resolveAndEnlistMsgStoreTransaction(t); this.containerItemStream.addItem(item, msTran); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "writeStartedFlush", item); return item; } // this should not occur // log error and throw exception SIErrorException e = new SIErrorException( nls.getFormattedMessage( "INTERNAL_MESSAGING_ERROR_CWSIP0001", new Object[] { "com.ibm.ws.sib.processor.impl.AnycastOutputHandler", "1:2810:1.89.4.1" }, null)); // FFDC FFDCFilter.processException( e, "com.ibm.ws.sib.processor.impl.AnycastOutputHandler.writeStartedFlush", "1:2817:1.89.4.1", this); SibTr.exception(tc, e); SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0001", new Object[] { "com.ibm.ws.sib.processor.impl.AnycastOutputHandler", "1:2822:1.89.4.1" }); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "writeStartedFlush", e); throw e; }
java
public final Item writeStartedFlush(TransactionCommon t, AOStream stream) throws Exception { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "writeStartedFlush"); String key = SIMPUtils.getRemoteGetKey(stream.getRemoteMEUuid(), stream.getGatheringTargetDestUuid()); StreamInfo sinfo = streamTable.get(key); if ((sinfo != null) && sinfo.streamId.equals(stream.streamId)) { AOStartedFlushItem item = new AOStartedFlushItem(key, stream.streamId); Transaction msTran = mp.resolveAndEnlistMsgStoreTransaction(t); this.containerItemStream.addItem(item, msTran); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "writeStartedFlush", item); return item; } // this should not occur // log error and throw exception SIErrorException e = new SIErrorException( nls.getFormattedMessage( "INTERNAL_MESSAGING_ERROR_CWSIP0001", new Object[] { "com.ibm.ws.sib.processor.impl.AnycastOutputHandler", "1:2810:1.89.4.1" }, null)); // FFDC FFDCFilter.processException( e, "com.ibm.ws.sib.processor.impl.AnycastOutputHandler.writeStartedFlush", "1:2817:1.89.4.1", this); SibTr.exception(tc, e); SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0001", new Object[] { "com.ibm.ws.sib.processor.impl.AnycastOutputHandler", "1:2822:1.89.4.1" }); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "writeStartedFlush", e); throw e; }
[ "public", "final", "Item", "writeStartedFlush", "(", "TransactionCommon", "t", ",", "AOStream", "stream", ")", "throws", "Exception", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"writeStartedFlush\"", ")", ";", "String", "key", "=", "SIMPUtils", ".", "getRemoteGetKey", "(", "stream", ".", "getRemoteMEUuid", "(", ")", ",", "stream", ".", "getGatheringTargetDestUuid", "(", ")", ")", ";", "StreamInfo", "sinfo", "=", "streamTable", ".", "get", "(", "key", ")", ";", "if", "(", "(", "sinfo", "!=", "null", ")", "&&", "sinfo", ".", "streamId", ".", "equals", "(", "stream", ".", "streamId", ")", ")", "{", "AOStartedFlushItem", "item", "=", "new", "AOStartedFlushItem", "(", "key", ",", "stream", ".", "streamId", ")", ";", "Transaction", "msTran", "=", "mp", ".", "resolveAndEnlistMsgStoreTransaction", "(", "t", ")", ";", "this", ".", "containerItemStream", ".", "addItem", "(", "item", ",", "msTran", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"writeStartedFlush\"", ",", "item", ")", ";", "return", "item", ";", "}", "// this should not occur", "// log error and throw exception", "SIErrorException", "e", "=", "new", "SIErrorException", "(", "nls", ".", "getFormattedMessage", "(", "\"INTERNAL_MESSAGING_ERROR_CWSIP0001\"", ",", "new", "Object", "[", "]", "{", "\"com.ibm.ws.sib.processor.impl.AnycastOutputHandler\"", ",", "\"1:2810:1.89.4.1\"", "}", ",", "null", ")", ")", ";", "// FFDC", "FFDCFilter", ".", "processException", "(", "e", ",", "\"com.ibm.ws.sib.processor.impl.AnycastOutputHandler.writeStartedFlush\"", ",", "\"1:2817:1.89.4.1\"", ",", "this", ")", ";", "SibTr", ".", "exception", "(", "tc", ",", "e", ")", ";", "SibTr", ".", "error", "(", "tc", ",", "\"INTERNAL_MESSAGING_ERROR_CWSIP0001\"", ",", "new", "Object", "[", "]", "{", "\"com.ibm.ws.sib.processor.impl.AnycastOutputHandler\"", ",", "\"1:2822:1.89.4.1\"", "}", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"writeStartedFlush\"", ",", "e", ")", ";", "throw", "e", ";", "}" ]
Helper method used by AOStream to persistently record that flush has been started @param t the transaction @param stream the stream making this call @return the Item written @throws Exception
[ "Helper", "method", "used", "by", "AOStream", "to", "persistently", "record", "that", "flush", "has", "been", "started" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AnycastOutputHandler.java#L2740-L2782
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AnycastOutputHandler.java
AnycastOutputHandler.writtenStartedFlush
public final void writtenStartedFlush(AOStream stream, Item startedFlushItem) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "writtenStartedFlush"); String key = SIMPUtils.getRemoteGetKey(stream.getRemoteMEUuid(), stream.getGatheringTargetDestUuid()); StreamInfo sinfo = streamTable.get(key); if ((sinfo != null) && sinfo.streamId.equals(stream.streamId)) { synchronized (sinfo) { sinfo.item = (AOStartedFlushItem) startedFlushItem; } } else { // this should not occur // log error and throw exception SIErrorException e = new SIErrorException( nls.getFormattedMessage( "INTERNAL_MESSAGING_ERROR_CWSIP0001", new Object[] { "com.ibm.ws.sib.processor.impl.AnycastOutputHandler", "1:2858:1.89.4.1" }, null)); // FFDC FFDCFilter.processException( e, "com.ibm.ws.sib.processor.impl.AnycastOutputHandler.writtenStartedFlush", "1:2865:1.89.4.1", this); SibTr.exception(tc, e); SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0001", new Object[] { "com.ibm.ws.sib.processor.impl.AnycastOutputHandler", "1:2872:1.89.4.1" }); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "writtenStartedFlush", e); throw e; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "writtenStartedFlush"); }
java
public final void writtenStartedFlush(AOStream stream, Item startedFlushItem) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "writtenStartedFlush"); String key = SIMPUtils.getRemoteGetKey(stream.getRemoteMEUuid(), stream.getGatheringTargetDestUuid()); StreamInfo sinfo = streamTable.get(key); if ((sinfo != null) && sinfo.streamId.equals(stream.streamId)) { synchronized (sinfo) { sinfo.item = (AOStartedFlushItem) startedFlushItem; } } else { // this should not occur // log error and throw exception SIErrorException e = new SIErrorException( nls.getFormattedMessage( "INTERNAL_MESSAGING_ERROR_CWSIP0001", new Object[] { "com.ibm.ws.sib.processor.impl.AnycastOutputHandler", "1:2858:1.89.4.1" }, null)); // FFDC FFDCFilter.processException( e, "com.ibm.ws.sib.processor.impl.AnycastOutputHandler.writtenStartedFlush", "1:2865:1.89.4.1", this); SibTr.exception(tc, e); SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0001", new Object[] { "com.ibm.ws.sib.processor.impl.AnycastOutputHandler", "1:2872:1.89.4.1" }); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "writtenStartedFlush", e); throw e; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "writtenStartedFlush"); }
[ "public", "final", "void", "writtenStartedFlush", "(", "AOStream", "stream", ",", "Item", "startedFlushItem", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"writtenStartedFlush\"", ")", ";", "String", "key", "=", "SIMPUtils", ".", "getRemoteGetKey", "(", "stream", ".", "getRemoteMEUuid", "(", ")", ",", "stream", ".", "getGatheringTargetDestUuid", "(", ")", ")", ";", "StreamInfo", "sinfo", "=", "streamTable", ".", "get", "(", "key", ")", ";", "if", "(", "(", "sinfo", "!=", "null", ")", "&&", "sinfo", ".", "streamId", ".", "equals", "(", "stream", ".", "streamId", ")", ")", "{", "synchronized", "(", "sinfo", ")", "{", "sinfo", ".", "item", "=", "(", "AOStartedFlushItem", ")", "startedFlushItem", ";", "}", "}", "else", "{", "// this should not occur", "// log error and throw exception", "SIErrorException", "e", "=", "new", "SIErrorException", "(", "nls", ".", "getFormattedMessage", "(", "\"INTERNAL_MESSAGING_ERROR_CWSIP0001\"", ",", "new", "Object", "[", "]", "{", "\"com.ibm.ws.sib.processor.impl.AnycastOutputHandler\"", ",", "\"1:2858:1.89.4.1\"", "}", ",", "null", ")", ")", ";", "// FFDC", "FFDCFilter", ".", "processException", "(", "e", ",", "\"com.ibm.ws.sib.processor.impl.AnycastOutputHandler.writtenStartedFlush\"", ",", "\"1:2865:1.89.4.1\"", ",", "this", ")", ";", "SibTr", ".", "exception", "(", "tc", ",", "e", ")", ";", "SibTr", ".", "error", "(", "tc", ",", "\"INTERNAL_MESSAGING_ERROR_CWSIP0001\"", ",", "new", "Object", "[", "]", "{", "\"com.ibm.ws.sib.processor.impl.AnycastOutputHandler\"", ",", "\"1:2872:1.89.4.1\"", "}", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"writtenStartedFlush\"", ",", "e", ")", ";", "throw", "e", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"writtenStartedFlush\"", ")", ";", "}" ]
Callback when the Item that records that flush has been started has been committed to persistent storage @param stream The stream making this call @param startedFlushItem The item written
[ "Callback", "when", "the", "Item", "that", "records", "that", "flush", "has", "been", "started", "has", "been", "committed", "to", "persistent", "storage" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AnycastOutputHandler.java#L2789-L2835
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AnycastOutputHandler.java
AnycastOutputHandler.getItemStream
public SIMPItemStream getItemStream() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getItemStream"); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getItemStream", containerItemStream); return (SIMPItemStream) containerItemStream; }
java
public SIMPItemStream getItemStream() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getItemStream"); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getItemStream", containerItemStream); return (SIMPItemStream) containerItemStream; }
[ "public", "SIMPItemStream", "getItemStream", "(", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"getItemStream\"", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"getItemStream\"", ",", "containerItemStream", ")", ";", "return", "(", "SIMPItemStream", ")", "containerItemStream", ";", "}" ]
Return the SIMPItemStream associated with this AOH. This method is needed for proper cleanup of remote durable subscriptions since the usual item stream owned by the DestinationHandler is not used. @return The SIMPItemStream passed to this AOH during instantiation.
[ "Return", "the", "SIMPItemStream", "associated", "with", "this", "AOH", ".", "This", "method", "is", "needed", "for", "proper", "cleanup", "of", "remote", "durable", "subscriptions", "since", "the", "usual", "item", "stream", "owned", "by", "the", "DestinationHandler", "is", "not", "used", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AnycastOutputHandler.java#L2952-L2961
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AnycastOutputHandler.java
AnycastOutputHandler.getDestName
public final String getDestName() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getDestName"); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getDestName", destName); return destName; }
java
public final String getDestName() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getDestName"); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getDestName", destName); return destName; }
[ "public", "final", "String", "getDestName", "(", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"getDestName\"", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"getDestName\"", ",", "destName", ")", ";", "return", "destName", ";", "}" ]
Return the destination name which this AOH is associated with. @return The destination name passed to this AOH during instantiation.
[ "Return", "the", "destination", "name", "which", "this", "AOH", "is", "associated", "with", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AnycastOutputHandler.java#L2968-L2977
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AnycastOutputHandler.java
AnycastOutputHandler.getDestUUID
public final SIBUuid12 getDestUUID() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, "getDestUUID"); SibTr.exit(tc, "getDestUUID", destName); } return destUuid; }
java
public final SIBUuid12 getDestUUID() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, "getDestUUID"); SibTr.exit(tc, "getDestUUID", destName); } return destUuid; }
[ "public", "final", "SIBUuid12", "getDestUUID", "(", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "entry", "(", "tc", ",", "\"getDestUUID\"", ")", ";", "SibTr", ".", "exit", "(", "tc", ",", "\"getDestUUID\"", ",", "destName", ")", ";", "}", "return", "destUuid", ";", "}" ]
Return the destination UUID which this AOH is associated with. This method is needed for proper cleanup of remote durable subscriptions since pseudo destinations are used, rather than the destination normally associated with the DestinationHandler. @return The destination name passed to this AOH during instantiation.
[ "Return", "the", "destination", "UUID", "which", "this", "AOH", "is", "associated", "with", ".", "This", "method", "is", "needed", "for", "proper", "cleanup", "of", "remote", "durable", "subscriptions", "since", "pseudo", "destinations", "are", "used", "rather", "than", "the", "destination", "normally", "associated", "with", "the", "DestinationHandler", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AnycastOutputHandler.java#L2987-L2996
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AnycastOutputHandler.java
AnycastOutputHandler.forceFlushAtSource
public void forceFlushAtSource(SIBUuid8 remoteUuid, SIBUuid12 gatheringTargetDestUuid) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "forceFlushAtSource", new Object[] {remoteUuid, gatheringTargetDestUuid}); StreamInfo sinfo; boolean success = false; String key = SIMPUtils.getRemoteGetKey(remoteUuid, gatheringTargetDestUuid); synchronized (streamTable) { sinfo = streamTable.get(key); } if (sinfo == null) { // need to do nothing as a stream for this RME does not exist success = true; } else if (sinfo.stream == null) { // stream for this RME is being created, which means that the RME just sent a request // to create a stream. How are we claiming that this RME has been deleted? // We should throw some sort of Exception. SIErrorException e = new SIErrorException( nls.getFormattedMessage( "INTERNAL_MESSAGING_ERROR_CWSIP0001", new Object[] { "com.ibm.ws.sib.processor.impl.AnycastOutputHandler", "1:3159:1.89.4.1" }, null)); FFDCFilter.processException( e, "com.ibm.ws.sib.processor.impl.AnycastOutputHandler.forceFlushAtSource", "1:3165:1.89.4.1", this); SibTr.exception(tc, e); SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0001", new Object[] { "com.ibm.ws.sib.processor.impl.AnycastOutputHandler", "1:3171:1.89.4.1" }); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "forceFlushAtSource"); throw e; } else { try { AOStream stream = sinfo.stream; // first close() the stream. stream.close(); // We are now guaranteed that all asynchronous writed to the Message Store initiated by that stream are done. // Now get all the value ticks from the itemStream ArrayList<AOValue> valueTicks = new ArrayList<AOValue>(); NonLockingCursor cursor = sinfo.itemStream.newNonLockingItemCursor(null); AOValue tick; while ((tick = (AOValue) cursor.next()) != null) { valueTicks.add(tick); } cursor.finished(); // now delete them and the item stream etc. deleteAndUnlockPersistentStream(sinfo, valueTicks); // now remove from the streamTable synchronized (streamTable) { streamTable.remove(key); } success = true; } catch (Exception e) { FFDCFilter.processException( e, "com.ibm.ws.sib.processor.impl.AnycastOutputHandler.forceFlushAtSource", "1:3211:1.89.4.1", this); SibTr.exception(tc, e); SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0001", new Object[] { "com.ibm.ws.sib.processor.impl.AnycastOutputHandler", "1:3217:1.89.4.1" }); // we should throw an exception SIErrorException e2 = new SIErrorException( nls.getFormattedMessage( "INTERNAL_MESSAGING_ERROR_CWSIP0001", new Object[] { "com.ibm.ws.sib.processor.impl.AnycastOutputHandler", "1:3226:1.89.4.1"}, null)); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "forceFlushAtSource"); throw e2; } } // end else if (success) { // Log message to console saying we have finished flush at anycast DME for this destination and RME SibTr.info( tc, "FLUSH_COMPLETE_CWSIP0452", new Object[] {destName, mp.getMessagingEngineName(), key}); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "forceFlushAtSource"); }
java
public void forceFlushAtSource(SIBUuid8 remoteUuid, SIBUuid12 gatheringTargetDestUuid) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "forceFlushAtSource", new Object[] {remoteUuid, gatheringTargetDestUuid}); StreamInfo sinfo; boolean success = false; String key = SIMPUtils.getRemoteGetKey(remoteUuid, gatheringTargetDestUuid); synchronized (streamTable) { sinfo = streamTable.get(key); } if (sinfo == null) { // need to do nothing as a stream for this RME does not exist success = true; } else if (sinfo.stream == null) { // stream for this RME is being created, which means that the RME just sent a request // to create a stream. How are we claiming that this RME has been deleted? // We should throw some sort of Exception. SIErrorException e = new SIErrorException( nls.getFormattedMessage( "INTERNAL_MESSAGING_ERROR_CWSIP0001", new Object[] { "com.ibm.ws.sib.processor.impl.AnycastOutputHandler", "1:3159:1.89.4.1" }, null)); FFDCFilter.processException( e, "com.ibm.ws.sib.processor.impl.AnycastOutputHandler.forceFlushAtSource", "1:3165:1.89.4.1", this); SibTr.exception(tc, e); SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0001", new Object[] { "com.ibm.ws.sib.processor.impl.AnycastOutputHandler", "1:3171:1.89.4.1" }); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "forceFlushAtSource"); throw e; } else { try { AOStream stream = sinfo.stream; // first close() the stream. stream.close(); // We are now guaranteed that all asynchronous writed to the Message Store initiated by that stream are done. // Now get all the value ticks from the itemStream ArrayList<AOValue> valueTicks = new ArrayList<AOValue>(); NonLockingCursor cursor = sinfo.itemStream.newNonLockingItemCursor(null); AOValue tick; while ((tick = (AOValue) cursor.next()) != null) { valueTicks.add(tick); } cursor.finished(); // now delete them and the item stream etc. deleteAndUnlockPersistentStream(sinfo, valueTicks); // now remove from the streamTable synchronized (streamTable) { streamTable.remove(key); } success = true; } catch (Exception e) { FFDCFilter.processException( e, "com.ibm.ws.sib.processor.impl.AnycastOutputHandler.forceFlushAtSource", "1:3211:1.89.4.1", this); SibTr.exception(tc, e); SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0001", new Object[] { "com.ibm.ws.sib.processor.impl.AnycastOutputHandler", "1:3217:1.89.4.1" }); // we should throw an exception SIErrorException e2 = new SIErrorException( nls.getFormattedMessage( "INTERNAL_MESSAGING_ERROR_CWSIP0001", new Object[] { "com.ibm.ws.sib.processor.impl.AnycastOutputHandler", "1:3226:1.89.4.1"}, null)); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "forceFlushAtSource"); throw e2; } } // end else if (success) { // Log message to console saying we have finished flush at anycast DME for this destination and RME SibTr.info( tc, "FLUSH_COMPLETE_CWSIP0452", new Object[] {destName, mp.getMessagingEngineName(), key}); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "forceFlushAtSource"); }
[ "public", "void", "forceFlushAtSource", "(", "SIBUuid8", "remoteUuid", ",", "SIBUuid12", "gatheringTargetDestUuid", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"forceFlushAtSource\"", ",", "new", "Object", "[", "]", "{", "remoteUuid", ",", "gatheringTargetDestUuid", "}", ")", ";", "StreamInfo", "sinfo", ";", "boolean", "success", "=", "false", ";", "String", "key", "=", "SIMPUtils", ".", "getRemoteGetKey", "(", "remoteUuid", ",", "gatheringTargetDestUuid", ")", ";", "synchronized", "(", "streamTable", ")", "{", "sinfo", "=", "streamTable", ".", "get", "(", "key", ")", ";", "}", "if", "(", "sinfo", "==", "null", ")", "{", "// need to do nothing as a stream for this RME does not exist", "success", "=", "true", ";", "}", "else", "if", "(", "sinfo", ".", "stream", "==", "null", ")", "{", "// stream for this RME is being created, which means that the RME just sent a request", "// to create a stream. How are we claiming that this RME has been deleted?", "// We should throw some sort of Exception.", "SIErrorException", "e", "=", "new", "SIErrorException", "(", "nls", ".", "getFormattedMessage", "(", "\"INTERNAL_MESSAGING_ERROR_CWSIP0001\"", ",", "new", "Object", "[", "]", "{", "\"com.ibm.ws.sib.processor.impl.AnycastOutputHandler\"", ",", "\"1:3159:1.89.4.1\"", "}", ",", "null", ")", ")", ";", "FFDCFilter", ".", "processException", "(", "e", ",", "\"com.ibm.ws.sib.processor.impl.AnycastOutputHandler.forceFlushAtSource\"", ",", "\"1:3165:1.89.4.1\"", ",", "this", ")", ";", "SibTr", ".", "exception", "(", "tc", ",", "e", ")", ";", "SibTr", ".", "error", "(", "tc", ",", "\"INTERNAL_MESSAGING_ERROR_CWSIP0001\"", ",", "new", "Object", "[", "]", "{", "\"com.ibm.ws.sib.processor.impl.AnycastOutputHandler\"", ",", "\"1:3171:1.89.4.1\"", "}", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"forceFlushAtSource\"", ")", ";", "throw", "e", ";", "}", "else", "{", "try", "{", "AOStream", "stream", "=", "sinfo", ".", "stream", ";", "// first close() the stream.", "stream", ".", "close", "(", ")", ";", "// We are now guaranteed that all asynchronous writed to the Message Store initiated by that stream are done.", "// Now get all the value ticks from the itemStream", "ArrayList", "<", "AOValue", ">", "valueTicks", "=", "new", "ArrayList", "<", "AOValue", ">", "(", ")", ";", "NonLockingCursor", "cursor", "=", "sinfo", ".", "itemStream", ".", "newNonLockingItemCursor", "(", "null", ")", ";", "AOValue", "tick", ";", "while", "(", "(", "tick", "=", "(", "AOValue", ")", "cursor", ".", "next", "(", ")", ")", "!=", "null", ")", "{", "valueTicks", ".", "add", "(", "tick", ")", ";", "}", "cursor", ".", "finished", "(", ")", ";", "// now delete them and the item stream etc.", "deleteAndUnlockPersistentStream", "(", "sinfo", ",", "valueTicks", ")", ";", "// now remove from the streamTable", "synchronized", "(", "streamTable", ")", "{", "streamTable", ".", "remove", "(", "key", ")", ";", "}", "success", "=", "true", ";", "}", "catch", "(", "Exception", "e", ")", "{", "FFDCFilter", ".", "processException", "(", "e", ",", "\"com.ibm.ws.sib.processor.impl.AnycastOutputHandler.forceFlushAtSource\"", ",", "\"1:3211:1.89.4.1\"", ",", "this", ")", ";", "SibTr", ".", "exception", "(", "tc", ",", "e", ")", ";", "SibTr", ".", "error", "(", "tc", ",", "\"INTERNAL_MESSAGING_ERROR_CWSIP0001\"", ",", "new", "Object", "[", "]", "{", "\"com.ibm.ws.sib.processor.impl.AnycastOutputHandler\"", ",", "\"1:3217:1.89.4.1\"", "}", ")", ";", "// we should throw an exception", "SIErrorException", "e2", "=", "new", "SIErrorException", "(", "nls", ".", "getFormattedMessage", "(", "\"INTERNAL_MESSAGING_ERROR_CWSIP0001\"", ",", "new", "Object", "[", "]", "{", "\"com.ibm.ws.sib.processor.impl.AnycastOutputHandler\"", ",", "\"1:3226:1.89.4.1\"", "}", ",", "null", ")", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"forceFlushAtSource\"", ")", ";", "throw", "e2", ";", "}", "}", "// end else", "if", "(", "success", ")", "{", "// Log message to console saying we have finished flush at anycast DME for this destination and RME", "SibTr", ".", "info", "(", "tc", ",", "\"FLUSH_COMPLETE_CWSIP0452\"", ",", "new", "Object", "[", "]", "{", "destName", ",", "mp", ".", "getMessagingEngineName", "(", ")", ",", "key", "}", ")", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"forceFlushAtSource\"", ")", ";", "}" ]
If the RME has been deleted then the stream needs to be flushed to unlock any messaqes on this DME. @param remoteME the uuid of the remote ME
[ "If", "the", "RME", "has", "been", "deleted", "then", "the", "stream", "needs", "to", "be", "flushed", "to", "unlock", "any", "messaqes", "on", "this", "DME", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AnycastOutputHandler.java#L3086-L3203
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AnycastOutputHandler.java
AnycastOutputHandler.deleteAndUnlockPersistentStream
private void deleteAndUnlockPersistentStream(StreamInfo sinfo, ArrayList valueTicks) throws MessageStoreException, SIRollbackException, SIConnectionLostException, SIIncorrectCallException, SIResourceException, SIErrorException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "deleteAndUnlockPersistentStream", new Object[]{sinfo, valueTicks}); // create a transaction, and delete all AOValue ticks, unlock the persistent locks, // and then remove sinfo.itemStream, and sinfo.item LocalTransaction tran = getLocalTransaction(); cleanupTicks(sinfo, tran, valueTicks); Transaction msTran = mp.resolveAndEnlistMsgStoreTransaction(tran); sinfo.itemStream.lockItemIfAvailable(controlItemLockID); // will always be available sinfo.itemStream.remove(msTran, controlItemLockID); if (sinfo.item != null) { sinfo.item.lockItemIfAvailable(controlItemLockID); // will always be available sinfo.item.remove(msTran, controlItemLockID); } tran.commit(); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "deleteAndUnlockPersistentStream"); }
java
private void deleteAndUnlockPersistentStream(StreamInfo sinfo, ArrayList valueTicks) throws MessageStoreException, SIRollbackException, SIConnectionLostException, SIIncorrectCallException, SIResourceException, SIErrorException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "deleteAndUnlockPersistentStream", new Object[]{sinfo, valueTicks}); // create a transaction, and delete all AOValue ticks, unlock the persistent locks, // and then remove sinfo.itemStream, and sinfo.item LocalTransaction tran = getLocalTransaction(); cleanupTicks(sinfo, tran, valueTicks); Transaction msTran = mp.resolveAndEnlistMsgStoreTransaction(tran); sinfo.itemStream.lockItemIfAvailable(controlItemLockID); // will always be available sinfo.itemStream.remove(msTran, controlItemLockID); if (sinfo.item != null) { sinfo.item.lockItemIfAvailable(controlItemLockID); // will always be available sinfo.item.remove(msTran, controlItemLockID); } tran.commit(); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "deleteAndUnlockPersistentStream"); }
[ "private", "void", "deleteAndUnlockPersistentStream", "(", "StreamInfo", "sinfo", ",", "ArrayList", "valueTicks", ")", "throws", "MessageStoreException", ",", "SIRollbackException", ",", "SIConnectionLostException", ",", "SIIncorrectCallException", ",", "SIResourceException", ",", "SIErrorException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"deleteAndUnlockPersistentStream\"", ",", "new", "Object", "[", "]", "{", "sinfo", ",", "valueTicks", "}", ")", ";", "// create a transaction, and delete all AOValue ticks, unlock the persistent locks,", "// and then remove sinfo.itemStream, and sinfo.item", "LocalTransaction", "tran", "=", "getLocalTransaction", "(", ")", ";", "cleanupTicks", "(", "sinfo", ",", "tran", ",", "valueTicks", ")", ";", "Transaction", "msTran", "=", "mp", ".", "resolveAndEnlistMsgStoreTransaction", "(", "tran", ")", ";", "sinfo", ".", "itemStream", ".", "lockItemIfAvailable", "(", "controlItemLockID", ")", ";", "// will always be available", "sinfo", ".", "itemStream", ".", "remove", "(", "msTran", ",", "controlItemLockID", ")", ";", "if", "(", "sinfo", ".", "item", "!=", "null", ")", "{", "sinfo", ".", "item", ".", "lockItemIfAvailable", "(", "controlItemLockID", ")", ";", "// will always be available", "sinfo", ".", "item", ".", "remove", "(", "msTran", ",", "controlItemLockID", ")", ";", "}", "tran", ".", "commit", "(", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"deleteAndUnlockPersistentStream\"", ")", ";", "}" ]
remove the persistent ticks and the itemstream and started-flush item
[ "remove", "the", "persistent", "ticks", "and", "the", "itemstream", "and", "started", "-", "flush", "item" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AnycastOutputHandler.java#L3207-L3230
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/BNFHeadersImpl.java
BNFHeadersImpl.init
protected void init(boolean useDirect, int outSize, int inSize, int cacheSize) { this.useDirectBuffer = useDirect; this.outgoingHdrBufferSize = outSize; this.incomingBufferSize = inSize; // if cache size has increased, then allocate the larger bytecache // array, but don't change to a smaller array if (cacheSize > this.byteCacheSize) { this.byteCacheSize = cacheSize; this.byteCache = new byte[cacheSize]; } }
java
protected void init(boolean useDirect, int outSize, int inSize, int cacheSize) { this.useDirectBuffer = useDirect; this.outgoingHdrBufferSize = outSize; this.incomingBufferSize = inSize; // if cache size has increased, then allocate the larger bytecache // array, but don't change to a smaller array if (cacheSize > this.byteCacheSize) { this.byteCacheSize = cacheSize; this.byteCache = new byte[cacheSize]; } }
[ "protected", "void", "init", "(", "boolean", "useDirect", ",", "int", "outSize", ",", "int", "inSize", ",", "int", "cacheSize", ")", "{", "this", ".", "useDirectBuffer", "=", "useDirect", ";", "this", ".", "outgoingHdrBufferSize", "=", "outSize", ";", "this", ".", "incomingBufferSize", "=", "inSize", ";", "// if cache size has increased, then allocate the larger bytecache", "// array, but don't change to a smaller array", "if", "(", "cacheSize", ">", "this", ".", "byteCacheSize", ")", "{", "this", ".", "byteCacheSize", "=", "cacheSize", ";", "this", ".", "byteCache", "=", "new", "byte", "[", "cacheSize", "]", ";", "}", "}" ]
Initialize this class instance with the chosen parse configuration options. @param useDirect -- use direct ByteBuffers or indirect @param outSize -- size of buffers to use while marshalling headers @param inSize -- size of buffers to use while parsing headers @param cacheSize -- byte cache size of optimized parsing
[ "Initialize", "this", "class", "instance", "with", "the", "chosen", "parse", "configuration", "options", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/BNFHeadersImpl.java#L271-L282
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/BNFHeadersImpl.java
BNFHeadersImpl.addParseBuffer
public void addParseBuffer(WsByteBuffer buffer) { // increment where we're about to put the new buffer in int index = ++this.parseIndex; if (null == this.parseBuffers) { // first parse buffer to track this.parseBuffers = new WsByteBuffer[BUFFERS_INITIAL_SIZE]; this.parseBuffersStartPos = new int[BUFFERS_INITIAL_SIZE]; for (int i = 0; i < BUFFERS_INITIAL_SIZE; i++) { this.parseBuffersStartPos[i] = HeaderStorage.NOTSET; } } else if (index == this.parseBuffers.length) { // grow the array int size = index + BUFFERS_MIN_GROWTH; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Increasing parse buffer array size to " + size); } WsByteBuffer[] tempNew = new WsByteBuffer[size]; System.arraycopy(this.parseBuffers, 0, tempNew, 0, index); this.parseBuffers = tempNew; int[] posNew = new int[size]; System.arraycopy(this.parseBuffersStartPos, 0, posNew, 0, index); for (int i = index; i < size; i++) { posNew[i] = HeaderStorage.NOTSET; } this.parseBuffersStartPos = posNew; } this.parseBuffers[index] = buffer; }
java
public void addParseBuffer(WsByteBuffer buffer) { // increment where we're about to put the new buffer in int index = ++this.parseIndex; if (null == this.parseBuffers) { // first parse buffer to track this.parseBuffers = new WsByteBuffer[BUFFERS_INITIAL_SIZE]; this.parseBuffersStartPos = new int[BUFFERS_INITIAL_SIZE]; for (int i = 0; i < BUFFERS_INITIAL_SIZE; i++) { this.parseBuffersStartPos[i] = HeaderStorage.NOTSET; } } else if (index == this.parseBuffers.length) { // grow the array int size = index + BUFFERS_MIN_GROWTH; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Increasing parse buffer array size to " + size); } WsByteBuffer[] tempNew = new WsByteBuffer[size]; System.arraycopy(this.parseBuffers, 0, tempNew, 0, index); this.parseBuffers = tempNew; int[] posNew = new int[size]; System.arraycopy(this.parseBuffersStartPos, 0, posNew, 0, index); for (int i = index; i < size; i++) { posNew[i] = HeaderStorage.NOTSET; } this.parseBuffersStartPos = posNew; } this.parseBuffers[index] = buffer; }
[ "public", "void", "addParseBuffer", "(", "WsByteBuffer", "buffer", ")", "{", "// increment where we're about to put the new buffer in", "int", "index", "=", "++", "this", ".", "parseIndex", ";", "if", "(", "null", "==", "this", ".", "parseBuffers", ")", "{", "// first parse buffer to track", "this", ".", "parseBuffers", "=", "new", "WsByteBuffer", "[", "BUFFERS_INITIAL_SIZE", "]", ";", "this", ".", "parseBuffersStartPos", "=", "new", "int", "[", "BUFFERS_INITIAL_SIZE", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "BUFFERS_INITIAL_SIZE", ";", "i", "++", ")", "{", "this", ".", "parseBuffersStartPos", "[", "i", "]", "=", "HeaderStorage", ".", "NOTSET", ";", "}", "}", "else", "if", "(", "index", "==", "this", ".", "parseBuffers", ".", "length", ")", "{", "// grow the array", "int", "size", "=", "index", "+", "BUFFERS_MIN_GROWTH", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Increasing parse buffer array size to \"", "+", "size", ")", ";", "}", "WsByteBuffer", "[", "]", "tempNew", "=", "new", "WsByteBuffer", "[", "size", "]", ";", "System", ".", "arraycopy", "(", "this", ".", "parseBuffers", ",", "0", ",", "tempNew", ",", "0", ",", "index", ")", ";", "this", ".", "parseBuffers", "=", "tempNew", ";", "int", "[", "]", "posNew", "=", "new", "int", "[", "size", "]", ";", "System", ".", "arraycopy", "(", "this", ".", "parseBuffersStartPos", ",", "0", ",", "posNew", ",", "0", ",", "index", ")", ";", "for", "(", "int", "i", "=", "index", ";", "i", "<", "size", ";", "i", "++", ")", "{", "posNew", "[", "i", "]", "=", "HeaderStorage", ".", "NOTSET", ";", "}", "this", ".", "parseBuffersStartPos", "=", "posNew", ";", "}", "this", ".", "parseBuffers", "[", "index", "]", "=", "buffer", ";", "}" ]
Save a reference to a new buffer with header parse information. This is not part of the "created list" and will not be released by this message class. @param buffer
[ "Save", "a", "reference", "to", "a", "new", "buffer", "with", "header", "parse", "information", ".", "This", "is", "not", "part", "of", "the", "created", "list", "and", "will", "not", "be", "released", "by", "this", "message", "class", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/BNFHeadersImpl.java#L295-L324
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/BNFHeadersImpl.java
BNFHeadersImpl.addToCreatedBuffer
public void addToCreatedBuffer(WsByteBuffer buffer) { // increment where we're about to put the new buffer in int index = ++this.createdIndex; if (null == this.myCreatedBuffers) { // first allocation this.myCreatedBuffers = new WsByteBuffer[BUFFERS_INITIAL_SIZE]; } else if (index == this.myCreatedBuffers.length) { // grow the array int size = index + BUFFERS_MIN_GROWTH; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Increasing created buffer array size to " + size); } WsByteBuffer[] tempNew = new WsByteBuffer[size]; System.arraycopy(this.myCreatedBuffers, 0, tempNew, 0, index); this.myCreatedBuffers = tempNew; } this.myCreatedBuffers[index] = buffer; }
java
public void addToCreatedBuffer(WsByteBuffer buffer) { // increment where we're about to put the new buffer in int index = ++this.createdIndex; if (null == this.myCreatedBuffers) { // first allocation this.myCreatedBuffers = new WsByteBuffer[BUFFERS_INITIAL_SIZE]; } else if (index == this.myCreatedBuffers.length) { // grow the array int size = index + BUFFERS_MIN_GROWTH; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Increasing created buffer array size to " + size); } WsByteBuffer[] tempNew = new WsByteBuffer[size]; System.arraycopy(this.myCreatedBuffers, 0, tempNew, 0, index); this.myCreatedBuffers = tempNew; } this.myCreatedBuffers[index] = buffer; }
[ "public", "void", "addToCreatedBuffer", "(", "WsByteBuffer", "buffer", ")", "{", "// increment where we're about to put the new buffer in", "int", "index", "=", "++", "this", ".", "createdIndex", ";", "if", "(", "null", "==", "this", ".", "myCreatedBuffers", ")", "{", "// first allocation", "this", ".", "myCreatedBuffers", "=", "new", "WsByteBuffer", "[", "BUFFERS_INITIAL_SIZE", "]", ";", "}", "else", "if", "(", "index", "==", "this", ".", "myCreatedBuffers", ".", "length", ")", "{", "// grow the array", "int", "size", "=", "index", "+", "BUFFERS_MIN_GROWTH", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Increasing created buffer array size to \"", "+", "size", ")", ";", "}", "WsByteBuffer", "[", "]", "tempNew", "=", "new", "WsByteBuffer", "[", "size", "]", ";", "System", ".", "arraycopy", "(", "this", ".", "myCreatedBuffers", ",", "0", ",", "tempNew", ",", "0", ",", "index", ")", ";", "this", ".", "myCreatedBuffers", "=", "tempNew", ";", "}", "this", ".", "myCreatedBuffers", "[", "index", "]", "=", "buffer", ";", "}" ]
Add a buffer on the list that will be manually released later. @param buffer
[ "Add", "a", "buffer", "on", "the", "list", "that", "will", "be", "manually", "released", "later", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/BNFHeadersImpl.java#L331-L348
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/BNFHeadersImpl.java
BNFHeadersImpl.clear
public void clear() { final boolean bTrace = TraceComponent.isAnyTracingEnabled(); if (bTrace && tc.isEntryEnabled()) { Tr.entry(tc, "clear"); } clearAllHeaders(); this.eohPosition = HeaderStorage.NOTSET; this.currentElem = null; this.stateOfParsing = PARSING_CRLF; this.binaryParsingState = GenericConstants.PARSING_HDR_FLAG; this.parsedToken = null; this.parsedTokenLength = 0; this.bytePosition = 0; this.byteLimit = 0; this.currentReadBB = null; clearBuffers(); this.debugContext = this; this.numCRLFs = 0; this.bIsMultiLine = false; this.lastCRLFBufferIndex = HeaderStorage.NOTSET; this.lastCRLFPosition = HeaderStorage.NOTSET; this.lastCRLFisCR = false; this.headerChangeCount = 0; this.headerAddCount = 0; this.bOverChangeLimit = false; this.compactHeaderFlag = false; this.table = null; this.isPushPromise = false; this.processedXForwardedHeader = false; this.processedForwardedHeader = false; this.forwardHeaderErrorState = false; this.forwardedByList = null; this.forwardedForList = null; this.forwardedHost = null; this.forwardedPort = null; this.forwardedProto = null; if (bTrace && tc.isEntryEnabled()) { Tr.exit(tc, "clear"); } }
java
public void clear() { final boolean bTrace = TraceComponent.isAnyTracingEnabled(); if (bTrace && tc.isEntryEnabled()) { Tr.entry(tc, "clear"); } clearAllHeaders(); this.eohPosition = HeaderStorage.NOTSET; this.currentElem = null; this.stateOfParsing = PARSING_CRLF; this.binaryParsingState = GenericConstants.PARSING_HDR_FLAG; this.parsedToken = null; this.parsedTokenLength = 0; this.bytePosition = 0; this.byteLimit = 0; this.currentReadBB = null; clearBuffers(); this.debugContext = this; this.numCRLFs = 0; this.bIsMultiLine = false; this.lastCRLFBufferIndex = HeaderStorage.NOTSET; this.lastCRLFPosition = HeaderStorage.NOTSET; this.lastCRLFisCR = false; this.headerChangeCount = 0; this.headerAddCount = 0; this.bOverChangeLimit = false; this.compactHeaderFlag = false; this.table = null; this.isPushPromise = false; this.processedXForwardedHeader = false; this.processedForwardedHeader = false; this.forwardHeaderErrorState = false; this.forwardedByList = null; this.forwardedForList = null; this.forwardedHost = null; this.forwardedPort = null; this.forwardedProto = null; if (bTrace && tc.isEntryEnabled()) { Tr.exit(tc, "clear"); } }
[ "public", "void", "clear", "(", ")", "{", "final", "boolean", "bTrace", "=", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", ";", "if", "(", "bTrace", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "entry", "(", "tc", ",", "\"clear\"", ")", ";", "}", "clearAllHeaders", "(", ")", ";", "this", ".", "eohPosition", "=", "HeaderStorage", ".", "NOTSET", ";", "this", ".", "currentElem", "=", "null", ";", "this", ".", "stateOfParsing", "=", "PARSING_CRLF", ";", "this", ".", "binaryParsingState", "=", "GenericConstants", ".", "PARSING_HDR_FLAG", ";", "this", ".", "parsedToken", "=", "null", ";", "this", ".", "parsedTokenLength", "=", "0", ";", "this", ".", "bytePosition", "=", "0", ";", "this", ".", "byteLimit", "=", "0", ";", "this", ".", "currentReadBB", "=", "null", ";", "clearBuffers", "(", ")", ";", "this", ".", "debugContext", "=", "this", ";", "this", ".", "numCRLFs", "=", "0", ";", "this", ".", "bIsMultiLine", "=", "false", ";", "this", ".", "lastCRLFBufferIndex", "=", "HeaderStorage", ".", "NOTSET", ";", "this", ".", "lastCRLFPosition", "=", "HeaderStorage", ".", "NOTSET", ";", "this", ".", "lastCRLFisCR", "=", "false", ";", "this", ".", "headerChangeCount", "=", "0", ";", "this", ".", "headerAddCount", "=", "0", ";", "this", ".", "bOverChangeLimit", "=", "false", ";", "this", ".", "compactHeaderFlag", "=", "false", ";", "this", ".", "table", "=", "null", ";", "this", ".", "isPushPromise", "=", "false", ";", "this", ".", "processedXForwardedHeader", "=", "false", ";", "this", ".", "processedForwardedHeader", "=", "false", ";", "this", ".", "forwardHeaderErrorState", "=", "false", ";", "this", ".", "forwardedByList", "=", "null", ";", "this", ".", "forwardedForList", "=", "null", ";", "this", ".", "forwardedHost", "=", "null", ";", "this", ".", "forwardedPort", "=", "null", ";", "this", ".", "forwardedProto", "=", "null", ";", "if", "(", "bTrace", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "exit", "(", "tc", ",", "\"clear\"", ")", ";", "}", "}" ]
Clear out information on this object so that it can be re-used.
[ "Clear", "out", "information", "on", "this", "object", "so", "that", "it", "can", "be", "re", "-", "used", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/BNFHeadersImpl.java#L533-L574
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/BNFHeadersImpl.java
BNFHeadersImpl.clearBuffers
private void clearBuffers() { // simply null out the parse buffers list, then release all the created buffers final boolean bTrace = TraceComponent.isAnyTracingEnabled(); for (int i = 0; i <= this.parseIndex; i++) { if (bTrace && tc.isDebugEnabled()) { Tr.debug(tc, "Removing reference to parse buffer: " + this.parseBuffers[i]); } this.parseBuffers[i] = null; this.parseBuffersStartPos[i] = HeaderStorage.NOTSET; } this.parseIndex = HeaderStorage.NOTSET; for (int i = 0; i <= this.createdIndex; i++) { if (bTrace && tc.isDebugEnabled()) { Tr.debug(tc, "Releasing marshall buffer: " + this.myCreatedBuffers[i]); } this.myCreatedBuffers[i].release(); this.myCreatedBuffers[i] = null; } this.createdIndex = HeaderStorage.NOTSET; }
java
private void clearBuffers() { // simply null out the parse buffers list, then release all the created buffers final boolean bTrace = TraceComponent.isAnyTracingEnabled(); for (int i = 0; i <= this.parseIndex; i++) { if (bTrace && tc.isDebugEnabled()) { Tr.debug(tc, "Removing reference to parse buffer: " + this.parseBuffers[i]); } this.parseBuffers[i] = null; this.parseBuffersStartPos[i] = HeaderStorage.NOTSET; } this.parseIndex = HeaderStorage.NOTSET; for (int i = 0; i <= this.createdIndex; i++) { if (bTrace && tc.isDebugEnabled()) { Tr.debug(tc, "Releasing marshall buffer: " + this.myCreatedBuffers[i]); } this.myCreatedBuffers[i].release(); this.myCreatedBuffers[i] = null; } this.createdIndex = HeaderStorage.NOTSET; }
[ "private", "void", "clearBuffers", "(", ")", "{", "// simply null out the parse buffers list, then release all the created buffers", "final", "boolean", "bTrace", "=", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<=", "this", ".", "parseIndex", ";", "i", "++", ")", "{", "if", "(", "bTrace", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Removing reference to parse buffer: \"", "+", "this", ".", "parseBuffers", "[", "i", "]", ")", ";", "}", "this", ".", "parseBuffers", "[", "i", "]", "=", "null", ";", "this", ".", "parseBuffersStartPos", "[", "i", "]", "=", "HeaderStorage", ".", "NOTSET", ";", "}", "this", ".", "parseIndex", "=", "HeaderStorage", ".", "NOTSET", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<=", "this", ".", "createdIndex", ";", "i", "++", ")", "{", "if", "(", "bTrace", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Releasing marshall buffer: \"", "+", "this", ".", "myCreatedBuffers", "[", "i", "]", ")", ";", "}", "this", ".", "myCreatedBuffers", "[", "i", "]", ".", "release", "(", ")", ";", "this", ".", "myCreatedBuffers", "[", "i", "]", "=", "null", ";", "}", "this", ".", "createdIndex", "=", "HeaderStorage", ".", "NOTSET", ";", "}" ]
Clear the array of buffers used during the parsing or marshalling of headers.
[ "Clear", "the", "array", "of", "buffers", "used", "during", "the", "parsing", "or", "marshalling", "of", "headers", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/BNFHeadersImpl.java#L580-L599
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/BNFHeadersImpl.java
BNFHeadersImpl.debug
public void debug() { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "*** Begin Header Debug ***"); HeaderElement elem = this.hdrSequence; while (null != elem) { Tr.debug(tc, elem.getName() + ": " + elem.getDebugValue()); elem = elem.nextSequence; } Tr.debug(tc, "*** End Header Debug ***"); } }
java
public void debug() { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "*** Begin Header Debug ***"); HeaderElement elem = this.hdrSequence; while (null != elem) { Tr.debug(tc, elem.getName() + ": " + elem.getDebugValue()); elem = elem.nextSequence; } Tr.debug(tc, "*** End Header Debug ***"); } }
[ "public", "void", "debug", "(", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"*** Begin Header Debug ***\"", ")", ";", "HeaderElement", "elem", "=", "this", ".", "hdrSequence", ";", "while", "(", "null", "!=", "elem", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "elem", ".", "getName", "(", ")", "+", "\": \"", "+", "elem", ".", "getDebugValue", "(", ")", ")", ";", "elem", "=", "elem", ".", "nextSequence", ";", "}", "Tr", ".", "debug", "(", "tc", ",", "\"*** End Header Debug ***\"", ")", ";", "}", "}" ]
Print debug information on the headers to the RAS tracing log.
[ "Print", "debug", "information", "on", "the", "headers", "to", "the", "RAS", "tracing", "log", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/BNFHeadersImpl.java#L604-L615
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/BNFHeadersImpl.java
BNFHeadersImpl.destroy
protected void destroy() { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Destroying these headers: " + this); } // if we have headers present, or reference parse buffers (i.e. // the first header parsed threw an error perhaps), then clear // the message now if (null != this.hdrSequence || HeaderStorage.NOTSET != this.parseIndex) { clear(); } this.byteCacheSize = DEFAULT_CACHESIZE; this.incomingBufferSize = DEFAULT_BUFFERSIZE; this.outgoingHdrBufferSize = DEFAULT_BUFFERSIZE; this.useDirectBuffer = true; this.limitNumHeaders = DEFAULT_LIMIT_NUMHEADERS; this.limitTokenSize = DEFAULT_LIMIT_TOKENSIZE; this.headerChangeLimit = HeaderStorage.NOTSET; }
java
protected void destroy() { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Destroying these headers: " + this); } // if we have headers present, or reference parse buffers (i.e. // the first header parsed threw an error perhaps), then clear // the message now if (null != this.hdrSequence || HeaderStorage.NOTSET != this.parseIndex) { clear(); } this.byteCacheSize = DEFAULT_CACHESIZE; this.incomingBufferSize = DEFAULT_BUFFERSIZE; this.outgoingHdrBufferSize = DEFAULT_BUFFERSIZE; this.useDirectBuffer = true; this.limitNumHeaders = DEFAULT_LIMIT_NUMHEADERS; this.limitTokenSize = DEFAULT_LIMIT_TOKENSIZE; this.headerChangeLimit = HeaderStorage.NOTSET; }
[ "protected", "void", "destroy", "(", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Destroying these headers: \"", "+", "this", ")", ";", "}", "// if we have headers present, or reference parse buffers (i.e.", "// the first header parsed threw an error perhaps), then clear", "// the message now", "if", "(", "null", "!=", "this", ".", "hdrSequence", "||", "HeaderStorage", ".", "NOTSET", "!=", "this", ".", "parseIndex", ")", "{", "clear", "(", ")", ";", "}", "this", ".", "byteCacheSize", "=", "DEFAULT_CACHESIZE", ";", "this", ".", "incomingBufferSize", "=", "DEFAULT_BUFFERSIZE", ";", "this", ".", "outgoingHdrBufferSize", "=", "DEFAULT_BUFFERSIZE", ";", "this", ".", "useDirectBuffer", "=", "true", ";", "this", ".", "limitNumHeaders", "=", "DEFAULT_LIMIT_NUMHEADERS", ";", "this", ".", "limitTokenSize", "=", "DEFAULT_LIMIT_TOKENSIZE", ";", "this", ".", "headerChangeLimit", "=", "HeaderStorage", ".", "NOTSET", ";", "}" ]
Completely clear out all the information on this object when it is no longer used.
[ "Completely", "clear", "out", "all", "the", "information", "on", "this", "object", "when", "it", "is", "no", "longer", "used", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/BNFHeadersImpl.java#L621-L638
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/BNFHeadersImpl.java
BNFHeadersImpl.writeByteArray
protected void writeByteArray(ObjectOutput output, byte[] data) throws IOException { if (null == data || 0 == data.length) { output.writeInt(-1); } else { output.writeInt(data.length); output.write(data); } }
java
protected void writeByteArray(ObjectOutput output, byte[] data) throws IOException { if (null == data || 0 == data.length) { output.writeInt(-1); } else { output.writeInt(data.length); output.write(data); } }
[ "protected", "void", "writeByteArray", "(", "ObjectOutput", "output", ",", "byte", "[", "]", "data", ")", "throws", "IOException", "{", "if", "(", "null", "==", "data", "||", "0", "==", "data", ".", "length", ")", "{", "output", ".", "writeInt", "(", "-", "1", ")", ";", "}", "else", "{", "output", ".", "writeInt", "(", "data", ".", "length", ")", ";", "output", ".", "write", "(", "data", ")", ";", "}", "}" ]
Write information for the input data to the output stream. If the input data is null or empty, this will write a -1 length marker. @param output @param data @throws IOException
[ "Write", "information", "for", "the", "input", "data", "to", "the", "output", "stream", ".", "If", "the", "input", "data", "is", "null", "or", "empty", "this", "will", "write", "a", "-", "1", "length", "marker", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/BNFHeadersImpl.java#L713-L720
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/BNFHeadersImpl.java
BNFHeadersImpl.scribbleWhiteSpace
private void scribbleWhiteSpace(WsByteBuffer buffer, int start, int stop) { if (buffer.hasArray()) { // buffer has a backing array so directly update that final byte[] data = buffer.array(); final int offset = buffer.arrayOffset(); int myStart = start + offset; int myStop = stop + offset; for (int i = myStart; i < myStop; i++) { data[i] = BNFHeaders.SPACE; } } else { // overlay whitespace into the buffer byte[] localWhitespace = whitespace; if (null == localWhitespace) { localWhitespace = getWhiteSpace(); } buffer.position(start); int len = stop - start; while (len > 0) { if (localWhitespace.length >= len) { buffer.put(localWhitespace, 0, len); break; // out of while } int partial = localWhitespace.length; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Scribbling " + partial + " bytes of whitespace"); } buffer.put(localWhitespace, 0, partial); len -= partial; } } }
java
private void scribbleWhiteSpace(WsByteBuffer buffer, int start, int stop) { if (buffer.hasArray()) { // buffer has a backing array so directly update that final byte[] data = buffer.array(); final int offset = buffer.arrayOffset(); int myStart = start + offset; int myStop = stop + offset; for (int i = myStart; i < myStop; i++) { data[i] = BNFHeaders.SPACE; } } else { // overlay whitespace into the buffer byte[] localWhitespace = whitespace; if (null == localWhitespace) { localWhitespace = getWhiteSpace(); } buffer.position(start); int len = stop - start; while (len > 0) { if (localWhitespace.length >= len) { buffer.put(localWhitespace, 0, len); break; // out of while } int partial = localWhitespace.length; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Scribbling " + partial + " bytes of whitespace"); } buffer.put(localWhitespace, 0, partial); len -= partial; } } }
[ "private", "void", "scribbleWhiteSpace", "(", "WsByteBuffer", "buffer", ",", "int", "start", ",", "int", "stop", ")", "{", "if", "(", "buffer", ".", "hasArray", "(", ")", ")", "{", "// buffer has a backing array so directly update that", "final", "byte", "[", "]", "data", "=", "buffer", ".", "array", "(", ")", ";", "final", "int", "offset", "=", "buffer", ".", "arrayOffset", "(", ")", ";", "int", "myStart", "=", "start", "+", "offset", ";", "int", "myStop", "=", "stop", "+", "offset", ";", "for", "(", "int", "i", "=", "myStart", ";", "i", "<", "myStop", ";", "i", "++", ")", "{", "data", "[", "i", "]", "=", "BNFHeaders", ".", "SPACE", ";", "}", "}", "else", "{", "// overlay whitespace into the buffer", "byte", "[", "]", "localWhitespace", "=", "whitespace", ";", "if", "(", "null", "==", "localWhitespace", ")", "{", "localWhitespace", "=", "getWhiteSpace", "(", ")", ";", "}", "buffer", ".", "position", "(", "start", ")", ";", "int", "len", "=", "stop", "-", "start", ";", "while", "(", "len", ">", "0", ")", "{", "if", "(", "localWhitespace", ".", "length", ">=", "len", ")", "{", "buffer", ".", "put", "(", "localWhitespace", ",", "0", ",", "len", ")", ";", "break", ";", "// out of while", "}", "int", "partial", "=", "localWhitespace", ".", "length", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Scribbling \"", "+", "partial", "+", "\" bytes of whitespace\"", ")", ";", "}", "buffer", ".", "put", "(", "localWhitespace", ",", "0", ",", "partial", ")", ";", "len", "-=", "partial", ";", "}", "}", "}" ]
Overlay whitespace into the input buffer using the provided starting and stopping positions. @param buffer @param start @param stop
[ "Overlay", "whitespace", "into", "the", "input", "buffer", "using", "the", "provided", "starting", "and", "stopping", "positions", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/BNFHeadersImpl.java#L1196-L1227
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/BNFHeadersImpl.java
BNFHeadersImpl.eraseValue
private void eraseValue(HeaderElement elem) { // wipe out the removed value if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Erasing existing header: " + elem.getName()); } int next_index = this.lastCRLFBufferIndex; int next_pos = this.lastCRLFPosition; if (null != elem.nextSequence && !elem.nextSequence.wasAdded()) { next_index = elem.nextSequence.getLastCRLFBufferIndex(); next_pos = elem.nextSequence.getLastCRLFPosition(); } int start = elem.getLastCRLFPosition(); // if it's only in one buffer, this for loop does nothing for (int x = elem.getLastCRLFBufferIndex(); x < next_index; x++) { // wiping out this buffer from start to limit this.parseBuffers[x].position(start); this.parseBuffers[x].limit(start); start = 0; } // last buffer, scribble from start until next_pos scribbleWhiteSpace(this.parseBuffers[next_index], start, next_pos); }
java
private void eraseValue(HeaderElement elem) { // wipe out the removed value if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Erasing existing header: " + elem.getName()); } int next_index = this.lastCRLFBufferIndex; int next_pos = this.lastCRLFPosition; if (null != elem.nextSequence && !elem.nextSequence.wasAdded()) { next_index = elem.nextSequence.getLastCRLFBufferIndex(); next_pos = elem.nextSequence.getLastCRLFPosition(); } int start = elem.getLastCRLFPosition(); // if it's only in one buffer, this for loop does nothing for (int x = elem.getLastCRLFBufferIndex(); x < next_index; x++) { // wiping out this buffer from start to limit this.parseBuffers[x].position(start); this.parseBuffers[x].limit(start); start = 0; } // last buffer, scribble from start until next_pos scribbleWhiteSpace(this.parseBuffers[next_index], start, next_pos); }
[ "private", "void", "eraseValue", "(", "HeaderElement", "elem", ")", "{", "// wipe out the removed value", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Erasing existing header: \"", "+", "elem", ".", "getName", "(", ")", ")", ";", "}", "int", "next_index", "=", "this", ".", "lastCRLFBufferIndex", ";", "int", "next_pos", "=", "this", ".", "lastCRLFPosition", ";", "if", "(", "null", "!=", "elem", ".", "nextSequence", "&&", "!", "elem", ".", "nextSequence", ".", "wasAdded", "(", ")", ")", "{", "next_index", "=", "elem", ".", "nextSequence", ".", "getLastCRLFBufferIndex", "(", ")", ";", "next_pos", "=", "elem", ".", "nextSequence", ".", "getLastCRLFPosition", "(", ")", ";", "}", "int", "start", "=", "elem", ".", "getLastCRLFPosition", "(", ")", ";", "// if it's only in one buffer, this for loop does nothing", "for", "(", "int", "x", "=", "elem", ".", "getLastCRLFBufferIndex", "(", ")", ";", "x", "<", "next_index", ";", "x", "++", ")", "{", "// wiping out this buffer from start to limit", "this", ".", "parseBuffers", "[", "x", "]", ".", "position", "(", "start", ")", ";", "this", ".", "parseBuffers", "[", "x", "]", ".", "limit", "(", "start", ")", ";", "start", "=", "0", ";", "}", "// last buffer, scribble from start until next_pos", "scribbleWhiteSpace", "(", "this", ".", "parseBuffers", "[", "next_index", "]", ",", "start", ",", "next_pos", ")", ";", "}" ]
Method to completely erase the input header from the parse buffers. @param elem
[ "Method", "to", "completely", "erase", "the", "input", "header", "from", "the", "parse", "buffers", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/BNFHeadersImpl.java#L1234-L1255
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/BNFHeadersImpl.java
BNFHeadersImpl.overlayBytes
private int overlayBytes(byte[] data, int inOffset, int inLength, int inIndex) { int length = inLength; int offset = inOffset; int index = inIndex; WsByteBuffer buffer = this.parseBuffers[index]; if (-1 == length) { length = data.length; } while (index <= this.parseIndex) { int remaining = buffer.remaining(); if (remaining >= length) { // it all fits now buffer.put(data, offset, length); return index; } // put what we can, loop through the next buffer buffer.put(data, offset, remaining); offset += remaining; length -= remaining; buffer = this.parseBuffers[++index]; buffer.position(0); } return index; }
java
private int overlayBytes(byte[] data, int inOffset, int inLength, int inIndex) { int length = inLength; int offset = inOffset; int index = inIndex; WsByteBuffer buffer = this.parseBuffers[index]; if (-1 == length) { length = data.length; } while (index <= this.parseIndex) { int remaining = buffer.remaining(); if (remaining >= length) { // it all fits now buffer.put(data, offset, length); return index; } // put what we can, loop through the next buffer buffer.put(data, offset, remaining); offset += remaining; length -= remaining; buffer = this.parseBuffers[++index]; buffer.position(0); } return index; }
[ "private", "int", "overlayBytes", "(", "byte", "[", "]", "data", ",", "int", "inOffset", ",", "int", "inLength", ",", "int", "inIndex", ")", "{", "int", "length", "=", "inLength", ";", "int", "offset", "=", "inOffset", ";", "int", "index", "=", "inIndex", ";", "WsByteBuffer", "buffer", "=", "this", ".", "parseBuffers", "[", "index", "]", ";", "if", "(", "-", "1", "==", "length", ")", "{", "length", "=", "data", ".", "length", ";", "}", "while", "(", "index", "<=", "this", ".", "parseIndex", ")", "{", "int", "remaining", "=", "buffer", ".", "remaining", "(", ")", ";", "if", "(", "remaining", ">=", "length", ")", "{", "// it all fits now", "buffer", ".", "put", "(", "data", ",", "offset", ",", "length", ")", ";", "return", "index", ";", "}", "// put what we can, loop through the next buffer", "buffer", ".", "put", "(", "data", ",", "offset", ",", "remaining", ")", ";", "offset", "+=", "remaining", ";", "length", "-=", "remaining", ";", "buffer", "=", "this", ".", "parseBuffers", "[", "++", "index", "]", ";", "buffer", ".", "position", "(", "0", ")", ";", "}", "return", "index", ";", "}" ]
Utility method to overlay the input bytes into the parse buffers, starting at the input index and moving forward as needed. @param data @param inOffset @param inLength @param inIndex @return index of last buffer updated
[ "Utility", "method", "to", "overlay", "the", "input", "bytes", "into", "the", "parse", "buffers", "starting", "at", "the", "input", "index", "and", "moving", "forward", "as", "needed", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/BNFHeadersImpl.java#L1267-L1290
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/BNFHeadersImpl.java
BNFHeadersImpl.overlayValue
private void overlayValue(HeaderElement elem) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Overlaying existing header: " + elem.getName()); } int next_index = this.lastCRLFBufferIndex; int next_pos = this.lastCRLFPosition; if (null != elem.nextSequence && !elem.nextSequence.wasAdded()) { next_index = elem.nextSequence.getLastCRLFBufferIndex(); next_pos = elem.nextSequence.getLastCRLFPosition(); } WsByteBuffer buffer = this.parseBuffers[elem.getLastCRLFBufferIndex()]; buffer.position(elem.getLastCRLFPosition() + (elem.isLastCRLFaCR() ? 2 : 1)); if (next_index == elem.getLastCRLFBufferIndex()) { // all in one buffer buffer.put(elem.getKey().getMarshalledByteArray(foundCompactHeader())); buffer.put(elem.asRawBytes(), elem.getOffset(), elem.getValueLength()); } else { // header straddles buffers int index = elem.getLastCRLFBufferIndex(); index = overlayBytes(elem.getKey().getMarshalledByteArray(foundCompactHeader()), 0, -1, index); index = overlayBytes(elem.asRawBytes(), elem.getOffset(), elem.getValueLength(), index); buffer = this.parseBuffers[index]; } // pad trailing whitespace if we need it int start = buffer.position(); if (start < next_pos) { scribbleWhiteSpace(buffer, start, next_pos); } }
java
private void overlayValue(HeaderElement elem) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Overlaying existing header: " + elem.getName()); } int next_index = this.lastCRLFBufferIndex; int next_pos = this.lastCRLFPosition; if (null != elem.nextSequence && !elem.nextSequence.wasAdded()) { next_index = elem.nextSequence.getLastCRLFBufferIndex(); next_pos = elem.nextSequence.getLastCRLFPosition(); } WsByteBuffer buffer = this.parseBuffers[elem.getLastCRLFBufferIndex()]; buffer.position(elem.getLastCRLFPosition() + (elem.isLastCRLFaCR() ? 2 : 1)); if (next_index == elem.getLastCRLFBufferIndex()) { // all in one buffer buffer.put(elem.getKey().getMarshalledByteArray(foundCompactHeader())); buffer.put(elem.asRawBytes(), elem.getOffset(), elem.getValueLength()); } else { // header straddles buffers int index = elem.getLastCRLFBufferIndex(); index = overlayBytes(elem.getKey().getMarshalledByteArray(foundCompactHeader()), 0, -1, index); index = overlayBytes(elem.asRawBytes(), elem.getOffset(), elem.getValueLength(), index); buffer = this.parseBuffers[index]; } // pad trailing whitespace if we need it int start = buffer.position(); if (start < next_pos) { scribbleWhiteSpace(buffer, start, next_pos); } }
[ "private", "void", "overlayValue", "(", "HeaderElement", "elem", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Overlaying existing header: \"", "+", "elem", ".", "getName", "(", ")", ")", ";", "}", "int", "next_index", "=", "this", ".", "lastCRLFBufferIndex", ";", "int", "next_pos", "=", "this", ".", "lastCRLFPosition", ";", "if", "(", "null", "!=", "elem", ".", "nextSequence", "&&", "!", "elem", ".", "nextSequence", ".", "wasAdded", "(", ")", ")", "{", "next_index", "=", "elem", ".", "nextSequence", ".", "getLastCRLFBufferIndex", "(", ")", ";", "next_pos", "=", "elem", ".", "nextSequence", ".", "getLastCRLFPosition", "(", ")", ";", "}", "WsByteBuffer", "buffer", "=", "this", ".", "parseBuffers", "[", "elem", ".", "getLastCRLFBufferIndex", "(", ")", "]", ";", "buffer", ".", "position", "(", "elem", ".", "getLastCRLFPosition", "(", ")", "+", "(", "elem", ".", "isLastCRLFaCR", "(", ")", "?", "2", ":", "1", ")", ")", ";", "if", "(", "next_index", "==", "elem", ".", "getLastCRLFBufferIndex", "(", ")", ")", "{", "// all in one buffer", "buffer", ".", "put", "(", "elem", ".", "getKey", "(", ")", ".", "getMarshalledByteArray", "(", "foundCompactHeader", "(", ")", ")", ")", ";", "buffer", ".", "put", "(", "elem", ".", "asRawBytes", "(", ")", ",", "elem", ".", "getOffset", "(", ")", ",", "elem", ".", "getValueLength", "(", ")", ")", ";", "}", "else", "{", "// header straddles buffers", "int", "index", "=", "elem", ".", "getLastCRLFBufferIndex", "(", ")", ";", "index", "=", "overlayBytes", "(", "elem", ".", "getKey", "(", ")", ".", "getMarshalledByteArray", "(", "foundCompactHeader", "(", ")", ")", ",", "0", ",", "-", "1", ",", "index", ")", ";", "index", "=", "overlayBytes", "(", "elem", ".", "asRawBytes", "(", ")", ",", "elem", ".", "getOffset", "(", ")", ",", "elem", ".", "getValueLength", "(", ")", ",", "index", ")", ";", "buffer", "=", "this", ".", "parseBuffers", "[", "index", "]", ";", "}", "// pad trailing whitespace if we need it", "int", "start", "=", "buffer", ".", "position", "(", ")", ";", "if", "(", "start", "<", "next_pos", ")", "{", "scribbleWhiteSpace", "(", "buffer", ",", "start", ",", "next_pos", ")", ";", "}", "}" ]
Method to overlay the new header value onto the older value in the parse buffers. @param elem
[ "Method", "to", "overlay", "the", "new", "header", "value", "onto", "the", "older", "value", "in", "the", "parse", "buffers", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/BNFHeadersImpl.java#L1298-L1326
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/BNFHeadersImpl.java
BNFHeadersImpl.marshallAddedHeaders
private WsByteBuffer[] marshallAddedHeaders(WsByteBuffer[] inBuffers, int index) { WsByteBuffer[] buffers = inBuffers; buffers[index] = allocateBuffer(this.outgoingHdrBufferSize); for (HeaderElement elem = this.hdrSequence; null != elem; elem = elem.nextSequence) { if (elem.wasAdded()) { buffers = marshallHeader(buffers, elem); } } // add second EOL buffers = putBytes(BNFHeaders.EOL, buffers); buffers = flushCache(buffers); // flip the last buffer now that we're done buffers[buffers.length - 1].flip(); return buffers; }
java
private WsByteBuffer[] marshallAddedHeaders(WsByteBuffer[] inBuffers, int index) { WsByteBuffer[] buffers = inBuffers; buffers[index] = allocateBuffer(this.outgoingHdrBufferSize); for (HeaderElement elem = this.hdrSequence; null != elem; elem = elem.nextSequence) { if (elem.wasAdded()) { buffers = marshallHeader(buffers, elem); } } // add second EOL buffers = putBytes(BNFHeaders.EOL, buffers); buffers = flushCache(buffers); // flip the last buffer now that we're done buffers[buffers.length - 1].flip(); return buffers; }
[ "private", "WsByteBuffer", "[", "]", "marshallAddedHeaders", "(", "WsByteBuffer", "[", "]", "inBuffers", ",", "int", "index", ")", "{", "WsByteBuffer", "[", "]", "buffers", "=", "inBuffers", ";", "buffers", "[", "index", "]", "=", "allocateBuffer", "(", "this", ".", "outgoingHdrBufferSize", ")", ";", "for", "(", "HeaderElement", "elem", "=", "this", ".", "hdrSequence", ";", "null", "!=", "elem", ";", "elem", "=", "elem", ".", "nextSequence", ")", "{", "if", "(", "elem", ".", "wasAdded", "(", ")", ")", "{", "buffers", "=", "marshallHeader", "(", "buffers", ",", "elem", ")", ";", "}", "}", "// add second EOL", "buffers", "=", "putBytes", "(", "BNFHeaders", ".", "EOL", ",", "buffers", ")", ";", "buffers", "=", "flushCache", "(", "buffers", ")", ";", "// flip the last buffer now that we're done", "buffers", "[", "buffers", ".", "length", "-", "1", "]", ".", "flip", "(", ")", ";", "return", "buffers", ";", "}" ]
Marshall the newly added headers from the sequence list to the output buffers starting at the input index on the list. @param inBuffers @param index @return WsByteBuffer[]
[ "Marshall", "the", "newly", "added", "headers", "from", "the", "sequence", "list", "to", "the", "output", "buffers", "starting", "at", "the", "input", "index", "on", "the", "list", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/BNFHeadersImpl.java#L1336-L1350
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/BNFHeadersImpl.java
BNFHeadersImpl.clearAllHeaders
private void clearAllHeaders() { final boolean bTrace = TraceComponent.isAnyTracingEnabled(); if (bTrace && tc.isEntryEnabled()) { Tr.entry(tc, "clearAllHeaders()"); } HeaderElement elem = this.hdrSequence; while (null != elem) { final HeaderElement next = elem.nextSequence; final HeaderKeys key = elem.getKey(); final int ord = key.getOrdinal(); if (storage.containsKey(ord)) { // first instance being removed if (key.useFilters()) { filterRemove(key, null); } storage.remove(ord); } elem.destroy(); elem = next; } this.hdrSequence = null; this.lastHdrInSequence = null; this.numberOfHeaders = 0; if (bTrace && tc.isEntryEnabled()) { Tr.exit(tc, "clearAllHeaders()"); } }
java
private void clearAllHeaders() { final boolean bTrace = TraceComponent.isAnyTracingEnabled(); if (bTrace && tc.isEntryEnabled()) { Tr.entry(tc, "clearAllHeaders()"); } HeaderElement elem = this.hdrSequence; while (null != elem) { final HeaderElement next = elem.nextSequence; final HeaderKeys key = elem.getKey(); final int ord = key.getOrdinal(); if (storage.containsKey(ord)) { // first instance being removed if (key.useFilters()) { filterRemove(key, null); } storage.remove(ord); } elem.destroy(); elem = next; } this.hdrSequence = null; this.lastHdrInSequence = null; this.numberOfHeaders = 0; if (bTrace && tc.isEntryEnabled()) { Tr.exit(tc, "clearAllHeaders()"); } }
[ "private", "void", "clearAllHeaders", "(", ")", "{", "final", "boolean", "bTrace", "=", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", ";", "if", "(", "bTrace", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "entry", "(", "tc", ",", "\"clearAllHeaders()\"", ")", ";", "}", "HeaderElement", "elem", "=", "this", ".", "hdrSequence", ";", "while", "(", "null", "!=", "elem", ")", "{", "final", "HeaderElement", "next", "=", "elem", ".", "nextSequence", ";", "final", "HeaderKeys", "key", "=", "elem", ".", "getKey", "(", ")", ";", "final", "int", "ord", "=", "key", ".", "getOrdinal", "(", ")", ";", "if", "(", "storage", ".", "containsKey", "(", "ord", ")", ")", "{", "// first instance being removed", "if", "(", "key", ".", "useFilters", "(", ")", ")", "{", "filterRemove", "(", "key", ",", "null", ")", ";", "}", "storage", ".", "remove", "(", "ord", ")", ";", "}", "elem", ".", "destroy", "(", ")", ";", "elem", "=", "next", ";", "}", "this", ".", "hdrSequence", "=", "null", ";", "this", ".", "lastHdrInSequence", "=", "null", ";", "this", ".", "numberOfHeaders", "=", "0", ";", "if", "(", "bTrace", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "exit", "(", "tc", ",", "\"clearAllHeaders()\"", ")", ";", "}", "}" ]
Clear all traces of the headers from storage.
[ "Clear", "all", "traces", "of", "the", "headers", "from", "storage", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/BNFHeadersImpl.java#L1657-L1684
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/BNFHeadersImpl.java
BNFHeadersImpl.removeSpecialHeader
public void removeSpecialHeader(HeaderKeys key) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "removeSpecialHeader(h): " + key.getName()); } removeHdrInstances(findHeader(key), FILTER_NO); }
java
public void removeSpecialHeader(HeaderKeys key) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "removeSpecialHeader(h): " + key.getName()); } removeHdrInstances(findHeader(key), FILTER_NO); }
[ "public", "void", "removeSpecialHeader", "(", "HeaderKeys", "key", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"removeSpecialHeader(h): \"", "+", "key", ".", "getName", "(", ")", ")", ";", "}", "removeHdrInstances", "(", "findHeader", "(", "key", ")", ",", "FILTER_NO", ")", ";", "}" ]
Remove all instances of a special header that does not require the headerkey filterRemove method to be called. @param key
[ "Remove", "all", "instances", "of", "a", "special", "header", "that", "does", "not", "require", "the", "headerkey", "filterRemove", "method", "to", "be", "called", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/BNFHeadersImpl.java#L1778-L1783
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/BNFHeadersImpl.java
BNFHeadersImpl.returnCurrentBuffer
public WsByteBuffer returnCurrentBuffer() { WsByteBuffer buff = null; if (HeaderStorage.NOTSET != this.parseIndex) { buff = this.parseBuffers[this.parseIndex]; this.parseIndex--; } return buff; }
java
public WsByteBuffer returnCurrentBuffer() { WsByteBuffer buff = null; if (HeaderStorage.NOTSET != this.parseIndex) { buff = this.parseBuffers[this.parseIndex]; this.parseIndex--; } return buff; }
[ "public", "WsByteBuffer", "returnCurrentBuffer", "(", ")", "{", "WsByteBuffer", "buff", "=", "null", ";", "if", "(", "HeaderStorage", ".", "NOTSET", "!=", "this", ".", "parseIndex", ")", "{", "buff", "=", "this", ".", "parseBuffers", "[", "this", ".", "parseIndex", "]", ";", "this", ".", "parseIndex", "--", ";", "}", "return", "buff", ";", "}" ]
Method to remove the current parsing buffer from this object's ownership so it can be used by others. @return WsByteBuffer (null if there is no current buffer)
[ "Method", "to", "remove", "the", "current", "parsing", "buffer", "from", "this", "object", "s", "ownership", "so", "it", "can", "be", "used", "by", "others", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/BNFHeadersImpl.java#L1791-L1798
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/BNFHeadersImpl.java
BNFHeadersImpl.createSingleHeader
private void createSingleHeader(HeaderKeys key, byte[] value, int offset, int length) { HeaderElement elem = findHeader(key); if (null != elem) { // delete all secondary instances first if (null != elem.nextInstance) { HeaderElement temp = elem.nextInstance; while (null != temp) { temp.remove(); temp = temp.nextInstance; } } if (HeaderStorage.NOTSET != this.headerChangeLimit) { // parse buffer reuse is enabled, see if we can use existing obj if (length <= elem.getValueLength()) { this.headerChangeCount++; elem.setByteArrayValue(value, offset, length); } else { elem.remove(); elem = null; } } else { // parse buffer reuse is disabled elem.setByteArrayValue(value, offset, length); } } if (null == elem) { // either it didn't exist or we chose not to re-use the object elem = getElement(key); elem.setByteArrayValue(value, offset, length); addHeader(elem, FILTER_NO); } else if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Replacing header " + key.getName() + " [" + elem.getDebugValue() + "]"); } }
java
private void createSingleHeader(HeaderKeys key, byte[] value, int offset, int length) { HeaderElement elem = findHeader(key); if (null != elem) { // delete all secondary instances first if (null != elem.nextInstance) { HeaderElement temp = elem.nextInstance; while (null != temp) { temp.remove(); temp = temp.nextInstance; } } if (HeaderStorage.NOTSET != this.headerChangeLimit) { // parse buffer reuse is enabled, see if we can use existing obj if (length <= elem.getValueLength()) { this.headerChangeCount++; elem.setByteArrayValue(value, offset, length); } else { elem.remove(); elem = null; } } else { // parse buffer reuse is disabled elem.setByteArrayValue(value, offset, length); } } if (null == elem) { // either it didn't exist or we chose not to re-use the object elem = getElement(key); elem.setByteArrayValue(value, offset, length); addHeader(elem, FILTER_NO); } else if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Replacing header " + key.getName() + " [" + elem.getDebugValue() + "]"); } }
[ "private", "void", "createSingleHeader", "(", "HeaderKeys", "key", ",", "byte", "[", "]", "value", ",", "int", "offset", ",", "int", "length", ")", "{", "HeaderElement", "elem", "=", "findHeader", "(", "key", ")", ";", "if", "(", "null", "!=", "elem", ")", "{", "// delete all secondary instances first", "if", "(", "null", "!=", "elem", ".", "nextInstance", ")", "{", "HeaderElement", "temp", "=", "elem", ".", "nextInstance", ";", "while", "(", "null", "!=", "temp", ")", "{", "temp", ".", "remove", "(", ")", ";", "temp", "=", "temp", ".", "nextInstance", ";", "}", "}", "if", "(", "HeaderStorage", ".", "NOTSET", "!=", "this", ".", "headerChangeLimit", ")", "{", "// parse buffer reuse is enabled, see if we can use existing obj", "if", "(", "length", "<=", "elem", ".", "getValueLength", "(", ")", ")", "{", "this", ".", "headerChangeCount", "++", ";", "elem", ".", "setByteArrayValue", "(", "value", ",", "offset", ",", "length", ")", ";", "}", "else", "{", "elem", ".", "remove", "(", ")", ";", "elem", "=", "null", ";", "}", "}", "else", "{", "// parse buffer reuse is disabled", "elem", ".", "setByteArrayValue", "(", "value", ",", "offset", ",", "length", ")", ";", "}", "}", "if", "(", "null", "==", "elem", ")", "{", "// either it didn't exist or we chose not to re-use the object", "elem", "=", "getElement", "(", "key", ")", ";", "elem", ".", "setByteArrayValue", "(", "value", ",", "offset", ",", "length", ")", ";", "addHeader", "(", "elem", ",", "FILTER_NO", ")", ";", "}", "else", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Replacing header \"", "+", "key", ".", "getName", "(", ")", "+", "\" [\"", "+", "elem", ".", "getDebugValue", "(", ")", "+", "\"]\"", ")", ";", "}", "}" ]
Utility method to create a single header instance with the given information. If elements already exist, this will delete secondary ones and overlay the value on the first element. @param key @param value @param offset @param length
[ "Utility", "method", "to", "create", "a", "single", "header", "instance", "with", "the", "given", "information", ".", "If", "elements", "already", "exist", "this", "will", "delete", "secondary", "ones", "and", "overlay", "the", "value", "on", "the", "first", "element", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/BNFHeadersImpl.java#L2044-L2077
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/BNFHeadersImpl.java
BNFHeadersImpl.addHeader
private void addHeader(HeaderElement elem, boolean bFilter) { final HeaderKeys key = elem.getKey(); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Adding header [" + key.getName() + "] with value [" + elem.getDebugValue() + "]"); } if (getRemoteIp() && key.getName().toLowerCase().startsWith("x-forwarded") && !forwardHeaderErrorState) { processForwardedHeader(elem, true); } else if (getRemoteIp() && key.getName().toLowerCase().startsWith("forwarded") && !forwardHeaderErrorState) { processForwardedHeader(elem, false); } if (bFilter) { if (key.useFilters() && !filterAdd(key, elem.asBytes())) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "filter disallowed: " + elem.getDebugValue()); } return; } } if (HttpHeaderKeys.isWasPrivateHeader(key.getName())) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "checking to see if private header is allowed: " + key.getName()); } if (!filterAdd(key, elem.asBytes())) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, key.getName() +" is not trusted for this host; not adding header"); } return; } } incrementHeaderCounter(); HeaderElement root = findHeader(key); boolean rc = addInstanceOfElement(root, elem); // did we change the root node? if (rc) { final int ord = key.getOrdinal(); storage.put(ord, elem); } }
java
private void addHeader(HeaderElement elem, boolean bFilter) { final HeaderKeys key = elem.getKey(); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Adding header [" + key.getName() + "] with value [" + elem.getDebugValue() + "]"); } if (getRemoteIp() && key.getName().toLowerCase().startsWith("x-forwarded") && !forwardHeaderErrorState) { processForwardedHeader(elem, true); } else if (getRemoteIp() && key.getName().toLowerCase().startsWith("forwarded") && !forwardHeaderErrorState) { processForwardedHeader(elem, false); } if (bFilter) { if (key.useFilters() && !filterAdd(key, elem.asBytes())) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "filter disallowed: " + elem.getDebugValue()); } return; } } if (HttpHeaderKeys.isWasPrivateHeader(key.getName())) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "checking to see if private header is allowed: " + key.getName()); } if (!filterAdd(key, elem.asBytes())) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, key.getName() +" is not trusted for this host; not adding header"); } return; } } incrementHeaderCounter(); HeaderElement root = findHeader(key); boolean rc = addInstanceOfElement(root, elem); // did we change the root node? if (rc) { final int ord = key.getOrdinal(); storage.put(ord, elem); } }
[ "private", "void", "addHeader", "(", "HeaderElement", "elem", ",", "boolean", "bFilter", ")", "{", "final", "HeaderKeys", "key", "=", "elem", ".", "getKey", "(", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEventEnabled", "(", ")", ")", "{", "Tr", ".", "event", "(", "tc", ",", "\"Adding header [\"", "+", "key", ".", "getName", "(", ")", "+", "\"] with value [\"", "+", "elem", ".", "getDebugValue", "(", ")", "+", "\"]\"", ")", ";", "}", "if", "(", "getRemoteIp", "(", ")", "&&", "key", ".", "getName", "(", ")", ".", "toLowerCase", "(", ")", ".", "startsWith", "(", "\"x-forwarded\"", ")", "&&", "!", "forwardHeaderErrorState", ")", "{", "processForwardedHeader", "(", "elem", ",", "true", ")", ";", "}", "else", "if", "(", "getRemoteIp", "(", ")", "&&", "key", ".", "getName", "(", ")", ".", "toLowerCase", "(", ")", ".", "startsWith", "(", "\"forwarded\"", ")", "&&", "!", "forwardHeaderErrorState", ")", "{", "processForwardedHeader", "(", "elem", ",", "false", ")", ";", "}", "if", "(", "bFilter", ")", "{", "if", "(", "key", ".", "useFilters", "(", ")", "&&", "!", "filterAdd", "(", "key", ",", "elem", ".", "asBytes", "(", ")", ")", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"filter disallowed: \"", "+", "elem", ".", "getDebugValue", "(", ")", ")", ";", "}", "return", ";", "}", "}", "if", "(", "HttpHeaderKeys", ".", "isWasPrivateHeader", "(", "key", ".", "getName", "(", ")", ")", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"checking to see if private header is allowed: \"", "+", "key", ".", "getName", "(", ")", ")", ";", "}", "if", "(", "!", "filterAdd", "(", "key", ",", "elem", ".", "asBytes", "(", ")", ")", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "key", ".", "getName", "(", ")", "+", "\" is not trusted for this host; not adding header\"", ")", ";", "}", "return", ";", "}", "}", "incrementHeaderCounter", "(", ")", ";", "HeaderElement", "root", "=", "findHeader", "(", "key", ")", ";", "boolean", "rc", "=", "addInstanceOfElement", "(", "root", ",", "elem", ")", ";", "// did we change the root node?", "if", "(", "rc", ")", "{", "final", "int", "ord", "=", "key", ".", "getOrdinal", "(", ")", ";", "storage", ".", "put", "(", "ord", ",", "elem", ")", ";", "}", "}" ]
Add this new instance of a header to storage. @param elem @param bFilter - call filter on add?
[ "Add", "this", "new", "instance", "of", "a", "header", "to", "storage", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/BNFHeadersImpl.java#L2085-L2129
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/BNFHeadersImpl.java
BNFHeadersImpl.findHeader
private HeaderElement findHeader(HeaderKeys key, int instance) { final int ord = key.getOrdinal(); if (!storage.containsKey(ord) && ord <= HttpHeaderKeys.ORD_MAX) { return null; } HeaderElement elem = null; //If the ordinal created for this key is larger than 1024, the header key //storage has been capped. As such, search the internal header storage //to see if we have a header with this name already added. if (ord > HttpHeaderKeys.ORD_MAX) { for (HeaderElement header : storage.values()) { if (header.getKey().getName().equals(key.getName())) { elem = header; break; } } } else { elem = storage.get(ord); } int i = -1; while (null != elem) { if (!elem.wasRemoved()) { if (++i == instance) { return elem; } } elem = elem.nextInstance; } return null; }
java
private HeaderElement findHeader(HeaderKeys key, int instance) { final int ord = key.getOrdinal(); if (!storage.containsKey(ord) && ord <= HttpHeaderKeys.ORD_MAX) { return null; } HeaderElement elem = null; //If the ordinal created for this key is larger than 1024, the header key //storage has been capped. As such, search the internal header storage //to see if we have a header with this name already added. if (ord > HttpHeaderKeys.ORD_MAX) { for (HeaderElement header : storage.values()) { if (header.getKey().getName().equals(key.getName())) { elem = header; break; } } } else { elem = storage.get(ord); } int i = -1; while (null != elem) { if (!elem.wasRemoved()) { if (++i == instance) { return elem; } } elem = elem.nextInstance; } return null; }
[ "private", "HeaderElement", "findHeader", "(", "HeaderKeys", "key", ",", "int", "instance", ")", "{", "final", "int", "ord", "=", "key", ".", "getOrdinal", "(", ")", ";", "if", "(", "!", "storage", ".", "containsKey", "(", "ord", ")", "&&", "ord", "<=", "HttpHeaderKeys", ".", "ORD_MAX", ")", "{", "return", "null", ";", "}", "HeaderElement", "elem", "=", "null", ";", "//If the ordinal created for this key is larger than 1024, the header key", "//storage has been capped. As such, search the internal header storage", "//to see if we have a header with this name already added.", "if", "(", "ord", ">", "HttpHeaderKeys", ".", "ORD_MAX", ")", "{", "for", "(", "HeaderElement", "header", ":", "storage", ".", "values", "(", ")", ")", "{", "if", "(", "header", ".", "getKey", "(", ")", ".", "getName", "(", ")", ".", "equals", "(", "key", ".", "getName", "(", ")", ")", ")", "{", "elem", "=", "header", ";", "break", ";", "}", "}", "}", "else", "{", "elem", "=", "storage", ".", "get", "(", "ord", ")", ";", "}", "int", "i", "=", "-", "1", ";", "while", "(", "null", "!=", "elem", ")", "{", "if", "(", "!", "elem", ".", "wasRemoved", "(", ")", ")", "{", "if", "(", "++", "i", "==", "instance", ")", "{", "return", "elem", ";", "}", "}", "elem", "=", "elem", ".", "nextInstance", ";", "}", "return", "null", ";", "}" ]
Find the specific instance of this header in storage. @param key @param instance @return HeaderElement
[ "Find", "the", "specific", "instance", "of", "this", "header", "in", "storage", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/BNFHeadersImpl.java#L2196-L2230
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/BNFHeadersImpl.java
BNFHeadersImpl.removeHdr
private void removeHdr(HeaderElement elem) { if (null == elem) { return; } HeaderKeys key = elem.getKey(); elem.remove(); if (key.useFilters()) { filterRemove(key, elem.asBytes()); } }
java
private void removeHdr(HeaderElement elem) { if (null == elem) { return; } HeaderKeys key = elem.getKey(); elem.remove(); if (key.useFilters()) { filterRemove(key, elem.asBytes()); } }
[ "private", "void", "removeHdr", "(", "HeaderElement", "elem", ")", "{", "if", "(", "null", "==", "elem", ")", "{", "return", ";", "}", "HeaderKeys", "key", "=", "elem", ".", "getKey", "(", ")", ";", "elem", ".", "remove", "(", ")", ";", "if", "(", "key", ".", "useFilters", "(", ")", ")", "{", "filterRemove", "(", "key", ",", "elem", ".", "asBytes", "(", ")", ")", ";", "}", "}" ]
Remove this single instance of a header. @param elem
[ "Remove", "this", "single", "instance", "of", "a", "header", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/BNFHeadersImpl.java#L2273-L2282
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/BNFHeadersImpl.java
BNFHeadersImpl.removeHdrInstances
private void removeHdrInstances(HeaderElement root, boolean bFilter) { if (null == root) { return; } HeaderKeys key = root.getKey(); if (bFilter && key.useFilters()) { filterRemove(key, null); } HeaderElement elem = root; while (null != elem) { elem.remove(); elem = elem.nextInstance; } }
java
private void removeHdrInstances(HeaderElement root, boolean bFilter) { if (null == root) { return; } HeaderKeys key = root.getKey(); if (bFilter && key.useFilters()) { filterRemove(key, null); } HeaderElement elem = root; while (null != elem) { elem.remove(); elem = elem.nextInstance; } }
[ "private", "void", "removeHdrInstances", "(", "HeaderElement", "root", ",", "boolean", "bFilter", ")", "{", "if", "(", "null", "==", "root", ")", "{", "return", ";", "}", "HeaderKeys", "key", "=", "root", ".", "getKey", "(", ")", ";", "if", "(", "bFilter", "&&", "key", ".", "useFilters", "(", ")", ")", "{", "filterRemove", "(", "key", ",", "null", ")", ";", "}", "HeaderElement", "elem", "=", "root", ";", "while", "(", "null", "!=", "elem", ")", "{", "elem", ".", "remove", "(", ")", ";", "elem", "=", "elem", ".", "nextInstance", ";", "}", "}" ]
Remove all instances of this header. @param root @param bFilter
[ "Remove", "all", "instances", "of", "this", "header", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/BNFHeadersImpl.java#L2290-L2303
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/BNFHeadersImpl.java
BNFHeadersImpl.setSpecialHeader
protected void setSpecialHeader(HeaderKeys key, byte[] value) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "setSpecialHeader(h,b[]): " + key.getName()); } removeHdrInstances(findHeader(key), FILTER_NO); HeaderElement elem = getElement(key); elem.setByteArrayValue(value); addHeader(elem, FILTER_NO); }
java
protected void setSpecialHeader(HeaderKeys key, byte[] value) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "setSpecialHeader(h,b[]): " + key.getName()); } removeHdrInstances(findHeader(key), FILTER_NO); HeaderElement elem = getElement(key); elem.setByteArrayValue(value); addHeader(elem, FILTER_NO); }
[ "protected", "void", "setSpecialHeader", "(", "HeaderKeys", "key", ",", "byte", "[", "]", "value", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"setSpecialHeader(h,b[]): \"", "+", "key", ".", "getName", "(", ")", ")", ";", "}", "removeHdrInstances", "(", "findHeader", "(", "key", ")", ",", "FILTER_NO", ")", ";", "HeaderElement", "elem", "=", "getElement", "(", "key", ")", ";", "elem", ".", "setByteArrayValue", "(", "value", ")", ";", "addHeader", "(", "elem", ",", "FILTER_NO", ")", ";", "}" ]
Set one of the special headers that does not require the headerkey filterX methods to be called. @param key @param value
[ "Set", "one", "of", "the", "special", "headers", "that", "does", "not", "require", "the", "headerkey", "filterX", "methods", "to", "be", "called", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/BNFHeadersImpl.java#L2312-L2320
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/BNFHeadersImpl.java
BNFHeadersImpl.setHeaderChangeLimit
public void setHeaderChangeLimit(int limit) { this.headerChangeLimit = limit; this.bOverChangeLimit = false; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Setting header change limit to " + limit); } }
java
public void setHeaderChangeLimit(int limit) { this.headerChangeLimit = limit; this.bOverChangeLimit = false; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Setting header change limit to " + limit); } }
[ "public", "void", "setHeaderChangeLimit", "(", "int", "limit", ")", "{", "this", ".", "headerChangeLimit", "=", "limit", ";", "this", ".", "bOverChangeLimit", "=", "false", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Setting header change limit to \"", "+", "limit", ")", ";", "}", "}" ]
Set the limit on the number of allowed header changes before this message must be remarshalled. @param limit
[ "Set", "the", "limit", "on", "the", "number", "of", "allowed", "header", "changes", "before", "this", "message", "must", "be", "remarshalled", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/BNFHeadersImpl.java#L2360-L2366
train