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/processor/impl/SubscriptionDefinitionImpl.java
SubscriptionDefinitionImpl.getUser
public String getUser() { if (tc.isEntryEnabled()) { SibTr.entry(tc, "getUser"); SibTr.exit(tc, "getUser", user); } return user; }
java
public String getUser() { if (tc.isEntryEnabled()) { SibTr.entry(tc, "getUser"); SibTr.exit(tc, "getUser", user); } return user; }
[ "public", "String", "getUser", "(", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "entry", "(", "tc", ",", "\"getUser\"", ")", ";", "SibTr", ".", "exit", "(", "tc", ",", "\"getUser\"", ",", "user", ")", ";", "}", "return", "user", ";", "}" ]
Returns the user. @return String
[ "Returns", "the", "user", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/SubscriptionDefinitionImpl.java#L151-L160
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/SubscriptionDefinitionImpl.java
SubscriptionDefinitionImpl.setDestination
public void setDestination(String destination) { if (tc.isEntryEnabled()) SibTr.entry(tc, "setDestination", destination); this.destination = destination; if (tc.isEntryEnabled()) SibTr.exit(tc, "setDestination"); }
java
public void setDestination(String destination) { if (tc.isEntryEnabled()) SibTr.entry(tc, "setDestination", destination); this.destination = destination; if (tc.isEntryEnabled()) SibTr.exit(tc, "setDestination"); }
[ "public", "void", "setDestination", "(", "String", "destination", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"setDestination\"", ",", "destination", ")", ";", "this", ".", "destination", "=", "destination", ";", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"setDestination\"", ")", ";", "}" ]
Sets the destination. @param destination The destination to set
[ "Sets", "the", "destination", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/SubscriptionDefinitionImpl.java#L166-L175
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/SubscriptionDefinitionImpl.java
SubscriptionDefinitionImpl.setSelector
public void setSelector(String selector) { if (tc.isEntryEnabled()) SibTr.entry(tc, "setSelector", selector); this.selector = selector; if (tc.isEntryEnabled()) SibTr.exit(tc, "setSelector"); }
java
public void setSelector(String selector) { if (tc.isEntryEnabled()) SibTr.entry(tc, "setSelector", selector); this.selector = selector; if (tc.isEntryEnabled()) SibTr.exit(tc, "setSelector"); }
[ "public", "void", "setSelector", "(", "String", "selector", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"setSelector\"", ",", "selector", ")", ";", "this", ".", "selector", "=", "selector", ";", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"setSelector\"", ")", ";", "}" ]
Sets the selector. @param selector The selector to set
[ "Sets", "the", "selector", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/SubscriptionDefinitionImpl.java#L181-L190
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/SubscriptionDefinitionImpl.java
SubscriptionDefinitionImpl.setTopic
public void setTopic(String topic) { if (tc.isEntryEnabled()) SibTr.entry(tc, "setTopic", topic); this.topic = topic; if (tc.isEntryEnabled()) SibTr.exit(tc, "setTopic"); }
java
public void setTopic(String topic) { if (tc.isEntryEnabled()) SibTr.entry(tc, "setTopic", topic); this.topic = topic; if (tc.isEntryEnabled()) SibTr.exit(tc, "setTopic"); }
[ "public", "void", "setTopic", "(", "String", "topic", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"setTopic\"", ",", "topic", ")", ";", "this", ".", "topic", "=", "topic", ";", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"setTopic\"", ")", ";", "}" ]
Sets the topic. @param topic The topic to set
[ "Sets", "the", "topic", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/SubscriptionDefinitionImpl.java#L196-L205
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/SubscriptionDefinitionImpl.java
SubscriptionDefinitionImpl.isNoLocal
public boolean isNoLocal() { if (tc.isEntryEnabled()) { SibTr.entry(tc, "isNoLocal"); SibTr.exit(tc, "isNoLocal", new Boolean(noLocal)); } return noLocal; }
java
public boolean isNoLocal() { if (tc.isEntryEnabled()) { SibTr.entry(tc, "isNoLocal"); SibTr.exit(tc, "isNoLocal", new Boolean(noLocal)); } return noLocal; }
[ "public", "boolean", "isNoLocal", "(", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "entry", "(", "tc", ",", "\"isNoLocal\"", ")", ";", "SibTr", ".", "exit", "(", "tc", ",", "\"isNoLocal\"", ",", "new", "Boolean", "(", "noLocal", ")", ")", ";", "}", "return", "noLocal", ";", "}" ]
Returns the noLocal. @return boolean
[ "Returns", "the", "noLocal", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/SubscriptionDefinitionImpl.java#L226-L235
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/SubscriptionDefinitionImpl.java
SubscriptionDefinitionImpl.setNoLocal
public void setNoLocal(boolean noLocal) { if (tc.isEntryEnabled()) SibTr.entry(tc, "setNoLocal", new Boolean(noLocal)); this.noLocal = noLocal; if (tc.isEntryEnabled()) SibTr.exit(tc, "setNoLocal"); }
java
public void setNoLocal(boolean noLocal) { if (tc.isEntryEnabled()) SibTr.entry(tc, "setNoLocal", new Boolean(noLocal)); this.noLocal = noLocal; if (tc.isEntryEnabled()) SibTr.exit(tc, "setNoLocal"); }
[ "public", "void", "setNoLocal", "(", "boolean", "noLocal", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"setNoLocal\"", ",", "new", "Boolean", "(", "noLocal", ")", ")", ";", "this", ".", "noLocal", "=", "noLocal", ";", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"setNoLocal\"", ")", ";", "}" ]
Sets the noLocal. @param noLocal The noLocal to set
[ "Sets", "the", "noLocal", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/SubscriptionDefinitionImpl.java#L241-L250
train
OpenLiberty/open-liberty
dev/com.ibm.ws.org.apache.cxf.cxf.core.3.2/src/org/apache/cxf/common/jaxb/JAXBUtils.java
JAXBUtils.namespaceURIToPackage
@FFDCIgnore(URISyntaxException.class) public static String namespaceURIToPackage(String namespaceURI) { try { return nameSpaceURIToPackage(new URI(namespaceURI)); } catch (URISyntaxException ex) { return null; } }
java
@FFDCIgnore(URISyntaxException.class) public static String namespaceURIToPackage(String namespaceURI) { try { return nameSpaceURIToPackage(new URI(namespaceURI)); } catch (URISyntaxException ex) { return null; } }
[ "@", "FFDCIgnore", "(", "URISyntaxException", ".", "class", ")", "public", "static", "String", "namespaceURIToPackage", "(", "String", "namespaceURI", ")", "{", "try", "{", "return", "nameSpaceURIToPackage", "(", "new", "URI", "(", "namespaceURI", ")", ")", ";", "}", "catch", "(", "URISyntaxException", "ex", ")", "{", "return", "null", ";", "}", "}" ]
Generates a Java package name from a URI according to the algorithm outlined in JAXB 2.0. @param namespaceURI the namespace URI. @return the package name.
[ "Generates", "a", "Java", "package", "name", "from", "a", "URI", "according", "to", "the", "algorithm", "outlined", "in", "JAXB", "2", ".", "0", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.org.apache.cxf.cxf.core.3.2/src/org/apache/cxf/common/jaxb/JAXBUtils.java#L269-L276
train
OpenLiberty/open-liberty
dev/com.ibm.ws.org.apache.cxf.cxf.core.3.2/src/org/apache/cxf/common/jaxb/JAXBUtils.java
JAXBUtils.nameToIdentifier
public static String nameToIdentifier(String name, IdentifierType type) { if (null == name || name.length() == 0) { return name; } // algorithm will not change an XML name that is already a legal and // conventional (!) Java class, method, or constant identifier boolean legalIdentifier = false; StringBuilder buf = new StringBuilder(name); boolean hasUnderscore = false; legalIdentifier = Character.isJavaIdentifierStart(buf.charAt(0)); for (int i = 1; i < name.length() && legalIdentifier; i++) { legalIdentifier &= Character.isJavaIdentifierPart(buf.charAt(i)); hasUnderscore |= '_' == buf.charAt(i); } boolean conventionalIdentifier = isConventionalIdentifier(buf, type); if (legalIdentifier && conventionalIdentifier) { if (JAXBUtils.isJavaKeyword(name) && type == IdentifierType.VARIABLE) { name = normalizePackageNamePart(name); } if (!hasUnderscore || IdentifierType.CLASS != type) { return name; } } // split into words List<String> words = new ArrayList<>(); StringTokenizer st = new StringTokenizer(name, XML_NAME_PUNCTUATION_STRING); while (st.hasMoreTokens()) { words.add(st.nextToken()); } for (int i = 0; i < words.size(); i++) { splitWord(words, i); } return makeConventionalIdentifier(words, type); }
java
public static String nameToIdentifier(String name, IdentifierType type) { if (null == name || name.length() == 0) { return name; } // algorithm will not change an XML name that is already a legal and // conventional (!) Java class, method, or constant identifier boolean legalIdentifier = false; StringBuilder buf = new StringBuilder(name); boolean hasUnderscore = false; legalIdentifier = Character.isJavaIdentifierStart(buf.charAt(0)); for (int i = 1; i < name.length() && legalIdentifier; i++) { legalIdentifier &= Character.isJavaIdentifierPart(buf.charAt(i)); hasUnderscore |= '_' == buf.charAt(i); } boolean conventionalIdentifier = isConventionalIdentifier(buf, type); if (legalIdentifier && conventionalIdentifier) { if (JAXBUtils.isJavaKeyword(name) && type == IdentifierType.VARIABLE) { name = normalizePackageNamePart(name); } if (!hasUnderscore || IdentifierType.CLASS != type) { return name; } } // split into words List<String> words = new ArrayList<>(); StringTokenizer st = new StringTokenizer(name, XML_NAME_PUNCTUATION_STRING); while (st.hasMoreTokens()) { words.add(st.nextToken()); } for (int i = 0; i < words.size(); i++) { splitWord(words, i); } return makeConventionalIdentifier(words, type); }
[ "public", "static", "String", "nameToIdentifier", "(", "String", "name", ",", "IdentifierType", "type", ")", "{", "if", "(", "null", "==", "name", "||", "name", ".", "length", "(", ")", "==", "0", ")", "{", "return", "name", ";", "}", "// algorithm will not change an XML name that is already a legal and", "// conventional (!) Java class, method, or constant identifier", "boolean", "legalIdentifier", "=", "false", ";", "StringBuilder", "buf", "=", "new", "StringBuilder", "(", "name", ")", ";", "boolean", "hasUnderscore", "=", "false", ";", "legalIdentifier", "=", "Character", ".", "isJavaIdentifierStart", "(", "buf", ".", "charAt", "(", "0", ")", ")", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<", "name", ".", "length", "(", ")", "&&", "legalIdentifier", ";", "i", "++", ")", "{", "legalIdentifier", "&=", "Character", ".", "isJavaIdentifierPart", "(", "buf", ".", "charAt", "(", "i", ")", ")", ";", "hasUnderscore", "|=", "'", "'", "==", "buf", ".", "charAt", "(", "i", ")", ";", "}", "boolean", "conventionalIdentifier", "=", "isConventionalIdentifier", "(", "buf", ",", "type", ")", ";", "if", "(", "legalIdentifier", "&&", "conventionalIdentifier", ")", "{", "if", "(", "JAXBUtils", ".", "isJavaKeyword", "(", "name", ")", "&&", "type", "==", "IdentifierType", ".", "VARIABLE", ")", "{", "name", "=", "normalizePackageNamePart", "(", "name", ")", ";", "}", "if", "(", "!", "hasUnderscore", "||", "IdentifierType", ".", "CLASS", "!=", "type", ")", "{", "return", "name", ";", "}", "}", "// split into words", "List", "<", "String", ">", "words", "=", "new", "ArrayList", "<>", "(", ")", ";", "StringTokenizer", "st", "=", "new", "StringTokenizer", "(", "name", ",", "XML_NAME_PUNCTUATION_STRING", ")", ";", "while", "(", "st", ".", "hasMoreTokens", "(", ")", ")", "{", "words", ".", "add", "(", "st", ".", "nextToken", "(", ")", ")", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "words", ".", "size", "(", ")", ";", "i", "++", ")", "{", "splitWord", "(", "words", ",", "i", ")", ";", "}", "return", "makeConventionalIdentifier", "(", "words", ",", "type", ")", ";", "}" ]
Converts an XML name to a Java identifier according to the mapping algorithm outlined in the JAXB specification @param name the XML name @return the Java identifier
[ "Converts", "an", "XML", "name", "to", "a", "Java", "identifier", "according", "to", "the", "mapping", "algorithm", "outlined", "in", "the", "JAXB", "specification" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.org.apache.cxf.cxf.core.3.2/src/org/apache/cxf/common/jaxb/JAXBUtils.java#L402-L445
train
OpenLiberty/open-liberty
dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/JSSEProviderFactory.java
JSSEProviderFactory.getDefaultSSLSocketFactory
public static String getDefaultSSLSocketFactory() { if (defaultSSLSocketFactory == null) { defaultSSLSocketFactory = AccessController.doPrivileged(new PrivilegedAction<String>() { @Override public String run() { return Security.getProperty("ssl.SocketFactory.provider"); } }); } return defaultSSLSocketFactory; }
java
public static String getDefaultSSLSocketFactory() { if (defaultSSLSocketFactory == null) { defaultSSLSocketFactory = AccessController.doPrivileged(new PrivilegedAction<String>() { @Override public String run() { return Security.getProperty("ssl.SocketFactory.provider"); } }); } return defaultSSLSocketFactory; }
[ "public", "static", "String", "getDefaultSSLSocketFactory", "(", ")", "{", "if", "(", "defaultSSLSocketFactory", "==", "null", ")", "{", "defaultSSLSocketFactory", "=", "AccessController", ".", "doPrivileged", "(", "new", "PrivilegedAction", "<", "String", ">", "(", ")", "{", "@", "Override", "public", "String", "run", "(", ")", "{", "return", "Security", ".", "getProperty", "(", "\"ssl.SocketFactory.provider\"", ")", ";", "}", "}", ")", ";", "}", "return", "defaultSSLSocketFactory", ";", "}" ]
Get the default SSLSocketFactory from Security. @return String
[ "Get", "the", "default", "SSLSocketFactory", "from", "Security", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/JSSEProviderFactory.java#L203-L214
train
OpenLiberty/open-liberty
dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/JSSEProviderFactory.java
JSSEProviderFactory.getDefaultSSLServerSocketFactory
public static String getDefaultSSLServerSocketFactory() { if (defaultSSLServerSocketFactory == null) { defaultSSLServerSocketFactory = AccessController.doPrivileged(new PrivilegedAction<String>() { @Override public String run() { return Security.getProperty("ssl.ServerSocketFactory.provider"); } }); } return defaultSSLServerSocketFactory; }
java
public static String getDefaultSSLServerSocketFactory() { if (defaultSSLServerSocketFactory == null) { defaultSSLServerSocketFactory = AccessController.doPrivileged(new PrivilegedAction<String>() { @Override public String run() { return Security.getProperty("ssl.ServerSocketFactory.provider"); } }); } return defaultSSLServerSocketFactory; }
[ "public", "static", "String", "getDefaultSSLServerSocketFactory", "(", ")", "{", "if", "(", "defaultSSLServerSocketFactory", "==", "null", ")", "{", "defaultSSLServerSocketFactory", "=", "AccessController", ".", "doPrivileged", "(", "new", "PrivilegedAction", "<", "String", ">", "(", ")", "{", "@", "Override", "public", "String", "run", "(", ")", "{", "return", "Security", ".", "getProperty", "(", "\"ssl.ServerSocketFactory.provider\"", ")", ";", "}", "}", ")", ";", "}", "return", "defaultSSLServerSocketFactory", ";", "}" ]
Get the default SSLServerSocketFactory class from Security. @return String
[ "Get", "the", "default", "SSLServerSocketFactory", "class", "from", "Security", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/JSSEProviderFactory.java#L221-L232
train
OpenLiberty/open-liberty
dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/JSSEProviderFactory.java
JSSEProviderFactory.getKeyManagerFactoryAlgorithm
public static String getKeyManagerFactoryAlgorithm() { if (keyManagerFactoryAlgorithm == null) { keyManagerFactoryAlgorithm = AccessController.doPrivileged(new PrivilegedAction<String>() { @Override public String run() { return Security.getProperty("ssl.KeyManagerFactory.algorithm"); } }); } return keyManagerFactoryAlgorithm; }
java
public static String getKeyManagerFactoryAlgorithm() { if (keyManagerFactoryAlgorithm == null) { keyManagerFactoryAlgorithm = AccessController.doPrivileged(new PrivilegedAction<String>() { @Override public String run() { return Security.getProperty("ssl.KeyManagerFactory.algorithm"); } }); } return keyManagerFactoryAlgorithm; }
[ "public", "static", "String", "getKeyManagerFactoryAlgorithm", "(", ")", "{", "if", "(", "keyManagerFactoryAlgorithm", "==", "null", ")", "{", "keyManagerFactoryAlgorithm", "=", "AccessController", ".", "doPrivileged", "(", "new", "PrivilegedAction", "<", "String", ">", "(", ")", "{", "@", "Override", "public", "String", "run", "(", ")", "{", "return", "Security", ".", "getProperty", "(", "\"ssl.KeyManagerFactory.algorithm\"", ")", ";", "}", "}", ")", ";", "}", "return", "keyManagerFactoryAlgorithm", ";", "}" ]
Get the key manager factory algorithm default from Security. @return String
[ "Get", "the", "key", "manager", "factory", "algorithm", "default", "from", "Security", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/JSSEProviderFactory.java#L239-L250
train
OpenLiberty/open-liberty
dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/JSSEProviderFactory.java
JSSEProviderFactory.getTrustManagerFactoryAlgorithm
public static String getTrustManagerFactoryAlgorithm() { if (trustManagerFactoryAlgorithm == null) { trustManagerFactoryAlgorithm = AccessController.doPrivileged(new PrivilegedAction<String>() { @Override public String run() { return Security.getProperty("ssl.TrustManagerFactory.algorithm"); } }); } return trustManagerFactoryAlgorithm; }
java
public static String getTrustManagerFactoryAlgorithm() { if (trustManagerFactoryAlgorithm == null) { trustManagerFactoryAlgorithm = AccessController.doPrivileged(new PrivilegedAction<String>() { @Override public String run() { return Security.getProperty("ssl.TrustManagerFactory.algorithm"); } }); } return trustManagerFactoryAlgorithm; }
[ "public", "static", "String", "getTrustManagerFactoryAlgorithm", "(", ")", "{", "if", "(", "trustManagerFactoryAlgorithm", "==", "null", ")", "{", "trustManagerFactoryAlgorithm", "=", "AccessController", ".", "doPrivileged", "(", "new", "PrivilegedAction", "<", "String", ">", "(", ")", "{", "@", "Override", "public", "String", "run", "(", ")", "{", "return", "Security", ".", "getProperty", "(", "\"ssl.TrustManagerFactory.algorithm\"", ")", ";", "}", "}", ")", ";", "}", "return", "trustManagerFactoryAlgorithm", ";", "}" ]
Get the trust manager factory algorithm default from Security. @return String
[ "Get", "the", "trust", "manager", "factory", "algorithm", "default", "from", "Security", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/JSSEProviderFactory.java#L257-L268
train
OpenLiberty/open-liberty
dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/JSSEProviderFactory.java
JSSEProviderFactory.initializeIBMCMSProvider
public static void initializeIBMCMSProvider() throws Exception { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.entry(tc, "initializeIBMCMSProvider"); Provider provider = Security.getProvider(Constants.IBMCMS_NAME); if (provider != null) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(tc, "initializeIBMCMSProvider (already present)"); return; } AccessController.doPrivileged(new PrivilegedAction<Object>() { @Override public Object run() { try { Provider cmsprovider = (Provider) Class.forName(Constants.IBMCMS).newInstance(); if (cmsprovider != null) { Security.addProvider(cmsprovider); } } catch (Exception e) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "Exception loading provider: " + Constants.IBMCMS); } return null; } }); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(tc, "initializeIBMCMSProvider (provider initialized)"); }
java
public static void initializeIBMCMSProvider() throws Exception { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.entry(tc, "initializeIBMCMSProvider"); Provider provider = Security.getProvider(Constants.IBMCMS_NAME); if (provider != null) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(tc, "initializeIBMCMSProvider (already present)"); return; } AccessController.doPrivileged(new PrivilegedAction<Object>() { @Override public Object run() { try { Provider cmsprovider = (Provider) Class.forName(Constants.IBMCMS).newInstance(); if (cmsprovider != null) { Security.addProvider(cmsprovider); } } catch (Exception e) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "Exception loading provider: " + Constants.IBMCMS); } return null; } }); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(tc, "initializeIBMCMSProvider (provider initialized)"); }
[ "public", "static", "void", "initializeIBMCMSProvider", "(", ")", "throws", "Exception", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "tc", ",", "\"initializeIBMCMSProvider\"", ")", ";", "Provider", "provider", "=", "Security", ".", "getProvider", "(", "Constants", ".", "IBMCMS_NAME", ")", ";", "if", "(", "provider", "!=", "null", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"initializeIBMCMSProvider (already present)\"", ")", ";", "return", ";", "}", "AccessController", ".", "doPrivileged", "(", "new", "PrivilegedAction", "<", "Object", ">", "(", ")", "{", "@", "Override", "public", "Object", "run", "(", ")", "{", "try", "{", "Provider", "cmsprovider", "=", "(", "Provider", ")", "Class", ".", "forName", "(", "Constants", ".", "IBMCMS", ")", ".", "newInstance", "(", ")", ";", "if", "(", "cmsprovider", "!=", "null", ")", "{", "Security", ".", "addProvider", "(", "cmsprovider", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "tc", ",", "\"Exception loading provider: \"", "+", "Constants", ".", "IBMCMS", ")", ";", "}", "return", "null", ";", "}", "}", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"initializeIBMCMSProvider (provider initialized)\"", ")", ";", "}" ]
Initialize the IBM CMS provider. @throws Exception
[ "Initialize", "the", "IBM", "CMS", "provider", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/JSSEProviderFactory.java#L275-L307
train
OpenLiberty/open-liberty
dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/JSSEProviderFactory.java
JSSEProviderFactory.insertProviderAt
public static void insertProviderAt(Provider newProvider, int slot) { Provider[] provider_list = Security.getProviders(); if (null == provider_list || 0 == provider_list.length) { return; } // add the new provider to the new list at the correct slot #. Provider[] newList = new Provider[provider_list.length + 2]; newList[slot] = newProvider; int newListIndex = 1; // add the rest of the providers for (int i = 0; i < provider_list.length; i++) { Provider currentProvider = provider_list[i]; if (currentProvider != null && !currentProvider.getName().equals(newProvider.getName())) { // keep incrementing until we find the first available slot. while (newList[newListIndex] != null) { newListIndex++; } newList[newListIndex] = currentProvider; newListIndex++; } } removeAllProviders(); // add the rest of the providers to the list. for (int i = 0; i < newList.length; i++) { Provider currentProvider = newList[i]; if (currentProvider != null) { int position = Security.insertProviderAt(currentProvider, (i + 1)); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, currentProvider.getName() + " provider added at position " + position); } } }
java
public static void insertProviderAt(Provider newProvider, int slot) { Provider[] provider_list = Security.getProviders(); if (null == provider_list || 0 == provider_list.length) { return; } // add the new provider to the new list at the correct slot #. Provider[] newList = new Provider[provider_list.length + 2]; newList[slot] = newProvider; int newListIndex = 1; // add the rest of the providers for (int i = 0; i < provider_list.length; i++) { Provider currentProvider = provider_list[i]; if (currentProvider != null && !currentProvider.getName().equals(newProvider.getName())) { // keep incrementing until we find the first available slot. while (newList[newListIndex] != null) { newListIndex++; } newList[newListIndex] = currentProvider; newListIndex++; } } removeAllProviders(); // add the rest of the providers to the list. for (int i = 0; i < newList.length; i++) { Provider currentProvider = newList[i]; if (currentProvider != null) { int position = Security.insertProviderAt(currentProvider, (i + 1)); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, currentProvider.getName() + " provider added at position " + position); } } }
[ "public", "static", "void", "insertProviderAt", "(", "Provider", "newProvider", ",", "int", "slot", ")", "{", "Provider", "[", "]", "provider_list", "=", "Security", ".", "getProviders", "(", ")", ";", "if", "(", "null", "==", "provider_list", "||", "0", "==", "provider_list", ".", "length", ")", "{", "return", ";", "}", "// add the new provider to the new list at the correct slot #.", "Provider", "[", "]", "newList", "=", "new", "Provider", "[", "provider_list", ".", "length", "+", "2", "]", ";", "newList", "[", "slot", "]", "=", "newProvider", ";", "int", "newListIndex", "=", "1", ";", "// add the rest of the providers", "for", "(", "int", "i", "=", "0", ";", "i", "<", "provider_list", ".", "length", ";", "i", "++", ")", "{", "Provider", "currentProvider", "=", "provider_list", "[", "i", "]", ";", "if", "(", "currentProvider", "!=", "null", "&&", "!", "currentProvider", ".", "getName", "(", ")", ".", "equals", "(", "newProvider", ".", "getName", "(", ")", ")", ")", "{", "// keep incrementing until we find the first available slot.", "while", "(", "newList", "[", "newListIndex", "]", "!=", "null", ")", "{", "newListIndex", "++", ";", "}", "newList", "[", "newListIndex", "]", "=", "currentProvider", ";", "newListIndex", "++", ";", "}", "}", "removeAllProviders", "(", ")", ";", "// add the rest of the providers to the list.", "for", "(", "int", "i", "=", "0", ";", "i", "<", "newList", ".", "length", ";", "i", "++", ")", "{", "Provider", "currentProvider", "=", "newList", "[", "i", "]", ";", "if", "(", "currentProvider", "!=", "null", ")", "{", "int", "position", "=", "Security", ".", "insertProviderAt", "(", "currentProvider", ",", "(", "i", "+", "1", ")", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "tc", ",", "currentProvider", ".", "getName", "(", ")", "+", "\" provider added at position \"", "+", "position", ")", ";", "}", "}", "}" ]
Insert a provider into Security at the provided slot number. @param newProvider @param slot
[ "Insert", "a", "provider", "into", "Security", "at", "the", "provided", "slot", "number", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/JSSEProviderFactory.java#L394-L432
train
OpenLiberty/open-liberty
dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/JSSEProviderFactory.java
JSSEProviderFactory.removeAllProviders
public static void removeAllProviders() { Provider[] provider_list = Security.getProviders(); for (int i = 0; i < provider_list.length; i++) { if (provider_list[i] != null) { String name = provider_list[i].getName(); if (name != null) { Security.removeProvider(name); } } } }
java
public static void removeAllProviders() { Provider[] provider_list = Security.getProviders(); for (int i = 0; i < provider_list.length; i++) { if (provider_list[i] != null) { String name = provider_list[i].getName(); if (name != null) { Security.removeProvider(name); } } } }
[ "public", "static", "void", "removeAllProviders", "(", ")", "{", "Provider", "[", "]", "provider_list", "=", "Security", ".", "getProviders", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "provider_list", ".", "length", ";", "i", "++", ")", "{", "if", "(", "provider_list", "[", "i", "]", "!=", "null", ")", "{", "String", "name", "=", "provider_list", "[", "i", "]", ".", "getName", "(", ")", ";", "if", "(", "name", "!=", "null", ")", "{", "Security", ".", "removeProvider", "(", "name", ")", ";", "}", "}", "}", "}" ]
Remove all providers from Security.
[ "Remove", "all", "providers", "from", "Security", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/JSSEProviderFactory.java#L437-L448
train
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/AppConfigChecker.java
AppConfigChecker.validateAsyncOnInterfaces
static void validateAsyncOnInterfaces(Class<?>[] ifaces, TraceComponent tc) { if (ifaces != null) { for (Class<?> iface : ifaces) { // d645943 - Modified the fix integrated for d618337 to include both // the class-level and method-level checks. Since no-interface view // beans are the interface, we need to check that the business // "interface" is really a Java interface. if (iface.isInterface()) { if (iface.getAnnotation(Asynchronous.class) != null) { //interface contains class-level @Asynchronous annotation Tr.warning(tc, "ASYNC_ON_INTERFACE_CNTR0305W", iface.getName()); continue; } for (Method m : iface.getMethods()) { if (m.getAnnotation(Asynchronous.class) != null) { //interface method contains @Asynchronous annotation Tr.warning(tc, "ASYNC_ON_INTERFACE_CNTR0305W", iface.getName()); break; // break out of the method for-loop - continue on to the next interface } } } } } }
java
static void validateAsyncOnInterfaces(Class<?>[] ifaces, TraceComponent tc) { if (ifaces != null) { for (Class<?> iface : ifaces) { // d645943 - Modified the fix integrated for d618337 to include both // the class-level and method-level checks. Since no-interface view // beans are the interface, we need to check that the business // "interface" is really a Java interface. if (iface.isInterface()) { if (iface.getAnnotation(Asynchronous.class) != null) { //interface contains class-level @Asynchronous annotation Tr.warning(tc, "ASYNC_ON_INTERFACE_CNTR0305W", iface.getName()); continue; } for (Method m : iface.getMethods()) { if (m.getAnnotation(Asynchronous.class) != null) { //interface method contains @Asynchronous annotation Tr.warning(tc, "ASYNC_ON_INTERFACE_CNTR0305W", iface.getName()); break; // break out of the method for-loop - continue on to the next interface } } } } } }
[ "static", "void", "validateAsyncOnInterfaces", "(", "Class", "<", "?", ">", "[", "]", "ifaces", ",", "TraceComponent", "tc", ")", "{", "if", "(", "ifaces", "!=", "null", ")", "{", "for", "(", "Class", "<", "?", ">", "iface", ":", "ifaces", ")", "{", "// d645943 - Modified the fix integrated for d618337 to include both", "// the class-level and method-level checks. Since no-interface view", "// beans are the interface, we need to check that the business", "// \"interface\" is really a Java interface.", "if", "(", "iface", ".", "isInterface", "(", ")", ")", "{", "if", "(", "iface", ".", "getAnnotation", "(", "Asynchronous", ".", "class", ")", "!=", "null", ")", "{", "//interface contains class-level @Asynchronous annotation", "Tr", ".", "warning", "(", "tc", ",", "\"ASYNC_ON_INTERFACE_CNTR0305W\"", ",", "iface", ".", "getName", "(", ")", ")", ";", "continue", ";", "}", "for", "(", "Method", "m", ":", "iface", ".", "getMethods", "(", ")", ")", "{", "if", "(", "m", ".", "getAnnotation", "(", "Asynchronous", ".", "class", ")", "!=", "null", ")", "{", "//interface method contains @Asynchronous annotation", "Tr", ".", "warning", "(", "tc", ",", "\"ASYNC_ON_INTERFACE_CNTR0305W\"", ",", "iface", ".", "getName", "(", ")", ")", ";", "break", ";", "// break out of the method for-loop - continue on to the next interface", "}", "}", "}", "}", "}", "}" ]
F743-13921
[ "F743", "-", "13921" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/AppConfigChecker.java#L53-L77
train
OpenLiberty/open-liberty
dev/com.ibm.ws.javamail.1.6/src/com/ibm/ws/javamail/internal/MailSessionService.java
MailSessionService.modified
@Modified protected void modified(ComponentContext context) throws Exception { processProperties(context.getProperties()); deregisterJavaMailMBean(); registerJavaMailMBean(); }
java
@Modified protected void modified(ComponentContext context) throws Exception { processProperties(context.getProperties()); deregisterJavaMailMBean(); registerJavaMailMBean(); }
[ "@", "Modified", "protected", "void", "modified", "(", "ComponentContext", "context", ")", "throws", "Exception", "{", "processProperties", "(", "context", ".", "getProperties", "(", ")", ")", ";", "deregisterJavaMailMBean", "(", ")", ";", "registerJavaMailMBean", "(", ")", ";", "}" ]
The Modified method is how the properties that are defined in the mailSession object of the server.xml are extracted and stored in the sessionProperties. @param context @param bundleContext @throws Exception
[ "The", "Modified", "method", "is", "how", "the", "properties", "that", "are", "defined", "in", "the", "mailSession", "object", "of", "the", "server", ".", "xml", "are", "extracted", "and", "stored", "in", "the", "sessionProperties", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.javamail.1.6/src/com/ibm/ws/javamail/internal/MailSessionService.java#L132-L138
train
OpenLiberty/open-liberty
dev/com.ibm.ws.javamail.1.6/src/com/ibm/ws/javamail/internal/MailSessionService.java
MailSessionService.createResource
@Override public Object createResource(ResourceInfo info) throws Exception { Properties propertyNames = createPropertyNames(); Properties props = createProperties(propertyNames); // The listOfPropMap is how the nested properties (name, value pairs) are // pulled from the Nester class. This iterates the map and stores them in the // props object if (listOfPropMap != null) { for (Map<String, Object> nestedProperties : listOfPropMap) { props.put(nestedProperties.get(NAME), nestedProperties.get(VALUE)); } } Session session = createSession(props); return session; }
java
@Override public Object createResource(ResourceInfo info) throws Exception { Properties propertyNames = createPropertyNames(); Properties props = createProperties(propertyNames); // The listOfPropMap is how the nested properties (name, value pairs) are // pulled from the Nester class. This iterates the map and stores them in the // props object if (listOfPropMap != null) { for (Map<String, Object> nestedProperties : listOfPropMap) { props.put(nestedProperties.get(NAME), nestedProperties.get(VALUE)); } } Session session = createSession(props); return session; }
[ "@", "Override", "public", "Object", "createResource", "(", "ResourceInfo", "info", ")", "throws", "Exception", "{", "Properties", "propertyNames", "=", "createPropertyNames", "(", ")", ";", "Properties", "props", "=", "createProperties", "(", "propertyNames", ")", ";", "// The listOfPropMap is how the nested properties (name, value pairs) are", "// pulled from the Nester class. This iterates the map and stores them in the", "// props object", "if", "(", "listOfPropMap", "!=", "null", ")", "{", "for", "(", "Map", "<", "String", ",", "Object", ">", "nestedProperties", ":", "listOfPropMap", ")", "{", "props", ".", "put", "(", "nestedProperties", ".", "get", "(", "NAME", ")", ",", "nestedProperties", ".", "get", "(", "VALUE", ")", ")", ";", "}", "}", "Session", "session", "=", "createSession", "(", "props", ")", ";", "return", "session", ";", "}" ]
The createResource uses the sessionProperties to create a javax.mail.Session object and return it to the caller. The caller uses JNDI look up with the JNDI name defined in the server.xml.
[ "The", "createResource", "uses", "the", "sessionProperties", "to", "create", "a", "javax", ".", "mail", ".", "Session", "object", "and", "return", "it", "to", "the", "caller", ".", "The", "caller", "uses", "JNDI", "look", "up", "with", "the", "JNDI", "name", "defined", "in", "the", "server", ".", "xml", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.javamail.1.6/src/com/ibm/ws/javamail/internal/MailSessionService.java#L159-L178
train
OpenLiberty/open-liberty
dev/com.ibm.ws.javamail.1.6/src/com/ibm/ws/javamail/internal/MailSessionService.java
MailSessionService.createProperties
private Properties createProperties(Properties propertyNames) { Properties props = new Properties(); for (String key : propertiesArray) { if (sessionProperties.get(key) != null) { if (!key.equalsIgnoreCase(STOREPROTOCOLCLASSNAME) && !key.equalsIgnoreCase(TRANSPORTPROTOCOLCLASSNAME)) { props.put(key, sessionProperties.get(key)); if (propertyNames.getProperty(key) != null) props.put(propertyNames.getProperty(key), sessionProperties.get(key)); } else { if (key.equalsIgnoreCase(STOREPROTOCOLCLASSNAME)) props.put("mail." + props.getProperty(STOREPROTOCOL) + ".class", sessionProperties.get(key)); else props.put("mail." + props.getProperty(TRANSPORTPROTOCOL) + ".class", sessionProperties.get(key)); } } } return props; }
java
private Properties createProperties(Properties propertyNames) { Properties props = new Properties(); for (String key : propertiesArray) { if (sessionProperties.get(key) != null) { if (!key.equalsIgnoreCase(STOREPROTOCOLCLASSNAME) && !key.equalsIgnoreCase(TRANSPORTPROTOCOLCLASSNAME)) { props.put(key, sessionProperties.get(key)); if (propertyNames.getProperty(key) != null) props.put(propertyNames.getProperty(key), sessionProperties.get(key)); } else { if (key.equalsIgnoreCase(STOREPROTOCOLCLASSNAME)) props.put("mail." + props.getProperty(STOREPROTOCOL) + ".class", sessionProperties.get(key)); else props.put("mail." + props.getProperty(TRANSPORTPROTOCOL) + ".class", sessionProperties.get(key)); } } } return props; }
[ "private", "Properties", "createProperties", "(", "Properties", "propertyNames", ")", "{", "Properties", "props", "=", "new", "Properties", "(", ")", ";", "for", "(", "String", "key", ":", "propertiesArray", ")", "{", "if", "(", "sessionProperties", ".", "get", "(", "key", ")", "!=", "null", ")", "{", "if", "(", "!", "key", ".", "equalsIgnoreCase", "(", "STOREPROTOCOLCLASSNAME", ")", "&&", "!", "key", ".", "equalsIgnoreCase", "(", "TRANSPORTPROTOCOLCLASSNAME", ")", ")", "{", "props", ".", "put", "(", "key", ",", "sessionProperties", ".", "get", "(", "key", ")", ")", ";", "if", "(", "propertyNames", ".", "getProperty", "(", "key", ")", "!=", "null", ")", "props", ".", "put", "(", "propertyNames", ".", "getProperty", "(", "key", ")", ",", "sessionProperties", ".", "get", "(", "key", ")", ")", ";", "}", "else", "{", "if", "(", "key", ".", "equalsIgnoreCase", "(", "STOREPROTOCOLCLASSNAME", ")", ")", "props", ".", "put", "(", "\"mail.\"", "+", "props", ".", "getProperty", "(", "STOREPROTOCOL", ")", "+", "\".class\"", ",", "sessionProperties", ".", "get", "(", "key", ")", ")", ";", "else", "props", ".", "put", "(", "\"mail.\"", "+", "props", ".", "getProperty", "(", "TRANSPORTPROTOCOL", ")", "+", "\".class\"", ",", "sessionProperties", ".", "get", "(", "key", ")", ")", ";", "}", "}", "}", "return", "props", ";", "}" ]
The createProperties method will iterate through the sessionProperties and put them into the props object so that it can be used to create the javax.mail.Session @param propertyNames @param props
[ "The", "createProperties", "method", "will", "iterate", "through", "the", "sessionProperties", "and", "put", "them", "into", "the", "props", "object", "so", "that", "it", "can", "be", "used", "to", "create", "the", "javax", ".", "mail", ".", "Session" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.javamail.1.6/src/com/ibm/ws/javamail/internal/MailSessionService.java#L187-L207
train
OpenLiberty/open-liberty
dev/com.ibm.ws.javamail.1.6/src/com/ibm/ws/javamail/internal/MailSessionService.java
MailSessionService.createPropertyNames
private Properties createPropertyNames() { Properties propertyNames = new Properties(); propertyNames.setProperty(HOST, "mail.host"); propertyNames.setProperty(USER, "mail.user"); propertyNames.setProperty(FROM, "mail.from"); propertyNames.setProperty(TRANSPORTPROTOCOL, "mail.transport.protocol"); propertyNames.setProperty(STOREPROTOCOL, "mail.store.protocol"); return propertyNames; }
java
private Properties createPropertyNames() { Properties propertyNames = new Properties(); propertyNames.setProperty(HOST, "mail.host"); propertyNames.setProperty(USER, "mail.user"); propertyNames.setProperty(FROM, "mail.from"); propertyNames.setProperty(TRANSPORTPROTOCOL, "mail.transport.protocol"); propertyNames.setProperty(STOREPROTOCOL, "mail.store.protocol"); return propertyNames; }
[ "private", "Properties", "createPropertyNames", "(", ")", "{", "Properties", "propertyNames", "=", "new", "Properties", "(", ")", ";", "propertyNames", ".", "setProperty", "(", "HOST", ",", "\"mail.host\"", ")", ";", "propertyNames", ".", "setProperty", "(", "USER", ",", "\"mail.user\"", ")", ";", "propertyNames", ".", "setProperty", "(", "FROM", ",", "\"mail.from\"", ")", ";", "propertyNames", ".", "setProperty", "(", "TRANSPORTPROTOCOL", ",", "\"mail.transport.protocol\"", ")", ";", "propertyNames", ".", "setProperty", "(", "STOREPROTOCOL", ",", "\"mail.store.protocol\"", ")", ";", "return", "propertyNames", ";", "}" ]
The createPropertyName method sets a property for five special strings that can be set in a different method such as mail.host. These are different way to set certain property values and are unique to these five
[ "The", "createPropertyName", "method", "sets", "a", "property", "for", "five", "special", "strings", "that", "can", "be", "set", "in", "a", "different", "method", "such", "as", "mail", ".", "host", ".", "These", "are", "different", "way", "to", "set", "certain", "property", "values", "and", "are", "unique", "to", "these", "five" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.javamail.1.6/src/com/ibm/ws/javamail/internal/MailSessionService.java#L215-L227
train
OpenLiberty/open-liberty
dev/com.ibm.ws.javamail.1.6/src/com/ibm/ws/javamail/internal/MailSessionService.java
MailSessionService.createSession
private Session createSession(Properties props) throws InvalidPasswordDecodingException, UnsupportedCryptoAlgorithmException { Session session = null; // Since the password attribute in the server.xml is masked // the decryption algorythm is needed to before it can be put // it into the props object. if (sessionProperties.get(PASSWORD) != null && sessionProperties.get(USER) != null) { SerializableProtectedString password = (SerializableProtectedString) sessionProperties.get(PASSWORD); String pwdStr = password == null ? null : String.valueOf(password.getChars()); pwdStr = PasswordUtil.getCryptoAlgorithm(pwdStr) == null ? pwdStr : PasswordUtil.decode(pwdStr); final String pwd = pwdStr; sessionProperties.put("mail.password", pwdStr); session = Session.getInstance(props, new Authenticator() { @Override protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication((String) sessionProperties.get(USER), pwd); } }); } else { session = Session.getInstance(props, null); } return session; }
java
private Session createSession(Properties props) throws InvalidPasswordDecodingException, UnsupportedCryptoAlgorithmException { Session session = null; // Since the password attribute in the server.xml is masked // the decryption algorythm is needed to before it can be put // it into the props object. if (sessionProperties.get(PASSWORD) != null && sessionProperties.get(USER) != null) { SerializableProtectedString password = (SerializableProtectedString) sessionProperties.get(PASSWORD); String pwdStr = password == null ? null : String.valueOf(password.getChars()); pwdStr = PasswordUtil.getCryptoAlgorithm(pwdStr) == null ? pwdStr : PasswordUtil.decode(pwdStr); final String pwd = pwdStr; sessionProperties.put("mail.password", pwdStr); session = Session.getInstance(props, new Authenticator() { @Override protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication((String) sessionProperties.get(USER), pwd); } }); } else { session = Session.getInstance(props, null); } return session; }
[ "private", "Session", "createSession", "(", "Properties", "props", ")", "throws", "InvalidPasswordDecodingException", ",", "UnsupportedCryptoAlgorithmException", "{", "Session", "session", "=", "null", ";", "// Since the password attribute in the server.xml is masked", "// the decryption algorythm is needed to before it can be put", "// it into the props object. ", "if", "(", "sessionProperties", ".", "get", "(", "PASSWORD", ")", "!=", "null", "&&", "sessionProperties", ".", "get", "(", "USER", ")", "!=", "null", ")", "{", "SerializableProtectedString", "password", "=", "(", "SerializableProtectedString", ")", "sessionProperties", ".", "get", "(", "PASSWORD", ")", ";", "String", "pwdStr", "=", "password", "==", "null", "?", "null", ":", "String", ".", "valueOf", "(", "password", ".", "getChars", "(", ")", ")", ";", "pwdStr", "=", "PasswordUtil", ".", "getCryptoAlgorithm", "(", "pwdStr", ")", "==", "null", "?", "pwdStr", ":", "PasswordUtil", ".", "decode", "(", "pwdStr", ")", ";", "final", "String", "pwd", "=", "pwdStr", ";", "sessionProperties", ".", "put", "(", "\"mail.password\"", ",", "pwdStr", ")", ";", "session", "=", "Session", ".", "getInstance", "(", "props", ",", "new", "Authenticator", "(", ")", "{", "@", "Override", "protected", "PasswordAuthentication", "getPasswordAuthentication", "(", ")", "{", "return", "new", "PasswordAuthentication", "(", "(", "String", ")", "sessionProperties", ".", "get", "(", "USER", ")", ",", "pwd", ")", ";", "}", "}", ")", ";", "}", "else", "{", "session", "=", "Session", ".", "getInstance", "(", "props", ",", "null", ")", ";", "}", "return", "session", ";", "}" ]
The createSession method creates a session using the props, if the password is specified in the server.xml then a session is creating using the password. If it is not specified then session is created with out a authenticator. @param props @return session @throws UnsupportedCryptoAlgorithmException @throws InvalidPasswordDecodingException
[ "The", "createSession", "method", "creates", "a", "session", "using", "the", "props", "if", "the", "password", "is", "specified", "in", "the", "server", ".", "xml", "then", "a", "session", "is", "creating", "using", "the", "password", ".", "If", "it", "is", "not", "specified", "then", "session", "is", "created", "with", "out", "a", "authenticator", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.javamail.1.6/src/com/ibm/ws/javamail/internal/MailSessionService.java#L240-L272
train
OpenLiberty/open-liberty
dev/com.ibm.ws.javamail.1.6/src/com/ibm/ws/javamail/internal/MailSessionService.java
MailSessionService.setMailSessionRegistrar
@Reference(service = MailSessionRegistrar.class, policy = ReferencePolicy.DYNAMIC, cardinality = ReferenceCardinality.OPTIONAL, target = "(component.name=com.ibm.ws.javamail.management.j2ee.MailSessionRegistrarImpl)") protected void setMailSessionRegistrar(ServiceReference<MailSessionRegistrar> ref) { mailSessionRegistrarRef.setReference(ref); registerJavaMailMBean(); }
java
@Reference(service = MailSessionRegistrar.class, policy = ReferencePolicy.DYNAMIC, cardinality = ReferenceCardinality.OPTIONAL, target = "(component.name=com.ibm.ws.javamail.management.j2ee.MailSessionRegistrarImpl)") protected void setMailSessionRegistrar(ServiceReference<MailSessionRegistrar> ref) { mailSessionRegistrarRef.setReference(ref); registerJavaMailMBean(); }
[ "@", "Reference", "(", "service", "=", "MailSessionRegistrar", ".", "class", ",", "policy", "=", "ReferencePolicy", ".", "DYNAMIC", ",", "cardinality", "=", "ReferenceCardinality", ".", "OPTIONAL", ",", "target", "=", "\"(component.name=com.ibm.ws.javamail.management.j2ee.MailSessionRegistrarImpl)\"", ")", "protected", "void", "setMailSessionRegistrar", "(", "ServiceReference", "<", "MailSessionRegistrar", ">", "ref", ")", "{", "mailSessionRegistrarRef", ".", "setReference", "(", "ref", ")", ";", "registerJavaMailMBean", "(", ")", ";", "}" ]
Declarative Services method for setting mail session registrar
[ "Declarative", "Services", "method", "for", "setting", "mail", "session", "registrar" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.javamail.1.6/src/com/ibm/ws/javamail/internal/MailSessionService.java#L277-L284
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/am/MPAlarmImpl.java
MPAlarmImpl.reset
void reset(long time, long latest, AlarmListener listener, Object context, long index) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry( tc, "reset", new Object[] { new Long(time), new Long(latest), listener, context, new Long(index) }); data = listener; this.time = time; this.latest = latest; this.context = context; this.index = index; //check if this alarm has a group listener groupListener = (listener instanceof GroupAlarmListener); //flag as not canceled active = true; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "reset"); }
java
void reset(long time, long latest, AlarmListener listener, Object context, long index) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry( tc, "reset", new Object[] { new Long(time), new Long(latest), listener, context, new Long(index) }); data = listener; this.time = time; this.latest = latest; this.context = context; this.index = index; //check if this alarm has a group listener groupListener = (listener instanceof GroupAlarmListener); //flag as not canceled active = true; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "reset"); }
[ "void", "reset", "(", "long", "time", ",", "long", "latest", ",", "AlarmListener", "listener", ",", "Object", "context", ",", "long", "index", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"reset\"", ",", "new", "Object", "[", "]", "{", "new", "Long", "(", "time", ")", ",", "new", "Long", "(", "latest", ")", ",", "listener", ",", "context", ",", "new", "Long", "(", "index", ")", "}", ")", ";", "data", "=", "listener", ";", "this", ".", "time", "=", "time", ";", "this", ".", "latest", "=", "latest", ";", "this", ".", "context", "=", "context", ";", "this", ".", "index", "=", "index", ";", "//check if this alarm has a group listener", "groupListener", "=", "(", "listener", "instanceof", "GroupAlarmListener", ")", ";", "//flag as not canceled ", "active", "=", "true", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"reset\"", ")", ";", "}" ]
reset this alarm's values @param time @param latest @param listener @param context
[ "reset", "this", "alarm", "s", "values" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/am/MPAlarmImpl.java#L131-L155
train
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/config/HpelConfigurator.java
HpelConfigurator.init
public static synchronized void init(HpelTraceServiceConfig config) { if (config == null) throw new NullPointerException("LogProviderConfig must not be null"); loggingConfig.compareAndSet(null, config); }
java
public static synchronized void init(HpelTraceServiceConfig config) { if (config == null) throw new NullPointerException("LogProviderConfig must not be null"); loggingConfig.compareAndSet(null, config); }
[ "public", "static", "synchronized", "void", "init", "(", "HpelTraceServiceConfig", "config", ")", "{", "if", "(", "config", "==", "null", ")", "throw", "new", "NullPointerException", "(", "\"LogProviderConfig must not be null\"", ")", ";", "loggingConfig", ".", "compareAndSet", "(", "null", ",", "config", ")", ";", "}" ]
Initializes HPEL Configuration proxy
[ "Initializes", "HPEL", "Configuration", "proxy" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/config/HpelConfigurator.java#L28-L33
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/exceptions/DataStoreAdapterException.java
DataStoreAdapterException.getLinkedException
@Override public Exception getLinkedException() { //return (Exception) getCause(); Throwable t = getCause(); while (t != null) { if (t instanceof Exception) { return (Exception) t; } else { t = t.getCause(); } } return null; }
java
@Override public Exception getLinkedException() { //return (Exception) getCause(); Throwable t = getCause(); while (t != null) { if (t instanceof Exception) { return (Exception) t; } else { t = t.getCause(); } } return null; }
[ "@", "Override", "public", "Exception", "getLinkedException", "(", ")", "{", "//return (Exception) getCause();", "Throwable", "t", "=", "getCause", "(", ")", ";", "while", "(", "t", "!=", "null", ")", "{", "if", "(", "t", "instanceof", "Exception", ")", "{", "return", "(", "Exception", ")", "t", ";", "}", "else", "{", "t", "=", "t", ".", "getCause", "(", ")", ";", "}", "}", "return", "null", ";", "}" ]
Retrieve the exception that was saved away @return Exception
[ "Retrieve", "the", "exception", "that", "was", "saved", "away" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/exceptions/DataStoreAdapterException.java#L196-L208
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/AdvancedLockManager.java
AdvancedLockManager.lock
public synchronized void lock() { if (tc.isEntryEnabled()) SibTr.entry(tc, "lock", this); boolean interrupted = false; // Attempt to get a lock on the mutex. // if we fail, then that is because the lock // must be held exclusively. while (!tryLock()) try { // Wait for 1 second then try again. if (tc.isDebugEnabled()) SibTr.debug(tc, "Waiting for lock"); wait(1000); } catch (InterruptedException e) { // No FFDC code needed interrupted = true; } if (interrupted) Thread.currentThread().interrupt(); if (tc.isEntryEnabled()) SibTr.exit(tc, "lock"); }
java
public synchronized void lock() { if (tc.isEntryEnabled()) SibTr.entry(tc, "lock", this); boolean interrupted = false; // Attempt to get a lock on the mutex. // if we fail, then that is because the lock // must be held exclusively. while (!tryLock()) try { // Wait for 1 second then try again. if (tc.isDebugEnabled()) SibTr.debug(tc, "Waiting for lock"); wait(1000); } catch (InterruptedException e) { // No FFDC code needed interrupted = true; } if (interrupted) Thread.currentThread().interrupt(); if (tc.isEntryEnabled()) SibTr.exit(tc, "lock"); }
[ "public", "synchronized", "void", "lock", "(", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"lock\"", ",", "this", ")", ";", "boolean", "interrupted", "=", "false", ";", "// Attempt to get a lock on the mutex.", "// if we fail, then that is because the lock", "// must be held exclusively.", "while", "(", "!", "tryLock", "(", ")", ")", "try", "{", "// Wait for 1 second then try again.", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "SibTr", ".", "debug", "(", "tc", ",", "\"Waiting for lock\"", ")", ";", "wait", "(", "1000", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "// No FFDC code needed", "interrupted", "=", "true", ";", "}", "if", "(", "interrupted", ")", "Thread", ".", "currentThread", "(", ")", ".", "interrupt", "(", ")", ";", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"lock\"", ")", ";", "}" ]
This method allows multiple lockers to lock the same mutex, until the lock exclusive is called. Then all lock requesters have to wait until the exclusive lock is released.
[ "This", "method", "allows", "multiple", "lockers", "to", "lock", "the", "same", "mutex", "until", "the", "lock", "exclusive", "is", "called", ".", "Then", "all", "lock", "requesters", "have", "to", "wait", "until", "the", "exclusive", "lock", "is", "released", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/AdvancedLockManager.java#L82-L112
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/AdvancedLockManager.java
AdvancedLockManager.tryLock
private boolean tryLock() { if (tc.isEntryEnabled()) SibTr.entry(tc, "tryLock", this); boolean result = false; synchronized (iMutex) { // Check that we aren't exclusively locked. if (!iExclusivelyLocked || iExclusiveLockHolder == Thread.currentThread()) { incrementThreadLockCount(); result = true; } } if (tc.isEntryEnabled()) SibTr.exit(tc, "tryLock", new Boolean(result)); return result; }
java
private boolean tryLock() { if (tc.isEntryEnabled()) SibTr.entry(tc, "tryLock", this); boolean result = false; synchronized (iMutex) { // Check that we aren't exclusively locked. if (!iExclusivelyLocked || iExclusiveLockHolder == Thread.currentThread()) { incrementThreadLockCount(); result = true; } } if (tc.isEntryEnabled()) SibTr.exit(tc, "tryLock", new Boolean(result)); return result; }
[ "private", "boolean", "tryLock", "(", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"tryLock\"", ",", "this", ")", ";", "boolean", "result", "=", "false", ";", "synchronized", "(", "iMutex", ")", "{", "// Check that we aren't exclusively locked.", "if", "(", "!", "iExclusivelyLocked", "||", "iExclusiveLockHolder", "==", "Thread", ".", "currentThread", "(", ")", ")", "{", "incrementThreadLockCount", "(", ")", ";", "result", "=", "true", ";", "}", "}", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"tryLock\"", ",", "new", "Boolean", "(", "result", ")", ")", ";", "return", "result", ";", "}" ]
This method increments a the number of locks that have been obtained. If the thread requesting the lock happens to be the thread that already has the exclusive lock we let that succeed as we don't want to cause any dead locks ! @return boolean if the lock was achieved.
[ "This", "method", "increments", "a", "the", "number", "of", "locks", "that", "have", "been", "obtained", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/AdvancedLockManager.java#L125-L146
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/AdvancedLockManager.java
AdvancedLockManager.incrementThreadLockCount
private void incrementThreadLockCount() { if (tc.isEntryEnabled()) SibTr.entry(tc, "incrementThreadLockCount", this); //get the current thread Thread currentThread = Thread.currentThread(); //get it's current read lock count LockCount count = (LockCount) readerThreads.get(currentThread); //if it doesn't exist, create it if(count == null) { count = new LockCount(); readerThreads.put(currentThread, count); } //increment the count if(count.count == 0) readerThreadCount++; count.count++; readLockCount++; if (tc.isEntryEnabled()) SibTr.exit(tc, "incrementThreadLockCount"); }
java
private void incrementThreadLockCount() { if (tc.isEntryEnabled()) SibTr.entry(tc, "incrementThreadLockCount", this); //get the current thread Thread currentThread = Thread.currentThread(); //get it's current read lock count LockCount count = (LockCount) readerThreads.get(currentThread); //if it doesn't exist, create it if(count == null) { count = new LockCount(); readerThreads.put(currentThread, count); } //increment the count if(count.count == 0) readerThreadCount++; count.count++; readLockCount++; if (tc.isEntryEnabled()) SibTr.exit(tc, "incrementThreadLockCount"); }
[ "private", "void", "incrementThreadLockCount", "(", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"incrementThreadLockCount\"", ",", "this", ")", ";", "//get the current thread", "Thread", "currentThread", "=", "Thread", ".", "currentThread", "(", ")", ";", "//get it's current read lock count", "LockCount", "count", "=", "(", "LockCount", ")", "readerThreads", ".", "get", "(", "currentThread", ")", ";", "//if it doesn't exist, create it", "if", "(", "count", "==", "null", ")", "{", "count", "=", "new", "LockCount", "(", ")", ";", "readerThreads", ".", "put", "(", "currentThread", ",", "count", ")", ";", "}", "//increment the count", "if", "(", "count", ".", "count", "==", "0", ")", "readerThreadCount", "++", ";", "count", ".", "count", "++", ";", "readLockCount", "++", ";", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"incrementThreadLockCount\"", ")", ";", "}" ]
The mutex must be held before calling this method. Increments the read lock count for a given thread. If this is the first time a given thread has taken a read lock, a new entry is created for it in the HashMap.
[ "The", "mutex", "must", "be", "held", "before", "calling", "this", "method", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/AdvancedLockManager.java#L155-L176
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/AdvancedLockManager.java
AdvancedLockManager.alienReadLocksHeld
private boolean alienReadLocksHeld() { if (tc.isEntryEnabled()) SibTr.entry(tc, "alienReadLocksHeld", this); boolean locksHeld = false; //if there is more than one thread holding read locks then return true if(readerThreadCount > 1) { locksHeld = true; } //if there is exactly one thread holding a read lock... else if(readerThreadCount == 1) { //check if it is the current thread holding that lock Thread currentThread = Thread.currentThread(); LockCount count = (LockCount) readerThreads.get(currentThread); //if the current thread does not hold any locks then return true since //it must be a different thread. locksHeld = (count == null || count.count == 0); } //if there are no threads holding read locks then return false (default) if (tc.isEntryEnabled()) SibTr.exit(tc, "alienReadLocksHeld", new Boolean(locksHeld)); return locksHeld; }
java
private boolean alienReadLocksHeld() { if (tc.isEntryEnabled()) SibTr.entry(tc, "alienReadLocksHeld", this); boolean locksHeld = false; //if there is more than one thread holding read locks then return true if(readerThreadCount > 1) { locksHeld = true; } //if there is exactly one thread holding a read lock... else if(readerThreadCount == 1) { //check if it is the current thread holding that lock Thread currentThread = Thread.currentThread(); LockCount count = (LockCount) readerThreads.get(currentThread); //if the current thread does not hold any locks then return true since //it must be a different thread. locksHeld = (count == null || count.count == 0); } //if there are no threads holding read locks then return false (default) if (tc.isEntryEnabled()) SibTr.exit(tc, "alienReadLocksHeld", new Boolean(locksHeld)); return locksHeld; }
[ "private", "boolean", "alienReadLocksHeld", "(", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"alienReadLocksHeld\"", ",", "this", ")", ";", "boolean", "locksHeld", "=", "false", ";", "//if there is more than one thread holding read locks then return true", "if", "(", "readerThreadCount", ">", "1", ")", "{", "locksHeld", "=", "true", ";", "}", "//if there is exactly one thread holding a read lock...", "else", "if", "(", "readerThreadCount", "==", "1", ")", "{", "//check if it is the current thread holding that lock", "Thread", "currentThread", "=", "Thread", ".", "currentThread", "(", ")", ";", "LockCount", "count", "=", "(", "LockCount", ")", "readerThreads", ".", "get", "(", "currentThread", ")", ";", "//if the current thread does not hold any locks then return true since", "//it must be a different thread.", "locksHeld", "=", "(", "count", "==", "null", "||", "count", ".", "count", "==", "0", ")", ";", "}", "//if there are no threads holding read locks then return false (default)", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"alienReadLocksHeld\"", ",", "new", "Boolean", "(", "locksHeld", ")", ")", ";", "return", "locksHeld", ";", "}" ]
The mutex must be help before calling this method. Are there any read locks held by threads other than the current one? @return true if there any read locks held by threads other than the current one
[ "The", "mutex", "must", "be", "help", "before", "calling", "this", "method", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/AdvancedLockManager.java#L303-L331
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/AdvancedLockManager.java
AdvancedLockManager.tryLockExclusive
private boolean tryLockExclusive() { if (tc.isEntryEnabled()) SibTr.entry(tc, "tryLockExclusive", this); boolean result = false; // Synchronize on the locking Mutex synchronized (iMutex) { // If it isn't already locked - lock it on this thread. if (!iExclusivelyLocked) { // Block new many lock requests iExclusivelyLocked = true; // Set the exclusive lock holder to be this thread iExclusiveLockHolder = Thread.currentThread(); if (tc.isDebugEnabled()) SibTr.debug(tc, "Got exclusive lock for thread " + iExclusiveLockHolder); // Set the return result to be true result = true; // Increment the exclusive lock count iExclusiveLockCount++; } // If we are locked, then check that the thread that is requesting // this lock is the same thread that owns the lock already. else if (iExclusiveLockHolder == Thread.currentThread()) { if (tc.isDebugEnabled()) SibTr.debug(tc, "Already hold exclusive lock " + (iExclusiveLockCount + 1)); result = true; // Increment the exclusive lock count iExclusiveLockCount++; } } if (tc.isEntryEnabled()) SibTr.exit(tc, "tryLockExclusive", new Boolean(result)); return result; }
java
private boolean tryLockExclusive() { if (tc.isEntryEnabled()) SibTr.entry(tc, "tryLockExclusive", this); boolean result = false; // Synchronize on the locking Mutex synchronized (iMutex) { // If it isn't already locked - lock it on this thread. if (!iExclusivelyLocked) { // Block new many lock requests iExclusivelyLocked = true; // Set the exclusive lock holder to be this thread iExclusiveLockHolder = Thread.currentThread(); if (tc.isDebugEnabled()) SibTr.debug(tc, "Got exclusive lock for thread " + iExclusiveLockHolder); // Set the return result to be true result = true; // Increment the exclusive lock count iExclusiveLockCount++; } // If we are locked, then check that the thread that is requesting // this lock is the same thread that owns the lock already. else if (iExclusiveLockHolder == Thread.currentThread()) { if (tc.isDebugEnabled()) SibTr.debug(tc, "Already hold exclusive lock " + (iExclusiveLockCount + 1)); result = true; // Increment the exclusive lock count iExclusiveLockCount++; } } if (tc.isEntryEnabled()) SibTr.exit(tc, "tryLockExclusive", new Boolean(result)); return result; }
[ "private", "boolean", "tryLockExclusive", "(", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"tryLockExclusive\"", ",", "this", ")", ";", "boolean", "result", "=", "false", ";", "// Synchronize on the locking Mutex", "synchronized", "(", "iMutex", ")", "{", "// If it isn't already locked - lock it on this thread.", "if", "(", "!", "iExclusivelyLocked", ")", "{", "// Block new many lock requests", "iExclusivelyLocked", "=", "true", ";", "// Set the exclusive lock holder to be this thread", "iExclusiveLockHolder", "=", "Thread", ".", "currentThread", "(", ")", ";", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "SibTr", ".", "debug", "(", "tc", ",", "\"Got exclusive lock for thread \"", "+", "iExclusiveLockHolder", ")", ";", "// Set the return result to be true", "result", "=", "true", ";", "// Increment the exclusive lock count", "iExclusiveLockCount", "++", ";", "}", "// If we are locked, then check that the thread that is requesting", "// this lock is the same thread that owns the lock already.", "else", "if", "(", "iExclusiveLockHolder", "==", "Thread", ".", "currentThread", "(", ")", ")", "{", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "SibTr", ".", "debug", "(", "tc", ",", "\"Already hold exclusive lock \"", "+", "(", "iExclusiveLockCount", "+", "1", ")", ")", ";", "result", "=", "true", ";", "// Increment the exclusive lock count", "iExclusiveLockCount", "++", ";", "}", "}", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"tryLockExclusive\"", ",", "new", "Boolean", "(", "result", ")", ")", ";", "return", "result", ";", "}" ]
This method attempts to lock the exclusively and won't succeed until it has the exclusive lock. @return boolean true if it is now the exclusive lock holder, false if a wait is still needed to lock exclusively
[ "This", "method", "attempts", "to", "lock", "the", "exclusively", "and", "won", "t", "succeed", "until", "it", "has", "the", "exclusive", "lock", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/AdvancedLockManager.java#L342-L387
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/AdvancedLockManager.java
AdvancedLockManager.unlockExclusive
public synchronized void unlockExclusive() { if (tc.isEntryEnabled()) SibTr.entry(tc, "unlockExclusive", this); // Synchronize on the locking Mutex. synchronized (iMutex) { // Only release the lock if the holder is the current thread. if (Thread.currentThread() == iExclusiveLockHolder) { if (tc.isDebugEnabled()) SibTr.debug(tc, "Unlocking current thread " + (iExclusiveLockCount - 1)); // Decrement the exclusive lock count, // if the count reaches 0 then we know that // we can safely remove the exclusive lock if (--iExclusiveLockCount == 0) { // Set the flag to indicate that the exclusive lock // has been released. iExclusivelyLocked = false; // Set the exclusive lock holder thread to be null iExclusiveLockHolder = null; // Notify any threads waiting for this lock. notifyAll(); } } else if (tc.isDebugEnabled()) SibTr.debug(tc, "Thread not the current thread to unlock exclusively"); } if (tc.isEntryEnabled()) SibTr.exit(tc, "unlockExclusive"); }
java
public synchronized void unlockExclusive() { if (tc.isEntryEnabled()) SibTr.entry(tc, "unlockExclusive", this); // Synchronize on the locking Mutex. synchronized (iMutex) { // Only release the lock if the holder is the current thread. if (Thread.currentThread() == iExclusiveLockHolder) { if (tc.isDebugEnabled()) SibTr.debug(tc, "Unlocking current thread " + (iExclusiveLockCount - 1)); // Decrement the exclusive lock count, // if the count reaches 0 then we know that // we can safely remove the exclusive lock if (--iExclusiveLockCount == 0) { // Set the flag to indicate that the exclusive lock // has been released. iExclusivelyLocked = false; // Set the exclusive lock holder thread to be null iExclusiveLockHolder = null; // Notify any threads waiting for this lock. notifyAll(); } } else if (tc.isDebugEnabled()) SibTr.debug(tc, "Thread not the current thread to unlock exclusively"); } if (tc.isEntryEnabled()) SibTr.exit(tc, "unlockExclusive"); }
[ "public", "synchronized", "void", "unlockExclusive", "(", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"unlockExclusive\"", ",", "this", ")", ";", "// Synchronize on the locking Mutex.", "synchronized", "(", "iMutex", ")", "{", "// Only release the lock if the holder is the current thread.", "if", "(", "Thread", ".", "currentThread", "(", ")", "==", "iExclusiveLockHolder", ")", "{", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "SibTr", ".", "debug", "(", "tc", ",", "\"Unlocking current thread \"", "+", "(", "iExclusiveLockCount", "-", "1", ")", ")", ";", "// Decrement the exclusive lock count,", "// if the count reaches 0 then we know that ", "// we can safely remove the exclusive lock", "if", "(", "--", "iExclusiveLockCount", "==", "0", ")", "{", "// Set the flag to indicate that the exclusive lock", "// has been released.", "iExclusivelyLocked", "=", "false", ";", "// Set the exclusive lock holder thread to be null", "iExclusiveLockHolder", "=", "null", ";", "// Notify any threads waiting for this lock.", "notifyAll", "(", ")", ";", "}", "}", "else", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "SibTr", ".", "debug", "(", "tc", ",", "\"Thread not the current thread to unlock exclusively\"", ")", ";", "}", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"unlockExclusive\"", ")", ";", "}" ]
This method unlocks the exclusive lock that was held. It also notifies any lock waiters.
[ "This", "method", "unlocks", "the", "exclusive", "lock", "that", "was", "held", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/AdvancedLockManager.java#L395-L432
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/webapp/webxml/WebXml.java
WebXml.init
public static void init(ExternalContext context) { WebXmlParser parser = new WebXmlParser(context); WebXml webXml = parser.parse(); context.getApplicationMap().put(WEB_XML_ATTR, webXml); MyfacesConfig mfconfig = MyfacesConfig.getCurrentInstance(context); long configRefreshPeriod = mfconfig.getConfigRefreshPeriod(); webXml.setParsingTime(System.currentTimeMillis()); webXml.setDelegateFacesServlet(mfconfig.getDelegateFacesServlet()); refreshPeriod = (configRefreshPeriod * 1000); }
java
public static void init(ExternalContext context) { WebXmlParser parser = new WebXmlParser(context); WebXml webXml = parser.parse(); context.getApplicationMap().put(WEB_XML_ATTR, webXml); MyfacesConfig mfconfig = MyfacesConfig.getCurrentInstance(context); long configRefreshPeriod = mfconfig.getConfigRefreshPeriod(); webXml.setParsingTime(System.currentTimeMillis()); webXml.setDelegateFacesServlet(mfconfig.getDelegateFacesServlet()); refreshPeriod = (configRefreshPeriod * 1000); }
[ "public", "static", "void", "init", "(", "ExternalContext", "context", ")", "{", "WebXmlParser", "parser", "=", "new", "WebXmlParser", "(", "context", ")", ";", "WebXml", "webXml", "=", "parser", ".", "parse", "(", ")", ";", "context", ".", "getApplicationMap", "(", ")", ".", "put", "(", "WEB_XML_ATTR", ",", "webXml", ")", ";", "MyfacesConfig", "mfconfig", "=", "MyfacesConfig", ".", "getCurrentInstance", "(", "context", ")", ";", "long", "configRefreshPeriod", "=", "mfconfig", ".", "getConfigRefreshPeriod", "(", ")", ";", "webXml", ".", "setParsingTime", "(", "System", ".", "currentTimeMillis", "(", ")", ")", ";", "webXml", ".", "setDelegateFacesServlet", "(", "mfconfig", ".", "getDelegateFacesServlet", "(", ")", ")", ";", "refreshPeriod", "=", "(", "configRefreshPeriod", "*", "1000", ")", ";", "}" ]
should be called when initialising Servlet @param context
[ "should", "be", "called", "when", "initialising", "Servlet" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/webapp/webxml/WebXml.java#L275-L285
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsErrorUtils.java
JmsErrorUtils.filterThrowable
private static void filterThrowable(Throwable t) { // Now we want to remove the superfluous lines of stack trace from the // exception (those that have been inserted as a result of the way we // created the exception. StackTraceElement[] stackLines = t.getStackTrace(); // If there is definitely something to work with. if ((stackLines != null) && (stackLines.length > 1)) { Vector v = new Vector(); // Look at each stack line in turn until we reach the JmsErrorUtils // class stuff, then copy them over starting with the first line after // JmsErrorUtils finishes. boolean euStarted = false; // First read up to the point where the JmsErrorUtils entries start. int index = 0; for (index = 0; index < stackLines.length; index++) { StackTraceElement ste = stackLines[index]; // See if this is the errorUtils if (className.equals(ste.getClassName())) { // We have found an error utils line euStarted = true; } else { if (euStarted) { // This indicates that we have now left the ErrorUtils lines, // and everything left in the stack should be copied across. v.add(ste); } } } // Now we take the filtered stack trace and set it back into the // exception we originally got it from. if (v.size() != 0) { StackTraceElement[] filteredSTE = new StackTraceElement[v.size()]; for (int i = 0; i < filteredSTE.length; i++) { filteredSTE[i] = (StackTraceElement) v.elementAt(i); } t.setStackTrace(filteredSTE); } } }
java
private static void filterThrowable(Throwable t) { // Now we want to remove the superfluous lines of stack trace from the // exception (those that have been inserted as a result of the way we // created the exception. StackTraceElement[] stackLines = t.getStackTrace(); // If there is definitely something to work with. if ((stackLines != null) && (stackLines.length > 1)) { Vector v = new Vector(); // Look at each stack line in turn until we reach the JmsErrorUtils // class stuff, then copy them over starting with the first line after // JmsErrorUtils finishes. boolean euStarted = false; // First read up to the point where the JmsErrorUtils entries start. int index = 0; for (index = 0; index < stackLines.length; index++) { StackTraceElement ste = stackLines[index]; // See if this is the errorUtils if (className.equals(ste.getClassName())) { // We have found an error utils line euStarted = true; } else { if (euStarted) { // This indicates that we have now left the ErrorUtils lines, // and everything left in the stack should be copied across. v.add(ste); } } } // Now we take the filtered stack trace and set it back into the // exception we originally got it from. if (v.size() != 0) { StackTraceElement[] filteredSTE = new StackTraceElement[v.size()]; for (int i = 0; i < filteredSTE.length; i++) { filteredSTE[i] = (StackTraceElement) v.elementAt(i); } t.setStackTrace(filteredSTE); } } }
[ "private", "static", "void", "filterThrowable", "(", "Throwable", "t", ")", "{", "// Now we want to remove the superfluous lines of stack trace from the", "// exception (those that have been inserted as a result of the way we", "// created the exception.", "StackTraceElement", "[", "]", "stackLines", "=", "t", ".", "getStackTrace", "(", ")", ";", "// If there is definitely something to work with.", "if", "(", "(", "stackLines", "!=", "null", ")", "&&", "(", "stackLines", ".", "length", ">", "1", ")", ")", "{", "Vector", "v", "=", "new", "Vector", "(", ")", ";", "// Look at each stack line in turn until we reach the JmsErrorUtils", "// class stuff, then copy them over starting with the first line after", "// JmsErrorUtils finishes.", "boolean", "euStarted", "=", "false", ";", "// First read up to the point where the JmsErrorUtils entries start.", "int", "index", "=", "0", ";", "for", "(", "index", "=", "0", ";", "index", "<", "stackLines", ".", "length", ";", "index", "++", ")", "{", "StackTraceElement", "ste", "=", "stackLines", "[", "index", "]", ";", "// See if this is the errorUtils", "if", "(", "className", ".", "equals", "(", "ste", ".", "getClassName", "(", ")", ")", ")", "{", "// We have found an error utils line", "euStarted", "=", "true", ";", "}", "else", "{", "if", "(", "euStarted", ")", "{", "// This indicates that we have now left the ErrorUtils lines,", "// and everything left in the stack should be copied across.", "v", ".", "add", "(", "ste", ")", ";", "}", "}", "}", "// Now we take the filtered stack trace and set it back into the", "// exception we originally got it from.", "if", "(", "v", ".", "size", "(", ")", "!=", "0", ")", "{", "StackTraceElement", "[", "]", "filteredSTE", "=", "new", "StackTraceElement", "[", "v", ".", "size", "(", ")", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "filteredSTE", ".", "length", ";", "i", "++", ")", "{", "filteredSTE", "[", "i", "]", "=", "(", "StackTraceElement", ")", "v", ".", "elementAt", "(", "i", ")", ";", "}", "t", ".", "setStackTrace", "(", "filteredSTE", ")", ";", "}", "}", "}" ]
This method filters the stack trace of the parameter object to remove all trace of the newThrowable and reflection calls that have been made. @param t
[ "This", "method", "filters", "the", "stack", "trace", "of", "the", "parameter", "object", "to", "remove", "all", "trace", "of", "the", "newThrowable", "and", "reflection", "calls", "that", "have", "been", "made", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsErrorUtils.java#L425-L470
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsErrorUtils.java
JmsErrorUtils.getJMS2Exception
public static Throwable getJMS2Exception(JMSException jmse, Class exceptionToBeThrown) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getJMS2Exceptions", new Object[] { jmse, exceptionToBeThrown }); JMSRuntimeException jmsre = null; try { jmsre = (JMSRuntimeException) exceptionToBeThrown.getConstructor(new Class[] { String.class, String.class, Throwable.class }). newInstance(new Object[] { jmse.getMessage(), jmse.getErrorCode(), jmse.getLinkedException() }); } catch (Exception e) { RuntimeException re = new RuntimeException("JmsErrorUtils.newThrowable#5", e); re.initCause(jmse); FFDCFilter.processException(re, "JmsErrorUtils.newThrowable", "JmsErrorUtils.newThrowable#5"); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "exception : ", re); throw re; } finally { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getJMS2Exceptions", jmsre); } return jmsre; }
java
public static Throwable getJMS2Exception(JMSException jmse, Class exceptionToBeThrown) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getJMS2Exceptions", new Object[] { jmse, exceptionToBeThrown }); JMSRuntimeException jmsre = null; try { jmsre = (JMSRuntimeException) exceptionToBeThrown.getConstructor(new Class[] { String.class, String.class, Throwable.class }). newInstance(new Object[] { jmse.getMessage(), jmse.getErrorCode(), jmse.getLinkedException() }); } catch (Exception e) { RuntimeException re = new RuntimeException("JmsErrorUtils.newThrowable#5", e); re.initCause(jmse); FFDCFilter.processException(re, "JmsErrorUtils.newThrowable", "JmsErrorUtils.newThrowable#5"); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "exception : ", re); throw re; } finally { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getJMS2Exceptions", jmsre); } return jmsre; }
[ "public", "static", "Throwable", "getJMS2Exception", "(", "JMSException", "jmse", ",", "Class", "exceptionToBeThrown", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"getJMS2Exceptions\"", ",", "new", "Object", "[", "]", "{", "jmse", ",", "exceptionToBeThrown", "}", ")", ";", "JMSRuntimeException", "jmsre", "=", "null", ";", "try", "{", "jmsre", "=", "(", "JMSRuntimeException", ")", "exceptionToBeThrown", ".", "getConstructor", "(", "new", "Class", "[", "]", "{", "String", ".", "class", ",", "String", ".", "class", ",", "Throwable", ".", "class", "}", ")", ".", "newInstance", "(", "new", "Object", "[", "]", "{", "jmse", ".", "getMessage", "(", ")", ",", "jmse", ".", "getErrorCode", "(", ")", ",", "jmse", ".", "getLinkedException", "(", ")", "}", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "RuntimeException", "re", "=", "new", "RuntimeException", "(", "\"JmsErrorUtils.newThrowable#5\"", ",", "e", ")", ";", "re", ".", "initCause", "(", "jmse", ")", ";", "FFDCFilter", ".", "processException", "(", "re", ",", "\"JmsErrorUtils.newThrowable\"", ",", "\"JmsErrorUtils.newThrowable#5\"", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "SibTr", ".", "debug", "(", "tc", ",", "\"exception : \"", ",", "re", ")", ";", "throw", "re", ";", "}", "finally", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"getJMS2Exceptions\"", ",", "jmsre", ")", ";", "}", "return", "jmsre", ";", "}" ]
This is a generic function to convert all the JMS 1.1 exceptions to JMS 2.0 exception. It uses reflection to create the desired JMS2.0 exception @param jmse The JMSException @param exceptionToBeThrown The exception which has to be returned @return Throwable It can be of type IllegalStateRuntimeException, InvalidClientIDRuntimeException, InvalidDestinationRuntimeException, InvalidSelectorRuntimeException, JMSSecurityRuntimeException, MessageFormatRuntimeException, MessageNotWriteableRuntimeException, ResourceAllocationRuntimeException, TransactionInProgressRuntimeException, TransactionRolledBackRuntimeException
[ "This", "is", "a", "generic", "function", "to", "convert", "all", "the", "JMS", "1", ".", "1", "exceptions", "to", "JMS", "2", ".", "0", "exception", ".", "It", "uses", "reflection", "to", "create", "the", "desired", "JMS2", ".", "0", "exception" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsErrorUtils.java#L482-L507
train
OpenLiberty/open-liberty
dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/wsspi/kernel/embeddable/EmbeddedServerDriver.java
EmbeddedServerDriver.isProductExtensionInstalled
private boolean isProductExtensionInstalled(String inputString, String productExtension) { if ((productExtension == null) || (inputString == null)) { return false; } int msgIndex = inputString.indexOf("CWWKF0012I: The server installed the following features:"); if (msgIndex == -1) { return false; } String msgString = inputString.substring(msgIndex); int leftBracketIndex = msgString.indexOf("["); int rightBracketIndex = msgString.indexOf("]"); if ((leftBracketIndex == -1) || (rightBracketIndex == -1) || (rightBracketIndex < leftBracketIndex)) { return false; } String features = msgString.substring(leftBracketIndex, rightBracketIndex); Log.info(c, "isProductExtensionInstalled", features); if (features.indexOf(productExtension) == -1) { return false; } return true; }
java
private boolean isProductExtensionInstalled(String inputString, String productExtension) { if ((productExtension == null) || (inputString == null)) { return false; } int msgIndex = inputString.indexOf("CWWKF0012I: The server installed the following features:"); if (msgIndex == -1) { return false; } String msgString = inputString.substring(msgIndex); int leftBracketIndex = msgString.indexOf("["); int rightBracketIndex = msgString.indexOf("]"); if ((leftBracketIndex == -1) || (rightBracketIndex == -1) || (rightBracketIndex < leftBracketIndex)) { return false; } String features = msgString.substring(leftBracketIndex, rightBracketIndex); Log.info(c, "isProductExtensionInstalled", features); if (features.indexOf(productExtension) == -1) { return false; } return true; }
[ "private", "boolean", "isProductExtensionInstalled", "(", "String", "inputString", ",", "String", "productExtension", ")", "{", "if", "(", "(", "productExtension", "==", "null", ")", "||", "(", "inputString", "==", "null", ")", ")", "{", "return", "false", ";", "}", "int", "msgIndex", "=", "inputString", ".", "indexOf", "(", "\"CWWKF0012I: The server installed the following features:\"", ")", ";", "if", "(", "msgIndex", "==", "-", "1", ")", "{", "return", "false", ";", "}", "String", "msgString", "=", "inputString", ".", "substring", "(", "msgIndex", ")", ";", "int", "leftBracketIndex", "=", "msgString", ".", "indexOf", "(", "\"[\"", ")", ";", "int", "rightBracketIndex", "=", "msgString", ".", "indexOf", "(", "\"]\"", ")", ";", "if", "(", "(", "leftBracketIndex", "==", "-", "1", ")", "||", "(", "rightBracketIndex", "==", "-", "1", ")", "||", "(", "rightBracketIndex", "<", "leftBracketIndex", ")", ")", "{", "return", "false", ";", "}", "String", "features", "=", "msgString", ".", "substring", "(", "leftBracketIndex", ",", "rightBracketIndex", ")", ";", "Log", ".", "info", "(", "c", ",", "\"isProductExtensionInstalled\"", ",", "features", ")", ";", "if", "(", "features", ".", "indexOf", "(", "productExtension", ")", "==", "-", "1", ")", "{", "return", "false", ";", "}", "return", "true", ";", "}" ]
Determine if the input product extension exists in the input string. @param inputString string to search. @param productExtension product extension to search for. @return true if input product extension is found in the input string.
[ "Determine", "if", "the", "input", "product", "extension", "exists", "in", "the", "input", "string", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/wsspi/kernel/embeddable/EmbeddedServerDriver.java#L239-L263
train
OpenLiberty/open-liberty
dev/com.ibm.ws.org.apache.cxf.cxf.rt.frontend.jaxrs.3.2/src/org/apache/cxf/jaxrs/utils/HttpUtils.java
HttpUtils.encodePartiallyEncoded
public static String encodePartiallyEncoded(String encoded, boolean query) { if (encoded.length() == 0) { return encoded; } Matcher m = ENCODE_PATTERN.matcher(encoded); if (!m.find()) { return query ? HttpUtils.queryEncode(encoded) : HttpUtils.pathEncode(encoded); } int length = encoded.length(); StringBuilder sb = new StringBuilder(length + 8); int i = 0; do { String before = encoded.substring(i, m.start()); sb.append(query ? HttpUtils.queryEncode(before) : HttpUtils.pathEncode(before)); sb.append(m.group()); i = m.end(); } while (m.find()); String tail = encoded.substring(i, length); sb.append(query ? HttpUtils.queryEncode(tail) : HttpUtils.pathEncode(tail)); return sb.toString(); }
java
public static String encodePartiallyEncoded(String encoded, boolean query) { if (encoded.length() == 0) { return encoded; } Matcher m = ENCODE_PATTERN.matcher(encoded); if (!m.find()) { return query ? HttpUtils.queryEncode(encoded) : HttpUtils.pathEncode(encoded); } int length = encoded.length(); StringBuilder sb = new StringBuilder(length + 8); int i = 0; do { String before = encoded.substring(i, m.start()); sb.append(query ? HttpUtils.queryEncode(before) : HttpUtils.pathEncode(before)); sb.append(m.group()); i = m.end(); } while (m.find()); String tail = encoded.substring(i, length); sb.append(query ? HttpUtils.queryEncode(tail) : HttpUtils.pathEncode(tail)); return sb.toString(); }
[ "public", "static", "String", "encodePartiallyEncoded", "(", "String", "encoded", ",", "boolean", "query", ")", "{", "if", "(", "encoded", ".", "length", "(", ")", "==", "0", ")", "{", "return", "encoded", ";", "}", "Matcher", "m", "=", "ENCODE_PATTERN", ".", "matcher", "(", "encoded", ")", ";", "if", "(", "!", "m", ".", "find", "(", ")", ")", "{", "return", "query", "?", "HttpUtils", ".", "queryEncode", "(", "encoded", ")", ":", "HttpUtils", ".", "pathEncode", "(", "encoded", ")", ";", "}", "int", "length", "=", "encoded", ".", "length", "(", ")", ";", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", "length", "+", "8", ")", ";", "int", "i", "=", "0", ";", "do", "{", "String", "before", "=", "encoded", ".", "substring", "(", "i", ",", "m", ".", "start", "(", ")", ")", ";", "sb", ".", "append", "(", "query", "?", "HttpUtils", ".", "queryEncode", "(", "before", ")", ":", "HttpUtils", ".", "pathEncode", "(", "before", ")", ")", ";", "sb", ".", "append", "(", "m", ".", "group", "(", ")", ")", ";", "i", "=", "m", ".", "end", "(", ")", ";", "}", "while", "(", "m", ".", "find", "(", ")", ")", ";", "String", "tail", "=", "encoded", ".", "substring", "(", "i", ",", "length", ")", ";", "sb", ".", "append", "(", "query", "?", "HttpUtils", ".", "queryEncode", "(", "tail", ")", ":", "HttpUtils", ".", "pathEncode", "(", "tail", ")", ")", ";", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Encodes partially encoded string. Encode all values but those matching pattern "percent char followed by two hexadecimal digits". @param encoded fully or partially encoded string. @return fully encoded string
[ "Encodes", "partially", "encoded", "string", ".", "Encode", "all", "values", "but", "those", "matching", "pattern", "percent", "char", "followed", "by", "two", "hexadecimal", "digits", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.org.apache.cxf.cxf.rt.frontend.jaxrs.3.2/src/org/apache/cxf/jaxrs/utils/HttpUtils.java#L191-L213
train
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/HpelCBEFormatter.java
HpelCBEFormatter.formatRecord
@Override public String formatRecord(RepositoryLogRecord record, Locale locale) { if (null == record) { throw new IllegalArgumentException("Record cannot be null"); } return getFormattedRecord(record, locale); }
java
@Override public String formatRecord(RepositoryLogRecord record, Locale locale) { if (null == record) { throw new IllegalArgumentException("Record cannot be null"); } return getFormattedRecord(record, locale); }
[ "@", "Override", "public", "String", "formatRecord", "(", "RepositoryLogRecord", "record", ",", "Locale", "locale", ")", "{", "if", "(", "null", "==", "record", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Record cannot be null\"", ")", ";", "}", "return", "getFormattedRecord", "(", "record", ",", "locale", ")", ";", "}" ]
Formats a RepositoryLogRecord into a localized CBE format output String. @param record the RepositoryLogRecord to be formatted @param locale the Locale to use for localization when formatting this record. @return the formated string output.
[ "Formats", "a", "RepositoryLogRecord", "into", "a", "localized", "CBE", "format", "output", "String", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/HpelCBEFormatter.java#L51-L58
train
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/HpelCBEFormatter.java
HpelCBEFormatter.getFormattedRecord
public String getFormattedRecord(RepositoryLogRecord record, Locale locale) { StringBuilder sb = new StringBuilder(300); //create opening tag for the CBE Event createEventOTag(sb, record, locale); //add the CBE elements createExtendedElement(sb, record); createExtendedElement(sb, "CommonBaseEventLogRecord:sequenceNumber", "long", String.valueOf(record.getSequence())); createExtendedElement(sb, "CommonBaseEventLogRecord:threadID", "int", String.valueOf(record.getThreadID())); if (record.getLoggerName() != null){ createExtendedElement(sb, "CommonBaseEventLogRecord:loggerName", "string", record.getLoggerName()); } for (String name: record.getExtensions().keySet()) { // Don't report pthreadId here since it is reported as part of the sourceComponentId. if (!RepositoryLogRecord.PTHREADID.equals(name)) { createExtendedElement(sb, record, name); } } if (headerProps.getProperty(ServerInstanceLogRecordList.HEADER_VERSION) != null) createExtendedElement(sb, "version", "string", headerProps.getProperty(ServerInstanceLogRecordList.HEADER_VERSION)); if (headerProps.getProperty(ServerInstanceLogRecordList.HEADER_PROCESSID) != null) createExtendedElement(sb, "processId", "string", headerProps.getProperty(ServerInstanceLogRecordList.HEADER_PROCESSID)); if (headerProps.getProperty(ServerInstanceLogRecordList.HEADER_SERVER_NAME) != null) createExtendedElement(sb, "processName", "string", headerProps.getProperty(ServerInstanceLogRecordList.HEADER_SERVER_NAME)); switch (record.getLocalizable()) { case WsLogRecord.REQUIRES_LOCALIZATION : createExtendedElement(sb, "localizable", "string", STR_REQUIRES_LOCALIZATION); //yes break; case WsLogRecord.REQUIRES_NO_LOCALIZATION: createExtendedElement(sb, "localizable", "string", STR_REQUIRES_NO_LOCALIZATION); //no break; default : createExtendedElement(sb, "localizable", "string", STR_DEFAULT_LOCALIZATION); //default break; } createSourceElement(sb, record); createMessageElement(sb, record); createSituationElement(sb); //create closing tag for the CBE Event createEventCTag(sb); return sb.toString(); }
java
public String getFormattedRecord(RepositoryLogRecord record, Locale locale) { StringBuilder sb = new StringBuilder(300); //create opening tag for the CBE Event createEventOTag(sb, record, locale); //add the CBE elements createExtendedElement(sb, record); createExtendedElement(sb, "CommonBaseEventLogRecord:sequenceNumber", "long", String.valueOf(record.getSequence())); createExtendedElement(sb, "CommonBaseEventLogRecord:threadID", "int", String.valueOf(record.getThreadID())); if (record.getLoggerName() != null){ createExtendedElement(sb, "CommonBaseEventLogRecord:loggerName", "string", record.getLoggerName()); } for (String name: record.getExtensions().keySet()) { // Don't report pthreadId here since it is reported as part of the sourceComponentId. if (!RepositoryLogRecord.PTHREADID.equals(name)) { createExtendedElement(sb, record, name); } } if (headerProps.getProperty(ServerInstanceLogRecordList.HEADER_VERSION) != null) createExtendedElement(sb, "version", "string", headerProps.getProperty(ServerInstanceLogRecordList.HEADER_VERSION)); if (headerProps.getProperty(ServerInstanceLogRecordList.HEADER_PROCESSID) != null) createExtendedElement(sb, "processId", "string", headerProps.getProperty(ServerInstanceLogRecordList.HEADER_PROCESSID)); if (headerProps.getProperty(ServerInstanceLogRecordList.HEADER_SERVER_NAME) != null) createExtendedElement(sb, "processName", "string", headerProps.getProperty(ServerInstanceLogRecordList.HEADER_SERVER_NAME)); switch (record.getLocalizable()) { case WsLogRecord.REQUIRES_LOCALIZATION : createExtendedElement(sb, "localizable", "string", STR_REQUIRES_LOCALIZATION); //yes break; case WsLogRecord.REQUIRES_NO_LOCALIZATION: createExtendedElement(sb, "localizable", "string", STR_REQUIRES_NO_LOCALIZATION); //no break; default : createExtendedElement(sb, "localizable", "string", STR_DEFAULT_LOCALIZATION); //default break; } createSourceElement(sb, record); createMessageElement(sb, record); createSituationElement(sb); //create closing tag for the CBE Event createEventCTag(sb); return sb.toString(); }
[ "public", "String", "getFormattedRecord", "(", "RepositoryLogRecord", "record", ",", "Locale", "locale", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", "300", ")", ";", "//create opening tag for the CBE Event", "createEventOTag", "(", "sb", ",", "record", ",", "locale", ")", ";", "//add the CBE elements", "createExtendedElement", "(", "sb", ",", "record", ")", ";", "createExtendedElement", "(", "sb", ",", "\"CommonBaseEventLogRecord:sequenceNumber\"", ",", "\"long\"", ",", "String", ".", "valueOf", "(", "record", ".", "getSequence", "(", ")", ")", ")", ";", "createExtendedElement", "(", "sb", ",", "\"CommonBaseEventLogRecord:threadID\"", ",", "\"int\"", ",", "String", ".", "valueOf", "(", "record", ".", "getThreadID", "(", ")", ")", ")", ";", "if", "(", "record", ".", "getLoggerName", "(", ")", "!=", "null", ")", "{", "createExtendedElement", "(", "sb", ",", "\"CommonBaseEventLogRecord:loggerName\"", ",", "\"string\"", ",", "record", ".", "getLoggerName", "(", ")", ")", ";", "}", "for", "(", "String", "name", ":", "record", ".", "getExtensions", "(", ")", ".", "keySet", "(", ")", ")", "{", "// Don't report pthreadId here since it is reported as part of the sourceComponentId.", "if", "(", "!", "RepositoryLogRecord", ".", "PTHREADID", ".", "equals", "(", "name", ")", ")", "{", "createExtendedElement", "(", "sb", ",", "record", ",", "name", ")", ";", "}", "}", "if", "(", "headerProps", ".", "getProperty", "(", "ServerInstanceLogRecordList", ".", "HEADER_VERSION", ")", "!=", "null", ")", "createExtendedElement", "(", "sb", ",", "\"version\"", ",", "\"string\"", ",", "headerProps", ".", "getProperty", "(", "ServerInstanceLogRecordList", ".", "HEADER_VERSION", ")", ")", ";", "if", "(", "headerProps", ".", "getProperty", "(", "ServerInstanceLogRecordList", ".", "HEADER_PROCESSID", ")", "!=", "null", ")", "createExtendedElement", "(", "sb", ",", "\"processId\"", ",", "\"string\"", ",", "headerProps", ".", "getProperty", "(", "ServerInstanceLogRecordList", ".", "HEADER_PROCESSID", ")", ")", ";", "if", "(", "headerProps", ".", "getProperty", "(", "ServerInstanceLogRecordList", ".", "HEADER_SERVER_NAME", ")", "!=", "null", ")", "createExtendedElement", "(", "sb", ",", "\"processName\"", ",", "\"string\"", ",", "headerProps", ".", "getProperty", "(", "ServerInstanceLogRecordList", ".", "HEADER_SERVER_NAME", ")", ")", ";", "switch", "(", "record", ".", "getLocalizable", "(", ")", ")", "{", "case", "WsLogRecord", ".", "REQUIRES_LOCALIZATION", ":", "createExtendedElement", "(", "sb", ",", "\"localizable\"", ",", "\"string\"", ",", "STR_REQUIRES_LOCALIZATION", ")", ";", "//yes", "break", ";", "case", "WsLogRecord", ".", "REQUIRES_NO_LOCALIZATION", ":", "createExtendedElement", "(", "sb", ",", "\"localizable\"", ",", "\"string\"", ",", "STR_REQUIRES_NO_LOCALIZATION", ")", ";", "//no\t", "break", ";", "default", ":", "createExtendedElement", "(", "sb", ",", "\"localizable\"", ",", "\"string\"", ",", "STR_DEFAULT_LOCALIZATION", ")", ";", "//default", "break", ";", "}", "createSourceElement", "(", "sb", ",", "record", ")", ";", "createMessageElement", "(", "sb", ",", "record", ")", ";", "createSituationElement", "(", "sb", ")", ";", "//create closing tag for the CBE Event", "createEventCTag", "(", "sb", ")", ";", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Gets a String representation of a log record as a CBEEvent XML element @param record of the event. @param locale the locale to use when printing the output. @return String representation of the record in CBE format.
[ "Gets", "a", "String", "representation", "of", "a", "log", "record", "as", "a", "CBEEvent", "XML", "element" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/HpelCBEFormatter.java#L78-L127
train
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/HpelCBEFormatter.java
HpelCBEFormatter.createEventOTag
private void createEventOTag(StringBuilder sb, RepositoryLogRecord record, Locale locale){ sb.append("<CommonBaseEvent creationTime=\""); // create the XML dateTime format // TimeZone is UTC, but since we are dealing with Millis we are already in UTC. sb.append(CBE_DATE_FORMAT.format(record.getMillis())); sb.append("\""); // create and add the globalInstanceId sb.append(" globalInstanceId=\"").append(GUID_PREFIX).append(Guid.generate()).append("\""); // write out the msg sb.append(" msg=\"").append(formatMessage(record, locale)).append("\""); short severity = 0; if (record.getLevel().intValue() >= Level.SEVERE.intValue()) { severity = 50; } else if (record.getLevel().intValue() >= Level.WARNING.intValue()) { severity = 30; } else { severity = 10; } sb.append(" severity=\"").append(severity).append("\""); sb.append(" version=\"1.0.1\">"); }
java
private void createEventOTag(StringBuilder sb, RepositoryLogRecord record, Locale locale){ sb.append("<CommonBaseEvent creationTime=\""); // create the XML dateTime format // TimeZone is UTC, but since we are dealing with Millis we are already in UTC. sb.append(CBE_DATE_FORMAT.format(record.getMillis())); sb.append("\""); // create and add the globalInstanceId sb.append(" globalInstanceId=\"").append(GUID_PREFIX).append(Guid.generate()).append("\""); // write out the msg sb.append(" msg=\"").append(formatMessage(record, locale)).append("\""); short severity = 0; if (record.getLevel().intValue() >= Level.SEVERE.intValue()) { severity = 50; } else if (record.getLevel().intValue() >= Level.WARNING.intValue()) { severity = 30; } else { severity = 10; } sb.append(" severity=\"").append(severity).append("\""); sb.append(" version=\"1.0.1\">"); }
[ "private", "void", "createEventOTag", "(", "StringBuilder", "sb", ",", "RepositoryLogRecord", "record", ",", "Locale", "locale", ")", "{", "sb", ".", "append", "(", "\"<CommonBaseEvent creationTime=\\\"\"", ")", ";", "// create the XML dateTime format", "// TimeZone is UTC, but since we are dealing with Millis we are already in UTC.", "sb", ".", "append", "(", "CBE_DATE_FORMAT", ".", "format", "(", "record", ".", "getMillis", "(", ")", ")", ")", ";", "sb", ".", "append", "(", "\"\\\"\"", ")", ";", "// create and add the globalInstanceId", "sb", ".", "append", "(", "\" globalInstanceId=\\\"\"", ")", ".", "append", "(", "GUID_PREFIX", ")", ".", "append", "(", "Guid", ".", "generate", "(", ")", ")", ".", "append", "(", "\"\\\"\"", ")", ";", "// write out the msg", "sb", ".", "append", "(", "\" msg=\\\"\"", ")", ".", "append", "(", "formatMessage", "(", "record", ",", "locale", ")", ")", ".", "append", "(", "\"\\\"\"", ")", ";", "short", "severity", "=", "0", ";", "if", "(", "record", ".", "getLevel", "(", ")", ".", "intValue", "(", ")", ">=", "Level", ".", "SEVERE", ".", "intValue", "(", ")", ")", "{", "severity", "=", "50", ";", "}", "else", "if", "(", "record", ".", "getLevel", "(", ")", ".", "intValue", "(", ")", ">=", "Level", ".", "WARNING", ".", "intValue", "(", ")", ")", "{", "severity", "=", "30", ";", "}", "else", "{", "severity", "=", "10", ";", "}", "sb", ".", "append", "(", "\" severity=\\\"\"", ")", ".", "append", "(", "severity", ")", ".", "append", "(", "\"\\\"\"", ")", ";", "sb", ".", "append", "(", "\" version=\\\"1.0.1\\\">\"", ")", ";", "}" ]
Appends the opening tag of a CommonBaseEvent XML element to a string buffer @param sb the string buffer the tag will be added to @param record the record that represents the common base event @param locale locale to be used for formatting the log record into CBE
[ "Appends", "the", "opening", "tag", "of", "a", "CommonBaseEvent", "XML", "element", "to", "a", "string", "buffer" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/HpelCBEFormatter.java#L146-L170
train
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/HpelCBEFormatter.java
HpelCBEFormatter.createSituationElement
private void createSituationElement(StringBuilder sb){ sb.append(lineSeparator).append(INDENT[0]).append("<situation categoryName=\"ReportSituation\">"); sb.append(lineSeparator).append(INDENT[1]).append( "<situationType xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"ReportSituation\" reasoningScope=\"INTERNAL\" reportCategory=\"LOG\"/>"); sb.append(lineSeparator).append(INDENT[0]).append("</situation>"); }
java
private void createSituationElement(StringBuilder sb){ sb.append(lineSeparator).append(INDENT[0]).append("<situation categoryName=\"ReportSituation\">"); sb.append(lineSeparator).append(INDENT[1]).append( "<situationType xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"ReportSituation\" reasoningScope=\"INTERNAL\" reportCategory=\"LOG\"/>"); sb.append(lineSeparator).append(INDENT[0]).append("</situation>"); }
[ "private", "void", "createSituationElement", "(", "StringBuilder", "sb", ")", "{", "sb", ".", "append", "(", "lineSeparator", ")", ".", "append", "(", "INDENT", "[", "0", "]", ")", ".", "append", "(", "\"<situation categoryName=\\\"ReportSituation\\\">\"", ")", ";", "sb", ".", "append", "(", "lineSeparator", ")", ".", "append", "(", "INDENT", "[", "1", "]", ")", ".", "append", "(", "\"<situationType xmlns:xsi=\\\"http://www.w3.org/2001/XMLSchema-instance\\\" xsi:type=\\\"ReportSituation\\\" reasoningScope=\\\"INTERNAL\\\" reportCategory=\\\"LOG\\\"/>\"", ")", ";", "sb", ".", "append", "(", "lineSeparator", ")", ".", "append", "(", "INDENT", "[", "0", "]", ")", ".", "append", "(", "\"</situation>\"", ")", ";", "}" ]
Appends the CBE Situation XML element of a record to a String buffer @param sb the string buffer the element will be added to
[ "Appends", "the", "CBE", "Situation", "XML", "element", "of", "a", "record", "to", "a", "String", "buffer" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/HpelCBEFormatter.java#L177-L182
train
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/HpelCBEFormatter.java
HpelCBEFormatter.createSourceElement
private void createSourceElement(StringBuilder sb, RepositoryLogRecord record){ String hostAddr = headerProps.getProperty(ServerInstanceLogRecordList.HEADER_HOSTADDRESS) == null? "": headerProps.getProperty(ServerInstanceLogRecordList.HEADER_HOSTADDRESS); String hostType = headerProps.getProperty(ServerInstanceLogRecordList.HEADER_HOSTTYPE) == null? "": headerProps.getProperty(ServerInstanceLogRecordList.HEADER_HOSTTYPE); // 660484 ... got rid of string concat since we already had the string buffer to do it better sb.append(lineSeparator).append(INDENT[0]).append("<sourceComponentId component=\"Logging\" componentIdType=\"Application\""); sb.append(" executionEnvironment=\"Java\" instanceId=\"").append(headerProps.getProperty(ServerInstanceLogRecordList.HEADER_SERVER_NAME)).append("\""); sb.append(" location=\"").append(hostAddr).append("\" locationType=\"").append(hostType).append("\""); sb.append(" processId=\"").append(headerProps.getProperty(ServerInstanceLogRecordList.HEADER_PROCESSID)).append("\"").append(" subComponent=\"Logger\""); sb.append(" threadId=\"").append(record.getExtension(RepositoryLogRecord.PTHREADID)).append("\""); sb.append(" componentType=\"Logging_Application\"/>"); }
java
private void createSourceElement(StringBuilder sb, RepositoryLogRecord record){ String hostAddr = headerProps.getProperty(ServerInstanceLogRecordList.HEADER_HOSTADDRESS) == null? "": headerProps.getProperty(ServerInstanceLogRecordList.HEADER_HOSTADDRESS); String hostType = headerProps.getProperty(ServerInstanceLogRecordList.HEADER_HOSTTYPE) == null? "": headerProps.getProperty(ServerInstanceLogRecordList.HEADER_HOSTTYPE); // 660484 ... got rid of string concat since we already had the string buffer to do it better sb.append(lineSeparator).append(INDENT[0]).append("<sourceComponentId component=\"Logging\" componentIdType=\"Application\""); sb.append(" executionEnvironment=\"Java\" instanceId=\"").append(headerProps.getProperty(ServerInstanceLogRecordList.HEADER_SERVER_NAME)).append("\""); sb.append(" location=\"").append(hostAddr).append("\" locationType=\"").append(hostType).append("\""); sb.append(" processId=\"").append(headerProps.getProperty(ServerInstanceLogRecordList.HEADER_PROCESSID)).append("\"").append(" subComponent=\"Logger\""); sb.append(" threadId=\"").append(record.getExtension(RepositoryLogRecord.PTHREADID)).append("\""); sb.append(" componentType=\"Logging_Application\"/>"); }
[ "private", "void", "createSourceElement", "(", "StringBuilder", "sb", ",", "RepositoryLogRecord", "record", ")", "{", "String", "hostAddr", "=", "headerProps", ".", "getProperty", "(", "ServerInstanceLogRecordList", ".", "HEADER_HOSTADDRESS", ")", "==", "null", "?", "\"\"", ":", "headerProps", ".", "getProperty", "(", "ServerInstanceLogRecordList", ".", "HEADER_HOSTADDRESS", ")", ";", "String", "hostType", "=", "headerProps", ".", "getProperty", "(", "ServerInstanceLogRecordList", ".", "HEADER_HOSTTYPE", ")", "==", "null", "?", "\"\"", ":", "headerProps", ".", "getProperty", "(", "ServerInstanceLogRecordList", ".", "HEADER_HOSTTYPE", ")", ";", "// 660484 ... got rid of string concat since we already had the string buffer to do it better", "sb", ".", "append", "(", "lineSeparator", ")", ".", "append", "(", "INDENT", "[", "0", "]", ")", ".", "append", "(", "\"<sourceComponentId component=\\\"Logging\\\" componentIdType=\\\"Application\\\"\"", ")", ";", "sb", ".", "append", "(", "\" executionEnvironment=\\\"Java\\\" instanceId=\\\"\"", ")", ".", "append", "(", "headerProps", ".", "getProperty", "(", "ServerInstanceLogRecordList", ".", "HEADER_SERVER_NAME", ")", ")", ".", "append", "(", "\"\\\"\"", ")", ";", "sb", ".", "append", "(", "\" location=\\\"\"", ")", ".", "append", "(", "hostAddr", ")", ".", "append", "(", "\"\\\" locationType=\\\"\"", ")", ".", "append", "(", "hostType", ")", ".", "append", "(", "\"\\\"\"", ")", ";", "sb", ".", "append", "(", "\" processId=\\\"\"", ")", ".", "append", "(", "headerProps", ".", "getProperty", "(", "ServerInstanceLogRecordList", ".", "HEADER_PROCESSID", ")", ")", ".", "append", "(", "\"\\\"\"", ")", ".", "append", "(", "\" subComponent=\\\"Logger\\\"\"", ")", ";", "sb", ".", "append", "(", "\" threadId=\\\"\"", ")", ".", "append", "(", "record", ".", "getExtension", "(", "RepositoryLogRecord", ".", "PTHREADID", ")", ")", ".", "append", "(", "\"\\\"\"", ")", ";", "sb", ".", "append", "(", "\" componentType=\\\"Logging_Application\\\"/>\"", ")", ";", "}" ]
Appends the CBE Source XML element of a record to a String buffer @param sb the string buffer the element will be added to @param record the record that represents the common base event
[ "Appends", "the", "CBE", "Source", "XML", "element", "of", "a", "record", "to", "a", "String", "buffer" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/HpelCBEFormatter.java#L190-L201
train
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/HpelCBEFormatter.java
HpelCBEFormatter.createMessageElement
private void createMessageElement(StringBuilder sb, RepositoryLogRecord record){ // 660484 elim string concat sb.append(lineSeparator).append(INDENT[0]).append("<msgDataElement msgLocale=\"").append(record.getMessageLocale()).append("\">"); if (record.getParameters() != null) { // how many params do we have? for (int c = 0; c < record.getParameters().length; c++) { sb.append(lineSeparator).append(INDENT[1]).append("<msgCatalogTokens value=\""). append(MessageFormat.format("{" + c + "}", record.getParameters())).append("\"/>"); } } // IBM SWG MsgID if (record.getMessageID() != null) { // Seems to be a IBM SWG ID. sb.append(lineSeparator).append(INDENT[1]).append("<msgId>").append(record.getMessageID()).append("</msgId>"); // IBM SWG MsgType sb.append(lineSeparator).append(INDENT[1]).append("<msgIdType>"); if (record.getMessageID().length() == 10) sb.append("IBM5.4.1"); else sb.append("IBM4.4.1"); sb.append("</msgIdType>"); } if (record.getRawMessage() != null && record.getResourceBundleName() != null) { sb.append(lineSeparator).append(INDENT[1]).append("<msgCatalogId>").append(record.getRawMessage()).append("</msgCatalogId>"); sb.append(lineSeparator).append(INDENT[1]).append("<msgCatalogType>Java</msgCatalogType>"); sb.append(lineSeparator).append(INDENT[1]).append("<msgCatalog>").append(record.getResourceBundleName()).append("</msgCatalog>"); } sb.append(lineSeparator).append(INDENT[0]).append("</msgDataElement>"); }
java
private void createMessageElement(StringBuilder sb, RepositoryLogRecord record){ // 660484 elim string concat sb.append(lineSeparator).append(INDENT[0]).append("<msgDataElement msgLocale=\"").append(record.getMessageLocale()).append("\">"); if (record.getParameters() != null) { // how many params do we have? for (int c = 0; c < record.getParameters().length; c++) { sb.append(lineSeparator).append(INDENT[1]).append("<msgCatalogTokens value=\""). append(MessageFormat.format("{" + c + "}", record.getParameters())).append("\"/>"); } } // IBM SWG MsgID if (record.getMessageID() != null) { // Seems to be a IBM SWG ID. sb.append(lineSeparator).append(INDENT[1]).append("<msgId>").append(record.getMessageID()).append("</msgId>"); // IBM SWG MsgType sb.append(lineSeparator).append(INDENT[1]).append("<msgIdType>"); if (record.getMessageID().length() == 10) sb.append("IBM5.4.1"); else sb.append("IBM4.4.1"); sb.append("</msgIdType>"); } if (record.getRawMessage() != null && record.getResourceBundleName() != null) { sb.append(lineSeparator).append(INDENT[1]).append("<msgCatalogId>").append(record.getRawMessage()).append("</msgCatalogId>"); sb.append(lineSeparator).append(INDENT[1]).append("<msgCatalogType>Java</msgCatalogType>"); sb.append(lineSeparator).append(INDENT[1]).append("<msgCatalog>").append(record.getResourceBundleName()).append("</msgCatalog>"); } sb.append(lineSeparator).append(INDENT[0]).append("</msgDataElement>"); }
[ "private", "void", "createMessageElement", "(", "StringBuilder", "sb", ",", "RepositoryLogRecord", "record", ")", "{", "// 660484 elim string concat", "sb", ".", "append", "(", "lineSeparator", ")", ".", "append", "(", "INDENT", "[", "0", "]", ")", ".", "append", "(", "\"<msgDataElement msgLocale=\\\"\"", ")", ".", "append", "(", "record", ".", "getMessageLocale", "(", ")", ")", ".", "append", "(", "\"\\\">\"", ")", ";", "if", "(", "record", ".", "getParameters", "(", ")", "!=", "null", ")", "{", "// how many params do we have?", "for", "(", "int", "c", "=", "0", ";", "c", "<", "record", ".", "getParameters", "(", ")", ".", "length", ";", "c", "++", ")", "{", "sb", ".", "append", "(", "lineSeparator", ")", ".", "append", "(", "INDENT", "[", "1", "]", ")", ".", "append", "(", "\"<msgCatalogTokens value=\\\"\"", ")", ".", "append", "(", "MessageFormat", ".", "format", "(", "\"{\"", "+", "c", "+", "\"}\"", ",", "record", ".", "getParameters", "(", ")", ")", ")", ".", "append", "(", "\"\\\"/>\"", ")", ";", "}", "}", "// IBM SWG MsgID", "if", "(", "record", ".", "getMessageID", "(", ")", "!=", "null", ")", "{", "// Seems to be a IBM SWG ID.", "sb", ".", "append", "(", "lineSeparator", ")", ".", "append", "(", "INDENT", "[", "1", "]", ")", ".", "append", "(", "\"<msgId>\"", ")", ".", "append", "(", "record", ".", "getMessageID", "(", ")", ")", ".", "append", "(", "\"</msgId>\"", ")", ";", "// IBM SWG MsgType", "sb", ".", "append", "(", "lineSeparator", ")", ".", "append", "(", "INDENT", "[", "1", "]", ")", ".", "append", "(", "\"<msgIdType>\"", ")", ";", "if", "(", "record", ".", "getMessageID", "(", ")", ".", "length", "(", ")", "==", "10", ")", "sb", ".", "append", "(", "\"IBM5.4.1\"", ")", ";", "else", "sb", ".", "append", "(", "\"IBM4.4.1\"", ")", ";", "sb", ".", "append", "(", "\"</msgIdType>\"", ")", ";", "}", "if", "(", "record", ".", "getRawMessage", "(", ")", "!=", "null", "&&", "record", ".", "getResourceBundleName", "(", ")", "!=", "null", ")", "{", "sb", ".", "append", "(", "lineSeparator", ")", ".", "append", "(", "INDENT", "[", "1", "]", ")", ".", "append", "(", "\"<msgCatalogId>\"", ")", ".", "append", "(", "record", ".", "getRawMessage", "(", ")", ")", ".", "append", "(", "\"</msgCatalogId>\"", ")", ";", "sb", ".", "append", "(", "lineSeparator", ")", ".", "append", "(", "INDENT", "[", "1", "]", ")", ".", "append", "(", "\"<msgCatalogType>Java</msgCatalogType>\"", ")", ";", "sb", ".", "append", "(", "lineSeparator", ")", ".", "append", "(", "INDENT", "[", "1", "]", ")", ".", "append", "(", "\"<msgCatalog>\"", ")", ".", "append", "(", "record", ".", "getResourceBundleName", "(", ")", ")", ".", "append", "(", "\"</msgCatalog>\"", ")", ";", "}", "sb", ".", "append", "(", "lineSeparator", ")", ".", "append", "(", "INDENT", "[", "0", "]", ")", ".", "append", "(", "\"</msgDataElement>\"", ")", ";", "}" ]
Appends the CBE Message Element XML element of a record to a String buffer @param sb the string buffer the element will be added to @param record the record that represents the common base event
[ "Appends", "the", "CBE", "Message", "Element", "XML", "element", "of", "a", "record", "to", "a", "String", "buffer" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/HpelCBEFormatter.java#L209-L238
train
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/HpelCBEFormatter.java
HpelCBEFormatter.createExtendedElement
private void createExtendedElement(StringBuilder sb, RepositoryLogRecord record){ sb.append(lineSeparator).append(INDENT[0]).append("<extendedDataElements name=\"CommonBaseEventLogRecord:level\" type=\"noValue\">"); sb.append(lineSeparator).append(INDENT[1]).append("<children name=\"CommonBaseEventLogRecord:name\" type=\"string\">"); sb.append(lineSeparator).append(INDENT[2]).append("<values>").append(record.getLevel().getName()).append("</values>"); sb.append(lineSeparator).append(INDENT[1]).append("</children>"); sb.append(lineSeparator).append(INDENT[1]).append("<children name=\"CommonBaseEventLogRecord:value\" type=\"int\">"); sb.append(lineSeparator).append(INDENT[2]).append("<values>").append(record.getLevel().intValue()).append("</values>"); sb.append(lineSeparator).append(INDENT[1]).append("</children>"); sb.append(lineSeparator).append(INDENT[0]).append("</extendedDataElements>"); }
java
private void createExtendedElement(StringBuilder sb, RepositoryLogRecord record){ sb.append(lineSeparator).append(INDENT[0]).append("<extendedDataElements name=\"CommonBaseEventLogRecord:level\" type=\"noValue\">"); sb.append(lineSeparator).append(INDENT[1]).append("<children name=\"CommonBaseEventLogRecord:name\" type=\"string\">"); sb.append(lineSeparator).append(INDENT[2]).append("<values>").append(record.getLevel().getName()).append("</values>"); sb.append(lineSeparator).append(INDENT[1]).append("</children>"); sb.append(lineSeparator).append(INDENT[1]).append("<children name=\"CommonBaseEventLogRecord:value\" type=\"int\">"); sb.append(lineSeparator).append(INDENT[2]).append("<values>").append(record.getLevel().intValue()).append("</values>"); sb.append(lineSeparator).append(INDENT[1]).append("</children>"); sb.append(lineSeparator).append(INDENT[0]).append("</extendedDataElements>"); }
[ "private", "void", "createExtendedElement", "(", "StringBuilder", "sb", ",", "RepositoryLogRecord", "record", ")", "{", "sb", ".", "append", "(", "lineSeparator", ")", ".", "append", "(", "INDENT", "[", "0", "]", ")", ".", "append", "(", "\"<extendedDataElements name=\\\"CommonBaseEventLogRecord:level\\\" type=\\\"noValue\\\">\"", ")", ";", "sb", ".", "append", "(", "lineSeparator", ")", ".", "append", "(", "INDENT", "[", "1", "]", ")", ".", "append", "(", "\"<children name=\\\"CommonBaseEventLogRecord:name\\\" type=\\\"string\\\">\"", ")", ";", "sb", ".", "append", "(", "lineSeparator", ")", ".", "append", "(", "INDENT", "[", "2", "]", ")", ".", "append", "(", "\"<values>\"", ")", ".", "append", "(", "record", ".", "getLevel", "(", ")", ".", "getName", "(", ")", ")", ".", "append", "(", "\"</values>\"", ")", ";", "sb", ".", "append", "(", "lineSeparator", ")", ".", "append", "(", "INDENT", "[", "1", "]", ")", ".", "append", "(", "\"</children>\"", ")", ";", "sb", ".", "append", "(", "lineSeparator", ")", ".", "append", "(", "INDENT", "[", "1", "]", ")", ".", "append", "(", "\"<children name=\\\"CommonBaseEventLogRecord:value\\\" type=\\\"int\\\">\"", ")", ";", "sb", ".", "append", "(", "lineSeparator", ")", ".", "append", "(", "INDENT", "[", "2", "]", ")", ".", "append", "(", "\"<values>\"", ")", ".", "append", "(", "record", ".", "getLevel", "(", ")", ".", "intValue", "(", ")", ")", ".", "append", "(", "\"</values>\"", ")", ";", "sb", ".", "append", "(", "lineSeparator", ")", ".", "append", "(", "INDENT", "[", "1", "]", ")", ".", "append", "(", "\"</children>\"", ")", ";", "sb", ".", "append", "(", "lineSeparator", ")", ".", "append", "(", "INDENT", "[", "0", "]", ")", ".", "append", "(", "\"</extendedDataElements>\"", ")", ";", "}" ]
Appends the CBE Extended Data Element of a record to a String buffer @param sb the string buffer the element will be added to @param record the record that represents the common base event
[ "Appends", "the", "CBE", "Extended", "Data", "Element", "of", "a", "record", "to", "a", "String", "buffer" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/HpelCBEFormatter.java#L246-L255
train
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/HpelCBEFormatter.java
HpelCBEFormatter.createExtendedElement
private void createExtendedElement(StringBuilder sb, RepositoryLogRecord record, String extensionID){ String edeValue = record.getExtension(extensionID); if (edeValue != null && !edeValue.isEmpty()){ createExtendedElement(sb, extensionID, "string", edeValue); } }
java
private void createExtendedElement(StringBuilder sb, RepositoryLogRecord record, String extensionID){ String edeValue = record.getExtension(extensionID); if (edeValue != null && !edeValue.isEmpty()){ createExtendedElement(sb, extensionID, "string", edeValue); } }
[ "private", "void", "createExtendedElement", "(", "StringBuilder", "sb", ",", "RepositoryLogRecord", "record", ",", "String", "extensionID", ")", "{", "String", "edeValue", "=", "record", ".", "getExtension", "(", "extensionID", ")", ";", "if", "(", "edeValue", "!=", "null", "&&", "!", "edeValue", ".", "isEmpty", "(", ")", ")", "{", "createExtendedElement", "(", "sb", ",", "extensionID", ",", "\"string\"", ",", "edeValue", ")", ";", "}", "}" ]
Appends the CBE Extended Data Element of a record's extension to a String buffer @param sb the string buffer the element will be added to @param record the record that represents the common base event @param extensionId the extension ID field from the record to use
[ "Appends", "the", "CBE", "Extended", "Data", "Element", "of", "a", "record", "s", "extension", "to", "a", "String", "buffer" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/HpelCBEFormatter.java#L264-L269
train
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/HpelCBEFormatter.java
HpelCBEFormatter.createExtendedElement
private void createExtendedElement(StringBuilder sb, String edeName, String edeType, String edeValues) { sb.append(lineSeparator).append(INDENT[0]).append("<extendedDataElements name=\"").append(edeName).append("\" type=\"").append(edeType).append("\">"); sb.append(lineSeparator).append(INDENT[1]).append("<values>").append(edeValues).append("</values>"); sb.append(lineSeparator).append(INDENT[0]).append("</extendedDataElements>"); }
java
private void createExtendedElement(StringBuilder sb, String edeName, String edeType, String edeValues) { sb.append(lineSeparator).append(INDENT[0]).append("<extendedDataElements name=\"").append(edeName).append("\" type=\"").append(edeType).append("\">"); sb.append(lineSeparator).append(INDENT[1]).append("<values>").append(edeValues).append("</values>"); sb.append(lineSeparator).append(INDENT[0]).append("</extendedDataElements>"); }
[ "private", "void", "createExtendedElement", "(", "StringBuilder", "sb", ",", "String", "edeName", ",", "String", "edeType", ",", "String", "edeValues", ")", "{", "sb", ".", "append", "(", "lineSeparator", ")", ".", "append", "(", "INDENT", "[", "0", "]", ")", ".", "append", "(", "\"<extendedDataElements name=\\\"\"", ")", ".", "append", "(", "edeName", ")", ".", "append", "(", "\"\\\" type=\\\"\"", ")", ".", "append", "(", "edeType", ")", ".", "append", "(", "\"\\\">\"", ")", ";", "sb", ".", "append", "(", "lineSeparator", ")", ".", "append", "(", "INDENT", "[", "1", "]", ")", ".", "append", "(", "\"<values>\"", ")", ".", "append", "(", "edeValues", ")", ".", "append", "(", "\"</values>\"", ")", ";", "sb", ".", "append", "(", "lineSeparator", ")", ".", "append", "(", "INDENT", "[", "0", "]", ")", ".", "append", "(", "\"</extendedDataElements>\"", ")", ";", "}" ]
Prints and extendedDataElement for CBE output Formatter's time zone. @param sb the string buffer the element will be added to @param edeName the name of the extendedDataElement. @param edeType the data type for the extendedDataElement value(s). @param edeValues the values for this extendedDataElement.
[ "Prints", "and", "extendedDataElement", "for", "CBE", "output", "Formatter", "s", "time", "zone", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/HpelCBEFormatter.java#L280-L284
train
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/internal/WebSecurityHelperImpl.java
WebSecurityHelperImpl.constructLTPACookieObj
private static Cookie constructLTPACookieObj(SingleSignonToken ssoToken) { byte[] ssoTokenBytes = ssoToken.getBytes(); String ssoCookieString = Base64Coder.base64EncodeToString(ssoTokenBytes); Cookie cookie = new Cookie(webAppSecConfig.getSSOCookieName(), ssoCookieString); return cookie; }
java
private static Cookie constructLTPACookieObj(SingleSignonToken ssoToken) { byte[] ssoTokenBytes = ssoToken.getBytes(); String ssoCookieString = Base64Coder.base64EncodeToString(ssoTokenBytes); Cookie cookie = new Cookie(webAppSecConfig.getSSOCookieName(), ssoCookieString); return cookie; }
[ "private", "static", "Cookie", "constructLTPACookieObj", "(", "SingleSignonToken", "ssoToken", ")", "{", "byte", "[", "]", "ssoTokenBytes", "=", "ssoToken", ".", "getBytes", "(", ")", ";", "String", "ssoCookieString", "=", "Base64Coder", ".", "base64EncodeToString", "(", "ssoTokenBytes", ")", ";", "Cookie", "cookie", "=", "new", "Cookie", "(", "webAppSecConfig", ".", "getSSOCookieName", "(", ")", ",", "ssoCookieString", ")", ";", "return", "cookie", ";", "}" ]
builds an LTPACookie object
[ "builds", "an", "LTPACookie", "object" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/internal/WebSecurityHelperImpl.java#L42-L47
train
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/internal/WebSecurityHelperImpl.java
WebSecurityHelperImpl.getLTPACookie
static Cookie getLTPACookie(final Subject subject) throws Exception { Cookie ltpaCookie = null; SingleSignonToken ssoToken = null; Set<SingleSignonToken> ssoTokens = subject.getPrivateCredentials(SingleSignonToken.class); Iterator<SingleSignonToken> ssoTokensIterator = ssoTokens.iterator(); if (ssoTokensIterator.hasNext()) { ssoToken = ssoTokensIterator.next(); if (ssoTokensIterator.hasNext()) { throw new WSSecurityException("More than one ssotoken found in subject"); } } if (ssoToken != null) { ltpaCookie = constructLTPACookieObj(ssoToken); } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "No ssotoken found for this subject"); } } return ltpaCookie; }
java
static Cookie getLTPACookie(final Subject subject) throws Exception { Cookie ltpaCookie = null; SingleSignonToken ssoToken = null; Set<SingleSignonToken> ssoTokens = subject.getPrivateCredentials(SingleSignonToken.class); Iterator<SingleSignonToken> ssoTokensIterator = ssoTokens.iterator(); if (ssoTokensIterator.hasNext()) { ssoToken = ssoTokensIterator.next(); if (ssoTokensIterator.hasNext()) { throw new WSSecurityException("More than one ssotoken found in subject"); } } if (ssoToken != null) { ltpaCookie = constructLTPACookieObj(ssoToken); } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "No ssotoken found for this subject"); } } return ltpaCookie; }
[ "static", "Cookie", "getLTPACookie", "(", "final", "Subject", "subject", ")", "throws", "Exception", "{", "Cookie", "ltpaCookie", "=", "null", ";", "SingleSignonToken", "ssoToken", "=", "null", ";", "Set", "<", "SingleSignonToken", ">", "ssoTokens", "=", "subject", ".", "getPrivateCredentials", "(", "SingleSignonToken", ".", "class", ")", ";", "Iterator", "<", "SingleSignonToken", ">", "ssoTokensIterator", "=", "ssoTokens", ".", "iterator", "(", ")", ";", "if", "(", "ssoTokensIterator", ".", "hasNext", "(", ")", ")", "{", "ssoToken", "=", "ssoTokensIterator", ".", "next", "(", ")", ";", "if", "(", "ssoTokensIterator", ".", "hasNext", "(", ")", ")", "{", "throw", "new", "WSSecurityException", "(", "\"More than one ssotoken found in subject\"", ")", ";", "}", "}", "if", "(", "ssoToken", "!=", "null", ")", "{", "ltpaCookie", "=", "constructLTPACookieObj", "(", "ssoToken", ")", ";", "}", "else", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"No ssotoken found for this subject\"", ")", ";", "}", "}", "return", "ltpaCookie", ";", "}" ]
Gets the LTPA cookie from the given subject @param subject @return @throws Exception
[ "Gets", "the", "LTPA", "cookie", "from", "the", "given", "subject" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/internal/WebSecurityHelperImpl.java#L56-L75
train
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/internal/WebSecurityHelperImpl.java
WebSecurityHelperImpl.getSSOCookieFromSSOToken
public static Cookie getSSOCookieFromSSOToken() throws Exception { Subject subject = null; Cookie ltpaCookie = null; if (webAppSecConfig == null) { // if we don't have the config, we can't construct the cookie return null; } try { subject = WSSubject.getRunAsSubject(); if (subject == null) { subject = WSSubject.getCallerSubject(); } if (subject != null) { ltpaCookie = getLTPACookie(subject); } else { if (tc.isDebugEnabled()) { Tr.debug(tc, "No subjects on the thread"); } } } catch (Exception e) { if (tc.isDebugEnabled()) { Tr.debug(tc, "getSSOCookieFromSSOToken caught exception: " + e.getMessage()); } throw e; } return ltpaCookie; }
java
public static Cookie getSSOCookieFromSSOToken() throws Exception { Subject subject = null; Cookie ltpaCookie = null; if (webAppSecConfig == null) { // if we don't have the config, we can't construct the cookie return null; } try { subject = WSSubject.getRunAsSubject(); if (subject == null) { subject = WSSubject.getCallerSubject(); } if (subject != null) { ltpaCookie = getLTPACookie(subject); } else { if (tc.isDebugEnabled()) { Tr.debug(tc, "No subjects on the thread"); } } } catch (Exception e) { if (tc.isDebugEnabled()) { Tr.debug(tc, "getSSOCookieFromSSOToken caught exception: " + e.getMessage()); } throw e; } return ltpaCookie; }
[ "public", "static", "Cookie", "getSSOCookieFromSSOToken", "(", ")", "throws", "Exception", "{", "Subject", "subject", "=", "null", ";", "Cookie", "ltpaCookie", "=", "null", ";", "if", "(", "webAppSecConfig", "==", "null", ")", "{", "// if we don't have the config, we can't construct the cookie", "return", "null", ";", "}", "try", "{", "subject", "=", "WSSubject", ".", "getRunAsSubject", "(", ")", ";", "if", "(", "subject", "==", "null", ")", "{", "subject", "=", "WSSubject", ".", "getCallerSubject", "(", ")", ";", "}", "if", "(", "subject", "!=", "null", ")", "{", "ltpaCookie", "=", "getLTPACookie", "(", "subject", ")", ";", "}", "else", "{", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"No subjects on the thread\"", ")", ";", "}", "}", "}", "catch", "(", "Exception", "e", ")", "{", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"getSSOCookieFromSSOToken caught exception: \"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "throw", "e", ";", "}", "return", "ltpaCookie", ";", "}" ]
Extracts an LTPA sso cookie from the subject of current thread and builds a ltpa cookie out of it for use on downstream web invocations. The caller must check for null return value only when not null that getName and getValue can be invoked on the returned Cookie object @return an object of type javax.servlet.http.Cookie. When the returned value is not null use Cookie methods getName() and getValue() to set the Cookie header on an http request with header value of Cookie.getName()=Cookie.getValue()
[ "Extracts", "an", "LTPA", "sso", "cookie", "from", "the", "subject", "of", "current", "thread", "and", "builds", "a", "ltpa", "cookie", "out", "of", "it", "for", "use", "on", "downstream", "web", "invocations", ".", "The", "caller", "must", "check", "for", "null", "return", "value", "only", "when", "not", "null", "that", "getName", "and", "getValue", "can", "be", "invoked", "on", "the", "returned", "Cookie", "object" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/internal/WebSecurityHelperImpl.java#L87-L113
train
OpenLiberty/open-liberty
dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/commands/ServerDumpPackager.java
ServerDumpPackager.packageServerDumps
private ReturnCode packageServerDumps(File packageFile, List<String> javaDumps) { DumpProcessor processor = new DumpProcessor(serverName, packageFile, bootProps, javaDumps); return processor.execute(); }
java
private ReturnCode packageServerDumps(File packageFile, List<String> javaDumps) { DumpProcessor processor = new DumpProcessor(serverName, packageFile, bootProps, javaDumps); return processor.execute(); }
[ "private", "ReturnCode", "packageServerDumps", "(", "File", "packageFile", ",", "List", "<", "String", ">", "javaDumps", ")", "{", "DumpProcessor", "processor", "=", "new", "DumpProcessor", "(", "serverName", ",", "packageFile", ",", "bootProps", ",", "javaDumps", ")", ";", "return", "processor", ".", "execute", "(", ")", ";", "}" ]
Creates an archive containing the server dumps, server configurations. @param packageFile @return
[ "Creates", "an", "archive", "containing", "the", "server", "dumps", "server", "configurations", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/commands/ServerDumpPackager.java#L354-L357
train
OpenLiberty/open-liberty
dev/com.ibm.ws.persistence/src/com/ibm/wsspi/persistence/internal/InMemoryUrlStreamHandler.java
InMemoryUrlStreamHandler.deregister
void deregister(List<URL> urls) { for (URL url : urls) { _data.remove(url.getFile()); } }
java
void deregister(List<URL> urls) { for (URL url : urls) { _data.remove(url.getFile()); } }
[ "void", "deregister", "(", "List", "<", "URL", ">", "urls", ")", "{", "for", "(", "URL", "url", ":", "urls", ")", "{", "_data", ".", "remove", "(", "url", ".", "getFile", "(", ")", ")", ";", "}", "}" ]
Remove mappings for the provided urls.
[ "Remove", "mappings", "for", "the", "provided", "urls", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.persistence/src/com/ibm/wsspi/persistence/internal/InMemoryUrlStreamHandler.java#L54-L58
train
OpenLiberty/open-liberty
dev/com.ibm.ws.persistence/src/com/ibm/wsspi/persistence/internal/InMemoryUrlStreamHandler.java
InMemoryUrlStreamHandler.register
void register(URL url, InMemoryMappingFile immf) { _data.put(url.getFile(), immf); }
java
void register(URL url, InMemoryMappingFile immf) { _data.put(url.getFile(), immf); }
[ "void", "register", "(", "URL", "url", ",", "InMemoryMappingFile", "immf", ")", "{", "_data", ".", "put", "(", "url", ".", "getFile", "(", ")", ",", "immf", ")", ";", "}" ]
Register the URL mapping to the provided InMemoryMappingFile.
[ "Register", "the", "URL", "mapping", "to", "the", "provided", "InMemoryMappingFile", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.persistence/src/com/ibm/wsspi/persistence/internal/InMemoryUrlStreamHandler.java#L63-L65
train
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/osgi/container/config/merge/MailSessionComparator.java
MailSessionComparator.isMatchingString
private boolean isMatchingString(String value1, String value2) { boolean valuesMatch = true; if (value1 == null) { if (value2 != null) { valuesMatch = false; } } else { valuesMatch = value1.equals(value2); } return valuesMatch; }
java
private boolean isMatchingString(String value1, String value2) { boolean valuesMatch = true; if (value1 == null) { if (value2 != null) { valuesMatch = false; } } else { valuesMatch = value1.equals(value2); } return valuesMatch; }
[ "private", "boolean", "isMatchingString", "(", "String", "value1", ",", "String", "value2", ")", "{", "boolean", "valuesMatch", "=", "true", ";", "if", "(", "value1", "==", "null", ")", "{", "if", "(", "value2", "!=", "null", ")", "{", "valuesMatch", "=", "false", ";", "}", "}", "else", "{", "valuesMatch", "=", "value1", ".", "equals", "(", "value2", ")", ";", "}", "return", "valuesMatch", ";", "}" ]
Compare two string values. @param value1 @param value2 @return true if matching
[ "Compare", "two", "string", "values", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/osgi/container/config/merge/MailSessionComparator.java#L59-L72
train
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/osgi/container/config/WebAppConfigurator.java
WebAppConfigurator.getListenerInterfaces
private List<Class<?>> getListenerInterfaces() { List<Class<?>> listenerInterfaces = new ArrayList<Class<?>>(Arrays.asList(SERVLET30_LISTENER_INTERFACES)); // Condition the HTTP ID Listener on Servlet 3.1 enablement. if (com.ibm.ws.webcontainer.osgi.WebContainer.getServletContainerSpecLevel() < com.ibm.ws.webcontainer.osgi.WebContainer.SPEC_LEVEL_31) { return listenerInterfaces; } // Use reflection for referenced Servlet 3.1 classes. Those won't load unless // Servlet 3.1 is enabled. Class<?> httpIDListenerInterface; try { httpIDListenerInterface = Class.forName(HTTP_ID_LISTENER_CLASS_NAME); } catch (ClassNotFoundException e) { httpIDListenerInterface = null; } if (httpIDListenerInterface != null) { listenerInterfaces.add(httpIDListenerInterface); } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Servlet 3.1 is enabled but failed to find the HTTP ID Listener class [ " + HTTP_ID_LISTENER_CLASS_NAME + " ]"); } } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Supported listener interfaces: " + listenerInterfaces); } return listenerInterfaces; }
java
private List<Class<?>> getListenerInterfaces() { List<Class<?>> listenerInterfaces = new ArrayList<Class<?>>(Arrays.asList(SERVLET30_LISTENER_INTERFACES)); // Condition the HTTP ID Listener on Servlet 3.1 enablement. if (com.ibm.ws.webcontainer.osgi.WebContainer.getServletContainerSpecLevel() < com.ibm.ws.webcontainer.osgi.WebContainer.SPEC_LEVEL_31) { return listenerInterfaces; } // Use reflection for referenced Servlet 3.1 classes. Those won't load unless // Servlet 3.1 is enabled. Class<?> httpIDListenerInterface; try { httpIDListenerInterface = Class.forName(HTTP_ID_LISTENER_CLASS_NAME); } catch (ClassNotFoundException e) { httpIDListenerInterface = null; } if (httpIDListenerInterface != null) { listenerInterfaces.add(httpIDListenerInterface); } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Servlet 3.1 is enabled but failed to find the HTTP ID Listener class [ " + HTTP_ID_LISTENER_CLASS_NAME + " ]"); } } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Supported listener interfaces: " + listenerInterfaces); } return listenerInterfaces; }
[ "private", "List", "<", "Class", "<", "?", ">", ">", "getListenerInterfaces", "(", ")", "{", "List", "<", "Class", "<", "?", ">", ">", "listenerInterfaces", "=", "new", "ArrayList", "<", "Class", "<", "?", ">", ">", "(", "Arrays", ".", "asList", "(", "SERVLET30_LISTENER_INTERFACES", ")", ")", ";", "// Condition the HTTP ID Listener on Servlet 3.1 enablement.", "if", "(", "com", ".", "ibm", ".", "ws", ".", "webcontainer", ".", "osgi", ".", "WebContainer", ".", "getServletContainerSpecLevel", "(", ")", "<", "com", ".", "ibm", ".", "ws", ".", "webcontainer", ".", "osgi", ".", "WebContainer", ".", "SPEC_LEVEL_31", ")", "{", "return", "listenerInterfaces", ";", "}", "// Use reflection for referenced Servlet 3.1 classes. Those won't load unless", "// Servlet 3.1 is enabled.", "Class", "<", "?", ">", "httpIDListenerInterface", ";", "try", "{", "httpIDListenerInterface", "=", "Class", ".", "forName", "(", "HTTP_ID_LISTENER_CLASS_NAME", ")", ";", "}", "catch", "(", "ClassNotFoundException", "e", ")", "{", "httpIDListenerInterface", "=", "null", ";", "}", "if", "(", "httpIDListenerInterface", "!=", "null", ")", "{", "listenerInterfaces", ".", "add", "(", "httpIDListenerInterface", ")", ";", "}", "else", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Servlet 3.1 is enabled but failed to find the HTTP ID Listener class [ \"", "+", "HTTP_ID_LISTENER_CLASS_NAME", "+", "\" ]\"", ")", ";", "}", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Supported listener interfaces: \"", "+", "listenerInterfaces", ")", ";", "}", "return", "listenerInterfaces", ";", "}" ]
Obtain the list of enabled listener interfaces. The list contents depends on servlet 3.1 enablement. @return The list of enabled listener interfaces.
[ "Obtain", "the", "list", "of", "enabled", "listener", "interfaces", ".", "The", "list", "contents", "depends", "on", "servlet", "3", ".", "1", "enablement", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/osgi/container/config/WebAppConfigurator.java#L134-L169
train
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/osgi/container/config/WebAppConfigurator.java
WebAppConfigurator.configureWebAppHelperFactory
public void configureWebAppHelperFactory(WebAppConfiguratorHelperFactory webAppConfiguratorHelperFactory, ResourceRefConfigFactory resourceRefConfigFactory) { webAppHelper = webAppConfiguratorHelperFactory.createWebAppConfiguratorHelper(this, resourceRefConfigFactory, getListenerInterfaces()); this.configHelpers.add(webAppHelper); }
java
public void configureWebAppHelperFactory(WebAppConfiguratorHelperFactory webAppConfiguratorHelperFactory, ResourceRefConfigFactory resourceRefConfigFactory) { webAppHelper = webAppConfiguratorHelperFactory.createWebAppConfiguratorHelper(this, resourceRefConfigFactory, getListenerInterfaces()); this.configHelpers.add(webAppHelper); }
[ "public", "void", "configureWebAppHelperFactory", "(", "WebAppConfiguratorHelperFactory", "webAppConfiguratorHelperFactory", ",", "ResourceRefConfigFactory", "resourceRefConfigFactory", ")", "{", "webAppHelper", "=", "webAppConfiguratorHelperFactory", ".", "createWebAppConfiguratorHelper", "(", "this", ",", "resourceRefConfigFactory", ",", "getListenerInterfaces", "(", ")", ")", ";", "this", ".", "configHelpers", ".", "add", "(", "webAppHelper", ")", ";", "}" ]
Configure the WebApp helper factory @param webAppConfiguratorHelperFactory The factory to be used @param resourceRefConfigFactory
[ "Configure", "the", "WebApp", "helper", "factory" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/osgi/container/config/WebAppConfigurator.java#L217-L220
train
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/osgi/container/config/WebAppConfigurator.java
WebAppConfigurator.validateDuplicateKeyValueConfiguration
public <T> void validateDuplicateKeyValueConfiguration(String parentElementName, String keyElementName, String keyElementValue, String valueElementName, T newValue, ConfigItem<T> priorConfigItem) { T priorValue = priorConfigItem.getValue(); if (priorValue == null) { if (newValue == null) { return; // Same null value; ignore } else { // Different values: null vs non-null; check the source } } else if (newValue == null) { // Different values: non-null vs null; check the source } else if (priorConfigItem.compareValue(newValue)) { return; // Same non-null value; ignore } ConfigSource priorSource = priorConfigItem.getSource(); ConfigSource newSource = getConfigSource(); if (priorSource == ConfigSource.WEB_XML) { if (newSource == ConfigSource.WEB_FRAGMENT) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "{0} {1} == {2} {3} == {4} is configured in web.xml, the value {5} from web-fragment.xml in {6} is ignored", parentElementName, keyElementName, keyElementValue, valueElementName, priorValue, newValue, getLibraryURI()); } } else { // web.xml vs web.xml: Should not be possible; ignore. } } else if (priorSource == ConfigSource.WEB_FRAGMENT) { // If the prior source is a web-fragment.xml, we have started // processing fragments, and any subsequent source must also // be a fragment. String priorLibraryURI = priorConfigItem.getLibraryURI(); String newLibraryURI = getLibraryURI(); if (!priorLibraryURI.equals(newLibraryURI)) { errorMessages.add(nls.getFormattedMessage("CONFLICT_KEY_VALUE_CONFIG_BETWEEN_WEB_FRAGMENT_XML", new Object[] { valueElementName, parentElementName, keyElementName, keyElementValue, priorValue, priorLibraryURI, newValue, newLibraryURI }, "Conflict configurations are found in the web-fragment.xml files")); } else { // Same library; should not be possible; ignore } } }
java
public <T> void validateDuplicateKeyValueConfiguration(String parentElementName, String keyElementName, String keyElementValue, String valueElementName, T newValue, ConfigItem<T> priorConfigItem) { T priorValue = priorConfigItem.getValue(); if (priorValue == null) { if (newValue == null) { return; // Same null value; ignore } else { // Different values: null vs non-null; check the source } } else if (newValue == null) { // Different values: non-null vs null; check the source } else if (priorConfigItem.compareValue(newValue)) { return; // Same non-null value; ignore } ConfigSource priorSource = priorConfigItem.getSource(); ConfigSource newSource = getConfigSource(); if (priorSource == ConfigSource.WEB_XML) { if (newSource == ConfigSource.WEB_FRAGMENT) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "{0} {1} == {2} {3} == {4} is configured in web.xml, the value {5} from web-fragment.xml in {6} is ignored", parentElementName, keyElementName, keyElementValue, valueElementName, priorValue, newValue, getLibraryURI()); } } else { // web.xml vs web.xml: Should not be possible; ignore. } } else if (priorSource == ConfigSource.WEB_FRAGMENT) { // If the prior source is a web-fragment.xml, we have started // processing fragments, and any subsequent source must also // be a fragment. String priorLibraryURI = priorConfigItem.getLibraryURI(); String newLibraryURI = getLibraryURI(); if (!priorLibraryURI.equals(newLibraryURI)) { errorMessages.add(nls.getFormattedMessage("CONFLICT_KEY_VALUE_CONFIG_BETWEEN_WEB_FRAGMENT_XML", new Object[] { valueElementName, parentElementName, keyElementName, keyElementValue, priorValue, priorLibraryURI, newValue, newLibraryURI }, "Conflict configurations are found in the web-fragment.xml files")); } else { // Same library; should not be possible; ignore } } }
[ "public", "<", "T", ">", "void", "validateDuplicateKeyValueConfiguration", "(", "String", "parentElementName", ",", "String", "keyElementName", ",", "String", "keyElementValue", ",", "String", "valueElementName", ",", "T", "newValue", ",", "ConfigItem", "<", "T", ">", "priorConfigItem", ")", "{", "T", "priorValue", "=", "priorConfigItem", ".", "getValue", "(", ")", ";", "if", "(", "priorValue", "==", "null", ")", "{", "if", "(", "newValue", "==", "null", ")", "{", "return", ";", "// Same null value; ignore", "}", "else", "{", "// Different values: null vs non-null; check the source", "}", "}", "else", "if", "(", "newValue", "==", "null", ")", "{", "// Different values: non-null vs null; check the source", "}", "else", "if", "(", "priorConfigItem", ".", "compareValue", "(", "newValue", ")", ")", "{", "return", ";", "// Same non-null value; ignore", "}", "ConfigSource", "priorSource", "=", "priorConfigItem", ".", "getSource", "(", ")", ";", "ConfigSource", "newSource", "=", "getConfigSource", "(", ")", ";", "if", "(", "priorSource", "==", "ConfigSource", ".", "WEB_XML", ")", "{", "if", "(", "newSource", "==", "ConfigSource", ".", "WEB_FRAGMENT", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"{0} {1} == {2} {3} == {4} is configured in web.xml, the value {5} from web-fragment.xml in {6} is ignored\"", ",", "parentElementName", ",", "keyElementName", ",", "keyElementValue", ",", "valueElementName", ",", "priorValue", ",", "newValue", ",", "getLibraryURI", "(", ")", ")", ";", "}", "}", "else", "{", "// web.xml vs web.xml: Should not be possible; ignore.", "}", "}", "else", "if", "(", "priorSource", "==", "ConfigSource", ".", "WEB_FRAGMENT", ")", "{", "// If the prior source is a web-fragment.xml, we have started", "// processing fragments, and any subsequent source must also", "// be a fragment.", "String", "priorLibraryURI", "=", "priorConfigItem", ".", "getLibraryURI", "(", ")", ";", "String", "newLibraryURI", "=", "getLibraryURI", "(", ")", ";", "if", "(", "!", "priorLibraryURI", ".", "equals", "(", "newLibraryURI", ")", ")", "{", "errorMessages", ".", "add", "(", "nls", ".", "getFormattedMessage", "(", "\"CONFLICT_KEY_VALUE_CONFIG_BETWEEN_WEB_FRAGMENT_XML\"", ",", "new", "Object", "[", "]", "{", "valueElementName", ",", "parentElementName", ",", "keyElementName", ",", "keyElementValue", ",", "priorValue", ",", "priorLibraryURI", ",", "newValue", ",", "newLibraryURI", "}", ",", "\"Conflict configurations are found in the web-fragment.xml files\"", ")", ")", ";", "}", "else", "{", "// Same library; should not be possible; ignore", "}", "}", "}" ]
Validate configuration items which are elements of keyed collections in two configurations. Nearly the same as {@link #validateDuplicateConfiguration(String, String, Object, ConfigItem)}, but with a different parameterization of the element location. @param parentElementName The name of the element which contains the value which is being tested. @param keyElementName The element supplying the key value which was used to match the configuration items. @param keyElementValue The value of the key element for the configuration items. @param valueElementName The name of the element containing the value which is being tested. @param newValue The new element value. The value may be null. @param priorConfigItem A prior configuration item which holds a prior element value. The prior element value may be null.
[ "Validate", "configuration", "items", "which", "are", "elements", "of", "keyed", "collections", "in", "two", "configurations", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/osgi/container/config/WebAppConfigurator.java#L570-L626
train
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/osgi/container/config/WebAppConfigurator.java
WebAppConfigurator.validateDuplicateDefaultErrorPageConfiguration
public void validateDuplicateDefaultErrorPageConfiguration(String newLocation, ConfigItem<String> priorLocationItem) { String priorLocation = priorLocationItem.getValue(); if (priorLocation == null) { if (newLocation == null) { return; // Same null Location; ignore } else { // Different Locations: null vs non-null; check the source } } else if (newLocation == null) { // Different Locations: non-null vs null; check the source } else if (priorLocation.equals(newLocation)) { return; // Same non-null Location; ignore } ConfigSource priorSource = priorLocationItem.getSource(); ConfigSource newSource = getConfigSource(); if (priorSource == ConfigSource.WEB_XML) { if (newSource == ConfigSource.WEB_FRAGMENT) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Default error page with location {0} in web.xml overrides default error page with location {1} in web-fragment.xml in {2}.", priorLocation, newLocation, getLibraryURI()); } } else { // web.xml vs web.xml: Should not be possible; ignore. } } else if (priorSource == ConfigSource.WEB_FRAGMENT) { // If the prior source is a web-fragment.xml, we have started // processing fragments, and any subsequent source must also // be a fragment. String priorLibraryURI = priorLocationItem.getLibraryURI(); String newLibraryURI = getLibraryURI(); if (!priorLibraryURI.equals(newLibraryURI)) { errorMessages.add(nls.getFormattedMessage("CONFLICT_DEFAULT_ERROR_PAGE_WEB_FRAGMENT_XML", new Object[] { priorLocation, priorLibraryURI, newLocation, newLibraryURI }, "Multiple default error pages with different locations in one or more web-fragment.xml.")); } else { // Same library; should not be possible; ignore } } }
java
public void validateDuplicateDefaultErrorPageConfiguration(String newLocation, ConfigItem<String> priorLocationItem) { String priorLocation = priorLocationItem.getValue(); if (priorLocation == null) { if (newLocation == null) { return; // Same null Location; ignore } else { // Different Locations: null vs non-null; check the source } } else if (newLocation == null) { // Different Locations: non-null vs null; check the source } else if (priorLocation.equals(newLocation)) { return; // Same non-null Location; ignore } ConfigSource priorSource = priorLocationItem.getSource(); ConfigSource newSource = getConfigSource(); if (priorSource == ConfigSource.WEB_XML) { if (newSource == ConfigSource.WEB_FRAGMENT) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Default error page with location {0} in web.xml overrides default error page with location {1} in web-fragment.xml in {2}.", priorLocation, newLocation, getLibraryURI()); } } else { // web.xml vs web.xml: Should not be possible; ignore. } } else if (priorSource == ConfigSource.WEB_FRAGMENT) { // If the prior source is a web-fragment.xml, we have started // processing fragments, and any subsequent source must also // be a fragment. String priorLibraryURI = priorLocationItem.getLibraryURI(); String newLibraryURI = getLibraryURI(); if (!priorLibraryURI.equals(newLibraryURI)) { errorMessages.add(nls.getFormattedMessage("CONFLICT_DEFAULT_ERROR_PAGE_WEB_FRAGMENT_XML", new Object[] { priorLocation, priorLibraryURI, newLocation, newLibraryURI }, "Multiple default error pages with different locations in one or more web-fragment.xml.")); } else { // Same library; should not be possible; ignore } } }
[ "public", "void", "validateDuplicateDefaultErrorPageConfiguration", "(", "String", "newLocation", ",", "ConfigItem", "<", "String", ">", "priorLocationItem", ")", "{", "String", "priorLocation", "=", "priorLocationItem", ".", "getValue", "(", ")", ";", "if", "(", "priorLocation", "==", "null", ")", "{", "if", "(", "newLocation", "==", "null", ")", "{", "return", ";", "// Same null Location; ignore", "}", "else", "{", "// Different Locations: null vs non-null; check the source", "}", "}", "else", "if", "(", "newLocation", "==", "null", ")", "{", "// Different Locations: non-null vs null; check the source", "}", "else", "if", "(", "priorLocation", ".", "equals", "(", "newLocation", ")", ")", "{", "return", ";", "// Same non-null Location; ignore", "}", "ConfigSource", "priorSource", "=", "priorLocationItem", ".", "getSource", "(", ")", ";", "ConfigSource", "newSource", "=", "getConfigSource", "(", ")", ";", "if", "(", "priorSource", "==", "ConfigSource", ".", "WEB_XML", ")", "{", "if", "(", "newSource", "==", "ConfigSource", ".", "WEB_FRAGMENT", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Default error page with location {0} in web.xml overrides default error page with location {1} in web-fragment.xml in {2}.\"", ",", "priorLocation", ",", "newLocation", ",", "getLibraryURI", "(", ")", ")", ";", "}", "}", "else", "{", "// web.xml vs web.xml: Should not be possible; ignore.", "}", "}", "else", "if", "(", "priorSource", "==", "ConfigSource", ".", "WEB_FRAGMENT", ")", "{", "// If the prior source is a web-fragment.xml, we have started", "// processing fragments, and any subsequent source must also", "// be a fragment.", "String", "priorLibraryURI", "=", "priorLocationItem", ".", "getLibraryURI", "(", ")", ";", "String", "newLibraryURI", "=", "getLibraryURI", "(", ")", ";", "if", "(", "!", "priorLibraryURI", ".", "equals", "(", "newLibraryURI", ")", ")", "{", "errorMessages", ".", "add", "(", "nls", ".", "getFormattedMessage", "(", "\"CONFLICT_DEFAULT_ERROR_PAGE_WEB_FRAGMENT_XML\"", ",", "new", "Object", "[", "]", "{", "priorLocation", ",", "priorLibraryURI", ",", "newLocation", ",", "newLibraryURI", "}", ",", "\"Multiple default error pages with different locations in one or more web-fragment.xml.\"", ")", ")", ";", "}", "else", "{", "// Same library; should not be possible; ignore", "}", "}", "}" ]
Validate default error page configuration items. Nearly the same as {@link #validateDuplicateConfiguration(String, String, Object, ConfigItem)}, but with no location parameters: Default error page configuration items are in a fixed location. @param newLocation The default error page location. May be null. @param priorLocationItem The configuration item of the prior default error page location. The location value may be null.
[ "Validate", "default", "error", "page", "configuration", "items", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/osgi/container/config/WebAppConfigurator.java#L646-L691
train
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/osgi/container/config/WebAppConfigurator.java
WebAppConfigurator.getConfigItemMap
@SuppressWarnings("unchecked") public <T> Map<String, ConfigItem<T>> getConfigItemMap(String key) { Map<String, ConfigItem<T>> configItemMap = (Map<String, ConfigItem<T>>) attributes.get(key); if (configItemMap == null) { configItemMap = new HashMap<String, ConfigItem<T>>(); attributes.put(key, configItemMap); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "ConfigContext create map instance for {0}", key); } } return configItemMap; }
java
@SuppressWarnings("unchecked") public <T> Map<String, ConfigItem<T>> getConfigItemMap(String key) { Map<String, ConfigItem<T>> configItemMap = (Map<String, ConfigItem<T>>) attributes.get(key); if (configItemMap == null) { configItemMap = new HashMap<String, ConfigItem<T>>(); attributes.put(key, configItemMap); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "ConfigContext create map instance for {0}", key); } } return configItemMap; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "T", ">", "Map", "<", "String", ",", "ConfigItem", "<", "T", ">", ">", "getConfigItemMap", "(", "String", "key", ")", "{", "Map", "<", "String", ",", "ConfigItem", "<", "T", ">", ">", "configItemMap", "=", "(", "Map", "<", "String", ",", "ConfigItem", "<", "T", ">", ">", ")", "attributes", ".", "get", "(", "key", ")", ";", "if", "(", "configItemMap", "==", "null", ")", "{", "configItemMap", "=", "new", "HashMap", "<", "String", ",", "ConfigItem", "<", "T", ">", ">", "(", ")", ";", "attributes", ".", "put", "(", "key", ",", "configItemMap", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"ConfigContext create map instance for {0}\"", ",", "key", ")", ";", "}", "}", "return", "configItemMap", ";", "}" ]
Obtain an attribute value as a mapping. Create and return a new empty mapping if one is not yet present. Once obtained as a mapping, the attribute value must always be obtained as a mapping. A subsequent attempt to obtain the value as a set will fail with a class cast exception. @param key The key of the attribute value. @return The attribute value as a mapping.
[ "Obtain", "an", "attribute", "value", "as", "a", "mapping", ".", "Create", "and", "return", "a", "new", "empty", "mapping", "if", "one", "is", "not", "yet", "present", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/osgi/container/config/WebAppConfigurator.java#L705-L717
train
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/osgi/container/config/WebAppConfigurator.java
WebAppConfigurator.getContextSet
@SuppressWarnings("unchecked") public <T> Set<T> getContextSet(String key) { Set<T> set = (Set<T>) attributes.get(key); if (set == null) { set = new HashSet<T>(); attributes.put(key, set); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "ConfigContext create set instance for {0}", key); } } return set; }
java
@SuppressWarnings("unchecked") public <T> Set<T> getContextSet(String key) { Set<T> set = (Set<T>) attributes.get(key); if (set == null) { set = new HashSet<T>(); attributes.put(key, set); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "ConfigContext create set instance for {0}", key); } } return set; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "T", ">", "Set", "<", "T", ">", "getContextSet", "(", "String", "key", ")", "{", "Set", "<", "T", ">", "set", "=", "(", "Set", "<", "T", ">", ")", "attributes", ".", "get", "(", "key", ")", ";", "if", "(", "set", "==", "null", ")", "{", "set", "=", "new", "HashSet", "<", "T", ">", "(", ")", ";", "attributes", ".", "put", "(", "key", ",", "set", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"ConfigContext create set instance for {0}\"", ",", "key", ")", ";", "}", "}", "return", "set", ";", "}" ]
Obtain an attribute value as a sset. Create and return a new empty set if one is not yet present. Once obtained as a set, the attribute value must always be obtained as a set. A subsequent attempt to obtain the value as a mapping will fail with a class cast exception. @param key The key of the attribute value. @return The attribute value as a set.
[ "Obtain", "an", "attribute", "value", "as", "a", "sset", ".", "Create", "and", "return", "a", "new", "empty", "set", "if", "one", "is", "not", "yet", "present", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/osgi/container/config/WebAppConfigurator.java#L731-L743
train
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/osgi/container/config/WebAppConfigurator.java
WebAppConfigurator.createConfigItem
public <T> ConfigItem<T> createConfigItem(T value, MergeComparator<T> comparator) { return new ConfigItemImpl<T>(value, getConfigSource(), getLibraryURI(), comparator); }
java
public <T> ConfigItem<T> createConfigItem(T value, MergeComparator<T> comparator) { return new ConfigItemImpl<T>(value, getConfigSource(), getLibraryURI(), comparator); }
[ "public", "<", "T", ">", "ConfigItem", "<", "T", ">", "createConfigItem", "(", "T", "value", ",", "MergeComparator", "<", "T", ">", "comparator", ")", "{", "return", "new", "ConfigItemImpl", "<", "T", ">", "(", "value", ",", "getConfigSource", "(", ")", ",", "getLibraryURI", "(", ")", ",", "comparator", ")", ";", "}" ]
Create a configuration item using the current source. See {@link #getConfigSource()} and {@link #getLibraryURI()}. @param value The value to place in the configuration item. A null value may be provided. @param comparator The comparator to be used for the configuration item. Null to select the default comparator. @return The new configuration item.
[ "Create", "a", "configuration", "item", "using", "the", "current", "source", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/osgi/container/config/WebAppConfigurator.java#L779-L781
train
OpenLiberty/open-liberty
dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/PeerLeaseData.java
PeerLeaseData.isExpired
public boolean isExpired() { if (tc.isEntryEnabled()) Tr.entry(tc, "isExpired"); boolean expired = false; long curTime = System.currentTimeMillis(); //TODO: if (curTime - _leaseTime > _leaseTimeout * 1000) // 30 seconds default for timeout { if (tc.isDebugEnabled()) Tr.debug(tc, "Lease has EXPIRED for " + _recoveryIdentity + ", currenttime: " + curTime + ", storedTime: " + _leaseTime); expired = true; } else { if (tc.isDebugEnabled()) Tr.debug(tc, "Lease has not expired for " + _recoveryIdentity + ", currenttime: " + curTime + ", storedTime: " + _leaseTime); } if (tc.isEntryEnabled()) Tr.exit(tc, "isExpired", expired); return expired; }
java
public boolean isExpired() { if (tc.isEntryEnabled()) Tr.entry(tc, "isExpired"); boolean expired = false; long curTime = System.currentTimeMillis(); //TODO: if (curTime - _leaseTime > _leaseTimeout * 1000) // 30 seconds default for timeout { if (tc.isDebugEnabled()) Tr.debug(tc, "Lease has EXPIRED for " + _recoveryIdentity + ", currenttime: " + curTime + ", storedTime: " + _leaseTime); expired = true; } else { if (tc.isDebugEnabled()) Tr.debug(tc, "Lease has not expired for " + _recoveryIdentity + ", currenttime: " + curTime + ", storedTime: " + _leaseTime); } if (tc.isEntryEnabled()) Tr.exit(tc, "isExpired", expired); return expired; }
[ "public", "boolean", "isExpired", "(", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "tc", ",", "\"isExpired\"", ")", ";", "boolean", "expired", "=", "false", ";", "long", "curTime", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "//TODO:", "if", "(", "curTime", "-", "_leaseTime", ">", "_leaseTimeout", "*", "1000", ")", "// 30 seconds default for timeout", "{", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "tc", ",", "\"Lease has EXPIRED for \"", "+", "_recoveryIdentity", "+", "\", currenttime: \"", "+", "curTime", "+", "\", storedTime: \"", "+", "_leaseTime", ")", ";", "expired", "=", "true", ";", "}", "else", "{", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "tc", ",", "\"Lease has not expired for \"", "+", "_recoveryIdentity", "+", "\", currenttime: \"", "+", "curTime", "+", "\", storedTime: \"", "+", "_leaseTime", ")", ";", "}", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"isExpired\"", ",", "expired", ")", ";", "return", "expired", ";", "}" ]
Has the peer expired?
[ "Has", "the", "peer", "expired?" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/PeerLeaseData.java#L63-L85
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jca.cm/src/com/ibm/ejs/j2c/FreePool.java
FreePool.returnToFreePool
protected void returnToFreePool(MCWrapper mcWrapper) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(this, tc, "returnToFreePool", gConfigProps.cfName); } if (mcWrapper.shouldBeDestroyed() || mcWrapper.hasFatalErrorNotificationOccurred(fatalErrorNotificationTime) || ((pm.agedTimeout != -1) && (mcWrapper.hasAgedTimedOut(pm.agedTimeoutMillis)))) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { if (mcWrapper.shouldBeDestroyed()) { Tr.debug(this, tc, "Connection destroy flag is set, removing connection " + mcWrapper); } if (mcWrapper.hasFatalErrorNotificationOccurred(fatalErrorNotificationTime)) { Tr.debug(this, tc, "Fatal error occurred, removing connection " + mcWrapper); } if (((pm.agedTimeout != -1) && (mcWrapper.hasAgedTimedOut(pm.agedTimeoutMillis)))) { Tr.debug(this, tc, "Aged timeout exceeded, removing connection " + mcWrapper); } if (mcWrapper.isDestroyState()) { Tr.debug(this, tc, "Mbean method purgePoolContents with option immediate was used." + " Connection cleanup and destroy is being processed."); } } if (mcWrapper.isDestroyState()) { final FreePool tempFP = this; final MCWrapper tempMCWrapper = mcWrapper; ThreadSupportedCleanupAndDestroy tscd = new ThreadSupportedCleanupAndDestroy(pm.tscdList, tempFP, tempMCWrapper); pm.tscdList.add(tscd); pm.connectorSvc.execSvcRef.getServiceWithException().submit(tscd); } else { cleanupAndDestroyMCWrapper(mcWrapper); // cleanup, remove, then release mcWrapper // Do not return this mcWrapper back to the free pool. removeMCWrapperFromList(mcWrapper, _mcWrapperDoesNotExistInFreePool, _synchronizeInMethod, _notifyWaiter, _decrementTotalCounter); } } else { returnToFreePoolDelegated(mcWrapper); // Added to Help PMI Stuff.Unable to inject code in if/else conditional situations. } // end else -- the mcWrapper is not stale if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(this, tc, "returnToFreePool"); } }
java
protected void returnToFreePool(MCWrapper mcWrapper) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(this, tc, "returnToFreePool", gConfigProps.cfName); } if (mcWrapper.shouldBeDestroyed() || mcWrapper.hasFatalErrorNotificationOccurred(fatalErrorNotificationTime) || ((pm.agedTimeout != -1) && (mcWrapper.hasAgedTimedOut(pm.agedTimeoutMillis)))) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { if (mcWrapper.shouldBeDestroyed()) { Tr.debug(this, tc, "Connection destroy flag is set, removing connection " + mcWrapper); } if (mcWrapper.hasFatalErrorNotificationOccurred(fatalErrorNotificationTime)) { Tr.debug(this, tc, "Fatal error occurred, removing connection " + mcWrapper); } if (((pm.agedTimeout != -1) && (mcWrapper.hasAgedTimedOut(pm.agedTimeoutMillis)))) { Tr.debug(this, tc, "Aged timeout exceeded, removing connection " + mcWrapper); } if (mcWrapper.isDestroyState()) { Tr.debug(this, tc, "Mbean method purgePoolContents with option immediate was used." + " Connection cleanup and destroy is being processed."); } } if (mcWrapper.isDestroyState()) { final FreePool tempFP = this; final MCWrapper tempMCWrapper = mcWrapper; ThreadSupportedCleanupAndDestroy tscd = new ThreadSupportedCleanupAndDestroy(pm.tscdList, tempFP, tempMCWrapper); pm.tscdList.add(tscd); pm.connectorSvc.execSvcRef.getServiceWithException().submit(tscd); } else { cleanupAndDestroyMCWrapper(mcWrapper); // cleanup, remove, then release mcWrapper // Do not return this mcWrapper back to the free pool. removeMCWrapperFromList(mcWrapper, _mcWrapperDoesNotExistInFreePool, _synchronizeInMethod, _notifyWaiter, _decrementTotalCounter); } } else { returnToFreePoolDelegated(mcWrapper); // Added to Help PMI Stuff.Unable to inject code in if/else conditional situations. } // end else -- the mcWrapper is not stale if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(this, tc, "returnToFreePool"); } }
[ "protected", "void", "returnToFreePool", "(", "MCWrapper", "mcWrapper", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "entry", "(", "this", ",", "tc", ",", "\"returnToFreePool\"", ",", "gConfigProps", ".", "cfName", ")", ";", "}", "if", "(", "mcWrapper", ".", "shouldBeDestroyed", "(", ")", "||", "mcWrapper", ".", "hasFatalErrorNotificationOccurred", "(", "fatalErrorNotificationTime", ")", "||", "(", "(", "pm", ".", "agedTimeout", "!=", "-", "1", ")", "&&", "(", "mcWrapper", ".", "hasAgedTimedOut", "(", "pm", ".", "agedTimeoutMillis", ")", ")", ")", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "if", "(", "mcWrapper", ".", "shouldBeDestroyed", "(", ")", ")", "{", "Tr", ".", "debug", "(", "this", ",", "tc", ",", "\"Connection destroy flag is set, removing connection \"", "+", "mcWrapper", ")", ";", "}", "if", "(", "mcWrapper", ".", "hasFatalErrorNotificationOccurred", "(", "fatalErrorNotificationTime", ")", ")", "{", "Tr", ".", "debug", "(", "this", ",", "tc", ",", "\"Fatal error occurred, removing connection \"", "+", "mcWrapper", ")", ";", "}", "if", "(", "(", "(", "pm", ".", "agedTimeout", "!=", "-", "1", ")", "&&", "(", "mcWrapper", ".", "hasAgedTimedOut", "(", "pm", ".", "agedTimeoutMillis", ")", ")", ")", ")", "{", "Tr", ".", "debug", "(", "this", ",", "tc", ",", "\"Aged timeout exceeded, removing connection \"", "+", "mcWrapper", ")", ";", "}", "if", "(", "mcWrapper", ".", "isDestroyState", "(", ")", ")", "{", "Tr", ".", "debug", "(", "this", ",", "tc", ",", "\"Mbean method purgePoolContents with option immediate was used.\"", "+", "\" Connection cleanup and destroy is being processed.\"", ")", ";", "}", "}", "if", "(", "mcWrapper", ".", "isDestroyState", "(", ")", ")", "{", "final", "FreePool", "tempFP", "=", "this", ";", "final", "MCWrapper", "tempMCWrapper", "=", "mcWrapper", ";", "ThreadSupportedCleanupAndDestroy", "tscd", "=", "new", "ThreadSupportedCleanupAndDestroy", "(", "pm", ".", "tscdList", ",", "tempFP", ",", "tempMCWrapper", ")", ";", "pm", ".", "tscdList", ".", "add", "(", "tscd", ")", ";", "pm", ".", "connectorSvc", ".", "execSvcRef", ".", "getServiceWithException", "(", ")", ".", "submit", "(", "tscd", ")", ";", "}", "else", "{", "cleanupAndDestroyMCWrapper", "(", "mcWrapper", ")", ";", "// cleanup, remove, then release mcWrapper", "// Do not return this mcWrapper back to the free pool.", "removeMCWrapperFromList", "(", "mcWrapper", ",", "_mcWrapperDoesNotExistInFreePool", ",", "_synchronizeInMethod", ",", "_notifyWaiter", ",", "_decrementTotalCounter", ")", ";", "}", "}", "else", "{", "returnToFreePoolDelegated", "(", "mcWrapper", ")", ";", "// Added to Help PMI Stuff.Unable to inject code in if/else conditional situations.", "}", "// end else -- the mcWrapper is not stale", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "exit", "(", "this", ",", "tc", ",", "\"returnToFreePool\"", ")", ";", "}", "}" ]
Return the mcWrapper to the free pool. @pre mcWrapper != null
[ "Return", "the", "mcWrapper", "to", "the", "free", "pool", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca.cm/src/com/ibm/ejs/j2c/FreePool.java#L244-L284
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jca.cm/src/com/ibm/ejs/j2c/FreePool.java
FreePool.removeMCWrapperFromList
protected void removeMCWrapperFromList( MCWrapper mcWrapper, boolean removeFromFreePool, boolean synchronizationNeeded, boolean skipWaiterNotify, boolean decrementTotalCounter) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(this, tc, "removeMCWrapperFromList"); } /* * This cast to UserData is safe, and does not need a * try/catch. */ if (synchronizationNeeded) { synchronized (pm.waiterFreePoolLock) { synchronized (freeConnectionLockObject) { if (removeFromFreePool) { // mcWrapper may not be in the free pool mcWrapperList.remove(mcWrapper); mcWrapper.setPoolState(0); } --numberOfConnectionsAssignedToThisFreePool; if (decrementTotalCounter) { pm.totalConnectionCount.decrementAndGet(); } if (!skipWaiterNotify) { // waiter code //synchronized(pm.waiterFreePoolLock) { pm.waiterFreePoolLock.notify(); //} } } } } else { if (removeFromFreePool) { // mcWrapper may not be in the free pool mcWrapperList.remove(mcWrapper); mcWrapper.setPoolState(0); --numberOfConnectionsAssignedToThisFreePool; } if (decrementTotalCounter) { pm.totalConnectionCount.decrementAndGet(); } // This code block may dead lock if we have the freePool lock and need to notify. // Since the current code does not use the notify code I am // commenting out the follow notify code //if (!skipWaiterNotify) { // waiter code // synchronized(pm.waiterFreePoolLock) { // pm.waiterFreePoolLock.notify(); // } //} } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(this, tc, "removeMCWrapperFromList"); } }
java
protected void removeMCWrapperFromList( MCWrapper mcWrapper, boolean removeFromFreePool, boolean synchronizationNeeded, boolean skipWaiterNotify, boolean decrementTotalCounter) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(this, tc, "removeMCWrapperFromList"); } /* * This cast to UserData is safe, and does not need a * try/catch. */ if (synchronizationNeeded) { synchronized (pm.waiterFreePoolLock) { synchronized (freeConnectionLockObject) { if (removeFromFreePool) { // mcWrapper may not be in the free pool mcWrapperList.remove(mcWrapper); mcWrapper.setPoolState(0); } --numberOfConnectionsAssignedToThisFreePool; if (decrementTotalCounter) { pm.totalConnectionCount.decrementAndGet(); } if (!skipWaiterNotify) { // waiter code //synchronized(pm.waiterFreePoolLock) { pm.waiterFreePoolLock.notify(); //} } } } } else { if (removeFromFreePool) { // mcWrapper may not be in the free pool mcWrapperList.remove(mcWrapper); mcWrapper.setPoolState(0); --numberOfConnectionsAssignedToThisFreePool; } if (decrementTotalCounter) { pm.totalConnectionCount.decrementAndGet(); } // This code block may dead lock if we have the freePool lock and need to notify. // Since the current code does not use the notify code I am // commenting out the follow notify code //if (!skipWaiterNotify) { // waiter code // synchronized(pm.waiterFreePoolLock) { // pm.waiterFreePoolLock.notify(); // } //} } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(this, tc, "removeMCWrapperFromList"); } }
[ "protected", "void", "removeMCWrapperFromList", "(", "MCWrapper", "mcWrapper", ",", "boolean", "removeFromFreePool", ",", "boolean", "synchronizationNeeded", ",", "boolean", "skipWaiterNotify", ",", "boolean", "decrementTotalCounter", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "entry", "(", "this", ",", "tc", ",", "\"removeMCWrapperFromList\"", ")", ";", "}", "/*\n * This cast to UserData is safe, and does not need a\n * try/catch.\n */", "if", "(", "synchronizationNeeded", ")", "{", "synchronized", "(", "pm", ".", "waiterFreePoolLock", ")", "{", "synchronized", "(", "freeConnectionLockObject", ")", "{", "if", "(", "removeFromFreePool", ")", "{", "// mcWrapper may not be in the free pool", "mcWrapperList", ".", "remove", "(", "mcWrapper", ")", ";", "mcWrapper", ".", "setPoolState", "(", "0", ")", ";", "}", "--", "numberOfConnectionsAssignedToThisFreePool", ";", "if", "(", "decrementTotalCounter", ")", "{", "pm", ".", "totalConnectionCount", ".", "decrementAndGet", "(", ")", ";", "}", "if", "(", "!", "skipWaiterNotify", ")", "{", "// waiter code", "//synchronized(pm.waiterFreePoolLock) {", "pm", ".", "waiterFreePoolLock", ".", "notify", "(", ")", ";", "//}", "}", "}", "}", "}", "else", "{", "if", "(", "removeFromFreePool", ")", "{", "// mcWrapper may not be in the free pool", "mcWrapperList", ".", "remove", "(", "mcWrapper", ")", ";", "mcWrapper", ".", "setPoolState", "(", "0", ")", ";", "--", "numberOfConnectionsAssignedToThisFreePool", ";", "}", "if", "(", "decrementTotalCounter", ")", "{", "pm", ".", "totalConnectionCount", ".", "decrementAndGet", "(", ")", ";", "}", "// This code block may dead lock if we have the freePool lock and need to notify.", "// Since the current code does not use the notify code I am", "// commenting out the follow notify code", "//if (!skipWaiterNotify) {", "// waiter code", "// synchronized(pm.waiterFreePoolLock) {", "// pm.waiterFreePoolLock.notify();", "// }", "//}", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "exit", "(", "this", ",", "tc", ",", "\"removeMCWrapperFromList\"", ")", ";", "}", "}" ]
This method will try to cleanup and destroy the connection and remove the mcWrapper from the free pool. - If removeFromFreePool is true, the mcWrapper exists in the free pool - If removeFromFreePool is false, the mcWrapper do not exist in the free pool @param Managed connection wrapper @param Remove from free pool @param Are we already synchronized on the freeLockObject @param Skip waiter notify @param Cleanup and Destroy MCWrapper @pre mcWrapper != null @throws ClassCastException
[ "This", "method", "will", "try", "to", "cleanup", "and", "destroy", "the", "connection", "and", "remove", "the", "mcWrapper", "from", "the", "free", "pool", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca.cm/src/com/ibm/ejs/j2c/FreePool.java#L390-L446
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jca.cm/src/com/ibm/ejs/j2c/FreePool.java
FreePool.removeParkedConnection
protected void removeParkedConnection() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(this, tc, "removeParkedConnection"); } // boolean errorOccured = false; if (pm.parkedMCWrapper != null) { // Only attempt to cleanup and destroy the parked MC if one exists... synchronized (pm.parkedConnectionLockObject) { if (pm.parkedMCWrapper != null) { cleanupAndDestroyMCWrapper(pm.parkedMCWrapper); // try { // pm.parkedMCWrapper.cleanup(); // } // catch (Exception exn1) // errorOccured = true; // if(TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()){ // Tr.debug(this, tc,"parked MCWrapper cleanup failed, datasource: " + gConfigProps.pmiName); // } // com.ibm.ws.ffdc.FFDCFilter.processException( // exn1, // "com.ibm.ejs.j2c.poolmanager.FreePool.removeParkedConnection", // this); // } // // try { // pm.parkedMCWrapper.destroy(); // no PMI for this connection. // } catch (Exception exn1) // errorOccured = true; // if(TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()){ // Tr.debug(this, tc,"parked MCWrapper destroy failed, datasource: " + gConfigProps.pmiName); // } // com.ibm.ws.ffdc.FFDCFilter.processException( // exn1, // "com.ibm.ejs.j2c.poolmanager.FreePool.removeParkedConnection", // this); // } pm.parkedMCWrapper = null; // Reset value to true to create a new parked connection. pm.createParkedConnection = true; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug( tc, "Reset the createParkedConnection flag to recreate a new parked connection"); } } } // end sync } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(this, tc, "removeParkedConnection"); } }
java
protected void removeParkedConnection() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(this, tc, "removeParkedConnection"); } // boolean errorOccured = false; if (pm.parkedMCWrapper != null) { // Only attempt to cleanup and destroy the parked MC if one exists... synchronized (pm.parkedConnectionLockObject) { if (pm.parkedMCWrapper != null) { cleanupAndDestroyMCWrapper(pm.parkedMCWrapper); // try { // pm.parkedMCWrapper.cleanup(); // } // catch (Exception exn1) // errorOccured = true; // if(TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()){ // Tr.debug(this, tc,"parked MCWrapper cleanup failed, datasource: " + gConfigProps.pmiName); // } // com.ibm.ws.ffdc.FFDCFilter.processException( // exn1, // "com.ibm.ejs.j2c.poolmanager.FreePool.removeParkedConnection", // this); // } // // try { // pm.parkedMCWrapper.destroy(); // no PMI for this connection. // } catch (Exception exn1) // errorOccured = true; // if(TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()){ // Tr.debug(this, tc,"parked MCWrapper destroy failed, datasource: " + gConfigProps.pmiName); // } // com.ibm.ws.ffdc.FFDCFilter.processException( // exn1, // "com.ibm.ejs.j2c.poolmanager.FreePool.removeParkedConnection", // this); // } pm.parkedMCWrapper = null; // Reset value to true to create a new parked connection. pm.createParkedConnection = true; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug( tc, "Reset the createParkedConnection flag to recreate a new parked connection"); } } } // end sync } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(this, tc, "removeParkedConnection"); } }
[ "protected", "void", "removeParkedConnection", "(", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "entry", "(", "this", ",", "tc", ",", "\"removeParkedConnection\"", ")", ";", "}", "// boolean errorOccured = false;", "if", "(", "pm", ".", "parkedMCWrapper", "!=", "null", ")", "{", "// Only attempt to cleanup and destroy the parked MC if one exists...", "synchronized", "(", "pm", ".", "parkedConnectionLockObject", ")", "{", "if", "(", "pm", ".", "parkedMCWrapper", "!=", "null", ")", "{", "cleanupAndDestroyMCWrapper", "(", "pm", ".", "parkedMCWrapper", ")", ";", "// try {", "// pm.parkedMCWrapper.cleanup();", "// }", "// catch (Exception exn1)", "// errorOccured = true;", "// if(TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()){", "// Tr.debug(this, tc,\"parked MCWrapper cleanup failed, datasource: \" + gConfigProps.pmiName);", "// }", "// com.ibm.ws.ffdc.FFDCFilter.processException(", "// exn1,", "// \"com.ibm.ejs.j2c.poolmanager.FreePool.removeParkedConnection\",", "// this);", "// }", "//", "// try {", "// pm.parkedMCWrapper.destroy(); // no PMI for this connection.", "// } catch (Exception exn1)", "// errorOccured = true;", "// if(TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()){", "// Tr.debug(this, tc,\"parked MCWrapper destroy failed, datasource: \" + gConfigProps.pmiName);", "// }", "// com.ibm.ws.ffdc.FFDCFilter.processException(", "// exn1,", "// \"com.ibm.ejs.j2c.poolmanager.FreePool.removeParkedConnection\",", "// this);", "// }", "pm", ".", "parkedMCWrapper", "=", "null", ";", "// Reset value to true to create a new parked connection.", "pm", ".", "createParkedConnection", "=", "true", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Reset the createParkedConnection flag to recreate a new parked connection\"", ")", ";", "}", "}", "}", "// end sync", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "exit", "(", "this", ",", "tc", ",", "\"removeParkedConnection\"", ")", ";", "}", "}" ]
Remove the parked managed connection. This method should only be called if do not have SmartHandleSupport in effect. The PoolManager controls the SmartHandleSupported flag, so we have to trust the PM not to call this method when smart handles is in effect.
[ "Remove", "the", "parked", "managed", "connection", ".", "This", "method", "should", "only", "be", "called", "if", "do", "not", "have", "SmartHandleSupport", "in", "effect", ".", "The", "PoolManager", "controls", "the", "SmartHandleSupported", "flag", "so", "we", "have", "to", "trust", "the", "PM", "not", "to", "call", "this", "method", "when", "smart", "handles", "is", "in", "effect", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca.cm/src/com/ibm/ejs/j2c/FreePool.java#L496-L553
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jca.cm/src/com/ibm/ejs/j2c/FreePool.java
FreePool.removeCleanupAndDestroyAllFreeConnections
protected void removeCleanupAndDestroyAllFreeConnections() { // removed iterator code // This method is called within a synchronize block if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(this, tc, "removeCleanupAndDestroyAllFreeConnections"); } int mcWrapperListIndex = mcWrapperList.size() - 1; for (int i = mcWrapperListIndex; i >= 0; --i) { MCWrapper mcw = (MCWrapper) mcWrapperList.remove(i); mcw.setPoolState(0); --numberOfConnectionsAssignedToThisFreePool; cleanupAndDestroyMCWrapper(mcw); pm.totalConnectionCount.decrementAndGet(); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(this, tc, "removeCleanupAndDestroyAllFreeConnections"); } }
java
protected void removeCleanupAndDestroyAllFreeConnections() { // removed iterator code // This method is called within a synchronize block if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(this, tc, "removeCleanupAndDestroyAllFreeConnections"); } int mcWrapperListIndex = mcWrapperList.size() - 1; for (int i = mcWrapperListIndex; i >= 0; --i) { MCWrapper mcw = (MCWrapper) mcWrapperList.remove(i); mcw.setPoolState(0); --numberOfConnectionsAssignedToThisFreePool; cleanupAndDestroyMCWrapper(mcw); pm.totalConnectionCount.decrementAndGet(); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(this, tc, "removeCleanupAndDestroyAllFreeConnections"); } }
[ "protected", "void", "removeCleanupAndDestroyAllFreeConnections", "(", ")", "{", "// removed iterator code", "// This method is called within a synchronize block", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "entry", "(", "this", ",", "tc", ",", "\"removeCleanupAndDestroyAllFreeConnections\"", ")", ";", "}", "int", "mcWrapperListIndex", "=", "mcWrapperList", ".", "size", "(", ")", "-", "1", ";", "for", "(", "int", "i", "=", "mcWrapperListIndex", ";", "i", ">=", "0", ";", "--", "i", ")", "{", "MCWrapper", "mcw", "=", "(", "MCWrapper", ")", "mcWrapperList", ".", "remove", "(", "i", ")", ";", "mcw", ".", "setPoolState", "(", "0", ")", ";", "--", "numberOfConnectionsAssignedToThisFreePool", ";", "cleanupAndDestroyMCWrapper", "(", "mcw", ")", ";", "pm", ".", "totalConnectionCount", ".", "decrementAndGet", "(", ")", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "exit", "(", "this", ",", "tc", ",", "\"removeCleanupAndDestroyAllFreeConnections\"", ")", ";", "}", "}" ]
Remove the mcWrappers from the arraylist. Cleanup and destroy the managed connections.
[ "Remove", "the", "mcWrappers", "from", "the", "arraylist", ".", "Cleanup", "and", "destroy", "the", "managed", "connections", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca.cm/src/com/ibm/ejs/j2c/FreePool.java#L1621-L1637
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jca.cm/src/com/ibm/ejs/j2c/FreePool.java
FreePool.cleanupAndDestroyAllFreeConnections
protected void cleanupAndDestroyAllFreeConnections() { // This method is called within a synchronize block if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(this, tc, "cleanupAndDestroyAllFreeConnections"); } int mcWrapperListIndex = mcWrapperList.size() - 1; for (int i = mcWrapperListIndex; i >= 0; --i) { MCWrapper mcw = (MCWrapper) mcWrapperList.remove(i); mcw.setPoolState(0); pm.totalConnectionCount.decrementAndGet(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(this, tc, "Calling cleanup and destroy on MCWrapper " + mcw); } cleanupAndDestroyMCWrapper(mcw); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(this, tc, "cleanupAndDestroyAllFreeConnections"); } }
java
protected void cleanupAndDestroyAllFreeConnections() { // This method is called within a synchronize block if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(this, tc, "cleanupAndDestroyAllFreeConnections"); } int mcWrapperListIndex = mcWrapperList.size() - 1; for (int i = mcWrapperListIndex; i >= 0; --i) { MCWrapper mcw = (MCWrapper) mcWrapperList.remove(i); mcw.setPoolState(0); pm.totalConnectionCount.decrementAndGet(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(this, tc, "Calling cleanup and destroy on MCWrapper " + mcw); } cleanupAndDestroyMCWrapper(mcw); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(this, tc, "cleanupAndDestroyAllFreeConnections"); } }
[ "protected", "void", "cleanupAndDestroyAllFreeConnections", "(", ")", "{", "// This method is called within a synchronize block", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "entry", "(", "this", ",", "tc", ",", "\"cleanupAndDestroyAllFreeConnections\"", ")", ";", "}", "int", "mcWrapperListIndex", "=", "mcWrapperList", ".", "size", "(", ")", "-", "1", ";", "for", "(", "int", "i", "=", "mcWrapperListIndex", ";", "i", ">=", "0", ";", "--", "i", ")", "{", "MCWrapper", "mcw", "=", "(", "MCWrapper", ")", "mcWrapperList", ".", "remove", "(", "i", ")", ";", "mcw", ".", "setPoolState", "(", "0", ")", ";", "pm", ".", "totalConnectionCount", ".", "decrementAndGet", "(", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "this", ",", "tc", ",", "\"Calling cleanup and destroy on MCWrapper \"", "+", "mcw", ")", ";", "}", "cleanupAndDestroyMCWrapper", "(", "mcw", ")", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "exit", "(", "this", ",", "tc", ",", "\"cleanupAndDestroyAllFreeConnections\"", ")", ";", "}", "}" ]
During server shutdown, try to cleanup and destroy the managed connections nicely. This method should only be called during server server shutdown.
[ "During", "server", "shutdown", "try", "to", "cleanup", "and", "destroy", "the", "managed", "connections", "nicely", ".", "This", "method", "should", "only", "be", "called", "during", "server", "server", "shutdown", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca.cm/src/com/ibm/ejs/j2c/FreePool.java#L1653-L1671
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jca.cm/src/com/ibm/ejs/j2c/FreePool.java
FreePool.incrementFatalErrorValue
protected void incrementFatalErrorValue(int value1) { /* * value1 and value2 are index values for the free pools. * When value1 and value2 are 0, we are in free pool . */ if (fatalErrorNotificationTime == Integer.MAX_VALUE - 1) { /* * We need to start over at zero. All connection * fatal error values need to be reset to zero. */ fatalErrorNotificationTime = 0; if (value1 == 0) { /* * We only want to do this once. When the values value1 and value2 are 0 * are are processing the first free pool. When we are processing all of the * rest of the free pool, this code will not be executed. */ pm.mcToMCWMapWrite.lock(); try { Collection<MCWrapper> mcWrappers = pm.mcToMCWMap.values(); Iterator<MCWrapper> mcWrapperIt = mcWrappers.iterator(); while (mcWrapperIt.hasNext()) { MCWrapper mcw = mcWrapperIt.next(); if (!mcw.isParkedWrapper()) { /* * Reset the fatal error value to zero. * This connection will be cleaned up and * destroyed when returned to the free pool. */ mcw.setFatalErrorValue(0); } } } finally { pm.mcToMCWMapWrite.unlock(); } } } else { ++fatalErrorNotificationTime; } }
java
protected void incrementFatalErrorValue(int value1) { /* * value1 and value2 are index values for the free pools. * When value1 and value2 are 0, we are in free pool . */ if (fatalErrorNotificationTime == Integer.MAX_VALUE - 1) { /* * We need to start over at zero. All connection * fatal error values need to be reset to zero. */ fatalErrorNotificationTime = 0; if (value1 == 0) { /* * We only want to do this once. When the values value1 and value2 are 0 * are are processing the first free pool. When we are processing all of the * rest of the free pool, this code will not be executed. */ pm.mcToMCWMapWrite.lock(); try { Collection<MCWrapper> mcWrappers = pm.mcToMCWMap.values(); Iterator<MCWrapper> mcWrapperIt = mcWrappers.iterator(); while (mcWrapperIt.hasNext()) { MCWrapper mcw = mcWrapperIt.next(); if (!mcw.isParkedWrapper()) { /* * Reset the fatal error value to zero. * This connection will be cleaned up and * destroyed when returned to the free pool. */ mcw.setFatalErrorValue(0); } } } finally { pm.mcToMCWMapWrite.unlock(); } } } else { ++fatalErrorNotificationTime; } }
[ "protected", "void", "incrementFatalErrorValue", "(", "int", "value1", ")", "{", "/*\n * value1 and value2 are index values for the free pools.\n * When value1 and value2 are 0, we are in free pool .\n */", "if", "(", "fatalErrorNotificationTime", "==", "Integer", ".", "MAX_VALUE", "-", "1", ")", "{", "/*\n * We need to start over at zero. All connection\n * fatal error values need to be reset to zero.\n */", "fatalErrorNotificationTime", "=", "0", ";", "if", "(", "value1", "==", "0", ")", "{", "/*\n * We only want to do this once. When the values value1 and value2 are 0\n * are are processing the first free pool. When we are processing all of the\n * rest of the free pool, this code will not be executed.\n */", "pm", ".", "mcToMCWMapWrite", ".", "lock", "(", ")", ";", "try", "{", "Collection", "<", "MCWrapper", ">", "mcWrappers", "=", "pm", ".", "mcToMCWMap", ".", "values", "(", ")", ";", "Iterator", "<", "MCWrapper", ">", "mcWrapperIt", "=", "mcWrappers", ".", "iterator", "(", ")", ";", "while", "(", "mcWrapperIt", ".", "hasNext", "(", ")", ")", "{", "MCWrapper", "mcw", "=", "mcWrapperIt", ".", "next", "(", ")", ";", "if", "(", "!", "mcw", ".", "isParkedWrapper", "(", ")", ")", "{", "/*\n * Reset the fatal error value to zero.\n * This connection will be cleaned up and\n * destroyed when returned to the free pool.\n */", "mcw", ".", "setFatalErrorValue", "(", "0", ")", ";", "}", "}", "}", "finally", "{", "pm", ".", "mcToMCWMapWrite", ".", "unlock", "(", ")", ";", "}", "}", "}", "else", "{", "++", "fatalErrorNotificationTime", ";", "}", "}" ]
This method should only be called when a fatal error occurs or when an attempt is made to remove all of the connections from the pool.
[ "This", "method", "should", "only", "be", "called", "when", "a", "fatal", "error", "occurs", "or", "when", "an", "attempt", "is", "made", "to", "remove", "all", "of", "the", "connections", "from", "the", "pool", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca.cm/src/com/ibm/ejs/j2c/FreePool.java#L1732-L1771
train
OpenLiberty/open-liberty
dev/com.ibm.ws.microprofile.config.1.1/src/com/ibm/ws/microprofile/config/converters/UserConverter.java
UserConverter.newInstance
@Trivial public static <K> UserConverter<K> newInstance(Converter<K> converter) { return newInstance(getType(converter), converter); }
java
@Trivial public static <K> UserConverter<K> newInstance(Converter<K> converter) { return newInstance(getType(converter), converter); }
[ "@", "Trivial", "public", "static", "<", "K", ">", "UserConverter", "<", "K", ">", "newInstance", "(", "Converter", "<", "K", ">", "converter", ")", "{", "return", "newInstance", "(", "getType", "(", "converter", ")", ",", "converter", ")", ";", "}" ]
Construct a new PriorityConverter using discovered or default type and priority @param converter
[ "Construct", "a", "new", "PriorityConverter", "using", "discovered", "or", "default", "type", "and", "priority" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.config.1.1/src/com/ibm/ws/microprofile/config/converters/UserConverter.java#L40-L43
train
OpenLiberty/open-liberty
dev/com.ibm.ws.microprofile.config.1.1/src/com/ibm/ws/microprofile/config/converters/UserConverter.java
UserConverter.newInstance
@Trivial public static <K> UserConverter<K> newInstance(Type type, Converter<K> converter) { return newInstance(type, getPriority(converter), converter); }
java
@Trivial public static <K> UserConverter<K> newInstance(Type type, Converter<K> converter) { return newInstance(type, getPriority(converter), converter); }
[ "@", "Trivial", "public", "static", "<", "K", ">", "UserConverter", "<", "K", ">", "newInstance", "(", "Type", "type", ",", "Converter", "<", "K", ">", "converter", ")", "{", "return", "newInstance", "(", "type", ",", "getPriority", "(", "converter", ")", ",", "converter", ")", ";", "}" ]
Construct a new PriorityConverter using discovered or default priority @param converter
[ "Construct", "a", "new", "PriorityConverter", "using", "discovered", "or", "default", "priority" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.config.1.1/src/com/ibm/ws/microprofile/config/converters/UserConverter.java#L50-L53
train
OpenLiberty/open-liberty
dev/com.ibm.ws.microprofile.config.1.1/src/com/ibm/ws/microprofile/config/converters/UserConverter.java
UserConverter.getType
@Trivial private static Type getType(Converter<?> converter) { Type type = null; Type[] itypes = converter.getClass().getGenericInterfaces(); for (Type itype : itypes) { ParameterizedType ptype = (ParameterizedType) itype; if (ptype.getRawType() == Converter.class) { Type[] atypes = ptype.getActualTypeArguments(); if (atypes.length == 1) { type = atypes[0]; break; } else { throw new ConfigException(Tr.formatMessage(tc, "unable.to.determine.conversion.type.CWMCG0009E", converter.getClass().getName())); } } } if (type == null) { throw new ConfigException(Tr.formatMessage(tc, "unable.to.determine.conversion.type.CWMCG0009E", converter.getClass().getName())); } return type; }
java
@Trivial private static Type getType(Converter<?> converter) { Type type = null; Type[] itypes = converter.getClass().getGenericInterfaces(); for (Type itype : itypes) { ParameterizedType ptype = (ParameterizedType) itype; if (ptype.getRawType() == Converter.class) { Type[] atypes = ptype.getActualTypeArguments(); if (atypes.length == 1) { type = atypes[0]; break; } else { throw new ConfigException(Tr.formatMessage(tc, "unable.to.determine.conversion.type.CWMCG0009E", converter.getClass().getName())); } } } if (type == null) { throw new ConfigException(Tr.formatMessage(tc, "unable.to.determine.conversion.type.CWMCG0009E", converter.getClass().getName())); } return type; }
[ "@", "Trivial", "private", "static", "Type", "getType", "(", "Converter", "<", "?", ">", "converter", ")", "{", "Type", "type", "=", "null", ";", "Type", "[", "]", "itypes", "=", "converter", ".", "getClass", "(", ")", ".", "getGenericInterfaces", "(", ")", ";", "for", "(", "Type", "itype", ":", "itypes", ")", "{", "ParameterizedType", "ptype", "=", "(", "ParameterizedType", ")", "itype", ";", "if", "(", "ptype", ".", "getRawType", "(", ")", "==", "Converter", ".", "class", ")", "{", "Type", "[", "]", "atypes", "=", "ptype", ".", "getActualTypeArguments", "(", ")", ";", "if", "(", "atypes", ".", "length", "==", "1", ")", "{", "type", "=", "atypes", "[", "0", "]", ";", "break", ";", "}", "else", "{", "throw", "new", "ConfigException", "(", "Tr", ".", "formatMessage", "(", "tc", ",", "\"unable.to.determine.conversion.type.CWMCG0009E\"", ",", "converter", ".", "getClass", "(", ")", ".", "getName", "(", ")", ")", ")", ";", "}", "}", "}", "if", "(", "type", "==", "null", ")", "{", "throw", "new", "ConfigException", "(", "Tr", ".", "formatMessage", "(", "tc", ",", "\"unable.to.determine.conversion.type.CWMCG0009E\"", ",", "converter", ".", "getClass", "(", ")", ".", "getName", "(", ")", ")", ")", ";", "}", "return", "type", ";", "}" ]
Reflectively work out the Type of a Converter @param converter @return
[ "Reflectively", "work", "out", "the", "Type", "of", "a", "Converter" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.config.1.1/src/com/ibm/ws/microprofile/config/converters/UserConverter.java#L103-L125
train
OpenLiberty/open-liberty
dev/com.ibm.ws.app.manager.war/src/com/ibm/ws/app/manager/war/internal/ZipUtils.java
ZipUtils.deleteWithRetry
@Trivial public static File deleteWithRetry(File file) { String methodName = "deleteWithRetry"; String filePath; if ( tc.isDebugEnabled() ) { filePath = file.getAbsolutePath(); Tr.debug(tc, methodName + ": Recursively delete [ " + filePath + " ]"); } else { filePath = null; } File firstFailure = delete(file); if ( firstFailure == null ) { if ( filePath != null ) { Tr.debug(tc, methodName + ": Successful first delete [ " + filePath + " ]"); } return null; } if ( filePath != null ) { Tr.debug(tc, methodName + ": Failed first delete [ " + filePath + " ]: Sleep up to 50 ms and retry"); } // Extract can occur with the server running, and not long after activity // on the previously extracted archives. // // If the first delete attempt failed, try again, up to a limit based on // the expected quiesce time of the zip file cache. File secondFailure = firstFailure; for ( int tryNo = 0; (secondFailure != null) && tryNo < RETRY_COUNT; tryNo++ ) { try { Thread.sleep(RETRY_AMOUNT); } catch ( InterruptedException e ) { // FFDC } secondFailure = delete(file); } if ( secondFailure == null ) { if ( filePath != null ) { Tr.debug(tc, methodName + ": Successful first delete [ " + filePath + " ]"); } return null; } else { if ( filePath != null ) { Tr.debug(tc, methodName + ": Failed second delete [ " + filePath + " ]"); } return secondFailure; } }
java
@Trivial public static File deleteWithRetry(File file) { String methodName = "deleteWithRetry"; String filePath; if ( tc.isDebugEnabled() ) { filePath = file.getAbsolutePath(); Tr.debug(tc, methodName + ": Recursively delete [ " + filePath + " ]"); } else { filePath = null; } File firstFailure = delete(file); if ( firstFailure == null ) { if ( filePath != null ) { Tr.debug(tc, methodName + ": Successful first delete [ " + filePath + " ]"); } return null; } if ( filePath != null ) { Tr.debug(tc, methodName + ": Failed first delete [ " + filePath + " ]: Sleep up to 50 ms and retry"); } // Extract can occur with the server running, and not long after activity // on the previously extracted archives. // // If the first delete attempt failed, try again, up to a limit based on // the expected quiesce time of the zip file cache. File secondFailure = firstFailure; for ( int tryNo = 0; (secondFailure != null) && tryNo < RETRY_COUNT; tryNo++ ) { try { Thread.sleep(RETRY_AMOUNT); } catch ( InterruptedException e ) { // FFDC } secondFailure = delete(file); } if ( secondFailure == null ) { if ( filePath != null ) { Tr.debug(tc, methodName + ": Successful first delete [ " + filePath + " ]"); } return null; } else { if ( filePath != null ) { Tr.debug(tc, methodName + ": Failed second delete [ " + filePath + " ]"); } return secondFailure; } }
[ "@", "Trivial", "public", "static", "File", "deleteWithRetry", "(", "File", "file", ")", "{", "String", "methodName", "=", "\"deleteWithRetry\"", ";", "String", "filePath", ";", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "filePath", "=", "file", ".", "getAbsolutePath", "(", ")", ";", "Tr", ".", "debug", "(", "tc", ",", "methodName", "+", "\": Recursively delete [ \"", "+", "filePath", "+", "\" ]\"", ")", ";", "}", "else", "{", "filePath", "=", "null", ";", "}", "File", "firstFailure", "=", "delete", "(", "file", ")", ";", "if", "(", "firstFailure", "==", "null", ")", "{", "if", "(", "filePath", "!=", "null", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "methodName", "+", "\": Successful first delete [ \"", "+", "filePath", "+", "\" ]\"", ")", ";", "}", "return", "null", ";", "}", "if", "(", "filePath", "!=", "null", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "methodName", "+", "\": Failed first delete [ \"", "+", "filePath", "+", "\" ]: Sleep up to 50 ms and retry\"", ")", ";", "}", "// Extract can occur with the server running, and not long after activity", "// on the previously extracted archives.", "//", "// If the first delete attempt failed, try again, up to a limit based on", "// the expected quiesce time of the zip file cache.", "File", "secondFailure", "=", "firstFailure", ";", "for", "(", "int", "tryNo", "=", "0", ";", "(", "secondFailure", "!=", "null", ")", "&&", "tryNo", "<", "RETRY_COUNT", ";", "tryNo", "++", ")", "{", "try", "{", "Thread", ".", "sleep", "(", "RETRY_AMOUNT", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "// FFDC", "}", "secondFailure", "=", "delete", "(", "file", ")", ";", "}", "if", "(", "secondFailure", "==", "null", ")", "{", "if", "(", "filePath", "!=", "null", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "methodName", "+", "\": Successful first delete [ \"", "+", "filePath", "+", "\" ]\"", ")", ";", "}", "return", "null", ";", "}", "else", "{", "if", "(", "filePath", "!=", "null", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "methodName", "+", "\": Failed second delete [ \"", "+", "filePath", "+", "\" ]\"", ")", ";", "}", "return", "secondFailure", ";", "}", "}" ]
Attempt to recursively delete a target file. Answer null if the delete was successful. Answer the first file which could not be deleted if the delete failed. If the delete fails, wait 400 MS then try again. Do this for the entire delete operation, not for each file deletion. A test must be done to verify that the file exists before invoking this method: If the file does not exist, the delete operation will fail. @param file The file to delete recursively. @return Null if the file was deleted. The first file which could not be deleted if the file could not be deleted.
[ "Attempt", "to", "recursively", "delete", "a", "target", "file", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.app.manager.war/src/com/ibm/ws/app/manager/war/internal/ZipUtils.java#L104-L155
train
OpenLiberty/open-liberty
dev/com.ibm.ws.app.manager.war/src/com/ibm/ws/app/manager/war/internal/ZipUtils.java
ZipUtils.delete
@Trivial public static File delete(File file) { String methodName = "delete"; String filePath; if ( tc.isDebugEnabled() ) { filePath = file.getAbsolutePath(); } else { filePath = null; } if ( file.isDirectory() ) { if ( filePath != null ) { Tr.debug(tc, methodName + ": Delete directory [ " + filePath + " ]"); } File firstFailure = null; File[] subFiles = file.listFiles(); if ( subFiles != null ) { for ( File subFile : subFiles ) { File nextFailure = delete(subFile); if ( (nextFailure != null) && (firstFailure == null) ) { firstFailure = nextFailure; } } } if ( firstFailure != null ) { if ( filePath != null ) { Tr.debug(tc, methodName + ": Cannot delete [ " + filePath + " ]" + " Child [ " + firstFailure.getAbsolutePath() + " ] could not be deleted."); } return firstFailure; } } else { if ( filePath != null ) { Tr.debug(tc, methodName + ": Delete simple file [ " + filePath + " ]"); } } if ( !file.delete() ) { if ( filePath != null ) { Tr.debug(tc, methodName + ": Failed to delete [ " + filePath + " ]"); } return file; } else { if ( filePath != null ) { Tr.debug(tc, methodName + ": Deleted [ " + filePath + " ]"); } return null; } }
java
@Trivial public static File delete(File file) { String methodName = "delete"; String filePath; if ( tc.isDebugEnabled() ) { filePath = file.getAbsolutePath(); } else { filePath = null; } if ( file.isDirectory() ) { if ( filePath != null ) { Tr.debug(tc, methodName + ": Delete directory [ " + filePath + " ]"); } File firstFailure = null; File[] subFiles = file.listFiles(); if ( subFiles != null ) { for ( File subFile : subFiles ) { File nextFailure = delete(subFile); if ( (nextFailure != null) && (firstFailure == null) ) { firstFailure = nextFailure; } } } if ( firstFailure != null ) { if ( filePath != null ) { Tr.debug(tc, methodName + ": Cannot delete [ " + filePath + " ]" + " Child [ " + firstFailure.getAbsolutePath() + " ] could not be deleted."); } return firstFailure; } } else { if ( filePath != null ) { Tr.debug(tc, methodName + ": Delete simple file [ " + filePath + " ]"); } } if ( !file.delete() ) { if ( filePath != null ) { Tr.debug(tc, methodName + ": Failed to delete [ " + filePath + " ]"); } return file; } else { if ( filePath != null ) { Tr.debug(tc, methodName + ": Deleted [ " + filePath + " ]"); } return null; } }
[ "@", "Trivial", "public", "static", "File", "delete", "(", "File", "file", ")", "{", "String", "methodName", "=", "\"delete\"", ";", "String", "filePath", ";", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "filePath", "=", "file", ".", "getAbsolutePath", "(", ")", ";", "}", "else", "{", "filePath", "=", "null", ";", "}", "if", "(", "file", ".", "isDirectory", "(", ")", ")", "{", "if", "(", "filePath", "!=", "null", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "methodName", "+", "\": Delete directory [ \"", "+", "filePath", "+", "\" ]\"", ")", ";", "}", "File", "firstFailure", "=", "null", ";", "File", "[", "]", "subFiles", "=", "file", ".", "listFiles", "(", ")", ";", "if", "(", "subFiles", "!=", "null", ")", "{", "for", "(", "File", "subFile", ":", "subFiles", ")", "{", "File", "nextFailure", "=", "delete", "(", "subFile", ")", ";", "if", "(", "(", "nextFailure", "!=", "null", ")", "&&", "(", "firstFailure", "==", "null", ")", ")", "{", "firstFailure", "=", "nextFailure", ";", "}", "}", "}", "if", "(", "firstFailure", "!=", "null", ")", "{", "if", "(", "filePath", "!=", "null", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "methodName", "+", "\": Cannot delete [ \"", "+", "filePath", "+", "\" ]\"", "+", "\" Child [ \"", "+", "firstFailure", ".", "getAbsolutePath", "(", ")", "+", "\" ] could not be deleted.\"", ")", ";", "}", "return", "firstFailure", ";", "}", "}", "else", "{", "if", "(", "filePath", "!=", "null", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "methodName", "+", "\": Delete simple file [ \"", "+", "filePath", "+", "\" ]\"", ")", ";", "}", "}", "if", "(", "!", "file", ".", "delete", "(", ")", ")", "{", "if", "(", "filePath", "!=", "null", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "methodName", "+", "\": Failed to delete [ \"", "+", "filePath", "+", "\" ]\"", ")", ";", "}", "return", "file", ";", "}", "else", "{", "if", "(", "filePath", "!=", "null", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "methodName", "+", "\": Deleted [ \"", "+", "filePath", "+", "\" ]\"", ")", ";", "}", "return", "null", ";", "}", "}" ]
Attempt to recursively delete a file. Do not retry in case of a failure. A test must be done to verify that the file exists before invoking this method: If the file does not exist, the delete operation will fail. @param file The file to recursively delete. @return Null if the file was deleted. The first file which could not be deleted if the file could not be deleted.
[ "Attempt", "to", "recursively", "delete", "a", "file", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.app.manager.war/src/com/ibm/ws/app/manager/war/internal/ZipUtils.java#L171-L224
train
OpenLiberty/open-liberty
dev/com.ibm.ws.app.manager.war/src/com/ibm/ws/app/manager/war/internal/ZipUtils.java
ZipUtils.unzip
public static void unzip( File source, File target, boolean isEar, long lastModified) throws IOException { byte[] transferBuffer = new byte[16 * 1024]; unzip(source, target, isEar, lastModified, transferBuffer); }
java
public static void unzip( File source, File target, boolean isEar, long lastModified) throws IOException { byte[] transferBuffer = new byte[16 * 1024]; unzip(source, target, isEar, lastModified, transferBuffer); }
[ "public", "static", "void", "unzip", "(", "File", "source", ",", "File", "target", ",", "boolean", "isEar", ",", "long", "lastModified", ")", "throws", "IOException", "{", "byte", "[", "]", "transferBuffer", "=", "new", "byte", "[", "16", "*", "1024", "]", ";", "unzip", "(", "source", ",", "target", ",", "isEar", ",", "lastModified", ",", "transferBuffer", ")", ";", "}" ]
Unpack a source archive into a target directory. If the source archive is a WAR, package web module archives as well. This operation is not smart enough to avoid unpacking WAR files in an application library folder. However, that is very unlikely to happen. @param source The source archive which is to be unpacked. @param target The directory into which to unpack the source archive. @param isEar Control parameter: Is the source archive an EAR file. When the source archive is an EAR, unpack nested WAR files. @param lastModified The last modified value to use for the expanded archive. @throws IOException Thrown in case of a failure.
[ "Unpack", "a", "source", "archive", "into", "a", "target", "directory", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.app.manager.war/src/com/ibm/ws/app/manager/war/internal/ZipUtils.java#L251-L257
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/el/unified/resolver/implicitobject/ImplicitObjectResolver.java
ImplicitObjectResolver.makeResolverForJSP
public static ELResolver makeResolverForJSP() { Map<String, ImplicitObject> forJSPList = new HashMap<String, ImplicitObject>(8);//4 ImplicitObject io1 = new FacesContextImplicitObject(); forJSPList.put(io1.getName(), io1); ImplicitObject io2 = new ViewImplicitObject(); forJSPList.put(io2.getName(), io2); ImplicitObject io3 = new ResourceImplicitObject(); forJSPList.put(io3.getName(), io3); ImplicitObject io4 = new ViewScopeImplicitObject(); forJSPList.put(io4.getName(), io4); return new ImplicitObjectResolver(forJSPList); }
java
public static ELResolver makeResolverForJSP() { Map<String, ImplicitObject> forJSPList = new HashMap<String, ImplicitObject>(8);//4 ImplicitObject io1 = new FacesContextImplicitObject(); forJSPList.put(io1.getName(), io1); ImplicitObject io2 = new ViewImplicitObject(); forJSPList.put(io2.getName(), io2); ImplicitObject io3 = new ResourceImplicitObject(); forJSPList.put(io3.getName(), io3); ImplicitObject io4 = new ViewScopeImplicitObject(); forJSPList.put(io4.getName(), io4); return new ImplicitObjectResolver(forJSPList); }
[ "public", "static", "ELResolver", "makeResolverForJSP", "(", ")", "{", "Map", "<", "String", ",", "ImplicitObject", ">", "forJSPList", "=", "new", "HashMap", "<", "String", ",", "ImplicitObject", ">", "(", "8", ")", ";", "//4", "ImplicitObject", "io1", "=", "new", "FacesContextImplicitObject", "(", ")", ";", "forJSPList", ".", "put", "(", "io1", ".", "getName", "(", ")", ",", "io1", ")", ";", "ImplicitObject", "io2", "=", "new", "ViewImplicitObject", "(", ")", ";", "forJSPList", ".", "put", "(", "io2", ".", "getName", "(", ")", ",", "io2", ")", ";", "ImplicitObject", "io3", "=", "new", "ResourceImplicitObject", "(", ")", ";", "forJSPList", ".", "put", "(", "io3", ".", "getName", "(", ")", ",", "io3", ")", ";", "ImplicitObject", "io4", "=", "new", "ViewScopeImplicitObject", "(", ")", ";", "forJSPList", ".", "put", "(", "io4", ".", "getName", "(", ")", ",", "io4", ")", ";", "return", "new", "ImplicitObjectResolver", "(", "forJSPList", ")", ";", "}" ]
Static factory for an ELResolver for resolving implicit objects in JSPs. See JSF 1.2 spec section 5.6.1.1
[ "Static", "factory", "for", "an", "ELResolver", "for", "resolving", "implicit", "objects", "in", "JSPs", ".", "See", "JSF", "1", ".", "2", "spec", "section", "5", ".", "6", ".", "1", ".", "1" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/el/unified/resolver/implicitobject/ImplicitObjectResolver.java#L45-L57
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/el/unified/resolver/implicitobject/ImplicitObjectResolver.java
ImplicitObjectResolver.makeResolverForFaces
public static ELResolver makeResolverForFaces() { Map<String, ImplicitObject> forFacesList = new HashMap<String, ImplicitObject>(30);//14 ImplicitObject io1 = new ApplicationImplicitObject(); forFacesList.put(io1.getName(), io1); ImplicitObject io2 = new ApplicationScopeImplicitObject(); forFacesList.put(io2.getName(), io2); ImplicitObject io3 = new CookieImplicitObject(); forFacesList.put(io3.getName(), io3); ImplicitObject io4 = new FacesContextImplicitObject(); forFacesList.put(io4.getName(), io4); ImplicitObject io5 = new HeaderImplicitObject(); forFacesList.put(io5.getName(), io5); ImplicitObject io6 = new HeaderValuesImplicitObject(); forFacesList.put(io6.getName(), io6); ImplicitObject io7 = new InitParamImplicitObject(); forFacesList.put(io7.getName(), io7); ImplicitObject io8 = new ParamImplicitObject(); forFacesList.put(io8.getName(), io8); ImplicitObject io9 = new ParamValuesImplicitObject(); forFacesList.put(io9.getName(), io9); ImplicitObject io10 = new RequestImplicitObject(); forFacesList.put(io10.getName(), io10); ImplicitObject io11 = new RequestScopeImplicitObject(); forFacesList.put(io11.getName(), io11); ImplicitObject io12 = new SessionImplicitObject(); forFacesList.put(io12.getName(), io12); ImplicitObject io13 = new SessionScopeImplicitObject(); forFacesList.put(io13.getName(), io13); ImplicitObject io14 = new ViewImplicitObject(); forFacesList.put(io14.getName(), io14); ImplicitObject io15 = new ComponentImplicitObject(); forFacesList.put(io15.getName(), io15); ImplicitObject io16 = new ResourceImplicitObject(); forFacesList.put(io16.getName(), io16); ImplicitObject io17 = new ViewScopeImplicitObject(); forFacesList.put(io17.getName(), io17); ImplicitObject io18 = new CompositeComponentImplicitObject(); forFacesList.put(io18.getName(), io18); ImplicitObject io19 = new FlowScopeImplicitObject(); forFacesList.put(io19.getName(), io19); return new ImplicitObjectResolver(forFacesList); }
java
public static ELResolver makeResolverForFaces() { Map<String, ImplicitObject> forFacesList = new HashMap<String, ImplicitObject>(30);//14 ImplicitObject io1 = new ApplicationImplicitObject(); forFacesList.put(io1.getName(), io1); ImplicitObject io2 = new ApplicationScopeImplicitObject(); forFacesList.put(io2.getName(), io2); ImplicitObject io3 = new CookieImplicitObject(); forFacesList.put(io3.getName(), io3); ImplicitObject io4 = new FacesContextImplicitObject(); forFacesList.put(io4.getName(), io4); ImplicitObject io5 = new HeaderImplicitObject(); forFacesList.put(io5.getName(), io5); ImplicitObject io6 = new HeaderValuesImplicitObject(); forFacesList.put(io6.getName(), io6); ImplicitObject io7 = new InitParamImplicitObject(); forFacesList.put(io7.getName(), io7); ImplicitObject io8 = new ParamImplicitObject(); forFacesList.put(io8.getName(), io8); ImplicitObject io9 = new ParamValuesImplicitObject(); forFacesList.put(io9.getName(), io9); ImplicitObject io10 = new RequestImplicitObject(); forFacesList.put(io10.getName(), io10); ImplicitObject io11 = new RequestScopeImplicitObject(); forFacesList.put(io11.getName(), io11); ImplicitObject io12 = new SessionImplicitObject(); forFacesList.put(io12.getName(), io12); ImplicitObject io13 = new SessionScopeImplicitObject(); forFacesList.put(io13.getName(), io13); ImplicitObject io14 = new ViewImplicitObject(); forFacesList.put(io14.getName(), io14); ImplicitObject io15 = new ComponentImplicitObject(); forFacesList.put(io15.getName(), io15); ImplicitObject io16 = new ResourceImplicitObject(); forFacesList.put(io16.getName(), io16); ImplicitObject io17 = new ViewScopeImplicitObject(); forFacesList.put(io17.getName(), io17); ImplicitObject io18 = new CompositeComponentImplicitObject(); forFacesList.put(io18.getName(), io18); ImplicitObject io19 = new FlowScopeImplicitObject(); forFacesList.put(io19.getName(), io19); return new ImplicitObjectResolver(forFacesList); }
[ "public", "static", "ELResolver", "makeResolverForFaces", "(", ")", "{", "Map", "<", "String", ",", "ImplicitObject", ">", "forFacesList", "=", "new", "HashMap", "<", "String", ",", "ImplicitObject", ">", "(", "30", ")", ";", "//14", "ImplicitObject", "io1", "=", "new", "ApplicationImplicitObject", "(", ")", ";", "forFacesList", ".", "put", "(", "io1", ".", "getName", "(", ")", ",", "io1", ")", ";", "ImplicitObject", "io2", "=", "new", "ApplicationScopeImplicitObject", "(", ")", ";", "forFacesList", ".", "put", "(", "io2", ".", "getName", "(", ")", ",", "io2", ")", ";", "ImplicitObject", "io3", "=", "new", "CookieImplicitObject", "(", ")", ";", "forFacesList", ".", "put", "(", "io3", ".", "getName", "(", ")", ",", "io3", ")", ";", "ImplicitObject", "io4", "=", "new", "FacesContextImplicitObject", "(", ")", ";", "forFacesList", ".", "put", "(", "io4", ".", "getName", "(", ")", ",", "io4", ")", ";", "ImplicitObject", "io5", "=", "new", "HeaderImplicitObject", "(", ")", ";", "forFacesList", ".", "put", "(", "io5", ".", "getName", "(", ")", ",", "io5", ")", ";", "ImplicitObject", "io6", "=", "new", "HeaderValuesImplicitObject", "(", ")", ";", "forFacesList", ".", "put", "(", "io6", ".", "getName", "(", ")", ",", "io6", ")", ";", "ImplicitObject", "io7", "=", "new", "InitParamImplicitObject", "(", ")", ";", "forFacesList", ".", "put", "(", "io7", ".", "getName", "(", ")", ",", "io7", ")", ";", "ImplicitObject", "io8", "=", "new", "ParamImplicitObject", "(", ")", ";", "forFacesList", ".", "put", "(", "io8", ".", "getName", "(", ")", ",", "io8", ")", ";", "ImplicitObject", "io9", "=", "new", "ParamValuesImplicitObject", "(", ")", ";", "forFacesList", ".", "put", "(", "io9", ".", "getName", "(", ")", ",", "io9", ")", ";", "ImplicitObject", "io10", "=", "new", "RequestImplicitObject", "(", ")", ";", "forFacesList", ".", "put", "(", "io10", ".", "getName", "(", ")", ",", "io10", ")", ";", "ImplicitObject", "io11", "=", "new", "RequestScopeImplicitObject", "(", ")", ";", "forFacesList", ".", "put", "(", "io11", ".", "getName", "(", ")", ",", "io11", ")", ";", "ImplicitObject", "io12", "=", "new", "SessionImplicitObject", "(", ")", ";", "forFacesList", ".", "put", "(", "io12", ".", "getName", "(", ")", ",", "io12", ")", ";", "ImplicitObject", "io13", "=", "new", "SessionScopeImplicitObject", "(", ")", ";", "forFacesList", ".", "put", "(", "io13", ".", "getName", "(", ")", ",", "io13", ")", ";", "ImplicitObject", "io14", "=", "new", "ViewImplicitObject", "(", ")", ";", "forFacesList", ".", "put", "(", "io14", ".", "getName", "(", ")", ",", "io14", ")", ";", "ImplicitObject", "io15", "=", "new", "ComponentImplicitObject", "(", ")", ";", "forFacesList", ".", "put", "(", "io15", ".", "getName", "(", ")", ",", "io15", ")", ";", "ImplicitObject", "io16", "=", "new", "ResourceImplicitObject", "(", ")", ";", "forFacesList", ".", "put", "(", "io16", ".", "getName", "(", ")", ",", "io16", ")", ";", "ImplicitObject", "io17", "=", "new", "ViewScopeImplicitObject", "(", ")", ";", "forFacesList", ".", "put", "(", "io17", ".", "getName", "(", ")", ",", "io17", ")", ";", "ImplicitObject", "io18", "=", "new", "CompositeComponentImplicitObject", "(", ")", ";", "forFacesList", ".", "put", "(", "io18", ".", "getName", "(", ")", ",", "io18", ")", ";", "ImplicitObject", "io19", "=", "new", "FlowScopeImplicitObject", "(", ")", ";", "forFacesList", ".", "put", "(", "io19", ".", "getName", "(", ")", ",", "io19", ")", ";", "return", "new", "ImplicitObjectResolver", "(", "forFacesList", ")", ";", "}" ]
Static factory for an ELResolver for resolving implicit objects in all of Faces. See JSF 1.2 spec section 5.6.1.2
[ "Static", "factory", "for", "an", "ELResolver", "for", "resolving", "implicit", "objects", "in", "all", "of", "Faces", ".", "See", "JSF", "1", ".", "2", "spec", "section", "5", ".", "6", ".", "1", ".", "2" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/el/unified/resolver/implicitobject/ImplicitObjectResolver.java#L62-L104
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/InboundTransmissionParser.java
InboundTransmissionParser.parse
public void parse(WsByteBuffer transmissionData) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "parse", transmissionData); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) JFapUtils.debugTraceWsByteBufferInfo(this, tc, transmissionData, "transmissionBuffer"); needMoreData = false; boolean encounteredError = false; while(!needMoreData && !encounteredError) { switch(state) { case(STATE_PARSING_PRIMARY_HEADER): parsePrimaryHeader(transmissionData); break; case(STATE_PARSING_CONVERSATION_HEADER): parseConversationHeader(transmissionData); break; case(STATE_PARSING_SEGMENT_START_HEADER): parseSegmentStartHeader(transmissionData); break; case(STATE_PARSING_PRIMARY_ONLY_PAYLOAD): parsePrimaryOnlyPayload(transmissionData); break; case(STATE_PARSE_CONVERSATION_PAYLOAD): parseConversationPayload(transmissionData); break; case(STATE_PARSE_SEGMENT_START_PAYLOAD): parseSegmentStartPayload(transmissionData); break; case(STATE_PARSE_SEGMENT_MIDDLE_PAYLOAD): parseSegmentMiddlePayload(transmissionData); break; case(STATE_PARSE_SEGMENT_END_PAYLOAD): parseSegmentEndPayload(transmissionData); break; case(STATE_ERROR): encounteredError = true; break; default: if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "got into default branch of parse() method case statement"); throwable = new SIErrorException("Should not have entered default branch of parse() method case statement"); FFDCFilter.processException(throwable, "com.ibm.ws.sib.jfapchannel.impl.InboundTransmissionParser", JFapChannelConstants.INBOUNDXMITPARSER_PARSE_01); state = STATE_ERROR; break; } } if (encounteredError) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "encountered error parsing"); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.exception(this, tc, throwable); connection.invalidate(false, throwable, "parse error while parsing transmission"); // D224570 } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "parse"); }
java
public void parse(WsByteBuffer transmissionData) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "parse", transmissionData); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) JFapUtils.debugTraceWsByteBufferInfo(this, tc, transmissionData, "transmissionBuffer"); needMoreData = false; boolean encounteredError = false; while(!needMoreData && !encounteredError) { switch(state) { case(STATE_PARSING_PRIMARY_HEADER): parsePrimaryHeader(transmissionData); break; case(STATE_PARSING_CONVERSATION_HEADER): parseConversationHeader(transmissionData); break; case(STATE_PARSING_SEGMENT_START_HEADER): parseSegmentStartHeader(transmissionData); break; case(STATE_PARSING_PRIMARY_ONLY_PAYLOAD): parsePrimaryOnlyPayload(transmissionData); break; case(STATE_PARSE_CONVERSATION_PAYLOAD): parseConversationPayload(transmissionData); break; case(STATE_PARSE_SEGMENT_START_PAYLOAD): parseSegmentStartPayload(transmissionData); break; case(STATE_PARSE_SEGMENT_MIDDLE_PAYLOAD): parseSegmentMiddlePayload(transmissionData); break; case(STATE_PARSE_SEGMENT_END_PAYLOAD): parseSegmentEndPayload(transmissionData); break; case(STATE_ERROR): encounteredError = true; break; default: if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "got into default branch of parse() method case statement"); throwable = new SIErrorException("Should not have entered default branch of parse() method case statement"); FFDCFilter.processException(throwable, "com.ibm.ws.sib.jfapchannel.impl.InboundTransmissionParser", JFapChannelConstants.INBOUNDXMITPARSER_PARSE_01); state = STATE_ERROR; break; } } if (encounteredError) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "encountered error parsing"); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.exception(this, tc, throwable); connection.invalidate(false, throwable, "parse error while parsing transmission"); // D224570 } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "parse"); }
[ "public", "void", "parse", "(", "WsByteBuffer", "transmissionData", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "this", ",", "tc", ",", "\"parse\"", ",", "transmissionData", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "JFapUtils", ".", "debugTraceWsByteBufferInfo", "(", "this", ",", "tc", ",", "transmissionData", ",", "\"transmissionBuffer\"", ")", ";", "needMoreData", "=", "false", ";", "boolean", "encounteredError", "=", "false", ";", "while", "(", "!", "needMoreData", "&&", "!", "encounteredError", ")", "{", "switch", "(", "state", ")", "{", "case", "(", "STATE_PARSING_PRIMARY_HEADER", ")", ":", "parsePrimaryHeader", "(", "transmissionData", ")", ";", "break", ";", "case", "(", "STATE_PARSING_CONVERSATION_HEADER", ")", ":", "parseConversationHeader", "(", "transmissionData", ")", ";", "break", ";", "case", "(", "STATE_PARSING_SEGMENT_START_HEADER", ")", ":", "parseSegmentStartHeader", "(", "transmissionData", ")", ";", "break", ";", "case", "(", "STATE_PARSING_PRIMARY_ONLY_PAYLOAD", ")", ":", "parsePrimaryOnlyPayload", "(", "transmissionData", ")", ";", "break", ";", "case", "(", "STATE_PARSE_CONVERSATION_PAYLOAD", ")", ":", "parseConversationPayload", "(", "transmissionData", ")", ";", "break", ";", "case", "(", "STATE_PARSE_SEGMENT_START_PAYLOAD", ")", ":", "parseSegmentStartPayload", "(", "transmissionData", ")", ";", "break", ";", "case", "(", "STATE_PARSE_SEGMENT_MIDDLE_PAYLOAD", ")", ":", "parseSegmentMiddlePayload", "(", "transmissionData", ")", ";", "break", ";", "case", "(", "STATE_PARSE_SEGMENT_END_PAYLOAD", ")", ":", "parseSegmentEndPayload", "(", "transmissionData", ")", ";", "break", ";", "case", "(", "STATE_ERROR", ")", ":", "encounteredError", "=", "true", ";", "break", ";", "default", ":", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "SibTr", ".", "debug", "(", "this", ",", "tc", ",", "\"got into default branch of parse() method case statement\"", ")", ";", "throwable", "=", "new", "SIErrorException", "(", "\"Should not have entered default branch of parse() method case statement\"", ")", ";", "FFDCFilter", ".", "processException", "(", "throwable", ",", "\"com.ibm.ws.sib.jfapchannel.impl.InboundTransmissionParser\"", ",", "JFapChannelConstants", ".", "INBOUNDXMITPARSER_PARSE_01", ")", ";", "state", "=", "STATE_ERROR", ";", "break", ";", "}", "}", "if", "(", "encounteredError", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "SibTr", ".", "debug", "(", "this", ",", "tc", ",", "\"encountered error parsing\"", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEventEnabled", "(", ")", ")", "SibTr", ".", "exception", "(", "this", ",", "tc", ",", "throwable", ")", ";", "connection", ".", "invalidate", "(", "false", ",", "throwable", ",", "\"parse error while parsing transmission\"", ")", ";", "// D224570", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "this", ",", "tc", ",", "\"parse\"", ")", ";", "}" ]
Parses a chunk of inbound data into discrete transmissions. The headers for these transmissions are decoded and the payload data is dispatched to the appropriate method for processing. @param transmissionData A chunk of transmission data to be parsed.
[ "Parses", "a", "chunk", "of", "inbound", "data", "into", "discrete", "transmissions", ".", "The", "headers", "for", "these", "transmissions", "are", "decoded", "and", "the", "payload", "data", "is", "dispatched", "to", "the", "appropriate", "method", "for", "processing", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/InboundTransmissionParser.java#L200-L255
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/InboundTransmissionParser.java
InboundTransmissionParser.parseSegmentStartHeader
private void parseSegmentStartHeader(WsByteBuffer contextBuffer) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "parseSegmentStartHeader", contextBuffer); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) JFapUtils.debugTraceWsByteBufferInfo(this, tc, contextBuffer, "contextBuffer"); WsByteBuffer rawData = readData(contextBuffer, unparsedFirstSegment); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) JFapUtils.debugTraceWsByteBufferInfo(this, tc, rawData, "rawData"); if (rawData != null) { segmentedTransmissionHeaderFields[primaryHeaderFields.priority].totalLength = rawData.getLong(); // D191832.1 transmissionPayloadRemaining -= JFapChannelConstants.SIZEOF_SEGMENT_START_HEADER; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "totalLenght: "+segmentedTransmissionHeaderFields[primaryHeaderFields.priority].totalLength); // D191832.1 if (segmentedTransmissionHeaderFields[primaryHeaderFields.priority].totalLength < 0) // D191832.1 { throwable = new SIConnectionLostException(nls.getFormattedMessage("TRANSPARSER_PROTOCOLERROR_SICJ0053", new Object[] {connection.remoteHostAddress, connection.chainName}, "TRANSPARSER_PROTOCOLERROR_SICJ0053")); // D226223 // This FFDC was generated because our peer sent a the start of a segmented transmission // with a segment size greater than the size suggested by the transmission size field. FFDCFilter.processException(throwable, "com.ibm.ws.sib.jfapchannel.impl.InboundTransmissionParser", JFapChannelConstants.INBOUNDXMITPARSER_PARSESSHDR_01, getFormattedBytes(contextBuffer)); // D267629 state = STATE_ERROR; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Conversation lost after peer transmitted more data than initially indicated in first part of segmented transmission"); } else { // begin D191832.1 segmentedTransmissionHeaderFields[primaryHeaderFields.priority].segmentType = rawData.get(); if (segmentedTransmissionHeaderFields[primaryHeaderFields.priority].segmentType < 0) segmentedTransmissionHeaderFields[primaryHeaderFields.priority].segmentType += 256; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "segmentType: "+segmentedTransmissionHeaderFields[primaryHeaderFields.priority].segmentType); // end D191832.1 rawData.position(rawData.position()+3); // skip padding. transmissionPayloadDataLength = primaryHeaderFields.segmentLength - (JFapChannelConstants.SIZEOF_PRIMARY_HEADER + JFapChannelConstants.SIZEOF_CONVERSATION_HEADER + JFapChannelConstants.SIZEOF_SEGMENT_START_HEADER); state = STATE_PARSE_SEGMENT_START_PAYLOAD; } } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "need more data"); needMoreData = true; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "parseSegmentStartHeader"); }
java
private void parseSegmentStartHeader(WsByteBuffer contextBuffer) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "parseSegmentStartHeader", contextBuffer); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) JFapUtils.debugTraceWsByteBufferInfo(this, tc, contextBuffer, "contextBuffer"); WsByteBuffer rawData = readData(contextBuffer, unparsedFirstSegment); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) JFapUtils.debugTraceWsByteBufferInfo(this, tc, rawData, "rawData"); if (rawData != null) { segmentedTransmissionHeaderFields[primaryHeaderFields.priority].totalLength = rawData.getLong(); // D191832.1 transmissionPayloadRemaining -= JFapChannelConstants.SIZEOF_SEGMENT_START_HEADER; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "totalLenght: "+segmentedTransmissionHeaderFields[primaryHeaderFields.priority].totalLength); // D191832.1 if (segmentedTransmissionHeaderFields[primaryHeaderFields.priority].totalLength < 0) // D191832.1 { throwable = new SIConnectionLostException(nls.getFormattedMessage("TRANSPARSER_PROTOCOLERROR_SICJ0053", new Object[] {connection.remoteHostAddress, connection.chainName}, "TRANSPARSER_PROTOCOLERROR_SICJ0053")); // D226223 // This FFDC was generated because our peer sent a the start of a segmented transmission // with a segment size greater than the size suggested by the transmission size field. FFDCFilter.processException(throwable, "com.ibm.ws.sib.jfapchannel.impl.InboundTransmissionParser", JFapChannelConstants.INBOUNDXMITPARSER_PARSESSHDR_01, getFormattedBytes(contextBuffer)); // D267629 state = STATE_ERROR; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Conversation lost after peer transmitted more data than initially indicated in first part of segmented transmission"); } else { // begin D191832.1 segmentedTransmissionHeaderFields[primaryHeaderFields.priority].segmentType = rawData.get(); if (segmentedTransmissionHeaderFields[primaryHeaderFields.priority].segmentType < 0) segmentedTransmissionHeaderFields[primaryHeaderFields.priority].segmentType += 256; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "segmentType: "+segmentedTransmissionHeaderFields[primaryHeaderFields.priority].segmentType); // end D191832.1 rawData.position(rawData.position()+3); // skip padding. transmissionPayloadDataLength = primaryHeaderFields.segmentLength - (JFapChannelConstants.SIZEOF_PRIMARY_HEADER + JFapChannelConstants.SIZEOF_CONVERSATION_HEADER + JFapChannelConstants.SIZEOF_SEGMENT_START_HEADER); state = STATE_PARSE_SEGMENT_START_PAYLOAD; } } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "need more data"); needMoreData = true; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "parseSegmentStartHeader"); }
[ "private", "void", "parseSegmentStartHeader", "(", "WsByteBuffer", "contextBuffer", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "this", ",", "tc", ",", "\"parseSegmentStartHeader\"", ",", "contextBuffer", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "JFapUtils", ".", "debugTraceWsByteBufferInfo", "(", "this", ",", "tc", ",", "contextBuffer", ",", "\"contextBuffer\"", ")", ";", "WsByteBuffer", "rawData", "=", "readData", "(", "contextBuffer", ",", "unparsedFirstSegment", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "JFapUtils", ".", "debugTraceWsByteBufferInfo", "(", "this", ",", "tc", ",", "rawData", ",", "\"rawData\"", ")", ";", "if", "(", "rawData", "!=", "null", ")", "{", "segmentedTransmissionHeaderFields", "[", "primaryHeaderFields", ".", "priority", "]", ".", "totalLength", "=", "rawData", ".", "getLong", "(", ")", ";", "// D191832.1", "transmissionPayloadRemaining", "-=", "JFapChannelConstants", ".", "SIZEOF_SEGMENT_START_HEADER", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "SibTr", ".", "debug", "(", "this", ",", "tc", ",", "\"totalLenght: \"", "+", "segmentedTransmissionHeaderFields", "[", "primaryHeaderFields", ".", "priority", "]", ".", "totalLength", ")", ";", "// D191832.1", "if", "(", "segmentedTransmissionHeaderFields", "[", "primaryHeaderFields", ".", "priority", "]", ".", "totalLength", "<", "0", ")", "// D191832.1", "{", "throwable", "=", "new", "SIConnectionLostException", "(", "nls", ".", "getFormattedMessage", "(", "\"TRANSPARSER_PROTOCOLERROR_SICJ0053\"", ",", "new", "Object", "[", "]", "{", "connection", ".", "remoteHostAddress", ",", "connection", ".", "chainName", "}", ",", "\"TRANSPARSER_PROTOCOLERROR_SICJ0053\"", ")", ")", ";", "// D226223", "// This FFDC was generated because our peer sent a the start of a segmented transmission", "// with a segment size greater than the size suggested by the transmission size field.", "FFDCFilter", ".", "processException", "(", "throwable", ",", "\"com.ibm.ws.sib.jfapchannel.impl.InboundTransmissionParser\"", ",", "JFapChannelConstants", ".", "INBOUNDXMITPARSER_PARSESSHDR_01", ",", "getFormattedBytes", "(", "contextBuffer", ")", ")", ";", "// D267629", "state", "=", "STATE_ERROR", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "SibTr", ".", "debug", "(", "this", ",", "tc", ",", "\"Conversation lost after peer transmitted more data than initially indicated in first part of segmented transmission\"", ")", ";", "}", "else", "{", "// begin D191832.1", "segmentedTransmissionHeaderFields", "[", "primaryHeaderFields", ".", "priority", "]", ".", "segmentType", "=", "rawData", ".", "get", "(", ")", ";", "if", "(", "segmentedTransmissionHeaderFields", "[", "primaryHeaderFields", ".", "priority", "]", ".", "segmentType", "<", "0", ")", "segmentedTransmissionHeaderFields", "[", "primaryHeaderFields", ".", "priority", "]", ".", "segmentType", "+=", "256", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "SibTr", ".", "debug", "(", "this", ",", "tc", ",", "\"segmentType: \"", "+", "segmentedTransmissionHeaderFields", "[", "primaryHeaderFields", ".", "priority", "]", ".", "segmentType", ")", ";", "// end D191832.1", "rawData", ".", "position", "(", "rawData", ".", "position", "(", ")", "+", "3", ")", ";", "// skip padding.", "transmissionPayloadDataLength", "=", "primaryHeaderFields", ".", "segmentLength", "-", "(", "JFapChannelConstants", ".", "SIZEOF_PRIMARY_HEADER", "+", "JFapChannelConstants", ".", "SIZEOF_CONVERSATION_HEADER", "+", "JFapChannelConstants", ".", "SIZEOF_SEGMENT_START_HEADER", ")", ";", "state", "=", "STATE_PARSE_SEGMENT_START_PAYLOAD", ";", "}", "}", "else", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "SibTr", ".", "debug", "(", "this", ",", "tc", ",", "\"need more data\"", ")", ";", "needMoreData", "=", "true", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "this", ",", "tc", ",", "\"parseSegmentStartHeader\"", ")", ";", "}" ]
Invoked to parse a start segment header structure from the supplied buffer. May be invoked multiple times to incrementally parse the structure. Once the structure has been fully parsed, transitions the state machine into the appropriate next state based on the layout of the transmission. @param contextBuffer
[ "Invoked", "to", "parse", "a", "start", "segment", "header", "structure", "from", "the", "supplied", "buffer", ".", "May", "be", "invoked", "multiple", "times", "to", "incrementally", "parse", "the", "structure", ".", "Once", "the", "structure", "has", "been", "fully", "parsed", "transitions", "the", "state", "machine", "into", "the", "appropriate", "next", "state", "based", "on", "the", "layout", "of", "the", "transmission", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/InboundTransmissionParser.java#L508-L552
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/InboundTransmissionParser.java
InboundTransmissionParser.parsePrimaryOnlyPayload
private void parsePrimaryOnlyPayload(WsByteBuffer contextBuffer) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "parsePrimaryOnlyPayload", contextBuffer); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) JFapUtils.debugTraceWsByteBufferInfo(this, tc, contextBuffer, "contextBuffer"); WsByteBuffer dispatchToConnectionData = null; if ((unparsedPayloadData == null) && (transmissionPayloadDataLength > contextBuffer.remaining())) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "allocating unparsed payload data area, size="+transmissionPayloadDataLength); unparsedPayloadData = allocateWsByteBuffer(transmissionPayloadDataLength, false); unparsedPayloadData.position(0); unparsedPayloadData.limit(transmissionPayloadDataLength); } if (state != STATE_ERROR) { if (unparsedPayloadData != null) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) JFapUtils.debugTraceWsByteBufferInfo(this, tc, unparsedPayloadData, "unparsedPayloadData"); dispatchToConnectionData = readData(contextBuffer, unparsedPayloadData); if (dispatchToConnectionData != null) { final boolean closed = dispatchToConnection(dispatchToConnectionData); if(closed) { //If this dispatch resulted in the connection closing we shouldn't expect any more data so break out of loop. needMoreData = true; if(TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Connection closed, breaking out of loop"); } reset(); } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "need more data"); needMoreData = true; } } else { int contextBufferPosition = contextBuffer.position(); int contextBufferLimit = contextBuffer.limit(); contextBuffer.limit(contextBufferPosition+transmissionPayloadDataLength); final boolean closed = dispatchToConnection(contextBuffer); if(closed) { //If this dispatch resulted in the connection closing we shouldn't expect any more data so break out of loop. needMoreData = true; if(TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Connection closed, breaking out of loop"); } else { contextBuffer.limit(contextBufferLimit); contextBuffer.position(contextBufferPosition+transmissionPayloadDataLength); } reset(); } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "parsePrimaryOnlyPayload"); }
java
private void parsePrimaryOnlyPayload(WsByteBuffer contextBuffer) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "parsePrimaryOnlyPayload", contextBuffer); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) JFapUtils.debugTraceWsByteBufferInfo(this, tc, contextBuffer, "contextBuffer"); WsByteBuffer dispatchToConnectionData = null; if ((unparsedPayloadData == null) && (transmissionPayloadDataLength > contextBuffer.remaining())) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "allocating unparsed payload data area, size="+transmissionPayloadDataLength); unparsedPayloadData = allocateWsByteBuffer(transmissionPayloadDataLength, false); unparsedPayloadData.position(0); unparsedPayloadData.limit(transmissionPayloadDataLength); } if (state != STATE_ERROR) { if (unparsedPayloadData != null) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) JFapUtils.debugTraceWsByteBufferInfo(this, tc, unparsedPayloadData, "unparsedPayloadData"); dispatchToConnectionData = readData(contextBuffer, unparsedPayloadData); if (dispatchToConnectionData != null) { final boolean closed = dispatchToConnection(dispatchToConnectionData); if(closed) { //If this dispatch resulted in the connection closing we shouldn't expect any more data so break out of loop. needMoreData = true; if(TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Connection closed, breaking out of loop"); } reset(); } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "need more data"); needMoreData = true; } } else { int contextBufferPosition = contextBuffer.position(); int contextBufferLimit = contextBuffer.limit(); contextBuffer.limit(contextBufferPosition+transmissionPayloadDataLength); final boolean closed = dispatchToConnection(contextBuffer); if(closed) { //If this dispatch resulted in the connection closing we shouldn't expect any more data so break out of loop. needMoreData = true; if(TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Connection closed, breaking out of loop"); } else { contextBuffer.limit(contextBufferLimit); contextBuffer.position(contextBufferPosition+transmissionPayloadDataLength); } reset(); } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "parsePrimaryOnlyPayload"); }
[ "private", "void", "parsePrimaryOnlyPayload", "(", "WsByteBuffer", "contextBuffer", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "this", ",", "tc", ",", "\"parsePrimaryOnlyPayload\"", ",", "contextBuffer", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "JFapUtils", ".", "debugTraceWsByteBufferInfo", "(", "this", ",", "tc", ",", "contextBuffer", ",", "\"contextBuffer\"", ")", ";", "WsByteBuffer", "dispatchToConnectionData", "=", "null", ";", "if", "(", "(", "unparsedPayloadData", "==", "null", ")", "&&", "(", "transmissionPayloadDataLength", ">", "contextBuffer", ".", "remaining", "(", ")", ")", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "SibTr", ".", "debug", "(", "this", ",", "tc", ",", "\"allocating unparsed payload data area, size=\"", "+", "transmissionPayloadDataLength", ")", ";", "unparsedPayloadData", "=", "allocateWsByteBuffer", "(", "transmissionPayloadDataLength", ",", "false", ")", ";", "unparsedPayloadData", ".", "position", "(", "0", ")", ";", "unparsedPayloadData", ".", "limit", "(", "transmissionPayloadDataLength", ")", ";", "}", "if", "(", "state", "!=", "STATE_ERROR", ")", "{", "if", "(", "unparsedPayloadData", "!=", "null", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "JFapUtils", ".", "debugTraceWsByteBufferInfo", "(", "this", ",", "tc", ",", "unparsedPayloadData", ",", "\"unparsedPayloadData\"", ")", ";", "dispatchToConnectionData", "=", "readData", "(", "contextBuffer", ",", "unparsedPayloadData", ")", ";", "if", "(", "dispatchToConnectionData", "!=", "null", ")", "{", "final", "boolean", "closed", "=", "dispatchToConnection", "(", "dispatchToConnectionData", ")", ";", "if", "(", "closed", ")", "{", "//If this dispatch resulted in the connection closing we shouldn't expect any more data so break out of loop.", "needMoreData", "=", "true", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "SibTr", ".", "debug", "(", "this", ",", "tc", ",", "\"Connection closed, breaking out of loop\"", ")", ";", "}", "reset", "(", ")", ";", "}", "else", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "SibTr", ".", "debug", "(", "this", ",", "tc", ",", "\"need more data\"", ")", ";", "needMoreData", "=", "true", ";", "}", "}", "else", "{", "int", "contextBufferPosition", "=", "contextBuffer", ".", "position", "(", ")", ";", "int", "contextBufferLimit", "=", "contextBuffer", ".", "limit", "(", ")", ";", "contextBuffer", ".", "limit", "(", "contextBufferPosition", "+", "transmissionPayloadDataLength", ")", ";", "final", "boolean", "closed", "=", "dispatchToConnection", "(", "contextBuffer", ")", ";", "if", "(", "closed", ")", "{", "//If this dispatch resulted in the connection closing we shouldn't expect any more data so break out of loop.", "needMoreData", "=", "true", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "SibTr", ".", "debug", "(", "this", ",", "tc", ",", "\"Connection closed, breaking out of loop\"", ")", ";", "}", "else", "{", "contextBuffer", ".", "limit", "(", "contextBufferLimit", ")", ";", "contextBuffer", ".", "position", "(", "contextBufferPosition", "+", "transmissionPayloadDataLength", ")", ";", "}", "reset", "(", ")", ";", "}", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "this", ",", "tc", ",", "\"parsePrimaryOnlyPayload\"", ")", ";", "}" ]
Invoked to parse a primary header payload structure from the supplied buffer. May be invoked multiple times to incrementally parse the structure. Once the structure has been fully parsed, transitions the state machine into the appropriate next state based on the layout of the transmission. @param contextBuffer
[ "Invoked", "to", "parse", "a", "primary", "header", "payload", "structure", "from", "the", "supplied", "buffer", ".", "May", "be", "invoked", "multiple", "times", "to", "incrementally", "parse", "the", "structure", ".", "Once", "the", "structure", "has", "been", "fully", "parsed", "transitions", "the", "state", "machine", "into", "the", "appropriate", "next", "state", "based", "on", "the", "layout", "of", "the", "transmission", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/InboundTransmissionParser.java#L561-L626
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/InboundTransmissionParser.java
InboundTransmissionParser.parseConversationPayload
private void parseConversationPayload(WsByteBuffer contextBuffer) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "parseConversationPayload", contextBuffer); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) JFapUtils.debugTraceWsByteBufferInfo(this, tc, contextBuffer, "contextBuffer"); if (unparsedPayloadData == null) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "allocating unparsed data buffer, size="+transmissionPayloadDataLength); unparsedPayloadData = allocateWsByteBuffer(transmissionPayloadDataLength, primaryHeaderFields.isPooled); unparsedPayloadData.position(0); unparsedPayloadData.limit(transmissionPayloadDataLength); } if (state != STATE_ERROR) { int unparsedDataRemaining = unparsedPayloadData.remaining(); int amountCopied = JFapUtils.copyWsByteBuffer(contextBuffer, unparsedPayloadData, unparsedDataRemaining); if (amountCopied == unparsedDataRemaining) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "dispatching to conversation - amount cpoied = "+amountCopied); dispatchToConversation(unparsedPayloadData); if (state != STATE_ERROR) reset(); } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "need more data"); needMoreData = true; } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "parseConversationPayload"); }
java
private void parseConversationPayload(WsByteBuffer contextBuffer) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "parseConversationPayload", contextBuffer); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) JFapUtils.debugTraceWsByteBufferInfo(this, tc, contextBuffer, "contextBuffer"); if (unparsedPayloadData == null) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "allocating unparsed data buffer, size="+transmissionPayloadDataLength); unparsedPayloadData = allocateWsByteBuffer(transmissionPayloadDataLength, primaryHeaderFields.isPooled); unparsedPayloadData.position(0); unparsedPayloadData.limit(transmissionPayloadDataLength); } if (state != STATE_ERROR) { int unparsedDataRemaining = unparsedPayloadData.remaining(); int amountCopied = JFapUtils.copyWsByteBuffer(contextBuffer, unparsedPayloadData, unparsedDataRemaining); if (amountCopied == unparsedDataRemaining) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "dispatching to conversation - amount cpoied = "+amountCopied); dispatchToConversation(unparsedPayloadData); if (state != STATE_ERROR) reset(); } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "need more data"); needMoreData = true; } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "parseConversationPayload"); }
[ "private", "void", "parseConversationPayload", "(", "WsByteBuffer", "contextBuffer", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "this", ",", "tc", ",", "\"parseConversationPayload\"", ",", "contextBuffer", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "JFapUtils", ".", "debugTraceWsByteBufferInfo", "(", "this", ",", "tc", ",", "contextBuffer", ",", "\"contextBuffer\"", ")", ";", "if", "(", "unparsedPayloadData", "==", "null", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "SibTr", ".", "debug", "(", "this", ",", "tc", ",", "\"allocating unparsed data buffer, size=\"", "+", "transmissionPayloadDataLength", ")", ";", "unparsedPayloadData", "=", "allocateWsByteBuffer", "(", "transmissionPayloadDataLength", ",", "primaryHeaderFields", ".", "isPooled", ")", ";", "unparsedPayloadData", ".", "position", "(", "0", ")", ";", "unparsedPayloadData", ".", "limit", "(", "transmissionPayloadDataLength", ")", ";", "}", "if", "(", "state", "!=", "STATE_ERROR", ")", "{", "int", "unparsedDataRemaining", "=", "unparsedPayloadData", ".", "remaining", "(", ")", ";", "int", "amountCopied", "=", "JFapUtils", ".", "copyWsByteBuffer", "(", "contextBuffer", ",", "unparsedPayloadData", ",", "unparsedDataRemaining", ")", ";", "if", "(", "amountCopied", "==", "unparsedDataRemaining", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "SibTr", ".", "debug", "(", "this", ",", "tc", ",", "\"dispatching to conversation - amount cpoied = \"", "+", "amountCopied", ")", ";", "dispatchToConversation", "(", "unparsedPayloadData", ")", ";", "if", "(", "state", "!=", "STATE_ERROR", ")", "reset", "(", ")", ";", "}", "else", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "SibTr", ".", "debug", "(", "this", ",", "tc", ",", "\"need more data\"", ")", ";", "needMoreData", "=", "true", ";", "}", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "this", ",", "tc", ",", "\"parseConversationPayload\"", ")", ";", "}" ]
Invoked to parse a conversation payload structure from the supplied buffer. May be invoked multiple times to incrementally parse the structure. Once the structure has been fully parsed, transitions the state machine into the appropriate next state based on the layout of the transmission. @param contextBuffer
[ "Invoked", "to", "parse", "a", "conversation", "payload", "structure", "from", "the", "supplied", "buffer", ".", "May", "be", "invoked", "multiple", "times", "to", "incrementally", "parse", "the", "structure", ".", "Once", "the", "structure", "has", "been", "fully", "parsed", "transitions", "the", "state", "machine", "into", "the", "appropriate", "next", "state", "based", "on", "the", "layout", "of", "the", "transmission", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/InboundTransmissionParser.java#L635-L670
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/InboundTransmissionParser.java
InboundTransmissionParser.parseSegmentStartPayload
private void parseSegmentStartPayload(WsByteBuffer contextBuffer) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "parseSegmentStartPayload", contextBuffer); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) JFapUtils.debugTraceWsByteBufferInfo(this, tc, contextBuffer, "contextBuffer"); if (unparsedPayloadData == null) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "allocating unparsed payload data buffe, size="+segmentedTransmissionHeaderFields[primaryHeaderFields.priority].totalLength); // D191832.1 unparsedPayloadData = allocateWsByteBuffer((int)segmentedTransmissionHeaderFields[primaryHeaderFields.priority].totalLength, primaryHeaderFields.isPooled); // D191832.1 unparsedPayloadData.position(0); unparsedPayloadData.limit((int)segmentedTransmissionHeaderFields[primaryHeaderFields.priority].totalLength); // D191832.1 } if (state != STATE_ERROR) { int amountCopied = JFapUtils.copyWsByteBuffer(contextBuffer, unparsedPayloadData, transmissionPayloadRemaining); transmissionPayloadRemaining -= amountCopied; if (inFlightSegmentedTransmissions[primaryHeaderFields.priority] != null) { throwable = new SIConnectionLostException(nls.getFormattedMessage("TRANSPARSER_PROTOCOLERROR_SICJ0053", new Object[] {connection.remoteHostAddress, connection.chainName}, "TRANSPARSER_PROTOCOLERROR_SICJ0053")); // D226223 // This FFDC was generated because our peer sent us a duplicate start of a segmented // transmission. I.e. we already had a partial segmented transmission built for a // given priority level when our peer sent us the start of another. FFDCFilter.processException(throwable, "com.ibm.ws.sib.jfapchannel.impl.InboundTransmissionParser", JFapChannelConstants.INBOUNDXMITPARSER_PARSESSPAYLOAD_01, getFormattedBytes(contextBuffer)); // D267629 state = STATE_ERROR; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Received the start of a segmented transmission whilst already processing a segmented transmission at the same priority level"); } else { needMoreData = (contextBuffer.remaining() == 0); if (!needMoreData) { inFlightSegmentedTransmissions[primaryHeaderFields.priority] = unparsedPayloadData; // begin F193735.3 if (type == Conversation.ME) meReadBytes += unparsedPayloadData.remaining(); else if (type == Conversation.CLIENT) clientReadBytes -= unparsedPayloadData.remaining(); // end F193735.3 reset(); } } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "parseSegmentStartPayload"); }
java
private void parseSegmentStartPayload(WsByteBuffer contextBuffer) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "parseSegmentStartPayload", contextBuffer); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) JFapUtils.debugTraceWsByteBufferInfo(this, tc, contextBuffer, "contextBuffer"); if (unparsedPayloadData == null) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "allocating unparsed payload data buffe, size="+segmentedTransmissionHeaderFields[primaryHeaderFields.priority].totalLength); // D191832.1 unparsedPayloadData = allocateWsByteBuffer((int)segmentedTransmissionHeaderFields[primaryHeaderFields.priority].totalLength, primaryHeaderFields.isPooled); // D191832.1 unparsedPayloadData.position(0); unparsedPayloadData.limit((int)segmentedTransmissionHeaderFields[primaryHeaderFields.priority].totalLength); // D191832.1 } if (state != STATE_ERROR) { int amountCopied = JFapUtils.copyWsByteBuffer(contextBuffer, unparsedPayloadData, transmissionPayloadRemaining); transmissionPayloadRemaining -= amountCopied; if (inFlightSegmentedTransmissions[primaryHeaderFields.priority] != null) { throwable = new SIConnectionLostException(nls.getFormattedMessage("TRANSPARSER_PROTOCOLERROR_SICJ0053", new Object[] {connection.remoteHostAddress, connection.chainName}, "TRANSPARSER_PROTOCOLERROR_SICJ0053")); // D226223 // This FFDC was generated because our peer sent us a duplicate start of a segmented // transmission. I.e. we already had a partial segmented transmission built for a // given priority level when our peer sent us the start of another. FFDCFilter.processException(throwable, "com.ibm.ws.sib.jfapchannel.impl.InboundTransmissionParser", JFapChannelConstants.INBOUNDXMITPARSER_PARSESSPAYLOAD_01, getFormattedBytes(contextBuffer)); // D267629 state = STATE_ERROR; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Received the start of a segmented transmission whilst already processing a segmented transmission at the same priority level"); } else { needMoreData = (contextBuffer.remaining() == 0); if (!needMoreData) { inFlightSegmentedTransmissions[primaryHeaderFields.priority] = unparsedPayloadData; // begin F193735.3 if (type == Conversation.ME) meReadBytes += unparsedPayloadData.remaining(); else if (type == Conversation.CLIENT) clientReadBytes -= unparsedPayloadData.remaining(); // end F193735.3 reset(); } } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "parseSegmentStartPayload"); }
[ "private", "void", "parseSegmentStartPayload", "(", "WsByteBuffer", "contextBuffer", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "this", ",", "tc", ",", "\"parseSegmentStartPayload\"", ",", "contextBuffer", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "JFapUtils", ".", "debugTraceWsByteBufferInfo", "(", "this", ",", "tc", ",", "contextBuffer", ",", "\"contextBuffer\"", ")", ";", "if", "(", "unparsedPayloadData", "==", "null", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "SibTr", ".", "debug", "(", "this", ",", "tc", ",", "\"allocating unparsed payload data buffe, size=\"", "+", "segmentedTransmissionHeaderFields", "[", "primaryHeaderFields", ".", "priority", "]", ".", "totalLength", ")", ";", "// D191832.1", "unparsedPayloadData", "=", "allocateWsByteBuffer", "(", "(", "int", ")", "segmentedTransmissionHeaderFields", "[", "primaryHeaderFields", ".", "priority", "]", ".", "totalLength", ",", "primaryHeaderFields", ".", "isPooled", ")", ";", "// D191832.1", "unparsedPayloadData", ".", "position", "(", "0", ")", ";", "unparsedPayloadData", ".", "limit", "(", "(", "int", ")", "segmentedTransmissionHeaderFields", "[", "primaryHeaderFields", ".", "priority", "]", ".", "totalLength", ")", ";", "// D191832.1", "}", "if", "(", "state", "!=", "STATE_ERROR", ")", "{", "int", "amountCopied", "=", "JFapUtils", ".", "copyWsByteBuffer", "(", "contextBuffer", ",", "unparsedPayloadData", ",", "transmissionPayloadRemaining", ")", ";", "transmissionPayloadRemaining", "-=", "amountCopied", ";", "if", "(", "inFlightSegmentedTransmissions", "[", "primaryHeaderFields", ".", "priority", "]", "!=", "null", ")", "{", "throwable", "=", "new", "SIConnectionLostException", "(", "nls", ".", "getFormattedMessage", "(", "\"TRANSPARSER_PROTOCOLERROR_SICJ0053\"", ",", "new", "Object", "[", "]", "{", "connection", ".", "remoteHostAddress", ",", "connection", ".", "chainName", "}", ",", "\"TRANSPARSER_PROTOCOLERROR_SICJ0053\"", ")", ")", ";", "// D226223", "// This FFDC was generated because our peer sent us a duplicate start of a segmented", "// transmission. I.e. we already had a partial segmented transmission built for a", "// given priority level when our peer sent us the start of another.", "FFDCFilter", ".", "processException", "(", "throwable", ",", "\"com.ibm.ws.sib.jfapchannel.impl.InboundTransmissionParser\"", ",", "JFapChannelConstants", ".", "INBOUNDXMITPARSER_PARSESSPAYLOAD_01", ",", "getFormattedBytes", "(", "contextBuffer", ")", ")", ";", "// D267629", "state", "=", "STATE_ERROR", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "SibTr", ".", "debug", "(", "this", ",", "tc", ",", "\"Received the start of a segmented transmission whilst already processing a segmented transmission at the same priority level\"", ")", ";", "}", "else", "{", "needMoreData", "=", "(", "contextBuffer", ".", "remaining", "(", ")", "==", "0", ")", ";", "if", "(", "!", "needMoreData", ")", "{", "inFlightSegmentedTransmissions", "[", "primaryHeaderFields", ".", "priority", "]", "=", "unparsedPayloadData", ";", "// begin F193735.3", "if", "(", "type", "==", "Conversation", ".", "ME", ")", "meReadBytes", "+=", "unparsedPayloadData", ".", "remaining", "(", ")", ";", "else", "if", "(", "type", "==", "Conversation", ".", "CLIENT", ")", "clientReadBytes", "-=", "unparsedPayloadData", ".", "remaining", "(", ")", ";", "// end F193735.3", "reset", "(", ")", ";", "}", "}", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "this", ",", "tc", ",", "\"parseSegmentStartPayload\"", ")", ";", "}" ]
Invoked to parse a segmented transmission start payload from the supplied buffer. May be invoked multiple times to incrementally parse the structure. Once the structure has been fully parsed, transitions the state machine into the appropriate next state based on the layout of the transmission. @param contextBuffer
[ "Invoked", "to", "parse", "a", "segmented", "transmission", "start", "payload", "from", "the", "supplied", "buffer", ".", "May", "be", "invoked", "multiple", "times", "to", "incrementally", "parse", "the", "structure", ".", "Once", "the", "structure", "has", "been", "fully", "parsed", "transitions", "the", "state", "machine", "into", "the", "appropriate", "next", "state", "based", "on", "the", "layout", "of", "the", "transmission", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/InboundTransmissionParser.java#L679-L727
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/InboundTransmissionParser.java
InboundTransmissionParser.parseSegmentMiddlePayload
private void parseSegmentMiddlePayload(WsByteBuffer contextBuffer) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "parseSegmentMiddlePayload", contextBuffer); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) JFapUtils.debugTraceWsByteBufferInfo(this, tc, contextBuffer, "contextBuffer"); WsByteBuffer partialTransmission = inFlightSegmentedTransmissions[primaryHeaderFields.priority]; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "partial transmission in slot "+primaryHeaderFields.priority+" = "+partialTransmission); int contextBufferRemaining = contextBuffer.remaining(); if (partialTransmission == null) { throwable = new SIConnectionLostException(nls.getFormattedMessage("TRANSPARSER_PROTOCOLERROR_SICJ0053", new Object[] {connection.remoteHostAddress, connection.chainName}, "TRANSPARSER_PROTOCOLERROR_SICJ0053")); // D226223 // This FFDC was generated because our peer sent the middle segment of a segmented // transmission without first sending the first segment. FFDCFilter.processException(throwable, "com.ibm.ws.sib.jfapchannel.impl.InboundTransmissionParser", JFapChannelConstants.INBOUNDXMITPARSER_PARSESMPAYLOAD_01, getFormattedBytes(contextBuffer)); // D267629 state = STATE_ERROR; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Received the middle segment of a segmented transmission prior to receiving a start segment."); } else if (partialTransmission.remaining() < transmissionPayloadRemaining) { throwable = new SIConnectionLostException(nls.getFormattedMessage("TRANSPARSER_PROTOCOLERROR_SICJ0053", new Object[] {connection.remoteHostAddress, connection.chainName}, "TRANSPARSER_PROTOCOLERROR_SICJ0053")); // D226223 // This FFDC was generated because our peer sent a middle segment of a segmented // transmission that would have made the overall transmitted data length greater // than that suggested in the first segment. FFDCFilter.processException(throwable, "com.ibm.ws.sib.jfapchannel.impl.InboundTransmissionParser", JFapChannelConstants.INBOUNDXMITPARSER_PARSESMPAYLOAD_02, getFormattedBytes(contextBuffer)); // D267629 state = STATE_ERROR; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Received a middle segment for a segmented transmission which makes the transmission larger than the peer indicated in the first segment."); } else { int amountCopied = JFapUtils.copyWsByteBuffer(contextBuffer, partialTransmission, transmissionPayloadRemaining); transmissionPayloadRemaining -= amountCopied; // begin F193735.3 if (type == Conversation.ME) meReadBytes -= amountCopied; else if (type == Conversation.CLIENT) clientReadBytes -= amountCopied; // end F193735.3 needMoreData = (amountCopied == contextBufferRemaining); if (!needMoreData) reset(); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "parseSegmentMiddlePayload"); }
java
private void parseSegmentMiddlePayload(WsByteBuffer contextBuffer) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "parseSegmentMiddlePayload", contextBuffer); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) JFapUtils.debugTraceWsByteBufferInfo(this, tc, contextBuffer, "contextBuffer"); WsByteBuffer partialTransmission = inFlightSegmentedTransmissions[primaryHeaderFields.priority]; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "partial transmission in slot "+primaryHeaderFields.priority+" = "+partialTransmission); int contextBufferRemaining = contextBuffer.remaining(); if (partialTransmission == null) { throwable = new SIConnectionLostException(nls.getFormattedMessage("TRANSPARSER_PROTOCOLERROR_SICJ0053", new Object[] {connection.remoteHostAddress, connection.chainName}, "TRANSPARSER_PROTOCOLERROR_SICJ0053")); // D226223 // This FFDC was generated because our peer sent the middle segment of a segmented // transmission without first sending the first segment. FFDCFilter.processException(throwable, "com.ibm.ws.sib.jfapchannel.impl.InboundTransmissionParser", JFapChannelConstants.INBOUNDXMITPARSER_PARSESMPAYLOAD_01, getFormattedBytes(contextBuffer)); // D267629 state = STATE_ERROR; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Received the middle segment of a segmented transmission prior to receiving a start segment."); } else if (partialTransmission.remaining() < transmissionPayloadRemaining) { throwable = new SIConnectionLostException(nls.getFormattedMessage("TRANSPARSER_PROTOCOLERROR_SICJ0053", new Object[] {connection.remoteHostAddress, connection.chainName}, "TRANSPARSER_PROTOCOLERROR_SICJ0053")); // D226223 // This FFDC was generated because our peer sent a middle segment of a segmented // transmission that would have made the overall transmitted data length greater // than that suggested in the first segment. FFDCFilter.processException(throwable, "com.ibm.ws.sib.jfapchannel.impl.InboundTransmissionParser", JFapChannelConstants.INBOUNDXMITPARSER_PARSESMPAYLOAD_02, getFormattedBytes(contextBuffer)); // D267629 state = STATE_ERROR; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Received a middle segment for a segmented transmission which makes the transmission larger than the peer indicated in the first segment."); } else { int amountCopied = JFapUtils.copyWsByteBuffer(contextBuffer, partialTransmission, transmissionPayloadRemaining); transmissionPayloadRemaining -= amountCopied; // begin F193735.3 if (type == Conversation.ME) meReadBytes -= amountCopied; else if (type == Conversation.CLIENT) clientReadBytes -= amountCopied; // end F193735.3 needMoreData = (amountCopied == contextBufferRemaining); if (!needMoreData) reset(); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "parseSegmentMiddlePayload"); }
[ "private", "void", "parseSegmentMiddlePayload", "(", "WsByteBuffer", "contextBuffer", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "this", ",", "tc", ",", "\"parseSegmentMiddlePayload\"", ",", "contextBuffer", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "JFapUtils", ".", "debugTraceWsByteBufferInfo", "(", "this", ",", "tc", ",", "contextBuffer", ",", "\"contextBuffer\"", ")", ";", "WsByteBuffer", "partialTransmission", "=", "inFlightSegmentedTransmissions", "[", "primaryHeaderFields", ".", "priority", "]", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "SibTr", ".", "debug", "(", "this", ",", "tc", ",", "\"partial transmission in slot \"", "+", "primaryHeaderFields", ".", "priority", "+", "\" = \"", "+", "partialTransmission", ")", ";", "int", "contextBufferRemaining", "=", "contextBuffer", ".", "remaining", "(", ")", ";", "if", "(", "partialTransmission", "==", "null", ")", "{", "throwable", "=", "new", "SIConnectionLostException", "(", "nls", ".", "getFormattedMessage", "(", "\"TRANSPARSER_PROTOCOLERROR_SICJ0053\"", ",", "new", "Object", "[", "]", "{", "connection", ".", "remoteHostAddress", ",", "connection", ".", "chainName", "}", ",", "\"TRANSPARSER_PROTOCOLERROR_SICJ0053\"", ")", ")", ";", "// D226223", "// This FFDC was generated because our peer sent the middle segment of a segmented", "// transmission without first sending the first segment.", "FFDCFilter", ".", "processException", "(", "throwable", ",", "\"com.ibm.ws.sib.jfapchannel.impl.InboundTransmissionParser\"", ",", "JFapChannelConstants", ".", "INBOUNDXMITPARSER_PARSESMPAYLOAD_01", ",", "getFormattedBytes", "(", "contextBuffer", ")", ")", ";", "// D267629", "state", "=", "STATE_ERROR", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "SibTr", ".", "debug", "(", "this", ",", "tc", ",", "\"Received the middle segment of a segmented transmission prior to receiving a start segment.\"", ")", ";", "}", "else", "if", "(", "partialTransmission", ".", "remaining", "(", ")", "<", "transmissionPayloadRemaining", ")", "{", "throwable", "=", "new", "SIConnectionLostException", "(", "nls", ".", "getFormattedMessage", "(", "\"TRANSPARSER_PROTOCOLERROR_SICJ0053\"", ",", "new", "Object", "[", "]", "{", "connection", ".", "remoteHostAddress", ",", "connection", ".", "chainName", "}", ",", "\"TRANSPARSER_PROTOCOLERROR_SICJ0053\"", ")", ")", ";", "// D226223", "// This FFDC was generated because our peer sent a middle segment of a segmented", "// transmission that would have made the overall transmitted data length greater", "// than that suggested in the first segment.", "FFDCFilter", ".", "processException", "(", "throwable", ",", "\"com.ibm.ws.sib.jfapchannel.impl.InboundTransmissionParser\"", ",", "JFapChannelConstants", ".", "INBOUNDXMITPARSER_PARSESMPAYLOAD_02", ",", "getFormattedBytes", "(", "contextBuffer", ")", ")", ";", "// D267629", "state", "=", "STATE_ERROR", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "SibTr", ".", "debug", "(", "this", ",", "tc", ",", "\"Received a middle segment for a segmented transmission which makes the transmission larger than the peer indicated in the first segment.\"", ")", ";", "}", "else", "{", "int", "amountCopied", "=", "JFapUtils", ".", "copyWsByteBuffer", "(", "contextBuffer", ",", "partialTransmission", ",", "transmissionPayloadRemaining", ")", ";", "transmissionPayloadRemaining", "-=", "amountCopied", ";", "// begin F193735.3", "if", "(", "type", "==", "Conversation", ".", "ME", ")", "meReadBytes", "-=", "amountCopied", ";", "else", "if", "(", "type", "==", "Conversation", ".", "CLIENT", ")", "clientReadBytes", "-=", "amountCopied", ";", "// end F193735.3", "needMoreData", "=", "(", "amountCopied", "==", "contextBufferRemaining", ")", ";", "if", "(", "!", "needMoreData", ")", "reset", "(", ")", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "this", ",", "tc", ",", "\"parseSegmentMiddlePayload\"", ")", ";", "}" ]
Invoked to parse a segmented transmission middle payload from the supplied buffer. May be invoked multiple times to incrementally parse the structure. Once the structure has been fully parsed, transitions the state machine into the appropriate next state based on the layout of the transmission. @param contextBuffer
[ "Invoked", "to", "parse", "a", "segmented", "transmission", "middle", "payload", "from", "the", "supplied", "buffer", ".", "May", "be", "invoked", "multiple", "times", "to", "incrementally", "parse", "the", "structure", ".", "Once", "the", "structure", "has", "been", "fully", "parsed", "transitions", "the", "state", "machine", "into", "the", "appropriate", "next", "state", "based", "on", "the", "layout", "of", "the", "transmission", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/InboundTransmissionParser.java#L736-L777
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/InboundTransmissionParser.java
InboundTransmissionParser.dispatchToConnection
private boolean dispatchToConnection(WsByteBuffer data) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "dispatchToConnection", data); //@stoptracescan@ if (TraceComponent.isAnyTracingEnabled()) JFapUtils.debugSummaryMessage(tc, connection, null, "received connection data with segment "+Integer.toHexString(primaryHeaderFields.segmentType)+" ("+JFapChannelConstants.getSegmentName(primaryHeaderFields.segmentType)+")"); //@starttracescan@ final boolean closed = connection.processData(primaryHeaderFields.segmentType, primaryHeaderFields.priority, primaryHeaderFields.isPooled, primaryHeaderFields.isExchange, data); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "dispatchToConnection", Boolean.valueOf(closed)); return closed; }
java
private boolean dispatchToConnection(WsByteBuffer data) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "dispatchToConnection", data); //@stoptracescan@ if (TraceComponent.isAnyTracingEnabled()) JFapUtils.debugSummaryMessage(tc, connection, null, "received connection data with segment "+Integer.toHexString(primaryHeaderFields.segmentType)+" ("+JFapChannelConstants.getSegmentName(primaryHeaderFields.segmentType)+")"); //@starttracescan@ final boolean closed = connection.processData(primaryHeaderFields.segmentType, primaryHeaderFields.priority, primaryHeaderFields.isPooled, primaryHeaderFields.isExchange, data); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "dispatchToConnection", Boolean.valueOf(closed)); return closed; }
[ "private", "boolean", "dispatchToConnection", "(", "WsByteBuffer", "data", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "this", ",", "tc", ",", "\"dispatchToConnection\"", ",", "data", ")", ";", "//@stoptracescan@", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", ")", "JFapUtils", ".", "debugSummaryMessage", "(", "tc", ",", "connection", ",", "null", ",", "\"received connection data with segment \"", "+", "Integer", ".", "toHexString", "(", "primaryHeaderFields", ".", "segmentType", ")", "+", "\" (\"", "+", "JFapChannelConstants", ".", "getSegmentName", "(", "primaryHeaderFields", ".", "segmentType", ")", "+", "\")\"", ")", ";", "//@starttracescan@", "final", "boolean", "closed", "=", "connection", ".", "processData", "(", "primaryHeaderFields", ".", "segmentType", ",", "primaryHeaderFields", ".", "priority", ",", "primaryHeaderFields", ".", "isPooled", ",", "primaryHeaderFields", ".", "isExchange", ",", "data", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "this", ",", "tc", ",", "\"dispatchToConnection\"", ",", "Boolean", ".", "valueOf", "(", "closed", ")", ")", ";", "return", "closed", ";", "}" ]
Dispatches a payload to the appropriate connection for processing. The implication of dispatching to a connection is that the payload did not have a conversation header on its transmission. @param data @returns true if this data resulted in the connection being closed and hence releasing its buffers
[ "Dispatches", "a", "payload", "to", "the", "appropriate", "connection", "for", "processing", ".", "The", "implication", "of", "dispatching", "to", "a", "connection", "is", "that", "the", "payload", "did", "not", "have", "a", "conversation", "header", "on", "its", "transmission", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/InboundTransmissionParser.java#L851-L860
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/InboundTransmissionParser.java
InboundTransmissionParser.reset
private void reset() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "reset"); throwable = null; state = STATE_PARSING_PRIMARY_HEADER; unparsedPrimaryHeader.position(0); unparsedPrimaryHeader.limit(JFapChannelConstants.SIZEOF_PRIMARY_HEADER); unparsedConversationHeader.position(0); unparsedConversationHeader.limit(JFapChannelConstants.SIZEOF_CONVERSATION_HEADER); unparsedFirstSegment.position(0); unparsedFirstSegment.limit(JFapChannelConstants.SIZEOF_SEGMENT_START_HEADER); unparsedPayloadData = null; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "reset"); }
java
private void reset() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "reset"); throwable = null; state = STATE_PARSING_PRIMARY_HEADER; unparsedPrimaryHeader.position(0); unparsedPrimaryHeader.limit(JFapChannelConstants.SIZEOF_PRIMARY_HEADER); unparsedConversationHeader.position(0); unparsedConversationHeader.limit(JFapChannelConstants.SIZEOF_CONVERSATION_HEADER); unparsedFirstSegment.position(0); unparsedFirstSegment.limit(JFapChannelConstants.SIZEOF_SEGMENT_START_HEADER); unparsedPayloadData = null; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "reset"); }
[ "private", "void", "reset", "(", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "this", ",", "tc", ",", "\"reset\"", ")", ";", "throwable", "=", "null", ";", "state", "=", "STATE_PARSING_PRIMARY_HEADER", ";", "unparsedPrimaryHeader", ".", "position", "(", "0", ")", ";", "unparsedPrimaryHeader", ".", "limit", "(", "JFapChannelConstants", ".", "SIZEOF_PRIMARY_HEADER", ")", ";", "unparsedConversationHeader", ".", "position", "(", "0", ")", ";", "unparsedConversationHeader", ".", "limit", "(", "JFapChannelConstants", ".", "SIZEOF_CONVERSATION_HEADER", ")", ";", "unparsedFirstSegment", ".", "position", "(", "0", ")", ";", "unparsedFirstSegment", ".", "limit", "(", "JFapChannelConstants", ".", "SIZEOF_SEGMENT_START_HEADER", ")", ";", "unparsedPayloadData", "=", "null", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "this", ",", "tc", ",", "\"reset\"", ")", ";", "}" ]
Resets the state of the parsing state machine so that it is read to parse another transmission.
[ "Resets", "the", "state", "of", "the", "parsing", "state", "machine", "so", "that", "it", "is", "read", "to", "parse", "another", "transmission", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/InboundTransmissionParser.java#L1100-L1118
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/InboundTransmissionParser.java
InboundTransmissionParser.readData
private WsByteBuffer readData(WsByteBuffer unparsedData, WsByteBuffer scratchArea) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "readData", new Object[] {unparsedData, scratchArea}); int scratchAreaRemaining = scratchArea.remaining(); int scratchAreaUsed = scratchArea.position(); WsByteBuffer retBuffer = null; if ((scratchAreaUsed == 0) && (unparsedData.remaining() >= scratchAreaRemaining)) { retBuffer = unparsedData; } else { int amountCopied = JFapUtils.copyWsByteBuffer(unparsedData, scratchArea, scratchAreaRemaining); if (amountCopied >= scratchAreaRemaining) { retBuffer = scratchArea; retBuffer.flip(); } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "readData", retBuffer); return retBuffer; }
java
private WsByteBuffer readData(WsByteBuffer unparsedData, WsByteBuffer scratchArea) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "readData", new Object[] {unparsedData, scratchArea}); int scratchAreaRemaining = scratchArea.remaining(); int scratchAreaUsed = scratchArea.position(); WsByteBuffer retBuffer = null; if ((scratchAreaUsed == 0) && (unparsedData.remaining() >= scratchAreaRemaining)) { retBuffer = unparsedData; } else { int amountCopied = JFapUtils.copyWsByteBuffer(unparsedData, scratchArea, scratchAreaRemaining); if (amountCopied >= scratchAreaRemaining) { retBuffer = scratchArea; retBuffer.flip(); } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "readData", retBuffer); return retBuffer; }
[ "private", "WsByteBuffer", "readData", "(", "WsByteBuffer", "unparsedData", ",", "WsByteBuffer", "scratchArea", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "this", ",", "tc", ",", "\"readData\"", ",", "new", "Object", "[", "]", "{", "unparsedData", ",", "scratchArea", "}", ")", ";", "int", "scratchAreaRemaining", "=", "scratchArea", ".", "remaining", "(", ")", ";", "int", "scratchAreaUsed", "=", "scratchArea", ".", "position", "(", ")", ";", "WsByteBuffer", "retBuffer", "=", "null", ";", "if", "(", "(", "scratchAreaUsed", "==", "0", ")", "&&", "(", "unparsedData", ".", "remaining", "(", ")", ">=", "scratchAreaRemaining", ")", ")", "{", "retBuffer", "=", "unparsedData", ";", "}", "else", "{", "int", "amountCopied", "=", "JFapUtils", ".", "copyWsByteBuffer", "(", "unparsedData", ",", "scratchArea", ",", "scratchAreaRemaining", ")", ";", "if", "(", "amountCopied", ">=", "scratchAreaRemaining", ")", "{", "retBuffer", "=", "scratchArea", ";", "retBuffer", ".", "flip", "(", ")", ";", "}", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "this", ",", "tc", ",", "\"readData\"", ",", "retBuffer", ")", ";", "return", "retBuffer", ";", "}" ]
Reads data from a buffer into a scratch area. @param unparsedData @param scratchArea @return
[ "Reads", "data", "from", "a", "buffer", "into", "a", "scratch", "area", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/InboundTransmissionParser.java#L1126-L1153
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/el/unified/resolver/ManagedBeanResolver.java
ManagedBeanResolver.createManagedBean
@SuppressWarnings("unchecked") private Object createManagedBean(final ManagedBean managedBean, final FacesContext facesContext) throws ELException { final ExternalContext extContext = facesContext.getExternalContext(); final Map<Object, Object> facesContextMap = facesContext.getAttributes(); final String managedBeanName = managedBean.getManagedBeanName(); // check for cyclic references List<String> beansUnderConstruction = (List<String>) facesContextMap.get(BEANS_UNDER_CONSTRUCTION); if (beansUnderConstruction == null) { beansUnderConstruction = new ArrayList<String>(); facesContextMap.put(BEANS_UNDER_CONSTRUCTION, beansUnderConstruction); } else if (beansUnderConstruction.contains(managedBeanName)) { throw new ELException("Detected cyclic reference to managedBean " + managedBeanName); } beansUnderConstruction.add(managedBeanName); Object obj = null; try { obj = beanBuilder.buildManagedBean(facesContext, managedBean); } finally { beansUnderConstruction.remove(managedBeanName); } putInScope(managedBean, facesContext, extContext, obj); return obj; }
java
@SuppressWarnings("unchecked") private Object createManagedBean(final ManagedBean managedBean, final FacesContext facesContext) throws ELException { final ExternalContext extContext = facesContext.getExternalContext(); final Map<Object, Object> facesContextMap = facesContext.getAttributes(); final String managedBeanName = managedBean.getManagedBeanName(); // check for cyclic references List<String> beansUnderConstruction = (List<String>) facesContextMap.get(BEANS_UNDER_CONSTRUCTION); if (beansUnderConstruction == null) { beansUnderConstruction = new ArrayList<String>(); facesContextMap.put(BEANS_UNDER_CONSTRUCTION, beansUnderConstruction); } else if (beansUnderConstruction.contains(managedBeanName)) { throw new ELException("Detected cyclic reference to managedBean " + managedBeanName); } beansUnderConstruction.add(managedBeanName); Object obj = null; try { obj = beanBuilder.buildManagedBean(facesContext, managedBean); } finally { beansUnderConstruction.remove(managedBeanName); } putInScope(managedBean, facesContext, extContext, obj); return obj; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "Object", "createManagedBean", "(", "final", "ManagedBean", "managedBean", ",", "final", "FacesContext", "facesContext", ")", "throws", "ELException", "{", "final", "ExternalContext", "extContext", "=", "facesContext", ".", "getExternalContext", "(", ")", ";", "final", "Map", "<", "Object", ",", "Object", ">", "facesContextMap", "=", "facesContext", ".", "getAttributes", "(", ")", ";", "final", "String", "managedBeanName", "=", "managedBean", ".", "getManagedBeanName", "(", ")", ";", "// check for cyclic references", "List", "<", "String", ">", "beansUnderConstruction", "=", "(", "List", "<", "String", ">", ")", "facesContextMap", ".", "get", "(", "BEANS_UNDER_CONSTRUCTION", ")", ";", "if", "(", "beansUnderConstruction", "==", "null", ")", "{", "beansUnderConstruction", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "facesContextMap", ".", "put", "(", "BEANS_UNDER_CONSTRUCTION", ",", "beansUnderConstruction", ")", ";", "}", "else", "if", "(", "beansUnderConstruction", ".", "contains", "(", "managedBeanName", ")", ")", "{", "throw", "new", "ELException", "(", "\"Detected cyclic reference to managedBean \"", "+", "managedBeanName", ")", ";", "}", "beansUnderConstruction", ".", "add", "(", "managedBeanName", ")", ";", "Object", "obj", "=", "null", ";", "try", "{", "obj", "=", "beanBuilder", ".", "buildManagedBean", "(", "facesContext", ",", "managedBean", ")", ";", "}", "finally", "{", "beansUnderConstruction", ".", "remove", "(", "managedBeanName", ")", ";", "}", "putInScope", "(", "managedBean", ",", "facesContext", ",", "extContext", ",", "obj", ")", ";", "return", "obj", ";", "}" ]
adapted from Manfred's JSF 1.1 VariableResolverImpl
[ "adapted", "from", "Manfred", "s", "JSF", "1", ".", "1", "VariableResolverImpl" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/el/unified/resolver/ManagedBeanResolver.java#L308-L343
train
OpenLiberty/open-liberty
dev/com.ibm.ws.container.service.compat/src/com/ibm/ejs/util/dopriv/SetContextClassLoaderPrivileged.java
SetContextClassLoaderPrivileged.run
public Object run() { Thread currentThread = Thread.currentThread(); oldClassLoader = threadContextAccessor.getContextClassLoader(currentThread); // 369927 // The following tests are done in a certain order to maximize performance if (newClassLoader == oldClassLoader) { wasChanged = false; } else if ((newClassLoader == null && oldClassLoader != null) || (newClassLoader != null && (oldClassLoader == null || !(newClassLoader.equals(oldClassLoader))))) { // class loaders are different, change to new one threadContextAccessor.setContextClassLoader(currentThread, newClassLoader); // 369927 wasChanged = true; } else wasChanged = false; return oldClassLoader; }
java
public Object run() { Thread currentThread = Thread.currentThread(); oldClassLoader = threadContextAccessor.getContextClassLoader(currentThread); // 369927 // The following tests are done in a certain order to maximize performance if (newClassLoader == oldClassLoader) { wasChanged = false; } else if ((newClassLoader == null && oldClassLoader != null) || (newClassLoader != null && (oldClassLoader == null || !(newClassLoader.equals(oldClassLoader))))) { // class loaders are different, change to new one threadContextAccessor.setContextClassLoader(currentThread, newClassLoader); // 369927 wasChanged = true; } else wasChanged = false; return oldClassLoader; }
[ "public", "Object", "run", "(", ")", "{", "Thread", "currentThread", "=", "Thread", ".", "currentThread", "(", ")", ";", "oldClassLoader", "=", "threadContextAccessor", ".", "getContextClassLoader", "(", "currentThread", ")", ";", "// 369927", "// The following tests are done in a certain order to maximize performance", "if", "(", "newClassLoader", "==", "oldClassLoader", ")", "{", "wasChanged", "=", "false", ";", "}", "else", "if", "(", "(", "newClassLoader", "==", "null", "&&", "oldClassLoader", "!=", "null", ")", "||", "(", "newClassLoader", "!=", "null", "&&", "(", "oldClassLoader", "==", "null", "||", "!", "(", "newClassLoader", ".", "equals", "(", "oldClassLoader", ")", ")", ")", ")", ")", "{", "// class loaders are different, change to new one", "threadContextAccessor", ".", "setContextClassLoader", "(", "currentThread", ",", "newClassLoader", ")", ";", "// 369927", "wasChanged", "=", "true", ";", "}", "else", "wasChanged", "=", "false", ";", "return", "oldClassLoader", ";", "}" ]
146064.3
[ "146064", ".", "3" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.container.service.compat/src/com/ibm/ejs/util/dopriv/SetContextClassLoaderPrivileged.java#L85-L102
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/jdbc/internal/PropertyService.java
PropertyService.isPassword
public static final boolean isPassword(String name) { return PASSWORD_PROPS.contains(name) || name.toLowerCase().contains(DataSourceDef.password.name()); }
java
public static final boolean isPassword(String name) { return PASSWORD_PROPS.contains(name) || name.toLowerCase().contains(DataSourceDef.password.name()); }
[ "public", "static", "final", "boolean", "isPassword", "(", "String", "name", ")", "{", "return", "PASSWORD_PROPS", ".", "contains", "(", "name", ")", "||", "name", ".", "toLowerCase", "(", ")", ".", "contains", "(", "DataSourceDef", ".", "password", ".", "name", "(", ")", ")", ";", "}" ]
Determines, based on the name of a property, if we expect the value might contain a password. @param name property name. @return true if the property value might be expected to contain a password, otherwise false.
[ "Determines", "based", "on", "the", "name", "of", "a", "property", "if", "we", "expect", "the", "value", "might", "contain", "a", "password", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/jdbc/internal/PropertyService.java#L204-L206
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/jdbc/internal/PropertyService.java
PropertyService.parseDurationProperties
public static void parseDurationProperties(Map<String, Object> vendorProps, String className, ConnectorService connectorSvc) throws Exception { // type=long, unit=milliseconds for (String propName : PropertyService.DURATION_MS_LONG_PROPS) { Object propValue = vendorProps.remove(propName); if (propValue != null) try { vendorProps.put(propName, MetatypeUtils.evaluateDuration((String) propValue, TimeUnit.MILLISECONDS)); } catch (Exception x) { x = connectorSvc.ignoreWarnOrFail(tc, x, x.getClass(), "UNSUPPORTED_VALUE_J2CA8011", propValue, propName, className); if (x != null) throw x; } } // type=int, unit=milliseconds for (String propName : PropertyService.DURATION_MS_INT_PROPS) { Object propValue = vendorProps.remove(propName); if (propValue != null) try { vendorProps.put(propName, MetatypeUtils.evaluateDuration((String) propValue, TimeUnit.MILLISECONDS).intValue()); } catch (Exception x) { x = connectorSvc.ignoreWarnOrFail(tc, x, x.getClass(), "UNSUPPORTED_VALUE_J2CA8011", propValue, propName, className); if (x != null) throw x; } } // type=int, unit=seconds for (String propName : PropertyService.DURATION_S_INT_PROPS) { Object propValue = vendorProps.remove(propName); if (propValue != null) if (propValue instanceof String) try { vendorProps.put(propName, MetatypeUtils.evaluateDuration((String) propValue, TimeUnit.SECONDS).intValue()); } catch (Exception x) { x = connectorSvc.ignoreWarnOrFail(tc, x, x.getClass(), "UNSUPPORTED_VALUE_J2CA8011", propValue, propName, className); if (x != null) throw x; } else // loginTimeout is already converted to int vendorProps.put(propName, propValue); } // lockTimeout has different type/units between Microsoft and DB2 i Object lockTimeout = vendorProps.remove("lockTimeout"); if (lockTimeout != null) try { if (className.startsWith("com.microsoft")) vendorProps.put("lockTimeout", MetatypeUtils.evaluateDuration((String) lockTimeout, TimeUnit.MILLISECONDS)); else vendorProps.put("lockTimeout", MetatypeUtils.evaluateDuration((String) lockTimeout, TimeUnit.SECONDS).intValue()); } catch (Exception x) { x = connectorSvc.ignoreWarnOrFail(tc, x, x.getClass(), "UNSUPPORTED_VALUE_J2CA8011", lockTimeout, "lockTimeout", className); if (x != null) throw x; } }
java
public static void parseDurationProperties(Map<String, Object> vendorProps, String className, ConnectorService connectorSvc) throws Exception { // type=long, unit=milliseconds for (String propName : PropertyService.DURATION_MS_LONG_PROPS) { Object propValue = vendorProps.remove(propName); if (propValue != null) try { vendorProps.put(propName, MetatypeUtils.evaluateDuration((String) propValue, TimeUnit.MILLISECONDS)); } catch (Exception x) { x = connectorSvc.ignoreWarnOrFail(tc, x, x.getClass(), "UNSUPPORTED_VALUE_J2CA8011", propValue, propName, className); if (x != null) throw x; } } // type=int, unit=milliseconds for (String propName : PropertyService.DURATION_MS_INT_PROPS) { Object propValue = vendorProps.remove(propName); if (propValue != null) try { vendorProps.put(propName, MetatypeUtils.evaluateDuration((String) propValue, TimeUnit.MILLISECONDS).intValue()); } catch (Exception x) { x = connectorSvc.ignoreWarnOrFail(tc, x, x.getClass(), "UNSUPPORTED_VALUE_J2CA8011", propValue, propName, className); if (x != null) throw x; } } // type=int, unit=seconds for (String propName : PropertyService.DURATION_S_INT_PROPS) { Object propValue = vendorProps.remove(propName); if (propValue != null) if (propValue instanceof String) try { vendorProps.put(propName, MetatypeUtils.evaluateDuration((String) propValue, TimeUnit.SECONDS).intValue()); } catch (Exception x) { x = connectorSvc.ignoreWarnOrFail(tc, x, x.getClass(), "UNSUPPORTED_VALUE_J2CA8011", propValue, propName, className); if (x != null) throw x; } else // loginTimeout is already converted to int vendorProps.put(propName, propValue); } // lockTimeout has different type/units between Microsoft and DB2 i Object lockTimeout = vendorProps.remove("lockTimeout"); if (lockTimeout != null) try { if (className.startsWith("com.microsoft")) vendorProps.put("lockTimeout", MetatypeUtils.evaluateDuration((String) lockTimeout, TimeUnit.MILLISECONDS)); else vendorProps.put("lockTimeout", MetatypeUtils.evaluateDuration((String) lockTimeout, TimeUnit.SECONDS).intValue()); } catch (Exception x) { x = connectorSvc.ignoreWarnOrFail(tc, x, x.getClass(), "UNSUPPORTED_VALUE_J2CA8011", lockTimeout, "lockTimeout", className); if (x != null) throw x; } }
[ "public", "static", "void", "parseDurationProperties", "(", "Map", "<", "String", ",", "Object", ">", "vendorProps", ",", "String", "className", ",", "ConnectorService", "connectorSvc", ")", "throws", "Exception", "{", "// type=long, unit=milliseconds", "for", "(", "String", "propName", ":", "PropertyService", ".", "DURATION_MS_LONG_PROPS", ")", "{", "Object", "propValue", "=", "vendorProps", ".", "remove", "(", "propName", ")", ";", "if", "(", "propValue", "!=", "null", ")", "try", "{", "vendorProps", ".", "put", "(", "propName", ",", "MetatypeUtils", ".", "evaluateDuration", "(", "(", "String", ")", "propValue", ",", "TimeUnit", ".", "MILLISECONDS", ")", ")", ";", "}", "catch", "(", "Exception", "x", ")", "{", "x", "=", "connectorSvc", ".", "ignoreWarnOrFail", "(", "tc", ",", "x", ",", "x", ".", "getClass", "(", ")", ",", "\"UNSUPPORTED_VALUE_J2CA8011\"", ",", "propValue", ",", "propName", ",", "className", ")", ";", "if", "(", "x", "!=", "null", ")", "throw", "x", ";", "}", "}", "// type=int, unit=milliseconds", "for", "(", "String", "propName", ":", "PropertyService", ".", "DURATION_MS_INT_PROPS", ")", "{", "Object", "propValue", "=", "vendorProps", ".", "remove", "(", "propName", ")", ";", "if", "(", "propValue", "!=", "null", ")", "try", "{", "vendorProps", ".", "put", "(", "propName", ",", "MetatypeUtils", ".", "evaluateDuration", "(", "(", "String", ")", "propValue", ",", "TimeUnit", ".", "MILLISECONDS", ")", ".", "intValue", "(", ")", ")", ";", "}", "catch", "(", "Exception", "x", ")", "{", "x", "=", "connectorSvc", ".", "ignoreWarnOrFail", "(", "tc", ",", "x", ",", "x", ".", "getClass", "(", ")", ",", "\"UNSUPPORTED_VALUE_J2CA8011\"", ",", "propValue", ",", "propName", ",", "className", ")", ";", "if", "(", "x", "!=", "null", ")", "throw", "x", ";", "}", "}", "// type=int, unit=seconds", "for", "(", "String", "propName", ":", "PropertyService", ".", "DURATION_S_INT_PROPS", ")", "{", "Object", "propValue", "=", "vendorProps", ".", "remove", "(", "propName", ")", ";", "if", "(", "propValue", "!=", "null", ")", "if", "(", "propValue", "instanceof", "String", ")", "try", "{", "vendorProps", ".", "put", "(", "propName", ",", "MetatypeUtils", ".", "evaluateDuration", "(", "(", "String", ")", "propValue", ",", "TimeUnit", ".", "SECONDS", ")", ".", "intValue", "(", ")", ")", ";", "}", "catch", "(", "Exception", "x", ")", "{", "x", "=", "connectorSvc", ".", "ignoreWarnOrFail", "(", "tc", ",", "x", ",", "x", ".", "getClass", "(", ")", ",", "\"UNSUPPORTED_VALUE_J2CA8011\"", ",", "propValue", ",", "propName", ",", "className", ")", ";", "if", "(", "x", "!=", "null", ")", "throw", "x", ";", "}", "else", "// loginTimeout is already converted to int", "vendorProps", ".", "put", "(", "propName", ",", "propValue", ")", ";", "}", "// lockTimeout has different type/units between Microsoft and DB2 i", "Object", "lockTimeout", "=", "vendorProps", ".", "remove", "(", "\"lockTimeout\"", ")", ";", "if", "(", "lockTimeout", "!=", "null", ")", "try", "{", "if", "(", "className", ".", "startsWith", "(", "\"com.microsoft\"", ")", ")", "vendorProps", ".", "put", "(", "\"lockTimeout\"", ",", "MetatypeUtils", ".", "evaluateDuration", "(", "(", "String", ")", "lockTimeout", ",", "TimeUnit", ".", "MILLISECONDS", ")", ")", ";", "else", "vendorProps", ".", "put", "(", "\"lockTimeout\"", ",", "MetatypeUtils", ".", "evaluateDuration", "(", "(", "String", ")", "lockTimeout", ",", "TimeUnit", ".", "SECONDS", ")", ".", "intValue", "(", ")", ")", ";", "}", "catch", "(", "Exception", "x", ")", "{", "x", "=", "connectorSvc", ".", "ignoreWarnOrFail", "(", "tc", ",", "x", ",", "x", ".", "getClass", "(", ")", ",", "\"UNSUPPORTED_VALUE_J2CA8011\"", ",", "lockTimeout", ",", "\"lockTimeout\"", ",", "className", ")", ";", "if", "(", "x", "!=", "null", ")", "throw", "x", ";", "}", "}" ]
Parse and convert duration type properties. @param vendorProps the vendor properties. @param className data source implementation class name. @param connectorSvc connector service. @throws Exception if an error occurs.
[ "Parse", "and", "convert", "duration", "type", "properties", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/jdbc/internal/PropertyService.java#L216-L274
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/jdbc/internal/PropertyService.java
PropertyService.parsePasswordProperties
public static final void parsePasswordProperties(Map<String, Object> vendorProps) { for (String propName : PASSWORD_PROPS) { String propValue = (String) vendorProps.remove(propName); if (propValue != null) vendorProps.put(propName, new SerializableProtectedString(propValue.toCharArray())); } }
java
public static final void parsePasswordProperties(Map<String, Object> vendorProps) { for (String propName : PASSWORD_PROPS) { String propValue = (String) vendorProps.remove(propName); if (propValue != null) vendorProps.put(propName, new SerializableProtectedString(propValue.toCharArray())); } }
[ "public", "static", "final", "void", "parsePasswordProperties", "(", "Map", "<", "String", ",", "Object", ">", "vendorProps", ")", "{", "for", "(", "String", "propName", ":", "PASSWORD_PROPS", ")", "{", "String", "propValue", "=", "(", "String", ")", "vendorProps", ".", "remove", "(", "propName", ")", ";", "if", "(", "propValue", "!=", "null", ")", "vendorProps", ".", "put", "(", "propName", ",", "new", "SerializableProtectedString", "(", "propValue", ".", "toCharArray", "(", ")", ")", ")", ";", "}", "}" ]
Parse and convert password properties to SerializableProtectedString. @param vendorProps
[ "Parse", "and", "convert", "password", "properties", "to", "SerializableProtectedString", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/jdbc/internal/PropertyService.java#L281-L288
train
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/Queue.java
Queue.removeTail
public QueueElement removeTail() { if (head == null) { return null; } QueueElement result = tail; if (result.previous == null) { head = null; tail = null; } else { tail = result.previous; tail.next = null; } result.previous = null; result.next = null; result.queue = null; numElements--; return result; }
java
public QueueElement removeTail() { if (head == null) { return null; } QueueElement result = tail; if (result.previous == null) { head = null; tail = null; } else { tail = result.previous; tail.next = null; } result.previous = null; result.next = null; result.queue = null; numElements--; return result; }
[ "public", "QueueElement", "removeTail", "(", ")", "{", "if", "(", "head", "==", "null", ")", "{", "return", "null", ";", "}", "QueueElement", "result", "=", "tail", ";", "if", "(", "result", ".", "previous", "==", "null", ")", "{", "head", "=", "null", ";", "tail", "=", "null", ";", "}", "else", "{", "tail", "=", "result", ".", "previous", ";", "tail", ".", "next", "=", "null", ";", "}", "result", ".", "previous", "=", "null", ";", "result", ".", "next", "=", "null", ";", "result", ".", "queue", "=", "null", ";", "numElements", "--", ";", "return", "result", ";", "}" ]
Remove the element at the tail of this queue and return it. If the queue is empty return null.
[ "Remove", "the", "element", "at", "the", "tail", "of", "this", "queue", "and", "return", "it", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/Queue.java#L150-L171
train
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/RemoteResultCollector.java
RemoteResultCollector.getLogLists
public RemoteAllResults getLogLists(LogQueryBean logQueryBean, RepositoryPointer after) throws LogRepositoryException { RemoteAllResults result = new RemoteAllResults(logQueryBean); Iterable<ServerInstanceLogRecordList> lists; if (after == null) { lists = logReader.getLogLists(logQueryBean); } else { lists = logReader.getLogLists(after, logQueryBean); } for (ServerInstanceLogRecordList instance: lists) { result.addInstance(instance.getStartTime()); } return result; }
java
public RemoteAllResults getLogLists(LogQueryBean logQueryBean, RepositoryPointer after) throws LogRepositoryException { RemoteAllResults result = new RemoteAllResults(logQueryBean); Iterable<ServerInstanceLogRecordList> lists; if (after == null) { lists = logReader.getLogLists(logQueryBean); } else { lists = logReader.getLogLists(after, logQueryBean); } for (ServerInstanceLogRecordList instance: lists) { result.addInstance(instance.getStartTime()); } return result; }
[ "public", "RemoteAllResults", "getLogLists", "(", "LogQueryBean", "logQueryBean", ",", "RepositoryPointer", "after", ")", "throws", "LogRepositoryException", "{", "RemoteAllResults", "result", "=", "new", "RemoteAllResults", "(", "logQueryBean", ")", ";", "Iterable", "<", "ServerInstanceLogRecordList", ">", "lists", ";", "if", "(", "after", "==", "null", ")", "{", "lists", "=", "logReader", ".", "getLogLists", "(", "logQueryBean", ")", ";", "}", "else", "{", "lists", "=", "logReader", ".", "getLogLists", "(", "after", ",", "logQueryBean", ")", ";", "}", "for", "(", "ServerInstanceLogRecordList", "instance", ":", "lists", ")", "{", "result", ".", "addInstance", "(", "instance", ".", "getStartTime", "(", ")", ")", ";", "}", "return", "result", ";", "}" ]
retrieves results for all server instances in the repository. @param logQueryBean query indicator @param after starting location of instances to be return. @return Set of all server instances satisfying the query request. @throws LogRepositoryException indicating that an error occurred while reading list of instances from the server.
[ "retrieves", "results", "for", "all", "server", "instances", "in", "the", "repository", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/RemoteResultCollector.java#L45-L57
train
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/RemoteResultCollector.java
RemoteResultCollector.getLogListForServerInstance
public RemoteInstanceResult getLogListForServerInstance(RemoteInstanceDetails indicator, RepositoryPointer after, int offset, int maxRecords, Locale locale) throws LogRepositoryException { ServerInstanceLogRecordList instance; // Pointer should be used only if start time is null. This way the same query object can be reused // for different server instances and start time value will indicate if pointer should be used. if (after == null) { instance = logReader.getLogListForServerInstance(indicator.getStartTime(), indicator.getQuery()); for (String key: indicator.getProcPath()) { instance = instance.getChildren().get(key); if (instance == null) { // Specified subprocess is not found (most probably it was purged already). Return an empty result. return new RemoteInstanceResult(null, null, new HashSet<String>()); } } } else { instance = logReader.getLogListForServerInstance(after, indicator.getQuery()); } RemoteInstanceResult result; // Return start time, header, and subprocess info only on the first request (where cache is not set yet). if (indicator.getCache() == null) { result = new RemoteInstanceResult(instance.getStartTime(), instance.getHeader(), instance.getChildren().keySet()); } else { result = new RemoteInstanceResult(null, null, new HashSet<String>()); if (instance instanceof ServerInstanceLogRecordListImpl) { ((ServerInstanceLogRecordListImpl)instance).setCache(indicator.getCache()); } } // Allow maxRecords to be 0 if caller is interested in instance header only. if (maxRecords != 0) { for (RepositoryLogRecord record: instance.range(offset, maxRecords)) { if (locale != null && !locale.toString().equals(record.getMessageLocale()) && record instanceof RepositoryLogRecordImpl) { RepositoryLogRecordImpl recordImpl = (RepositoryLogRecordImpl)record; recordImpl.setLocalizedMessage(HpelFormatter.translateMessage(record, locale)); recordImpl.setMessageLocale(locale.toString()); } result.addRecord(record); } } // Return cache back only if caller does not have complete set if (instance instanceof ServerInstanceLogRecordListImpl && (indicator.getCache()==null || !indicator.getCache().isComplete())) { result.setCache(((ServerInstanceLogRecordListImpl)instance).getCache()); } return result; }
java
public RemoteInstanceResult getLogListForServerInstance(RemoteInstanceDetails indicator, RepositoryPointer after, int offset, int maxRecords, Locale locale) throws LogRepositoryException { ServerInstanceLogRecordList instance; // Pointer should be used only if start time is null. This way the same query object can be reused // for different server instances and start time value will indicate if pointer should be used. if (after == null) { instance = logReader.getLogListForServerInstance(indicator.getStartTime(), indicator.getQuery()); for (String key: indicator.getProcPath()) { instance = instance.getChildren().get(key); if (instance == null) { // Specified subprocess is not found (most probably it was purged already). Return an empty result. return new RemoteInstanceResult(null, null, new HashSet<String>()); } } } else { instance = logReader.getLogListForServerInstance(after, indicator.getQuery()); } RemoteInstanceResult result; // Return start time, header, and subprocess info only on the first request (where cache is not set yet). if (indicator.getCache() == null) { result = new RemoteInstanceResult(instance.getStartTime(), instance.getHeader(), instance.getChildren().keySet()); } else { result = new RemoteInstanceResult(null, null, new HashSet<String>()); if (instance instanceof ServerInstanceLogRecordListImpl) { ((ServerInstanceLogRecordListImpl)instance).setCache(indicator.getCache()); } } // Allow maxRecords to be 0 if caller is interested in instance header only. if (maxRecords != 0) { for (RepositoryLogRecord record: instance.range(offset, maxRecords)) { if (locale != null && !locale.toString().equals(record.getMessageLocale()) && record instanceof RepositoryLogRecordImpl) { RepositoryLogRecordImpl recordImpl = (RepositoryLogRecordImpl)record; recordImpl.setLocalizedMessage(HpelFormatter.translateMessage(record, locale)); recordImpl.setMessageLocale(locale.toString()); } result.addRecord(record); } } // Return cache back only if caller does not have complete set if (instance instanceof ServerInstanceLogRecordListImpl && (indicator.getCache()==null || !indicator.getCache().isComplete())) { result.setCache(((ServerInstanceLogRecordListImpl)instance).getCache()); } return result; }
[ "public", "RemoteInstanceResult", "getLogListForServerInstance", "(", "RemoteInstanceDetails", "indicator", ",", "RepositoryPointer", "after", ",", "int", "offset", ",", "int", "maxRecords", ",", "Locale", "locale", ")", "throws", "LogRepositoryException", "{", "ServerInstanceLogRecordList", "instance", ";", "// Pointer should be used only if start time is null. This way the same query object can be reused", "// for different server instances and start time value will indicate if pointer should be used.", "if", "(", "after", "==", "null", ")", "{", "instance", "=", "logReader", ".", "getLogListForServerInstance", "(", "indicator", ".", "getStartTime", "(", ")", ",", "indicator", ".", "getQuery", "(", ")", ")", ";", "for", "(", "String", "key", ":", "indicator", ".", "getProcPath", "(", ")", ")", "{", "instance", "=", "instance", ".", "getChildren", "(", ")", ".", "get", "(", "key", ")", ";", "if", "(", "instance", "==", "null", ")", "{", "// Specified subprocess is not found (most probably it was purged already). Return an empty result.", "return", "new", "RemoteInstanceResult", "(", "null", ",", "null", ",", "new", "HashSet", "<", "String", ">", "(", ")", ")", ";", "}", "}", "}", "else", "{", "instance", "=", "logReader", ".", "getLogListForServerInstance", "(", "after", ",", "indicator", ".", "getQuery", "(", ")", ")", ";", "}", "RemoteInstanceResult", "result", ";", "// Return start time, header, and subprocess info only on the first request (where cache is not set yet).", "if", "(", "indicator", ".", "getCache", "(", ")", "==", "null", ")", "{", "result", "=", "new", "RemoteInstanceResult", "(", "instance", ".", "getStartTime", "(", ")", ",", "instance", ".", "getHeader", "(", ")", ",", "instance", ".", "getChildren", "(", ")", ".", "keySet", "(", ")", ")", ";", "}", "else", "{", "result", "=", "new", "RemoteInstanceResult", "(", "null", ",", "null", ",", "new", "HashSet", "<", "String", ">", "(", ")", ")", ";", "if", "(", "instance", "instanceof", "ServerInstanceLogRecordListImpl", ")", "{", "(", "(", "ServerInstanceLogRecordListImpl", ")", "instance", ")", ".", "setCache", "(", "indicator", ".", "getCache", "(", ")", ")", ";", "}", "}", "// Allow maxRecords to be 0 if caller is interested in instance header only.", "if", "(", "maxRecords", "!=", "0", ")", "{", "for", "(", "RepositoryLogRecord", "record", ":", "instance", ".", "range", "(", "offset", ",", "maxRecords", ")", ")", "{", "if", "(", "locale", "!=", "null", "&&", "!", "locale", ".", "toString", "(", ")", ".", "equals", "(", "record", ".", "getMessageLocale", "(", ")", ")", "&&", "record", "instanceof", "RepositoryLogRecordImpl", ")", "{", "RepositoryLogRecordImpl", "recordImpl", "=", "(", "RepositoryLogRecordImpl", ")", "record", ";", "recordImpl", ".", "setLocalizedMessage", "(", "HpelFormatter", ".", "translateMessage", "(", "record", ",", "locale", ")", ")", ";", "recordImpl", ".", "setMessageLocale", "(", "locale", ".", "toString", "(", ")", ")", ";", "}", "result", ".", "addRecord", "(", "record", ")", ";", "}", "}", "// Return cache back only if caller does not have complete set", "if", "(", "instance", "instanceof", "ServerInstanceLogRecordListImpl", "&&", "(", "indicator", ".", "getCache", "(", ")", "==", "null", "||", "!", "indicator", ".", "getCache", "(", ")", ".", "isComplete", "(", ")", ")", ")", "{", "result", ".", "setCache", "(", "(", "(", "ServerInstanceLogRecordListImpl", ")", "instance", ")", ".", "getCache", "(", ")", ")", ";", "}", "return", "result", ";", "}" ]
retrieves records and header for one server instance. @param indicator server instance identifier. @param after starting location after which records are return. @param offset number of records to skip. @param maxRecords maximum number of records to return. @param locale language into which record messages are translated. @return Set of instance log records satisfying the original query request. @throws LogRepositoryException indicating that an error occurred while reading records from the server.
[ "retrieves", "records", "and", "header", "for", "one", "server", "instance", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/RemoteResultCollector.java#L70-L113
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jca.cm/src/com/ibm/ws/jca/cm/ConnectionManagerService.java
ConnectionManagerService.setValidating
public void setValidating(boolean isValidating) { if (isValidating) MCWrapper.isValidating.set(true); else MCWrapper.isValidating.remove(); }
java
public void setValidating(boolean isValidating) { if (isValidating) MCWrapper.isValidating.set(true); else MCWrapper.isValidating.remove(); }
[ "public", "void", "setValidating", "(", "boolean", "isValidating", ")", "{", "if", "(", "isValidating", ")", "MCWrapper", ".", "isValidating", ".", "set", "(", "true", ")", ";", "else", "MCWrapper", ".", "isValidating", ".", "remove", "(", ")", ";", "}" ]
Indicates to the connection manager whether validation is occurring on the current thread. @param isValidating true if validation is occurring on the current thread. Otherwise false.
[ "Indicates", "to", "the", "connection", "manager", "whether", "validation", "is", "occurring", "on", "the", "current", "thread", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca.cm/src/com/ibm/ws/jca/cm/ConnectionManagerService.java#L131-L136
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/impl/ProxyQueueConversationGroupImpl.java
ProxyQueueConversationGroupImpl.createBrowserProxyQueue
public synchronized BrowserProxyQueue createBrowserProxyQueue() // F171893 throws SIResourceException, SIIncorrectCallException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createBrowserProxyQueue"); // F171893 checkClosed(); short id = nextId(); BrowserProxyQueue proxyQueue = new BrowserProxyQueueImpl(this, id, conversation); idToProxyQueueMap.put(new ImmutableId(id), proxyQueue); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createBrowserProxyQueue", proxyQueue); return proxyQueue; }
java
public synchronized BrowserProxyQueue createBrowserProxyQueue() // F171893 throws SIResourceException, SIIncorrectCallException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createBrowserProxyQueue"); // F171893 checkClosed(); short id = nextId(); BrowserProxyQueue proxyQueue = new BrowserProxyQueueImpl(this, id, conversation); idToProxyQueueMap.put(new ImmutableId(id), proxyQueue); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createBrowserProxyQueue", proxyQueue); return proxyQueue; }
[ "public", "synchronized", "BrowserProxyQueue", "createBrowserProxyQueue", "(", ")", "// F171893", "throws", "SIResourceException", ",", "SIIncorrectCallException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"createBrowserProxyQueue\"", ")", ";", "// F171893", "checkClosed", "(", ")", ";", "short", "id", "=", "nextId", "(", ")", ";", "BrowserProxyQueue", "proxyQueue", "=", "new", "BrowserProxyQueueImpl", "(", "this", ",", "id", ",", "conversation", ")", ";", "idToProxyQueueMap", ".", "put", "(", "new", "ImmutableId", "(", "id", ")", ",", "proxyQueue", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"createBrowserProxyQueue\"", ",", "proxyQueue", ")", ";", "return", "proxyQueue", ";", "}" ]
Creates a new browser proxy queue for this group. @see com.ibm.ws.sib.comms.client.proxyqueue.ProxyQueueConversationGroup#createBrowserProxyQueue()
[ "Creates", "a", "new", "browser", "proxy", "queue", "for", "this", "group", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/impl/ProxyQueueConversationGroupImpl.java#L120-L131
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/impl/ProxyQueueConversationGroupImpl.java
ProxyQueueConversationGroupImpl.createAsynchConsumerProxyQueue
public synchronized AsynchConsumerProxyQueue createAsynchConsumerProxyQueue(OrderingContext oc) throws SIResourceException, SIIncorrectCallException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createAsynchConsumerProxyQueue"); short id = nextId(); // begin D249096 AsynchConsumerProxyQueue proxyQueue = null; if (oc == null) { proxyQueue = new NonReadAheadSessionProxyQueueImpl(this, id, conversation); } else { proxyQueue = new OrderedSessionProxyQueueImpl(this, id, conversation, oc); } // end D249096 idToProxyQueueMap.put(new ImmutableId(id), proxyQueue); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createAsynchConsumerProxyQueue", proxyQueue); return proxyQueue; }
java
public synchronized AsynchConsumerProxyQueue createAsynchConsumerProxyQueue(OrderingContext oc) throws SIResourceException, SIIncorrectCallException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createAsynchConsumerProxyQueue"); short id = nextId(); // begin D249096 AsynchConsumerProxyQueue proxyQueue = null; if (oc == null) { proxyQueue = new NonReadAheadSessionProxyQueueImpl(this, id, conversation); } else { proxyQueue = new OrderedSessionProxyQueueImpl(this, id, conversation, oc); } // end D249096 idToProxyQueueMap.put(new ImmutableId(id), proxyQueue); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createAsynchConsumerProxyQueue", proxyQueue); return proxyQueue; }
[ "public", "synchronized", "AsynchConsumerProxyQueue", "createAsynchConsumerProxyQueue", "(", "OrderingContext", "oc", ")", "throws", "SIResourceException", ",", "SIIncorrectCallException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"createAsynchConsumerProxyQueue\"", ")", ";", "short", "id", "=", "nextId", "(", ")", ";", "// begin D249096", "AsynchConsumerProxyQueue", "proxyQueue", "=", "null", ";", "if", "(", "oc", "==", "null", ")", "{", "proxyQueue", "=", "new", "NonReadAheadSessionProxyQueueImpl", "(", "this", ",", "id", ",", "conversation", ")", ";", "}", "else", "{", "proxyQueue", "=", "new", "OrderedSessionProxyQueueImpl", "(", "this", ",", "id", ",", "conversation", ",", "oc", ")", ";", "}", "// end D249096", "idToProxyQueueMap", ".", "put", "(", "new", "ImmutableId", "(", "id", ")", ",", "proxyQueue", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"createAsynchConsumerProxyQueue\"", ",", "proxyQueue", ")", ";", "return", "proxyQueue", ";", "}" ]
Creates a new asynchronous consumer proxy queue for this group. @throws SIResourceException @throws SIResourceException @throws SIIncorrectCallException @throws SIIncorrectCallException @throws SIErrorException @throws SIConnectionUnavailableException @throws SISessionUnavailableException @throws SIConnectionDroppedException @throws SISessionDroppedException @see com.ibm.ws.sib.comms.client.proxyqueue.ProxyQueueConversationGroup#createAsynchConsumerProxyQueue()
[ "Creates", "a", "new", "asynchronous", "consumer", "proxy", "queue", "for", "this", "group", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/impl/ProxyQueueConversationGroupImpl.java#L147-L173
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/impl/ProxyQueueConversationGroupImpl.java
ProxyQueueConversationGroupImpl.createReadAheadProxyQueue
public synchronized AsynchConsumerProxyQueue createReadAheadProxyQueue(Reliability unrecoverableReliability) // f187521.2.1 throws SIResourceException, SIIncorrectCallException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createReadAheadProxyQueue"); checkClosed(); // begin D249096 short id = nextId(); AsynchConsumerProxyQueue proxyQueue = new ReadAheadSessionProxyQueueImpl(this, id, conversation, unrecoverableReliability); // f187521.2.1 // f191114 // end D249096 idToProxyQueueMap.put(new ImmutableId(id), proxyQueue); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createReadAheadProxyQueue", proxyQueue); return proxyQueue; }
java
public synchronized AsynchConsumerProxyQueue createReadAheadProxyQueue(Reliability unrecoverableReliability) // f187521.2.1 throws SIResourceException, SIIncorrectCallException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createReadAheadProxyQueue"); checkClosed(); // begin D249096 short id = nextId(); AsynchConsumerProxyQueue proxyQueue = new ReadAheadSessionProxyQueueImpl(this, id, conversation, unrecoverableReliability); // f187521.2.1 // f191114 // end D249096 idToProxyQueueMap.put(new ImmutableId(id), proxyQueue); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createReadAheadProxyQueue", proxyQueue); return proxyQueue; }
[ "public", "synchronized", "AsynchConsumerProxyQueue", "createReadAheadProxyQueue", "(", "Reliability", "unrecoverableReliability", ")", "// f187521.2.1", "throws", "SIResourceException", ",", "SIIncorrectCallException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"createReadAheadProxyQueue\"", ")", ";", "checkClosed", "(", ")", ";", "// begin D249096", "short", "id", "=", "nextId", "(", ")", ";", "AsynchConsumerProxyQueue", "proxyQueue", "=", "new", "ReadAheadSessionProxyQueueImpl", "(", "this", ",", "id", ",", "conversation", ",", "unrecoverableReliability", ")", ";", "// f187521.2.1 // f191114", "// end D249096", "idToProxyQueueMap", ".", "put", "(", "new", "ImmutableId", "(", "id", ")", ",", "proxyQueue", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"createReadAheadProxyQueue\"", ",", "proxyQueue", ")", ";", "return", "proxyQueue", ";", "}" ]
Creates a new read ahead proxy queue for this group. @see com.ibm.ws.sib.comms.client.proxyqueue.ProxyQueueConversationGroup#createReadAheadProxyQueue(Reliability)
[ "Creates", "a", "new", "read", "ahead", "proxy", "queue", "for", "this", "group", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/impl/ProxyQueueConversationGroupImpl.java#L220-L236
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/impl/ProxyQueueConversationGroupImpl.java
ProxyQueueConversationGroupImpl.bury
public synchronized void bury(ProxyQueue queue) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "bury"); // Get the proxy queue id short id = queue.getId(); // Remove it from the table mutableId.setValue(id); idToProxyQueueMap.remove(mutableId); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "bury"); }
java
public synchronized void bury(ProxyQueue queue) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "bury"); // Get the proxy queue id short id = queue.getId(); // Remove it from the table mutableId.setValue(id); idToProxyQueueMap.remove(mutableId); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "bury"); }
[ "public", "synchronized", "void", "bury", "(", "ProxyQueue", "queue", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"bury\"", ")", ";", "// Get the proxy queue id", "short", "id", "=", "queue", ".", "getId", "(", ")", ";", "// Remove it from the table", "mutableId", ".", "setValue", "(", "id", ")", ";", "idToProxyQueueMap", ".", "remove", "(", "mutableId", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"bury\"", ")", ";", "}" ]
If a session is failed to be created then we need to bury it so that it never bothers us again. The queue is simply removed from the conversation group - no attempt is made to remove messages. It is assumed that if something went wrong in the creation then no messages would ever get to the queue. @param queue
[ "If", "a", "session", "is", "failed", "to", "be", "created", "then", "we", "need", "to", "bury", "it", "so", "that", "it", "never", "bothers", "us", "again", ".", "The", "queue", "is", "simply", "removed", "from", "the", "conversation", "group", "-", "no", "attempt", "is", "made", "to", "remove", "messages", ".", "It", "is", "assumed", "that", "if", "something", "went", "wrong", "in", "the", "creation", "then", "no", "messages", "would", "ever", "get", "to", "the", "queue", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/impl/ProxyQueueConversationGroupImpl.java#L304-L316
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/impl/ProxyQueueConversationGroupImpl.java
ProxyQueueConversationGroupImpl.find
public synchronized ProxyQueue find(short proxyQueueId) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "find", ""+proxyQueueId); mutableId.setValue(proxyQueueId); ProxyQueue retQueue = idToProxyQueueMap.get(mutableId); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "find", retQueue); return retQueue; }
java
public synchronized ProxyQueue find(short proxyQueueId) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "find", ""+proxyQueueId); mutableId.setValue(proxyQueueId); ProxyQueue retQueue = idToProxyQueueMap.get(mutableId); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "find", retQueue); return retQueue; }
[ "public", "synchronized", "ProxyQueue", "find", "(", "short", "proxyQueueId", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"find\"", ",", "\"\"", "+", "proxyQueueId", ")", ";", "mutableId", ".", "setValue", "(", "proxyQueueId", ")", ";", "ProxyQueue", "retQueue", "=", "idToProxyQueueMap", ".", "get", "(", "mutableId", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"find\"", ",", "retQueue", ")", ";", "return", "retQueue", ";", "}" ]
Locates a proxy queue, from this group, via its queue ID. @see com.ibm.ws.sib.comms.client.proxyqueue.ProxyQueueConversationGroup#find(short)
[ "Locates", "a", "proxy", "queue", "from", "this", "group", "via", "its", "queue", "ID", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/impl/ProxyQueueConversationGroupImpl.java#L411-L420
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/impl/ProxyQueueConversationGroupImpl.java
ProxyQueueConversationGroupImpl.notifyClose
protected void notifyClose(ProxyQueue queue) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "notifyClose", queue); try { final short id = queue.getId(); idAllocator.releaseId(id); //Remove the id from the map synchronized(this) { idToProxyQueueMap.remove(new ImmutableId(id)); } } catch (IdAllocatorException e) { FFDCFilter.processException(e, CLASS_NAME + ".notifyClose", CommsConstants.PROXYQUEUECONVGROUPIMPL_NOTIFYCLOSE_01, this); // D177231 if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.exception(tc, e); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "notifyClose"); }
java
protected void notifyClose(ProxyQueue queue) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "notifyClose", queue); try { final short id = queue.getId(); idAllocator.releaseId(id); //Remove the id from the map synchronized(this) { idToProxyQueueMap.remove(new ImmutableId(id)); } } catch (IdAllocatorException e) { FFDCFilter.processException(e, CLASS_NAME + ".notifyClose", CommsConstants.PROXYQUEUECONVGROUPIMPL_NOTIFYCLOSE_01, this); // D177231 if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.exception(tc, e); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "notifyClose"); }
[ "protected", "void", "notifyClose", "(", "ProxyQueue", "queue", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"notifyClose\"", ",", "queue", ")", ";", "try", "{", "final", "short", "id", "=", "queue", ".", "getId", "(", ")", ";", "idAllocator", ".", "releaseId", "(", "id", ")", ";", "//Remove the id from the map", "synchronized", "(", "this", ")", "{", "idToProxyQueueMap", ".", "remove", "(", "new", "ImmutableId", "(", "id", ")", ")", ";", "}", "}", "catch", "(", "IdAllocatorException", "e", ")", "{", "FFDCFilter", ".", "processException", "(", "e", ",", "CLASS_NAME", "+", "\".notifyClose\"", ",", "CommsConstants", ".", "PROXYQUEUECONVGROUPIMPL_NOTIFYCLOSE_01", ",", "this", ")", ";", "// D177231", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEventEnabled", "(", ")", ")", "SibTr", ".", "exception", "(", "tc", ",", "e", ")", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"notifyClose\"", ")", ";", "}" ]
Notified when a proxy queue in this group is closed. Allows us to free up the ID assigned to it. @param queue
[ "Notified", "when", "a", "proxy", "queue", "in", "this", "group", "is", "closed", ".", "Allows", "us", "to", "free", "up", "the", "ID", "assigned", "to", "it", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/impl/ProxyQueueConversationGroupImpl.java#L451-L473
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/impl/ProxyQueueConversationGroupImpl.java
ProxyQueueConversationGroupImpl.nextId
private short nextId() throws SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "nextId"); short id; try { id = idAllocator.allocateId(); } catch (IdAllocatorException e) { // No FFDC code needed SIResourceException resourceException = new SIResourceException( nls.getFormattedMessage("MAX_SESSIONS_REACHED_SICO1019", new Object[]{""+Short.MAX_VALUE}, null) // d192293 ); resourceException.initCause(e); throw resourceException; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "nextId", ""+id); return id; }
java
private short nextId() throws SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "nextId"); short id; try { id = idAllocator.allocateId(); } catch (IdAllocatorException e) { // No FFDC code needed SIResourceException resourceException = new SIResourceException( nls.getFormattedMessage("MAX_SESSIONS_REACHED_SICO1019", new Object[]{""+Short.MAX_VALUE}, null) // d192293 ); resourceException.initCause(e); throw resourceException; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "nextId", ""+id); return id; }
[ "private", "short", "nextId", "(", ")", "throws", "SIResourceException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"nextId\"", ")", ";", "short", "id", ";", "try", "{", "id", "=", "idAllocator", ".", "allocateId", "(", ")", ";", "}", "catch", "(", "IdAllocatorException", "e", ")", "{", "// No FFDC code needed", "SIResourceException", "resourceException", "=", "new", "SIResourceException", "(", "nls", ".", "getFormattedMessage", "(", "\"MAX_SESSIONS_REACHED_SICO1019\"", ",", "new", "Object", "[", "]", "{", "\"\"", "+", "Short", ".", "MAX_VALUE", "}", ",", "null", ")", "// d192293", ")", ";", "resourceException", ".", "initCause", "(", "e", ")", ";", "throw", "resourceException", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"nextId\"", ",", "\"\"", "+", "id", ")", ";", "return", "id", ";", "}" ]
Helper method. Returns the next id to be used for a proxy queue. @return short The next ID to use. @throws SIResourceException Thrown if there are no more free Ids.
[ "Helper", "method", ".", "Returns", "the", "next", "id", "to", "be", "used", "for", "a", "proxy", "queue", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/impl/ProxyQueueConversationGroupImpl.java#L481-L500
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/impl/ProxyQueueConversationGroupImpl.java
ProxyQueueConversationGroupImpl.checkClosed
private void checkClosed() throws SIIncorrectCallException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "checkClosed", ""+closed); if (closed) throw new SIIncorrectCallException( TraceNLS.getFormattedMessage(CommsConstants.MSG_BUNDLE, "PROXY_QUEUE_CONVERSATION_GROUP_CLOSED_SICO1059", null, "PROXY_QUEUE_CONVERSATION_GROUP_CLOSED_SICO1059") // D270373 ); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "checkClosed"); }
java
private void checkClosed() throws SIIncorrectCallException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "checkClosed", ""+closed); if (closed) throw new SIIncorrectCallException( TraceNLS.getFormattedMessage(CommsConstants.MSG_BUNDLE, "PROXY_QUEUE_CONVERSATION_GROUP_CLOSED_SICO1059", null, "PROXY_QUEUE_CONVERSATION_GROUP_CLOSED_SICO1059") // D270373 ); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "checkClosed"); }
[ "private", "void", "checkClosed", "(", ")", "throws", "SIIncorrectCallException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"checkClosed\"", ",", "\"\"", "+", "closed", ")", ";", "if", "(", "closed", ")", "throw", "new", "SIIncorrectCallException", "(", "TraceNLS", ".", "getFormattedMessage", "(", "CommsConstants", ".", "MSG_BUNDLE", ",", "\"PROXY_QUEUE_CONVERSATION_GROUP_CLOSED_SICO1059\"", ",", "null", ",", "\"PROXY_QUEUE_CONVERSATION_GROUP_CLOSED_SICO1059\"", ")", "// D270373", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"checkClosed\"", ")", ";", "}" ]
Helper method. Checks if this group has been closed and throws an exception if it has. @throws SIIncorrectCallException
[ "Helper", "method", ".", "Checks", "if", "this", "group", "has", "been", "closed", "and", "throws", "an", "exception", "if", "it", "has", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/impl/ProxyQueueConversationGroupImpl.java#L507-L515
train