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.msgstore/src/com/ibm/ws/objectManager/AbstractTreeMap.java
AbstractTreeMap.containsValue
public boolean containsValue(Object value) throws ObjectManagerException { if (getRoot() != null) return containsValue(getRoot(), value); return false; }
java
public boolean containsValue(Object value) throws ObjectManagerException { if (getRoot() != null) return containsValue(getRoot(), value); return false; }
[ "public", "boolean", "containsValue", "(", "Object", "value", ")", "throws", "ObjectManagerException", "{", "if", "(", "getRoot", "(", ")", "!=", "null", ")", "return", "containsValue", "(", "getRoot", "(", ")", ",", "value", ")", ";", "return", "false", ";", "}" ]
Searches this TreeMap for the specified value. @param value the object to search for @return true if <code>value</code> is a value of this TreeMap, false otherwise
[ "Searches", "this", "TreeMap", "for", "the", "specified", "value", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/AbstractTreeMap.java#L618-L622
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/AbstractTreeMap.java
AbstractTreeMap.entrySet
public Set entrySet() throws ObjectManagerException { return new AbstractSetView() { public long size() { return size; } public boolean contains(Object object) throws ObjectManagerException { if (object instanceof Map.Entry) { Map.Entry entry = (Map.Entry) object; Object v1 = get(entry.getKey()), v2 = entry.getValue(); return v1 == null ? v2 == null : v1.equals(v2); } return false; } public Iterator iterator() throws ObjectManagerException { return makeTreeMapIterator(new AbstractMapEntry.Type() { public Object get(AbstractMapEntry entry) { return entry; } }); } }; }
java
public Set entrySet() throws ObjectManagerException { return new AbstractSetView() { public long size() { return size; } public boolean contains(Object object) throws ObjectManagerException { if (object instanceof Map.Entry) { Map.Entry entry = (Map.Entry) object; Object v1 = get(entry.getKey()), v2 = entry.getValue(); return v1 == null ? v2 == null : v1.equals(v2); } return false; } public Iterator iterator() throws ObjectManagerException { return makeTreeMapIterator(new AbstractMapEntry.Type() { public Object get(AbstractMapEntry entry) { return entry; } }); } }; }
[ "public", "Set", "entrySet", "(", ")", "throws", "ObjectManagerException", "{", "return", "new", "AbstractSetView", "(", ")", "{", "public", "long", "size", "(", ")", "{", "return", "size", ";", "}", "public", "boolean", "contains", "(", "Object", "object", ")", "throws", "ObjectManagerException", "{", "if", "(", "object", "instanceof", "Map", ".", "Entry", ")", "{", "Map", ".", "Entry", "entry", "=", "(", "Map", ".", "Entry", ")", "object", ";", "Object", "v1", "=", "get", "(", "entry", ".", "getKey", "(", ")", ")", ",", "v2", "=", "entry", ".", "getValue", "(", ")", ";", "return", "v1", "==", "null", "?", "v2", "==", "null", ":", "v1", ".", "equals", "(", "v2", ")", ";", "}", "return", "false", ";", "}", "public", "Iterator", "iterator", "(", ")", "throws", "ObjectManagerException", "{", "return", "makeTreeMapIterator", "(", "new", "AbstractMapEntry", ".", "Type", "(", ")", "{", "public", "Object", "get", "(", "AbstractMapEntry", "entry", ")", "{", "return", "entry", ";", "}", "}", ")", ";", "}", "}", ";", "}" ]
Answers a Set of the mappings contained in this TreeMap. Each element in the set is a Map.Entry. The set is backed by this TreeMap so changes to one are relected by the other. The set does not support adding. @return a Set of the mappings
[ "Answers", "a", "Set", "of", "the", "mappings", "contained", "in", "this", "TreeMap", ".", "Each", "element", "in", "the", "set", "is", "a", "Map", ".", "Entry", ".", "The", "set", "is", "backed", "by", "this", "TreeMap", "so", "changes", "to", "one", "are", "relected", "by", "the", "other", ".", "The", "set", "does", "not", "support", "adding", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/AbstractTreeMap.java#L643-L666
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/AbstractTreeMap.java
AbstractTreeMap.get
public Object get(Object key) throws ObjectManagerException { Entry node = find(key); if (node != null) return node.value; return null; }
java
public Object get(Object key) throws ObjectManagerException { Entry node = find(key); if (node != null) return node.value; return null; }
[ "public", "Object", "get", "(", "Object", "key", ")", "throws", "ObjectManagerException", "{", "Entry", "node", "=", "find", "(", "key", ")", ";", "if", "(", "node", "!=", "null", ")", "return", "node", ".", "value", ";", "return", "null", ";", "}" ]
Answers the value of the mapping with the specified key. @param key the key @return the value of the mapping with the specified key @exception ClassCastException when the key cannot be compared with the keys in this TreeMap @exception NullPointerException when the key is null and the comparator cannot handle null
[ "Answers", "the", "value", "of", "the", "mapping", "with", "the", "specified", "key", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/AbstractTreeMap.java#L821-L826
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/AbstractTreeMap.java
AbstractTreeMap.headMap
public SortedMap headMap(Object endKey) { // Check for errors if (comparator == null) ((Comparable) endKey).compareTo(endKey); else comparator.compare(endKey, endKey); return makeSubMap(null, endKey); }
java
public SortedMap headMap(Object endKey) { // Check for errors if (comparator == null) ((Comparable) endKey).compareTo(endKey); else comparator.compare(endKey, endKey); return makeSubMap(null, endKey); }
[ "public", "SortedMap", "headMap", "(", "Object", "endKey", ")", "{", "// Check for errors", "if", "(", "comparator", "==", "null", ")", "(", "(", "Comparable", ")", "endKey", ")", ".", "compareTo", "(", "endKey", ")", ";", "else", "comparator", ".", "compare", "(", "endKey", ",", "endKey", ")", ";", "return", "makeSubMap", "(", "null", ",", "endKey", ")", ";", "}" ]
Answers a SortedMap of the specified portion of this TreeMap which contains keys less than the end key. The returned SortedMap is backed by this TreeMap so changes to one are reflected by the other. @param endKey the end key @return a submap where the keys are less than <code>endKey</code> @exception ClassCastException when the end key cannot be compared with the keys in this TreeMap @exception NullPointerException when the end key is null and the comparator cannot handle null
[ "Answers", "a", "SortedMap", "of", "the", "specified", "portion", "of", "this", "TreeMap", "which", "contains", "keys", "less", "than", "the", "end", "key", ".", "The", "returned", "SortedMap", "is", "backed", "by", "this", "TreeMap", "so", "changes", "to", "one", "are", "reflected", "by", "the", "other", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/AbstractTreeMap.java#L844-L851
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/AbstractTreeMap.java
AbstractTreeMap.keyCollection
public Collection keyCollection() { if (keyCollection == null) { keyCollection = new AbstractCollectionView() { public long size() throws ObjectManagerException { return AbstractTreeMap.this.size(); } public Iterator iterator() throws ObjectManagerException { return makeTreeMapIterator( new AbstractMapEntry.Type() { public Object get(AbstractMapEntry entry) { return entry.key; } }); } }; } return keyCollection; }
java
public Collection keyCollection() { if (keyCollection == null) { keyCollection = new AbstractCollectionView() { public long size() throws ObjectManagerException { return AbstractTreeMap.this.size(); } public Iterator iterator() throws ObjectManagerException { return makeTreeMapIterator( new AbstractMapEntry.Type() { public Object get(AbstractMapEntry entry) { return entry.key; } }); } }; } return keyCollection; }
[ "public", "Collection", "keyCollection", "(", ")", "{", "if", "(", "keyCollection", "==", "null", ")", "{", "keyCollection", "=", "new", "AbstractCollectionView", "(", ")", "{", "public", "long", "size", "(", ")", "throws", "ObjectManagerException", "{", "return", "AbstractTreeMap", ".", "this", ".", "size", "(", ")", ";", "}", "public", "Iterator", "iterator", "(", ")", "throws", "ObjectManagerException", "{", "return", "makeTreeMapIterator", "(", "new", "AbstractMapEntry", ".", "Type", "(", ")", "{", "public", "Object", "get", "(", "AbstractMapEntry", "entry", ")", "{", "return", "entry", ".", "key", ";", "}", "}", ")", ";", "}", "}", ";", "}", "return", "keyCollection", ";", "}" ]
Answers a Collection of the keys contained in this TreeMap. The set is backed by this TreeMap so changes to one are relected by the other. The Collection does not support adding. @return a Collection of the keys
[ "Answers", "a", "Collection", "of", "the", "keys", "contained", "in", "this", "TreeMap", ".", "The", "set", "is", "backed", "by", "this", "TreeMap", "so", "changes", "to", "one", "are", "relected", "by", "the", "other", ".", "The", "Collection", "does", "not", "support", "adding", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/AbstractTreeMap.java#L860-L878
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/AbstractTreeMap.java
AbstractTreeMap.remove
public Object remove(Object key) throws ObjectManagerException { Entry node = find(key); if (node == null) return null; Object result = node.value; rbDelete(node); return result; }
java
public Object remove(Object key) throws ObjectManagerException { Entry node = find(key); if (node == null) return null; Object result = node.value; rbDelete(node); return result; }
[ "public", "Object", "remove", "(", "Object", "key", ")", "throws", "ObjectManagerException", "{", "Entry", "node", "=", "find", "(", "key", ")", ";", "if", "(", "node", "==", "null", ")", "return", "null", ";", "Object", "result", "=", "node", ".", "value", ";", "rbDelete", "(", "node", ")", ";", "return", "result", ";", "}" ]
Removes a mapping with the specified key from this TreeMap. @param key the key of the mapping to remove @return the value of the removed mapping or null if key is not a key in this TreeMap @exception ClassCastException when the key cannot be compared with the keys in this TreeMap @exception NullPointerException when the key is null and the comparator cannot handle null @throws ObjectManagerException
[ "Removes", "a", "mapping", "with", "the", "specified", "key", "from", "this", "TreeMap", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/AbstractTreeMap.java#L1048-L1055
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/AbstractTreeMap.java
AbstractTreeMap.subMap
public SortedMap subMap(Object startKey, Object endKey) { if (comparator == null) { if (((Comparable) startKey).compareTo(endKey) <= 0) return makeSubMap(startKey, endKey); } else { if (comparator.compare(startKey, endKey) <= 0) return makeSubMap(startKey, endKey); } throw new IllegalArgumentException(); }
java
public SortedMap subMap(Object startKey, Object endKey) { if (comparator == null) { if (((Comparable) startKey).compareTo(endKey) <= 0) return makeSubMap(startKey, endKey); } else { if (comparator.compare(startKey, endKey) <= 0) return makeSubMap(startKey, endKey); } throw new IllegalArgumentException(); }
[ "public", "SortedMap", "subMap", "(", "Object", "startKey", ",", "Object", "endKey", ")", "{", "if", "(", "comparator", "==", "null", ")", "{", "if", "(", "(", "(", "Comparable", ")", "startKey", ")", ".", "compareTo", "(", "endKey", ")", "<=", "0", ")", "return", "makeSubMap", "(", "startKey", ",", "endKey", ")", ";", "}", "else", "{", "if", "(", "comparator", ".", "compare", "(", "startKey", ",", "endKey", ")", "<=", "0", ")", "return", "makeSubMap", "(", "startKey", ",", "endKey", ")", ";", "}", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}" ]
Answers a SortedMap of the specified portion of this TreeMap which contains keys greater or equal to the start key but less than the end key. The returned SortedMap is backed by this TreeMap so changes to one are reflected by the other. @param startKey the start key @param endKey the end key @return a submap where the keys are greater or equal to <code>startKey</code> and less than <code>endKey</code> @exception ClassCastException when the start or end key cannot be compared with the keys in this TreeMap @exception NullPointerException when the start or end key is null and the comparator cannot handle null
[ "Answers", "a", "SortedMap", "of", "the", "specified", "portion", "of", "this", "TreeMap", "which", "contains", "keys", "greater", "or", "equal", "to", "the", "start", "key", "but", "less", "than", "the", "end", "key", ".", "The", "returned", "SortedMap", "is", "backed", "by", "this", "TreeMap", "so", "changes", "to", "one", "are", "reflected", "by", "the", "other", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/AbstractTreeMap.java#L1103-L1112
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/AbstractTreeMap.java
AbstractTreeMap.tailMap
public SortedMap tailMap(Object startKey) { // Check for errors if (comparator == null) ((Comparable) startKey).compareTo(startKey); else comparator.compare(startKey, startKey); return makeSubMap(startKey, null); }
java
public SortedMap tailMap(Object startKey) { // Check for errors if (comparator == null) ((Comparable) startKey).compareTo(startKey); else comparator.compare(startKey, startKey); return makeSubMap(startKey, null); }
[ "public", "SortedMap", "tailMap", "(", "Object", "startKey", ")", "{", "// Check for errors", "if", "(", "comparator", "==", "null", ")", "(", "(", "Comparable", ")", "startKey", ")", ".", "compareTo", "(", "startKey", ")", ";", "else", "comparator", ".", "compare", "(", "startKey", ",", "startKey", ")", ";", "return", "makeSubMap", "(", "startKey", ",", "null", ")", ";", "}" ]
Answers a SortedMap of the specified portion of this TreeMap which contains keys greater or equal to the start key. The returned SortedMap is backed by this TreeMap so changes to one are reflected by the other. @param startKey the start key @return a submap where the keys are greater or equal to <code>startKey</code> @exception ClassCastException when the start key cannot be compared with the keys in this TreeMap @exception NullPointerException when the start key is null and the comparator cannot handle null
[ "Answers", "a", "SortedMap", "of", "the", "specified", "portion", "of", "this", "TreeMap", "which", "contains", "keys", "greater", "or", "equal", "to", "the", "start", "key", ".", "The", "returned", "SortedMap", "is", "backed", "by", "this", "TreeMap", "so", "changes", "to", "one", "are", "reflected", "by", "the", "other", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/AbstractTreeMap.java#L1142-L1149
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/AbstractTreeMap.java
AbstractTreeMap.values
public Collection values() { if (values == null) { values = new AbstractCollectionView() { public long size() throws ObjectManagerException { return AbstractTreeMap.this.size(); } public Iterator iterator() throws ObjectManagerException { return makeTreeMapIterator(new AbstractMapEntry.Type() { public Object get(AbstractMapEntry entry) { return entry.getValue(); } }); } }; } return values; }
java
public Collection values() { if (values == null) { values = new AbstractCollectionView() { public long size() throws ObjectManagerException { return AbstractTreeMap.this.size(); } public Iterator iterator() throws ObjectManagerException { return makeTreeMapIterator(new AbstractMapEntry.Type() { public Object get(AbstractMapEntry entry) { return entry.getValue(); } }); } }; } return values; }
[ "public", "Collection", "values", "(", ")", "{", "if", "(", "values", "==", "null", ")", "{", "values", "=", "new", "AbstractCollectionView", "(", ")", "{", "public", "long", "size", "(", ")", "throws", "ObjectManagerException", "{", "return", "AbstractTreeMap", ".", "this", ".", "size", "(", ")", ";", "}", "public", "Iterator", "iterator", "(", ")", "throws", "ObjectManagerException", "{", "return", "makeTreeMapIterator", "(", "new", "AbstractMapEntry", ".", "Type", "(", ")", "{", "public", "Object", "get", "(", "AbstractMapEntry", "entry", ")", "{", "return", "entry", ".", "getValue", "(", ")", ";", "}", "}", ")", ";", "}", "}", ";", "}", "return", "values", ";", "}" ]
Answers a Collection of the values contained in this TreeMap. The collection is backed by this TreeMap so changes to one are relected by the other. The collection does not support adding. @return a Collection of the values
[ "Answers", "a", "Collection", "of", "the", "values", "contained", "in", "this", "TreeMap", ".", "The", "collection", "is", "backed", "by", "this", "TreeMap", "so", "changes", "to", "one", "are", "relected", "by", "the", "other", ".", "The", "collection", "does", "not", "support", "adding", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/AbstractTreeMap.java#L1158-L1175
train
OpenLiberty/open-liberty
dev/com.ibm.ws.mongo_fat/fat/src/com/ibm/ws/mongo/fat/MongoServerSelector.java
MongoServerSelector.assignMongoServers
public static void assignMongoServers(LibertyServer libertyServer) throws Exception { MongoServerSelector mongoServerSelector = new MongoServerSelector(libertyServer); mongoServerSelector.updateLibertyServerMongos(); }
java
public static void assignMongoServers(LibertyServer libertyServer) throws Exception { MongoServerSelector mongoServerSelector = new MongoServerSelector(libertyServer); mongoServerSelector.updateLibertyServerMongos(); }
[ "public", "static", "void", "assignMongoServers", "(", "LibertyServer", "libertyServer", ")", "throws", "Exception", "{", "MongoServerSelector", "mongoServerSelector", "=", "new", "MongoServerSelector", "(", "libertyServer", ")", ";", "mongoServerSelector", ".", "updateLibertyServerMongos", "(", ")", ";", "}" ]
Reads a server configuration and replaces the placeholder values with an available host and port as specified in the mongo.properties file @param libertyServer The server configuration to assign Mongo servers to @throws Exception Can't connect to any of the specified Mongo servers
[ "Reads", "a", "server", "configuration", "and", "replaces", "the", "placeholder", "values", "with", "an", "available", "host", "and", "port", "as", "specified", "in", "the", "mongo", ".", "properties", "file" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.mongo_fat/fat/src/com/ibm/ws/mongo/fat/MongoServerSelector.java#L67-L70
train
OpenLiberty/open-liberty
dev/com.ibm.ws.mongo_fat/fat/src/com/ibm/ws/mongo/fat/MongoServerSelector.java
MongoServerSelector.getMongoElements
private Map<String, List<MongoElement>> getMongoElements() throws Exception { for (MongoElement mongo : serverConfig.getMongos()) { addMongoElementToMap(mongo); } for (MongoDBElement mongoDB : serverConfig.getMongoDBs()) { if (mongoDB.getMongo() != null) { addMongoElementToMap(mongoDB.getMongo()); } } return mongoElements; }
java
private Map<String, List<MongoElement>> getMongoElements() throws Exception { for (MongoElement mongo : serverConfig.getMongos()) { addMongoElementToMap(mongo); } for (MongoDBElement mongoDB : serverConfig.getMongoDBs()) { if (mongoDB.getMongo() != null) { addMongoElementToMap(mongoDB.getMongo()); } } return mongoElements; }
[ "private", "Map", "<", "String", ",", "List", "<", "MongoElement", ">", ">", "getMongoElements", "(", ")", "throws", "Exception", "{", "for", "(", "MongoElement", "mongo", ":", "serverConfig", ".", "getMongos", "(", ")", ")", "{", "addMongoElementToMap", "(", "mongo", ")", ";", "}", "for", "(", "MongoDBElement", "mongoDB", ":", "serverConfig", ".", "getMongoDBs", "(", ")", ")", "{", "if", "(", "mongoDB", ".", "getMongo", "(", ")", "!=", "null", ")", "{", "addMongoElementToMap", "(", "mongoDB", ".", "getMongo", "(", ")", ")", ";", "}", "}", "return", "mongoElements", ";", "}" ]
Creates a mapping of a Mongo server placeholder value to the one or more mongo elements in the server.xml containing that placeholder @param libertyServer @return
[ "Creates", "a", "mapping", "of", "a", "Mongo", "server", "placeholder", "value", "to", "the", "one", "or", "more", "mongo", "elements", "in", "the", "server", ".", "xml", "containing", "that", "placeholder" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.mongo_fat/fat/src/com/ibm/ws/mongo/fat/MongoServerSelector.java#L91-L101
train
OpenLiberty/open-liberty
dev/com.ibm.ws.mongo_fat/fat/src/com/ibm/ws/mongo/fat/MongoServerSelector.java
MongoServerSelector.updateMongoElements
private void updateMongoElements(String serverPlaceholder, ExternalTestService mongoService) { Integer[] port = { Integer.valueOf(mongoService.getPort()) }; for (MongoElement mongo : mongoElements.get(serverPlaceholder)) { mongo.setHostNames(mongoService.getAddress()); mongo.setPorts(port); String user = mongo.getUser(); if (user != null) { String replacementPassword = mongoService.getProperties().get(user + "_password"); if (replacementPassword != null) { mongo.setPassword(replacementPassword); } } } }
java
private void updateMongoElements(String serverPlaceholder, ExternalTestService mongoService) { Integer[] port = { Integer.valueOf(mongoService.getPort()) }; for (MongoElement mongo : mongoElements.get(serverPlaceholder)) { mongo.setHostNames(mongoService.getAddress()); mongo.setPorts(port); String user = mongo.getUser(); if (user != null) { String replacementPassword = mongoService.getProperties().get(user + "_password"); if (replacementPassword != null) { mongo.setPassword(replacementPassword); } } } }
[ "private", "void", "updateMongoElements", "(", "String", "serverPlaceholder", ",", "ExternalTestService", "mongoService", ")", "{", "Integer", "[", "]", "port", "=", "{", "Integer", ".", "valueOf", "(", "mongoService", ".", "getPort", "(", ")", ")", "}", ";", "for", "(", "MongoElement", "mongo", ":", "mongoElements", ".", "get", "(", "serverPlaceholder", ")", ")", "{", "mongo", ".", "setHostNames", "(", "mongoService", ".", "getAddress", "(", ")", ")", ";", "mongo", ".", "setPorts", "(", "port", ")", ";", "String", "user", "=", "mongo", ".", "getUser", "(", ")", ";", "if", "(", "user", "!=", "null", ")", "{", "String", "replacementPassword", "=", "mongoService", ".", "getProperties", "(", ")", ".", "get", "(", "user", "+", "\"_password\"", ")", ";", "if", "(", "replacementPassword", "!=", "null", ")", "{", "mongo", ".", "setPassword", "(", "replacementPassword", ")", ";", "}", "}", "}", "}" ]
For the mongo elements containing the given placeholder value, the host and port placeholder values in the mongo element are replaced with an actual host and port of an available mongo server. @param availableMongoServer
[ "For", "the", "mongo", "elements", "containing", "the", "given", "placeholder", "value", "the", "host", "and", "port", "placeholder", "values", "in", "the", "mongo", "element", "are", "replaced", "with", "an", "actual", "host", "and", "port", "of", "an", "available", "mongo", "server", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.mongo_fat/fat/src/com/ibm/ws/mongo/fat/MongoServerSelector.java#L125-L139
train
OpenLiberty/open-liberty
dev/com.ibm.ws.mongo_fat/fat/src/com/ibm/ws/mongo/fat/MongoServerSelector.java
MongoServerSelector.validateMongoConnection
private static boolean validateMongoConnection(ExternalTestService mongoService) { String method = "validateMongoConnection"; MongoClient mongoClient = null; String host = mongoService.getAddress(); int port = mongoService.getPort(); File trustStore = null; MongoClientOptions.Builder optionsBuilder = new MongoClientOptions.Builder().connectTimeout(30000); try { trustStore = File.createTempFile("mongoTrustStore", "jks"); Map<String, String> serviceProperties = mongoService.getProperties(); String password = serviceProperties.get(TEST_USERNAME + "_password"); // will be null if there's no auth for this server SSLSocketFactory sslSocketFactory = null; try { mongoService.writePropertyAsFile("ca_truststore", trustStore); sslSocketFactory = getSocketFactory(trustStore); } catch (IllegalStateException e) { // Ignore exception thrown if truststore is not present for this server // This indicates that we are not using SSL for this server and sslSocketFactory will be null } if (sslSocketFactory != null) { optionsBuilder.socketFactory(sslSocketFactory); } MongoClientOptions clientOptions = optionsBuilder.build(); List<MongoCredential> credentials = Collections.emptyList(); if (password != null) { MongoCredential credential = MongoCredential.createCredential(TEST_USERNAME, TEST_DATABASE, password.toCharArray()); credentials = Collections.singletonList(credential); } Log.info(c, method, "Attempting to contact server " + host + ":" + port + " with password " + (password != null ? "set" : "not set") + " and truststore " + (sslSocketFactory != null ? "set" : "not set")); mongoClient = new MongoClient(new ServerAddress(host, port), credentials, clientOptions); mongoClient.getDB("default").getCollectionNames(); mongoClient.close(); } catch (Exception e) { Log.info(c, method, "Couldn't create a connection to " + mongoService.getServiceName() + " on " + mongoService.getAddress() + ". " + e.toString()); mongoService.reportUnhealthy("Couldn't connect to server. Exception: " + e.toString()); return false; } finally { if (trustStore != null) { trustStore.delete(); } } return true; }
java
private static boolean validateMongoConnection(ExternalTestService mongoService) { String method = "validateMongoConnection"; MongoClient mongoClient = null; String host = mongoService.getAddress(); int port = mongoService.getPort(); File trustStore = null; MongoClientOptions.Builder optionsBuilder = new MongoClientOptions.Builder().connectTimeout(30000); try { trustStore = File.createTempFile("mongoTrustStore", "jks"); Map<String, String> serviceProperties = mongoService.getProperties(); String password = serviceProperties.get(TEST_USERNAME + "_password"); // will be null if there's no auth for this server SSLSocketFactory sslSocketFactory = null; try { mongoService.writePropertyAsFile("ca_truststore", trustStore); sslSocketFactory = getSocketFactory(trustStore); } catch (IllegalStateException e) { // Ignore exception thrown if truststore is not present for this server // This indicates that we are not using SSL for this server and sslSocketFactory will be null } if (sslSocketFactory != null) { optionsBuilder.socketFactory(sslSocketFactory); } MongoClientOptions clientOptions = optionsBuilder.build(); List<MongoCredential> credentials = Collections.emptyList(); if (password != null) { MongoCredential credential = MongoCredential.createCredential(TEST_USERNAME, TEST_DATABASE, password.toCharArray()); credentials = Collections.singletonList(credential); } Log.info(c, method, "Attempting to contact server " + host + ":" + port + " with password " + (password != null ? "set" : "not set") + " and truststore " + (sslSocketFactory != null ? "set" : "not set")); mongoClient = new MongoClient(new ServerAddress(host, port), credentials, clientOptions); mongoClient.getDB("default").getCollectionNames(); mongoClient.close(); } catch (Exception e) { Log.info(c, method, "Couldn't create a connection to " + mongoService.getServiceName() + " on " + mongoService.getAddress() + ". " + e.toString()); mongoService.reportUnhealthy("Couldn't connect to server. Exception: " + e.toString()); return false; } finally { if (trustStore != null) { trustStore.delete(); } } return true; }
[ "private", "static", "boolean", "validateMongoConnection", "(", "ExternalTestService", "mongoService", ")", "{", "String", "method", "=", "\"validateMongoConnection\"", ";", "MongoClient", "mongoClient", "=", "null", ";", "String", "host", "=", "mongoService", ".", "getAddress", "(", ")", ";", "int", "port", "=", "mongoService", ".", "getPort", "(", ")", ";", "File", "trustStore", "=", "null", ";", "MongoClientOptions", ".", "Builder", "optionsBuilder", "=", "new", "MongoClientOptions", ".", "Builder", "(", ")", ".", "connectTimeout", "(", "30000", ")", ";", "try", "{", "trustStore", "=", "File", ".", "createTempFile", "(", "\"mongoTrustStore\"", ",", "\"jks\"", ")", ";", "Map", "<", "String", ",", "String", ">", "serviceProperties", "=", "mongoService", ".", "getProperties", "(", ")", ";", "String", "password", "=", "serviceProperties", ".", "get", "(", "TEST_USERNAME", "+", "\"_password\"", ")", ";", "// will be null if there's no auth for this server", "SSLSocketFactory", "sslSocketFactory", "=", "null", ";", "try", "{", "mongoService", ".", "writePropertyAsFile", "(", "\"ca_truststore\"", ",", "trustStore", ")", ";", "sslSocketFactory", "=", "getSocketFactory", "(", "trustStore", ")", ";", "}", "catch", "(", "IllegalStateException", "e", ")", "{", "// Ignore exception thrown if truststore is not present for this server", "// This indicates that we are not using SSL for this server and sslSocketFactory will be null", "}", "if", "(", "sslSocketFactory", "!=", "null", ")", "{", "optionsBuilder", ".", "socketFactory", "(", "sslSocketFactory", ")", ";", "}", "MongoClientOptions", "clientOptions", "=", "optionsBuilder", ".", "build", "(", ")", ";", "List", "<", "MongoCredential", ">", "credentials", "=", "Collections", ".", "emptyList", "(", ")", ";", "if", "(", "password", "!=", "null", ")", "{", "MongoCredential", "credential", "=", "MongoCredential", ".", "createCredential", "(", "TEST_USERNAME", ",", "TEST_DATABASE", ",", "password", ".", "toCharArray", "(", ")", ")", ";", "credentials", "=", "Collections", ".", "singletonList", "(", "credential", ")", ";", "}", "Log", ".", "info", "(", "c", ",", "method", ",", "\"Attempting to contact server \"", "+", "host", "+", "\":\"", "+", "port", "+", "\" with password \"", "+", "(", "password", "!=", "null", "?", "\"set\"", ":", "\"not set\"", ")", "+", "\" and truststore \"", "+", "(", "sslSocketFactory", "!=", "null", "?", "\"set\"", ":", "\"not set\"", ")", ")", ";", "mongoClient", "=", "new", "MongoClient", "(", "new", "ServerAddress", "(", "host", ",", "port", ")", ",", "credentials", ",", "clientOptions", ")", ";", "mongoClient", ".", "getDB", "(", "\"default\"", ")", ".", "getCollectionNames", "(", ")", ";", "mongoClient", ".", "close", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "Log", ".", "info", "(", "c", ",", "method", ",", "\"Couldn't create a connection to \"", "+", "mongoService", ".", "getServiceName", "(", ")", "+", "\" on \"", "+", "mongoService", ".", "getAddress", "(", ")", "+", "\". \"", "+", "e", ".", "toString", "(", ")", ")", ";", "mongoService", ".", "reportUnhealthy", "(", "\"Couldn't connect to server. Exception: \"", "+", "e", ".", "toString", "(", ")", ")", ";", "return", "false", ";", "}", "finally", "{", "if", "(", "trustStore", "!=", "null", ")", "{", "trustStore", ".", "delete", "(", ")", ";", "}", "}", "return", "true", ";", "}" ]
Creates a connection to the mongo server at the given location using the mongo java client. @param location @param auth @param encrypted @return @throws Exception
[ "Creates", "a", "connection", "to", "the", "mongo", "server", "at", "the", "given", "location", "using", "the", "mongo", "java", "client", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.mongo_fat/fat/src/com/ibm/ws/mongo/fat/MongoServerSelector.java#L190-L242
train
OpenLiberty/open-liberty
dev/com.ibm.ws.mongo_fat/fat/src/com/ibm/ws/mongo/fat/MongoServerSelector.java
MongoServerSelector.getSocketFactory
private static SSLSocketFactory getSocketFactory(File trustStore) throws KeyStoreException, FileNotFoundException, IOException, NoSuchAlgorithmException, CertificateException, KeyManagementException { KeyStore keystore = KeyStore.getInstance("JKS"); InputStream truststoreInputStream = null; try { truststoreInputStream = new FileInputStream(trustStore); keystore.load(truststoreInputStream, KEYSTORE_PW); } finally { if (truststoreInputStream != null) { truststoreInputStream.close(); } } TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance("PKIX"); trustManagerFactory.init(keystore); TrustManager[] trustMangers = trustManagerFactory.getTrustManagers(); SSLContext sslContext = SSLContext.getInstance("TLS"); sslContext.init(null, trustMangers, null); SSLSocketFactory sslSocketFactory = sslContext.getSocketFactory(); return sslSocketFactory; }
java
private static SSLSocketFactory getSocketFactory(File trustStore) throws KeyStoreException, FileNotFoundException, IOException, NoSuchAlgorithmException, CertificateException, KeyManagementException { KeyStore keystore = KeyStore.getInstance("JKS"); InputStream truststoreInputStream = null; try { truststoreInputStream = new FileInputStream(trustStore); keystore.load(truststoreInputStream, KEYSTORE_PW); } finally { if (truststoreInputStream != null) { truststoreInputStream.close(); } } TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance("PKIX"); trustManagerFactory.init(keystore); TrustManager[] trustMangers = trustManagerFactory.getTrustManagers(); SSLContext sslContext = SSLContext.getInstance("TLS"); sslContext.init(null, trustMangers, null); SSLSocketFactory sslSocketFactory = sslContext.getSocketFactory(); return sslSocketFactory; }
[ "private", "static", "SSLSocketFactory", "getSocketFactory", "(", "File", "trustStore", ")", "throws", "KeyStoreException", ",", "FileNotFoundException", ",", "IOException", ",", "NoSuchAlgorithmException", ",", "CertificateException", ",", "KeyManagementException", "{", "KeyStore", "keystore", "=", "KeyStore", ".", "getInstance", "(", "\"JKS\"", ")", ";", "InputStream", "truststoreInputStream", "=", "null", ";", "try", "{", "truststoreInputStream", "=", "new", "FileInputStream", "(", "trustStore", ")", ";", "keystore", ".", "load", "(", "truststoreInputStream", ",", "KEYSTORE_PW", ")", ";", "}", "finally", "{", "if", "(", "truststoreInputStream", "!=", "null", ")", "{", "truststoreInputStream", ".", "close", "(", ")", ";", "}", "}", "TrustManagerFactory", "trustManagerFactory", "=", "TrustManagerFactory", ".", "getInstance", "(", "\"PKIX\"", ")", ";", "trustManagerFactory", ".", "init", "(", "keystore", ")", ";", "TrustManager", "[", "]", "trustMangers", "=", "trustManagerFactory", ".", "getTrustManagers", "(", ")", ";", "SSLContext", "sslContext", "=", "SSLContext", ".", "getInstance", "(", "\"TLS\"", ")", ";", "sslContext", ".", "init", "(", "null", ",", "trustMangers", ",", "null", ")", ";", "SSLSocketFactory", "sslSocketFactory", "=", "sslContext", ".", "getSocketFactory", "(", ")", ";", "return", "sslSocketFactory", ";", "}" ]
Returns an SSLSocketFactory needed to connect to an SSL mongo server. The socket factory is created using the testTruststore.jks. @return @throws KeyStoreException @throws FileNotFoundException @throws IOException @throws NoSuchAlgorithmException @throws CertificateException @throws KeyManagementException
[ "Returns", "an", "SSLSocketFactory", "needed", "to", "connect", "to", "an", "SSL", "mongo", "server", ".", "The", "socket", "factory", "is", "created", "using", "the", "testTruststore", ".", "jks", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.mongo_fat/fat/src/com/ibm/ws/mongo/fat/MongoServerSelector.java#L255-L277
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/LocaleUtils.java
LocaleUtils.converterTagLocaleFromString
public static Locale converterTagLocaleFromString(String name) { try { Locale locale; StringTokenizer st = new StringTokenizer(name, "_"); String language = st.nextToken(); if(st.hasMoreTokens()) { String country = st.nextToken(); if(st.hasMoreTokens()) { String variant = st.nextToken(); locale = new Locale(language, country, variant); } else { locale = new Locale(language, country); } } else { locale = new Locale(language); } return locale; } catch(Exception e) { throw new IllegalArgumentException("Locale parsing exception - " + "invalid string representation '" + name + "'"); } }
java
public static Locale converterTagLocaleFromString(String name) { try { Locale locale; StringTokenizer st = new StringTokenizer(name, "_"); String language = st.nextToken(); if(st.hasMoreTokens()) { String country = st.nextToken(); if(st.hasMoreTokens()) { String variant = st.nextToken(); locale = new Locale(language, country, variant); } else { locale = new Locale(language, country); } } else { locale = new Locale(language); } return locale; } catch(Exception e) { throw new IllegalArgumentException("Locale parsing exception - " + "invalid string representation '" + name + "'"); } }
[ "public", "static", "Locale", "converterTagLocaleFromString", "(", "String", "name", ")", "{", "try", "{", "Locale", "locale", ";", "StringTokenizer", "st", "=", "new", "StringTokenizer", "(", "name", ",", "\"_\"", ")", ";", "String", "language", "=", "st", ".", "nextToken", "(", ")", ";", "if", "(", "st", ".", "hasMoreTokens", "(", ")", ")", "{", "String", "country", "=", "st", ".", "nextToken", "(", ")", ";", "if", "(", "st", ".", "hasMoreTokens", "(", ")", ")", "{", "String", "variant", "=", "st", ".", "nextToken", "(", ")", ";", "locale", "=", "new", "Locale", "(", "language", ",", "country", ",", "variant", ")", ";", "}", "else", "{", "locale", "=", "new", "Locale", "(", "language", ",", "country", ")", ";", "}", "}", "else", "{", "locale", "=", "new", "Locale", "(", "language", ")", ";", "}", "return", "locale", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Locale parsing exception - \"", "+", "\"invalid string representation '\"", "+", "name", "+", "\"'\"", ")", ";", "}", "}" ]
Convert locale string used by converter tags to locale. @param name name of the locale @return locale specified by the given String @see org.apache.myfaces.taglib.core.ConvertDateTimeTag#setConverterLocale @see org.apache.myfaces.taglib.core.ConvertNumberTag#setConverterLocale
[ "Convert", "locale", "string", "used", "by", "converter", "tags", "to", "locale", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/LocaleUtils.java#L109-L144
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/ConcurrentLinkedList.java
ConcurrentLinkedList.incrementHeadSequenceNumber
public void incrementHeadSequenceNumber(ConcurrentSubList.Link link) throws ObjectManagerException { if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.entry(this, cclass, "incrementheadSequenceNumber", new Object[] { link }); if (link.next == null) { // This subList is now empty. headSequenceNumber++; // Look at another list next time. } else { // Still more links in this subList. ConcurrentSubList.Link nextLink = (ConcurrentSubList.Link) link.next.getManagedObject(); // If insertion into the body of the list has taken place, // then a sequenceNumber will have been duplicated. if (nextLink.sequenceNumber != headSequenceNumber) headSequenceNumber++; } // if( firstLink.next == null). if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.exit(this, cclass, "incrementHeadSequenceNumber", new Object[] { new Long(headSequenceNumber) }); }
java
public void incrementHeadSequenceNumber(ConcurrentSubList.Link link) throws ObjectManagerException { if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.entry(this, cclass, "incrementheadSequenceNumber", new Object[] { link }); if (link.next == null) { // This subList is now empty. headSequenceNumber++; // Look at another list next time. } else { // Still more links in this subList. ConcurrentSubList.Link nextLink = (ConcurrentSubList.Link) link.next.getManagedObject(); // If insertion into the body of the list has taken place, // then a sequenceNumber will have been duplicated. if (nextLink.sequenceNumber != headSequenceNumber) headSequenceNumber++; } // if( firstLink.next == null). if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.exit(this, cclass, "incrementHeadSequenceNumber", new Object[] { new Long(headSequenceNumber) }); }
[ "public", "void", "incrementHeadSequenceNumber", "(", "ConcurrentSubList", ".", "Link", "link", ")", "throws", "ObjectManagerException", "{", "if", "(", "Tracing", ".", "isAnyTracingEnabled", "(", ")", "&&", "trace", ".", "isEntryEnabled", "(", ")", ")", "trace", ".", "entry", "(", "this", ",", "cclass", ",", "\"incrementheadSequenceNumber\"", ",", "new", "Object", "[", "]", "{", "link", "}", ")", ";", "if", "(", "link", ".", "next", "==", "null", ")", "{", "// This subList is now empty.", "headSequenceNumber", "++", ";", "// Look at another list next time.", "}", "else", "{", "// Still more links in this subList.", "ConcurrentSubList", ".", "Link", "nextLink", "=", "(", "ConcurrentSubList", ".", "Link", ")", "link", ".", "next", ".", "getManagedObject", "(", ")", ";", "// If insertion into the body of the list has taken place,", "// then a sequenceNumber will have been duplicated.", "if", "(", "nextLink", ".", "sequenceNumber", "!=", "headSequenceNumber", ")", "headSequenceNumber", "++", ";", "}", "// if( firstLink.next == null).", "if", "(", "Tracing", ".", "isAnyTracingEnabled", "(", ")", "&&", "trace", ".", "isEntryEnabled", "(", ")", ")", "trace", ".", "exit", "(", "this", ",", "cclass", ",", "\"incrementHeadSequenceNumber\"", ",", "new", "Object", "[", "]", "{", "new", "Long", "(", "headSequenceNumber", ")", "}", ")", ";", "}" ]
Increment the headSequenceNumber, after removal of a link in a subList. Caller must already be synchronized on headSequenceNumberLock. @param link causing the increment. @throws ObjectManagerException
[ "Increment", "the", "headSequenceNumber", "after", "removal", "of", "a", "link", "in", "a", "subList", ".", "Caller", "must", "already", "be", "synchronized", "on", "headSequenceNumberLock", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/ConcurrentLinkedList.java#L139-L163
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/ConcurrentLinkedList.java
ConcurrentLinkedList.resetTailSequenceNumber
private void resetTailSequenceNumber() throws ObjectManagerException { if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.entry(this, cclass , "resetTailSequenceNumber" ); for (int i = 0; i < subListTokens.length; i++) { subLists[i] = ((ConcurrentSubList) subListTokens[i].getManagedObject()); // In case another thread is currently removing the tail, take a safe copy. Token tailToken = subLists[i].tail; // Establish the highest existing tailSequenceNumber. if (tailToken != null) { ConcurrentSubList.Link tail = (ConcurrentSubList.Link) tailToken.getManagedObject(); tailSequenceNumber = Math.max(tailSequenceNumber, tail.sequenceNumber); } // if (tailToken != null). } // for subList. tailSequenceNumberSet = true; if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.exit(this, cclass , "resetHeadSequenceNumber" ); }
java
private void resetTailSequenceNumber() throws ObjectManagerException { if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.entry(this, cclass , "resetTailSequenceNumber" ); for (int i = 0; i < subListTokens.length; i++) { subLists[i] = ((ConcurrentSubList) subListTokens[i].getManagedObject()); // In case another thread is currently removing the tail, take a safe copy. Token tailToken = subLists[i].tail; // Establish the highest existing tailSequenceNumber. if (tailToken != null) { ConcurrentSubList.Link tail = (ConcurrentSubList.Link) tailToken.getManagedObject(); tailSequenceNumber = Math.max(tailSequenceNumber, tail.sequenceNumber); } // if (tailToken != null). } // for subList. tailSequenceNumberSet = true; if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.exit(this, cclass , "resetHeadSequenceNumber" ); }
[ "private", "void", "resetTailSequenceNumber", "(", ")", "throws", "ObjectManagerException", "{", "if", "(", "Tracing", ".", "isAnyTracingEnabled", "(", ")", "&&", "trace", ".", "isEntryEnabled", "(", ")", ")", "trace", ".", "entry", "(", "this", ",", "cclass", ",", "\"resetTailSequenceNumber\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "subListTokens", ".", "length", ";", "i", "++", ")", "{", "subLists", "[", "i", "]", "=", "(", "(", "ConcurrentSubList", ")", "subListTokens", "[", "i", "]", ".", "getManagedObject", "(", ")", ")", ";", "// In case another thread is currently removing the tail, take a safe copy.", "Token", "tailToken", "=", "subLists", "[", "i", "]", ".", "tail", ";", "// Establish the highest existing tailSequenceNumber.", "if", "(", "tailToken", "!=", "null", ")", "{", "ConcurrentSubList", ".", "Link", "tail", "=", "(", "ConcurrentSubList", ".", "Link", ")", "tailToken", ".", "getManagedObject", "(", ")", ";", "tailSequenceNumber", "=", "Math", ".", "max", "(", "tailSequenceNumber", ",", "tail", ".", "sequenceNumber", ")", ";", "}", "// if (tailToken != null).", "}", "// for subList.", "tailSequenceNumberSet", "=", "true", ";", "if", "(", "Tracing", ".", "isAnyTracingEnabled", "(", ")", "&&", "trace", ".", "isEntryEnabled", "(", ")", ")", "trace", ".", "exit", "(", "this", ",", "cclass", ",", "\"resetHeadSequenceNumber\"", ")", ";", "}" ]
Reset the tailSequenceNumber. Caller must be synchronized on tailSequenceNumberLock. @throws ObjectManagerException
[ "Reset", "the", "tailSequenceNumber", ".", "Caller", "must", "be", "synchronized", "on", "tailSequenceNumberLock", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/ConcurrentLinkedList.java#L230-L256
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/ConcurrentLinkedList.java
ConcurrentLinkedList.insert
protected ConcurrentSubList.Link insert(Token token, ConcurrentSubList.Link insertPoint, Transaction transaction) throws ObjectManagerException { if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.entry(this, cclass, "insert", new Object[] { token, insertPoint, transaction }); ConcurrentSubList.Link newLink = null; synchronized (transaction.internalTransaction) { // Establish the sequenceNumber of this Object in the overall list, // before the insert point. long sequenceNumber = insertPoint.sequenceNumber; sequenceNumber--; // Figure out which subList the Object should be added to. ConcurrentSubList list = getSublist(sequenceNumber); // Add the link near the tail of the list according to its assigned // sequence number. tailSequenceNumberLock.lock(); try { newLink = list.addEntry(token, transaction, sequenceNumber, this); } finally { if (tailSequenceNumberLock.isHeldByCurrentThread()) tailSequenceNumberLock.unlock(); } // try (tailSequenceNumberLock). } // synchronized (transaction.internalTransaction). if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.exit(this, cclass, "insert", new Object[] { newLink }); return newLink; }
java
protected ConcurrentSubList.Link insert(Token token, ConcurrentSubList.Link insertPoint, Transaction transaction) throws ObjectManagerException { if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.entry(this, cclass, "insert", new Object[] { token, insertPoint, transaction }); ConcurrentSubList.Link newLink = null; synchronized (transaction.internalTransaction) { // Establish the sequenceNumber of this Object in the overall list, // before the insert point. long sequenceNumber = insertPoint.sequenceNumber; sequenceNumber--; // Figure out which subList the Object should be added to. ConcurrentSubList list = getSublist(sequenceNumber); // Add the link near the tail of the list according to its assigned // sequence number. tailSequenceNumberLock.lock(); try { newLink = list.addEntry(token, transaction, sequenceNumber, this); } finally { if (tailSequenceNumberLock.isHeldByCurrentThread()) tailSequenceNumberLock.unlock(); } // try (tailSequenceNumberLock). } // synchronized (transaction.internalTransaction). if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.exit(this, cclass, "insert", new Object[] { newLink }); return newLink; }
[ "protected", "ConcurrentSubList", ".", "Link", "insert", "(", "Token", "token", ",", "ConcurrentSubList", ".", "Link", "insertPoint", ",", "Transaction", "transaction", ")", "throws", "ObjectManagerException", "{", "if", "(", "Tracing", ".", "isAnyTracingEnabled", "(", ")", "&&", "trace", ".", "isEntryEnabled", "(", ")", ")", "trace", ".", "entry", "(", "this", ",", "cclass", ",", "\"insert\"", ",", "new", "Object", "[", "]", "{", "token", ",", "insertPoint", ",", "transaction", "}", ")", ";", "ConcurrentSubList", ".", "Link", "newLink", "=", "null", ";", "synchronized", "(", "transaction", ".", "internalTransaction", ")", "{", "// Establish the sequenceNumber of this Object in the overall list,", "// before the insert point.", "long", "sequenceNumber", "=", "insertPoint", ".", "sequenceNumber", ";", "sequenceNumber", "--", ";", "// Figure out which subList the Object should be added to.", "ConcurrentSubList", "list", "=", "getSublist", "(", "sequenceNumber", ")", ";", "// Add the link near the tail of the list according to its assigned", "// sequence number.", "tailSequenceNumberLock", ".", "lock", "(", ")", ";", "try", "{", "newLink", "=", "list", ".", "addEntry", "(", "token", ",", "transaction", ",", "sequenceNumber", ",", "this", ")", ";", "}", "finally", "{", "if", "(", "tailSequenceNumberLock", ".", "isHeldByCurrentThread", "(", ")", ")", "tailSequenceNumberLock", ".", "unlock", "(", ")", ";", "}", "// try (tailSequenceNumberLock).", "}", "// synchronized (transaction.internalTransaction).", "if", "(", "Tracing", ".", "isAnyTracingEnabled", "(", ")", "&&", "trace", ".", "isEntryEnabled", "(", ")", ")", "trace", ".", "exit", "(", "this", ",", "cclass", ",", "\"insert\"", ",", "new", "Object", "[", "]", "{", "newLink", "}", ")", ";", "return", "newLink", ";", "}" ]
Insert before the given link. @param token to insert. @param insertPoint which the new link will be before. @param transaction controling the insertion. @return ConcurrentSubList.Link the inserted Link. @throws ObjectManagerException
[ "Insert", "before", "the", "given", "link", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/ConcurrentLinkedList.java#L554-L592
train
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/osgi/WebContainer.java
WebContainer.activate
public void activate(ComponentContext compcontext, Map<String, Object> properties) { String methodName = "activate"; if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Activating the WebContainer bundle"); } WebContainer.instance.set(this); this.context = compcontext; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, methodName, "Default Port [ " + DEFAULT_PORT + " ]"); Tr.debug(tc, methodName, "Default Virtual Host [ " + DEFAULT_VHOST_NAME + " ]"); } WebContainerConfiguration webconfig = new WebContainerConfiguration(DEFAULT_PORT); webconfig.setDefaultVirtualHostName(DEFAULT_VHOST_NAME); this.initialize(webconfig, properties); this.classLoadingSRRef.activate(context); this.sessionHelperSRRef.activate(context); this.cacheManagerSRRef.activate(context); this.injectionEngineSRRef.activate(context); this.managedObjectServiceSRRef.activate(context); this.servletContainerInitializers.activate(context); this.transferContextServiceRef.activate(context); this.webMBeanRuntimeServiceRef.activate(context); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Object mbeanService = context.locateService(REFERENCE_WEB_MBEAN_RUNTIME); Tr.debug(tc, methodName, "Web MBean Runtime [ " + mbeanService + " ]"); Tr.debug(tc, methodName, "Web MBean Runtime Reference [ " + webMBeanRuntimeServiceRef.getReference() + " ]"); Tr.debug(tc, methodName, "Web MBean Runtime Service [ " + webMBeanRuntimeServiceRef.getService() + " ]"); } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, methodName, "Posting STARTED_EVENT"); } Event event = this.eventService.createEvent(WebContainerConstants.STARTED_EVENT); this.eventService.postEvent(event); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, methodName, "Posted STARTED_EVENT"); } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, methodName, "Activating the WebContainer bundle: Complete"); } }
java
public void activate(ComponentContext compcontext, Map<String, Object> properties) { String methodName = "activate"; if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Activating the WebContainer bundle"); } WebContainer.instance.set(this); this.context = compcontext; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, methodName, "Default Port [ " + DEFAULT_PORT + " ]"); Tr.debug(tc, methodName, "Default Virtual Host [ " + DEFAULT_VHOST_NAME + " ]"); } WebContainerConfiguration webconfig = new WebContainerConfiguration(DEFAULT_PORT); webconfig.setDefaultVirtualHostName(DEFAULT_VHOST_NAME); this.initialize(webconfig, properties); this.classLoadingSRRef.activate(context); this.sessionHelperSRRef.activate(context); this.cacheManagerSRRef.activate(context); this.injectionEngineSRRef.activate(context); this.managedObjectServiceSRRef.activate(context); this.servletContainerInitializers.activate(context); this.transferContextServiceRef.activate(context); this.webMBeanRuntimeServiceRef.activate(context); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Object mbeanService = context.locateService(REFERENCE_WEB_MBEAN_RUNTIME); Tr.debug(tc, methodName, "Web MBean Runtime [ " + mbeanService + " ]"); Tr.debug(tc, methodName, "Web MBean Runtime Reference [ " + webMBeanRuntimeServiceRef.getReference() + " ]"); Tr.debug(tc, methodName, "Web MBean Runtime Service [ " + webMBeanRuntimeServiceRef.getService() + " ]"); } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, methodName, "Posting STARTED_EVENT"); } Event event = this.eventService.createEvent(WebContainerConstants.STARTED_EVENT); this.eventService.postEvent(event); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, methodName, "Posted STARTED_EVENT"); } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, methodName, "Activating the WebContainer bundle: Complete"); } }
[ "public", "void", "activate", "(", "ComponentContext", "compcontext", ",", "Map", "<", "String", ",", "Object", ">", "properties", ")", "{", "String", "methodName", "=", "\"activate\"", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEventEnabled", "(", ")", ")", "{", "Tr", ".", "event", "(", "tc", ",", "\"Activating the WebContainer bundle\"", ")", ";", "}", "WebContainer", ".", "instance", ".", "set", "(", "this", ")", ";", "this", ".", "context", "=", "compcontext", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "methodName", ",", "\"Default Port [ \"", "+", "DEFAULT_PORT", "+", "\" ]\"", ")", ";", "Tr", ".", "debug", "(", "tc", ",", "methodName", ",", "\"Default Virtual Host [ \"", "+", "DEFAULT_VHOST_NAME", "+", "\" ]\"", ")", ";", "}", "WebContainerConfiguration", "webconfig", "=", "new", "WebContainerConfiguration", "(", "DEFAULT_PORT", ")", ";", "webconfig", ".", "setDefaultVirtualHostName", "(", "DEFAULT_VHOST_NAME", ")", ";", "this", ".", "initialize", "(", "webconfig", ",", "properties", ")", ";", "this", ".", "classLoadingSRRef", ".", "activate", "(", "context", ")", ";", "this", ".", "sessionHelperSRRef", ".", "activate", "(", "context", ")", ";", "this", ".", "cacheManagerSRRef", ".", "activate", "(", "context", ")", ";", "this", ".", "injectionEngineSRRef", ".", "activate", "(", "context", ")", ";", "this", ".", "managedObjectServiceSRRef", ".", "activate", "(", "context", ")", ";", "this", ".", "servletContainerInitializers", ".", "activate", "(", "context", ")", ";", "this", ".", "transferContextServiceRef", ".", "activate", "(", "context", ")", ";", "this", ".", "webMBeanRuntimeServiceRef", ".", "activate", "(", "context", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Object", "mbeanService", "=", "context", ".", "locateService", "(", "REFERENCE_WEB_MBEAN_RUNTIME", ")", ";", "Tr", ".", "debug", "(", "tc", ",", "methodName", ",", "\"Web MBean Runtime [ \"", "+", "mbeanService", "+", "\" ]\"", ")", ";", "Tr", ".", "debug", "(", "tc", ",", "methodName", ",", "\"Web MBean Runtime Reference [ \"", "+", "webMBeanRuntimeServiceRef", ".", "getReference", "(", ")", "+", "\" ]\"", ")", ";", "Tr", ".", "debug", "(", "tc", ",", "methodName", ",", "\"Web MBean Runtime Service [ \"", "+", "webMBeanRuntimeServiceRef", ".", "getService", "(", ")", "+", "\" ]\"", ")", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "methodName", ",", "\"Posting STARTED_EVENT\"", ")", ";", "}", "Event", "event", "=", "this", ".", "eventService", ".", "createEvent", "(", "WebContainerConstants", ".", "STARTED_EVENT", ")", ";", "this", ".", "eventService", ".", "postEvent", "(", "event", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "methodName", ",", "\"Posted STARTED_EVENT\"", ")", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "methodName", ",", "\"Activating the WebContainer bundle: Complete\"", ")", ";", "}", "}" ]
Activate the web container as a DS component. Activate all child services. Set the web container singleton. Post a started event. @param componentContext The component context of the activation. @param properties Properties for the activation.
[ "Activate", "the", "web", "container", "as", "a", "DS", "component", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/osgi/WebContainer.java#L273-L321
train
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/osgi/WebContainer.java
WebContainer.deactivate
@FFDCIgnore(Exception.class) public void deactivate(ComponentContext componentContext) { String methodName = "deactivate"; if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Deactivating the WebContainer bundle"); } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, methodName, "Posting STOPPED_EVENT"); } Event event = this.eventService.createEvent(WebContainerConstants.STOPPED_EVENT); this.eventService.postEvent(event); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, methodName, "Posted STOPPED_EVENT"); } this.classLoadingSRRef.deactivate(componentContext); this.sessionHelperSRRef.deactivate(componentContext); this.cacheManagerSRRef.deactivate(componentContext); this.injectionEngineSRRef.deactivate(componentContext); this.managedObjectServiceSRRef.deactivate(context); this.servletContainerInitializers.deactivate(componentContext); this.transferContextServiceRef.deactivate(componentContext); this.webMBeanRuntimeServiceRef.deactivate(componentContext); // will now purge each host as it becomes redundant rather than all here. //this.vhostManager.purge(); // Clear/purge all maps. WebContainer.instance.compareAndSet(this, null); extensionFactories.clear(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, methodName, "Deactivating the WebContainer bundle: Complete"); } }
java
@FFDCIgnore(Exception.class) public void deactivate(ComponentContext componentContext) { String methodName = "deactivate"; if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Deactivating the WebContainer bundle"); } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, methodName, "Posting STOPPED_EVENT"); } Event event = this.eventService.createEvent(WebContainerConstants.STOPPED_EVENT); this.eventService.postEvent(event); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, methodName, "Posted STOPPED_EVENT"); } this.classLoadingSRRef.deactivate(componentContext); this.sessionHelperSRRef.deactivate(componentContext); this.cacheManagerSRRef.deactivate(componentContext); this.injectionEngineSRRef.deactivate(componentContext); this.managedObjectServiceSRRef.deactivate(context); this.servletContainerInitializers.deactivate(componentContext); this.transferContextServiceRef.deactivate(componentContext); this.webMBeanRuntimeServiceRef.deactivate(componentContext); // will now purge each host as it becomes redundant rather than all here. //this.vhostManager.purge(); // Clear/purge all maps. WebContainer.instance.compareAndSet(this, null); extensionFactories.clear(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, methodName, "Deactivating the WebContainer bundle: Complete"); } }
[ "@", "FFDCIgnore", "(", "Exception", ".", "class", ")", "public", "void", "deactivate", "(", "ComponentContext", "componentContext", ")", "{", "String", "methodName", "=", "\"deactivate\"", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEventEnabled", "(", ")", ")", "{", "Tr", ".", "event", "(", "tc", ",", "\"Deactivating the WebContainer bundle\"", ")", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "methodName", ",", "\"Posting STOPPED_EVENT\"", ")", ";", "}", "Event", "event", "=", "this", ".", "eventService", ".", "createEvent", "(", "WebContainerConstants", ".", "STOPPED_EVENT", ")", ";", "this", ".", "eventService", ".", "postEvent", "(", "event", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "methodName", ",", "\"Posted STOPPED_EVENT\"", ")", ";", "}", "this", ".", "classLoadingSRRef", ".", "deactivate", "(", "componentContext", ")", ";", "this", ".", "sessionHelperSRRef", ".", "deactivate", "(", "componentContext", ")", ";", "this", ".", "cacheManagerSRRef", ".", "deactivate", "(", "componentContext", ")", ";", "this", ".", "injectionEngineSRRef", ".", "deactivate", "(", "componentContext", ")", ";", "this", ".", "managedObjectServiceSRRef", ".", "deactivate", "(", "context", ")", ";", "this", ".", "servletContainerInitializers", ".", "deactivate", "(", "componentContext", ")", ";", "this", ".", "transferContextServiceRef", ".", "deactivate", "(", "componentContext", ")", ";", "this", ".", "webMBeanRuntimeServiceRef", ".", "deactivate", "(", "componentContext", ")", ";", "// will now purge each host as it becomes redundant rather than all here.", "//this.vhostManager.purge(); // Clear/purge all maps.", "WebContainer", ".", "instance", ".", "compareAndSet", "(", "this", ",", "null", ")", ";", "extensionFactories", ".", "clear", "(", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "methodName", ",", "\"Deactivating the WebContainer bundle: Complete\"", ")", ";", "}", "}" ]
Deactivate the web container as a DS component. Post a stopped event. Deactivate all child services. Clear the web container singleton. @param componentContext The component context of the deactivation.
[ "Deactivate", "the", "web", "container", "as", "a", "DS", "component", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/osgi/WebContainer.java#L382-L417
train
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/osgi/WebContainer.java
WebContainer.setClassLoadingService
@Reference(service=ClassLoadingService.class, name="classLoadingService") protected void setClassLoadingService(ServiceReference<ClassLoadingService> ref) { classLoadingSRRef.setReference(ref); }
java
@Reference(service=ClassLoadingService.class, name="classLoadingService") protected void setClassLoadingService(ServiceReference<ClassLoadingService> ref) { classLoadingSRRef.setReference(ref); }
[ "@", "Reference", "(", "service", "=", "ClassLoadingService", ".", "class", ",", "name", "=", "\"classLoadingService\"", ")", "protected", "void", "setClassLoadingService", "(", "ServiceReference", "<", "ClassLoadingService", ">", "ref", ")", "{", "classLoadingSRRef", ".", "setReference", "(", "ref", ")", ";", "}" ]
DS method for setting the class loading service reference. @param service
[ "DS", "method", "for", "setting", "the", "class", "loading", "service", "reference", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/osgi/WebContainer.java#L444-L447
train
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/osgi/WebContainer.java
WebContainer.setEncodingService
@Reference(policy=ReferencePolicy.DYNAMIC) protected void setEncodingService(EncodingUtils encUtils) { encodingServiceRef.set(encUtils); }
java
@Reference(policy=ReferencePolicy.DYNAMIC) protected void setEncodingService(EncodingUtils encUtils) { encodingServiceRef.set(encUtils); }
[ "@", "Reference", "(", "policy", "=", "ReferencePolicy", ".", "DYNAMIC", ")", "protected", "void", "setEncodingService", "(", "EncodingUtils", "encUtils", ")", "{", "encodingServiceRef", ".", "set", "(", "encUtils", ")", ";", "}" ]
DS method for setting the Encoding service. @param service
[ "DS", "method", "for", "setting", "the", "Encoding", "service", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/osgi/WebContainer.java#L545-L548
train
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/osgi/WebContainer.java
WebContainer.setSessionHelper
@Reference(service=SessionHelper.class, name="sessionHelper") protected void setSessionHelper(ServiceReference<SessionHelper> ref) { sessionHelperSRRef.setReference(ref); }
java
@Reference(service=SessionHelper.class, name="sessionHelper") protected void setSessionHelper(ServiceReference<SessionHelper> ref) { sessionHelperSRRef.setReference(ref); }
[ "@", "Reference", "(", "service", "=", "SessionHelper", ".", "class", ",", "name", "=", "\"sessionHelper\"", ")", "protected", "void", "setSessionHelper", "(", "ServiceReference", "<", "SessionHelper", ">", "ref", ")", "{", "sessionHelperSRRef", ".", "setReference", "(", "ref", ")", ";", "}" ]
Set the reference to the session helper service. @param ref
[ "Set", "the", "reference", "to", "the", "session", "helper", "service", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/osgi/WebContainer.java#L597-L600
train
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/osgi/WebContainer.java
WebContainer.createModuleMetaData
@Override public ModuleMetaData createModuleMetaData(ExtendedModuleInfo moduleInfo) throws MetaDataException { WebModuleInfo webModule = (WebModuleInfo) moduleInfo; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "createModuleMetaData: " + webModule.getName() + " " + webModule.getContextRoot()); } try { com.ibm.wsspi.adaptable.module.Container webModuleContainer = webModule.getContainer(); WebAppConfiguration appConfig = webModuleContainer.adapt(WebAppConfiguration.class); String appName = appConfig.getApplicationName(); String j2eeModuleName = appConfig.getJ2EEModuleName(); WebModuleMetaDataImpl wmmd = (WebModuleMetaDataImpl) appConfig.getMetaData(); wmmd.setJ2EEName(j2eeNameFactory.create(appName, j2eeModuleName, null)); appConfig.setWebApp(createWebApp(moduleInfo, appConfig)); return wmmd; } catch (Throwable e) { Throwable cause = e.getCause(); MetaDataException m; if ((cause!=null) && (cause instanceof MetaDataException)) { m = (MetaDataException) cause; //don't log a FFDC here as we already logged an exception } else { m = new MetaDataException(e); FFDCWrapper.processException(e, getClass().getName(), "createModuleMetaData", new Object[] { webModule, this });//this throws the exception } if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "createModuleMetaData: " + webModule.getName() + "; " + e); } throw m; } }
java
@Override public ModuleMetaData createModuleMetaData(ExtendedModuleInfo moduleInfo) throws MetaDataException { WebModuleInfo webModule = (WebModuleInfo) moduleInfo; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "createModuleMetaData: " + webModule.getName() + " " + webModule.getContextRoot()); } try { com.ibm.wsspi.adaptable.module.Container webModuleContainer = webModule.getContainer(); WebAppConfiguration appConfig = webModuleContainer.adapt(WebAppConfiguration.class); String appName = appConfig.getApplicationName(); String j2eeModuleName = appConfig.getJ2EEModuleName(); WebModuleMetaDataImpl wmmd = (WebModuleMetaDataImpl) appConfig.getMetaData(); wmmd.setJ2EEName(j2eeNameFactory.create(appName, j2eeModuleName, null)); appConfig.setWebApp(createWebApp(moduleInfo, appConfig)); return wmmd; } catch (Throwable e) { Throwable cause = e.getCause(); MetaDataException m; if ((cause!=null) && (cause instanceof MetaDataException)) { m = (MetaDataException) cause; //don't log a FFDC here as we already logged an exception } else { m = new MetaDataException(e); FFDCWrapper.processException(e, getClass().getName(), "createModuleMetaData", new Object[] { webModule, this });//this throws the exception } if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "createModuleMetaData: " + webModule.getName() + "; " + e); } throw m; } }
[ "@", "Override", "public", "ModuleMetaData", "createModuleMetaData", "(", "ExtendedModuleInfo", "moduleInfo", ")", "throws", "MetaDataException", "{", "WebModuleInfo", "webModule", "=", "(", "WebModuleInfo", ")", "moduleInfo", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"createModuleMetaData: \"", "+", "webModule", ".", "getName", "(", ")", "+", "\" \"", "+", "webModule", ".", "getContextRoot", "(", ")", ")", ";", "}", "try", "{", "com", ".", "ibm", ".", "wsspi", ".", "adaptable", ".", "module", ".", "Container", "webModuleContainer", "=", "webModule", ".", "getContainer", "(", ")", ";", "WebAppConfiguration", "appConfig", "=", "webModuleContainer", ".", "adapt", "(", "WebAppConfiguration", ".", "class", ")", ";", "String", "appName", "=", "appConfig", ".", "getApplicationName", "(", ")", ";", "String", "j2eeModuleName", "=", "appConfig", ".", "getJ2EEModuleName", "(", ")", ";", "WebModuleMetaDataImpl", "wmmd", "=", "(", "WebModuleMetaDataImpl", ")", "appConfig", ".", "getMetaData", "(", ")", ";", "wmmd", ".", "setJ2EEName", "(", "j2eeNameFactory", ".", "create", "(", "appName", ",", "j2eeModuleName", ",", "null", ")", ")", ";", "appConfig", ".", "setWebApp", "(", "createWebApp", "(", "moduleInfo", ",", "appConfig", ")", ")", ";", "return", "wmmd", ";", "}", "catch", "(", "Throwable", "e", ")", "{", "Throwable", "cause", "=", "e", ".", "getCause", "(", ")", ";", "MetaDataException", "m", ";", "if", "(", "(", "cause", "!=", "null", ")", "&&", "(", "cause", "instanceof", "MetaDataException", ")", ")", "{", "m", "=", "(", "MetaDataException", ")", "cause", ";", "//don't log a FFDC here as we already logged an exception", "}", "else", "{", "m", "=", "new", "MetaDataException", "(", "e", ")", ";", "FFDCWrapper", ".", "processException", "(", "e", ",", "getClass", "(", ")", ".", "getName", "(", ")", ",", "\"createModuleMetaData\"", ",", "new", "Object", "[", "]", "{", "webModule", ",", "this", "}", ")", ";", "//this throws the exception", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEventEnabled", "(", ")", ")", "{", "Tr", ".", "event", "(", "tc", ",", "\"createModuleMetaData: \"", "+", "webModule", ".", "getName", "(", ")", "+", "\"; \"", "+", "e", ")", ";", "}", "throw", "m", ";", "}", "}" ]
This will create the metadata for a web module in the web container
[ "This", "will", "create", "the", "metadata", "for", "a", "web", "module", "in", "the", "web", "container" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/osgi/WebContainer.java#L827-L858
train
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/osgi/WebContainer.java
WebContainer.registerMBeans
protected void registerMBeans(WebModuleMetaDataImpl webModule, com.ibm.wsspi.adaptable.module.Container container) { String methodName = "registerMBeans"; String appName = webModule.getApplicationMetaData().getName(); String webAppName = webModule.getName(); String debugName; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { debugName = appName + " " + webAppName; } else { debugName = null; } WebMBeanRuntime mBeanRuntime = webMBeanRuntimeServiceRef.getService(); if (mBeanRuntime == null) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, methodName, "Web Module [ " + debugName + " ]: No MBean Runtime"); } return; } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, methodName, "Web Module [ " + debugName + " ]: MBean Runtime"); } } String ddPath = com.ibm.ws.javaee.dd.web.WebApp.DD_NAME; // This should be obtained by an adapt call. Iterator<IServletConfig> servletConfigs = webModule.getConfiguration().getServletInfos(); webModule.mBeanServiceReg = mBeanRuntime.registerModuleMBean(appName, webAppName, container, ddPath, servletConfigs); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, methodName, "Web Module [ " + debugName + " ]: Registration [ " + webModule.mBeanServiceReg + " ]"); } servletConfigs = webModule.getConfiguration().getServletInfos(); while (servletConfigs.hasNext()) { IServletConfig servletConfig = servletConfigs.next(); String servletName = servletConfig.getServletName(); WebComponentMetaDataImpl wcmdi = (WebComponentMetaDataImpl) servletConfig.getMetaData(); wcmdi.mBeanServiceReg = mBeanRuntime.registerServletMBean(appName, webAppName, servletName); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, methodName, "Web Module [ " + debugName + " ] Servlet [ " + servletName + " ]: Registration [ " + wcmdi.mBeanServiceReg + " ]"); } } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, methodName, "Web Module [ " + debugName + " ]: Completed registrations"); } }
java
protected void registerMBeans(WebModuleMetaDataImpl webModule, com.ibm.wsspi.adaptable.module.Container container) { String methodName = "registerMBeans"; String appName = webModule.getApplicationMetaData().getName(); String webAppName = webModule.getName(); String debugName; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { debugName = appName + " " + webAppName; } else { debugName = null; } WebMBeanRuntime mBeanRuntime = webMBeanRuntimeServiceRef.getService(); if (mBeanRuntime == null) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, methodName, "Web Module [ " + debugName + " ]: No MBean Runtime"); } return; } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, methodName, "Web Module [ " + debugName + " ]: MBean Runtime"); } } String ddPath = com.ibm.ws.javaee.dd.web.WebApp.DD_NAME; // This should be obtained by an adapt call. Iterator<IServletConfig> servletConfigs = webModule.getConfiguration().getServletInfos(); webModule.mBeanServiceReg = mBeanRuntime.registerModuleMBean(appName, webAppName, container, ddPath, servletConfigs); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, methodName, "Web Module [ " + debugName + " ]: Registration [ " + webModule.mBeanServiceReg + " ]"); } servletConfigs = webModule.getConfiguration().getServletInfos(); while (servletConfigs.hasNext()) { IServletConfig servletConfig = servletConfigs.next(); String servletName = servletConfig.getServletName(); WebComponentMetaDataImpl wcmdi = (WebComponentMetaDataImpl) servletConfig.getMetaData(); wcmdi.mBeanServiceReg = mBeanRuntime.registerServletMBean(appName, webAppName, servletName); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, methodName, "Web Module [ " + debugName + " ] Servlet [ " + servletName + " ]: Registration [ " + wcmdi.mBeanServiceReg + " ]"); } } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, methodName, "Web Module [ " + debugName + " ]: Completed registrations"); } }
[ "protected", "void", "registerMBeans", "(", "WebModuleMetaDataImpl", "webModule", ",", "com", ".", "ibm", ".", "wsspi", ".", "adaptable", ".", "module", ".", "Container", "container", ")", "{", "String", "methodName", "=", "\"registerMBeans\"", ";", "String", "appName", "=", "webModule", ".", "getApplicationMetaData", "(", ")", ".", "getName", "(", ")", ";", "String", "webAppName", "=", "webModule", ".", "getName", "(", ")", ";", "String", "debugName", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "debugName", "=", "appName", "+", "\" \"", "+", "webAppName", ";", "}", "else", "{", "debugName", "=", "null", ";", "}", "WebMBeanRuntime", "mBeanRuntime", "=", "webMBeanRuntimeServiceRef", ".", "getService", "(", ")", ";", "if", "(", "mBeanRuntime", "==", "null", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "methodName", ",", "\"Web Module [ \"", "+", "debugName", "+", "\" ]: No MBean Runtime\"", ")", ";", "}", "return", ";", "}", "else", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "methodName", ",", "\"Web Module [ \"", "+", "debugName", "+", "\" ]: MBean Runtime\"", ")", ";", "}", "}", "String", "ddPath", "=", "com", ".", "ibm", ".", "ws", ".", "javaee", ".", "dd", ".", "web", ".", "WebApp", ".", "DD_NAME", ";", "// This should be obtained by an adapt call.", "Iterator", "<", "IServletConfig", ">", "servletConfigs", "=", "webModule", ".", "getConfiguration", "(", ")", ".", "getServletInfos", "(", ")", ";", "webModule", ".", "mBeanServiceReg", "=", "mBeanRuntime", ".", "registerModuleMBean", "(", "appName", ",", "webAppName", ",", "container", ",", "ddPath", ",", "servletConfigs", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "methodName", ",", "\"Web Module [ \"", "+", "debugName", "+", "\" ]: Registration [ \"", "+", "webModule", ".", "mBeanServiceReg", "+", "\" ]\"", ")", ";", "}", "servletConfigs", "=", "webModule", ".", "getConfiguration", "(", ")", ".", "getServletInfos", "(", ")", ";", "while", "(", "servletConfigs", ".", "hasNext", "(", ")", ")", "{", "IServletConfig", "servletConfig", "=", "servletConfigs", ".", "next", "(", ")", ";", "String", "servletName", "=", "servletConfig", ".", "getServletName", "(", ")", ";", "WebComponentMetaDataImpl", "wcmdi", "=", "(", "WebComponentMetaDataImpl", ")", "servletConfig", ".", "getMetaData", "(", ")", ";", "wcmdi", ".", "mBeanServiceReg", "=", "mBeanRuntime", ".", "registerServletMBean", "(", "appName", ",", "webAppName", ",", "servletName", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "methodName", ",", "\"Web Module [ \"", "+", "debugName", "+", "\" ] Servlet [ \"", "+", "servletName", "+", "\" ]: Registration [ \"", "+", "wcmdi", ".", "mBeanServiceReg", "+", "\" ]\"", ")", ";", "}", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "methodName", ",", "\"Web Module [ \"", "+", "debugName", "+", "\" ]: Completed registrations\"", ")", ";", "}", "}" ]
Check for the JSR77 runtime, and, if available, use it to register module and servlet mbeans. As a side effect, assign the mbean registration to the web module metadata and to the servlet metadata. The web module container is required for access to the web module descriptor. @param webModule The web module to register. @param container The container of the web module.
[ "Check", "for", "the", "JSR77", "runtime", "and", "if", "available", "use", "it", "to", "register", "module", "and", "servlet", "mbeans", ".", "As", "a", "side", "effect", "assign", "the", "mbean", "registration", "to", "the", "web", "module", "metadata", "and", "to", "the", "servlet", "metadata", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/osgi/WebContainer.java#L987-L1036
train
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/osgi/WebContainer.java
WebContainer.stopModule
public void stopModule(ExtendedModuleInfo moduleInfo) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "stopModule()",((WebModuleInfo)moduleInfo).getName()); } WebModuleInfo webModule = (WebModuleInfo) moduleInfo; try { DeployedModule dMod = this.deployedModuleMap.remove(webModule); if (null == dMod) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "stopModule()","DeployedModule not known"); } return; } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "stopModule: " + webModule.getName() + " " + webModule.getContextRoot()); } removeContextRootRequirement(dMod); removeModule(dMod); this.vhostManager.purgeHost(dMod.getVirtualHostName()); WebModuleMetaData wmmd = (WebModuleMetaData) ((ExtendedModuleInfo)webModule).getMetaData(); deregisterMBeans((WebModuleMetaDataImpl) wmmd); WebAppConfiguration appConfig = (WebAppConfiguration) wmmd.getConfiguration(); for (Iterator<IServletConfig> servletConfigs = appConfig.getServletInfos(); servletConfigs.hasNext();) { IServletConfig servletConfig = servletConfigs.next(); metaDataService.fireComponentMetaDataDestroyed(servletConfig.getMetaData()); } metaDataService.fireComponentMetaDataDestroyed(appConfig.getDefaultComponentMetaData()); metaDataService.fireComponentMetaDataDestroyed(wmmd.getCollaboratorComponentMetaData()); } catch (Throwable e) { FFDCWrapper.processException(e, getClass().getName(), "stopModule", new Object[] { webModule, this }); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "stopModule: " + webModule.getName() + "; " + e); } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "stopModule()"); } }
java
public void stopModule(ExtendedModuleInfo moduleInfo) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "stopModule()",((WebModuleInfo)moduleInfo).getName()); } WebModuleInfo webModule = (WebModuleInfo) moduleInfo; try { DeployedModule dMod = this.deployedModuleMap.remove(webModule); if (null == dMod) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "stopModule()","DeployedModule not known"); } return; } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "stopModule: " + webModule.getName() + " " + webModule.getContextRoot()); } removeContextRootRequirement(dMod); removeModule(dMod); this.vhostManager.purgeHost(dMod.getVirtualHostName()); WebModuleMetaData wmmd = (WebModuleMetaData) ((ExtendedModuleInfo)webModule).getMetaData(); deregisterMBeans((WebModuleMetaDataImpl) wmmd); WebAppConfiguration appConfig = (WebAppConfiguration) wmmd.getConfiguration(); for (Iterator<IServletConfig> servletConfigs = appConfig.getServletInfos(); servletConfigs.hasNext();) { IServletConfig servletConfig = servletConfigs.next(); metaDataService.fireComponentMetaDataDestroyed(servletConfig.getMetaData()); } metaDataService.fireComponentMetaDataDestroyed(appConfig.getDefaultComponentMetaData()); metaDataService.fireComponentMetaDataDestroyed(wmmd.getCollaboratorComponentMetaData()); } catch (Throwable e) { FFDCWrapper.processException(e, getClass().getName(), "stopModule", new Object[] { webModule, this }); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "stopModule: " + webModule.getName() + "; " + e); } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "stopModule()"); } }
[ "public", "void", "stopModule", "(", "ExtendedModuleInfo", "moduleInfo", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "entry", "(", "tc", ",", "\"stopModule()\"", ",", "(", "(", "WebModuleInfo", ")", "moduleInfo", ")", ".", "getName", "(", ")", ")", ";", "}", "WebModuleInfo", "webModule", "=", "(", "WebModuleInfo", ")", "moduleInfo", ";", "try", "{", "DeployedModule", "dMod", "=", "this", ".", "deployedModuleMap", ".", "remove", "(", "webModule", ")", ";", "if", "(", "null", "==", "dMod", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "exit", "(", "tc", ",", "\"stopModule()\"", ",", "\"DeployedModule not known\"", ")", ";", "}", "return", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"stopModule: \"", "+", "webModule", ".", "getName", "(", ")", "+", "\" \"", "+", "webModule", ".", "getContextRoot", "(", ")", ")", ";", "}", "removeContextRootRequirement", "(", "dMod", ")", ";", "removeModule", "(", "dMod", ")", ";", "this", ".", "vhostManager", ".", "purgeHost", "(", "dMod", ".", "getVirtualHostName", "(", ")", ")", ";", "WebModuleMetaData", "wmmd", "=", "(", "WebModuleMetaData", ")", "(", "(", "ExtendedModuleInfo", ")", "webModule", ")", ".", "getMetaData", "(", ")", ";", "deregisterMBeans", "(", "(", "WebModuleMetaDataImpl", ")", "wmmd", ")", ";", "WebAppConfiguration", "appConfig", "=", "(", "WebAppConfiguration", ")", "wmmd", ".", "getConfiguration", "(", ")", ";", "for", "(", "Iterator", "<", "IServletConfig", ">", "servletConfigs", "=", "appConfig", ".", "getServletInfos", "(", ")", ";", "servletConfigs", ".", "hasNext", "(", ")", ";", ")", "{", "IServletConfig", "servletConfig", "=", "servletConfigs", ".", "next", "(", ")", ";", "metaDataService", ".", "fireComponentMetaDataDestroyed", "(", "servletConfig", ".", "getMetaData", "(", ")", ")", ";", "}", "metaDataService", ".", "fireComponentMetaDataDestroyed", "(", "appConfig", ".", "getDefaultComponentMetaData", "(", ")", ")", ";", "metaDataService", ".", "fireComponentMetaDataDestroyed", "(", "wmmd", ".", "getCollaboratorComponentMetaData", "(", ")", ")", ";", "}", "catch", "(", "Throwable", "e", ")", "{", "FFDCWrapper", ".", "processException", "(", "e", ",", "getClass", "(", ")", ".", "getName", "(", ")", ",", "\"stopModule\"", ",", "new", "Object", "[", "]", "{", "webModule", ",", "this", "}", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEventEnabled", "(", ")", ")", "{", "Tr", ".", "event", "(", "tc", ",", "\"stopModule: \"", "+", "webModule", ".", "getName", "(", ")", "+", "\"; \"", "+", "e", ")", ";", "}", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "exit", "(", "tc", ",", "\"stopModule()\"", ")", ";", "}", "}" ]
This will stop a web module in the web container
[ "This", "will", "stop", "a", "web", "module", "in", "the", "web", "container" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/osgi/WebContainer.java#L1154-L1201
train
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/osgi/WebContainer.java
WebContainer.setConnContextPool
@Reference(cardinality=ReferenceCardinality.MANDATORY, policy=ReferencePolicy.DYNAMIC, policyOption=ReferencePolicyOption.GREEDY) protected void setConnContextPool(SRTConnectionContextPool pool) { this.connContextPool = pool; }
java
@Reference(cardinality=ReferenceCardinality.MANDATORY, policy=ReferencePolicy.DYNAMIC, policyOption=ReferencePolicyOption.GREEDY) protected void setConnContextPool(SRTConnectionContextPool pool) { this.connContextPool = pool; }
[ "@", "Reference", "(", "cardinality", "=", "ReferenceCardinality", ".", "MANDATORY", ",", "policy", "=", "ReferencePolicy", ".", "DYNAMIC", ",", "policyOption", "=", "ReferencePolicyOption", ".", "GREEDY", ")", "protected", "void", "setConnContextPool", "(", "SRTConnectionContextPool", "pool", ")", "{", "this", ".", "connContextPool", "=", "pool", ";", "}" ]
Only DS should invoke this method
[ "Only", "DS", "should", "invoke", "this", "method" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/osgi/WebContainer.java#L1445-L1448
train
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/wsspi/cache/Cache.java
Cache.refreshEntry
public void refreshEntry(com.ibm.wsspi.cache.CacheEntry ce){ cacheInstance.refreshEntry(ce.cacheEntry); }
java
public void refreshEntry(com.ibm.wsspi.cache.CacheEntry ce){ cacheInstance.refreshEntry(ce.cacheEntry); }
[ "public", "void", "refreshEntry", "(", "com", ".", "ibm", ".", "wsspi", ".", "cache", ".", "CacheEntry", "ce", ")", "{", "cacheInstance", ".", "refreshEntry", "(", "ce", ".", "cacheEntry", ")", ";", "}" ]
This method moves the specified entry to the end of the LRU queue. @param ce The cache entry
[ "This", "method", "moves", "the", "specified", "entry", "to", "the", "end", "of", "the", "LRU", "queue", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/wsspi/cache/Cache.java#L37-L39
train
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/wsspi/cache/Cache.java
Cache.getEntryDisk
public CacheEntry getEntryDisk(Object cacheId) { CacheEntry cacheEntry = new CacheEntry(cacheInstance.getEntryDisk(cacheId)); return cacheEntry; }
java
public CacheEntry getEntryDisk(Object cacheId) { CacheEntry cacheEntry = new CacheEntry(cacheInstance.getEntryDisk(cacheId)); return cacheEntry; }
[ "public", "CacheEntry", "getEntryDisk", "(", "Object", "cacheId", ")", "{", "CacheEntry", "cacheEntry", "=", "new", "CacheEntry", "(", "cacheInstance", ".", "getEntryDisk", "(", "cacheId", ")", ")", ";", "return", "cacheEntry", ";", "}" ]
This method returns the cache entry specified by cache ID from the disk cache. @param cacheId the cache ID @return The cache entry. NULL if cache ID does not exist.
[ "This", "method", "returns", "the", "cache", "entry", "specified", "by", "cache", "ID", "from", "the", "disk", "cache", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/wsspi/cache/Cache.java#L56-L59
train
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/wsspi/cache/Cache.java
Cache.getEntry
public com.ibm.wsspi.cache.CacheEntry getEntry(Object cacheId){ CacheEntry cacheEntry = new CacheEntry(cacheInstance.getEntry(cacheId)); return cacheEntry; }
java
public com.ibm.wsspi.cache.CacheEntry getEntry(Object cacheId){ CacheEntry cacheEntry = new CacheEntry(cacheInstance.getEntry(cacheId)); return cacheEntry; }
[ "public", "com", ".", "ibm", ".", "wsspi", ".", "cache", ".", "CacheEntry", "getEntry", "(", "Object", "cacheId", ")", "{", "CacheEntry", "cacheEntry", "=", "new", "CacheEntry", "(", "cacheInstance", ".", "getEntry", "(", "cacheId", ")", ")", ";", "return", "cacheEntry", ";", "}" ]
This method returns an instance of CacheEntry specified cache ID. @param cacheId the cache ID @return The instance of CacheEntry
[ "This", "method", "returns", "an", "instance", "of", "CacheEntry", "specified", "cache", "ID", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/wsspi/cache/Cache.java#L108-L111
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/translator/document/XMLEncodingDetector.java
XMLEncodingDetector.getEncoding
public static Object[] getEncoding(JspInputSource inputSource) throws IOException, JspCoreException { InputStream inStream = XMLEncodingDetector.getInputStream(inputSource); //InputStream inStream = JspUtil.getInputStream(fname, jarFile, ctxt, // err); XMLEncodingDetector detector = new XMLEncodingDetector(); Object[] ret = detector.getEncoding(inStream); inStream.close(); return ret; }
java
public static Object[] getEncoding(JspInputSource inputSource) throws IOException, JspCoreException { InputStream inStream = XMLEncodingDetector.getInputStream(inputSource); //InputStream inStream = JspUtil.getInputStream(fname, jarFile, ctxt, // err); XMLEncodingDetector detector = new XMLEncodingDetector(); Object[] ret = detector.getEncoding(inStream); inStream.close(); return ret; }
[ "public", "static", "Object", "[", "]", "getEncoding", "(", "JspInputSource", "inputSource", ")", "throws", "IOException", ",", "JspCoreException", "{", "InputStream", "inStream", "=", "XMLEncodingDetector", ".", "getInputStream", "(", "inputSource", ")", ";", "//InputStream inStream = JspUtil.getInputStream(fname, jarFile, ctxt,", "// err);", "XMLEncodingDetector", "detector", "=", "new", "XMLEncodingDetector", "(", ")", ";", "Object", "[", "]", "ret", "=", "detector", ".", "getEncoding", "(", "inStream", ")", ";", "inStream", ".", "close", "(", ")", ";", "return", "ret", ";", "}" ]
Autodetects the encoding of the XML document supplied by the given input stream. Encoding autodetection is done according to the XML 1.0 specification, Appendix F.1: Detection Without External Encoding Information. @return Two-element array, where the first element (of type java.lang.String) contains the name of the (auto)detected encoding, and the second element (of type java.lang.Boolean) specifies whether the encoding was specified using the 'encoding' attribute of an XML prolog (TRUE) or autodetected (FALSE).
[ "Autodetects", "the", "encoding", "of", "the", "XML", "document", "supplied", "by", "the", "given", "input", "stream", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/translator/document/XMLEncodingDetector.java#L86-L97
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/translator/document/XMLEncodingDetector.java
XMLEncodingDetector.createReader
private Reader createReader(InputStream inputStream, String encoding, Boolean isBigEndian) throws IOException, JspCoreException { // normalize encoding name if (encoding == null) { encoding = "UTF-8"; } // try to use an optimized reader String ENCODING = encoding.toUpperCase(Locale.ENGLISH); if (ENCODING.equals("UTF-8")) { return new UTF8Reader(inputStream, fBufferSize); } if (ENCODING.equals("US-ASCII")) { return new ASCIIReader(inputStream, fBufferSize); } if (ENCODING.equals("ISO-10646-UCS-4")) { if (isBigEndian != null) { boolean isBE = isBigEndian.booleanValue(); if (isBE) { return new UCSReader(inputStream, UCSReader.UCS4BE); } else { return new UCSReader(inputStream, UCSReader.UCS4LE); } } else { throw new JspCoreException("jsp.error.xml.encodingByteOrderUnsupported", new Object[] { encoding }); //err.jspError("jsp.error.xml.encodingByteOrderUnsupported", // encoding); } } if (ENCODING.equals("ISO-10646-UCS-2")) { if (isBigEndian != null) { // sould never happen with this encoding... boolean isBE = isBigEndian.booleanValue(); if (isBE) { return new UCSReader(inputStream, UCSReader.UCS2BE); } else { return new UCSReader(inputStream, UCSReader.UCS2LE); } } else { throw new JspCoreException("jsp.error.xml.encodingByteOrderUnsupported", new Object[] { encoding }); //err.jspError("jsp.error.xml.encodingByteOrderUnsupported", // encoding); } } // check for valid name boolean validIANA = XMLChar.isValidIANAEncoding(encoding); boolean validJava = XMLChar.isValidJavaEncoding(encoding); if (!validIANA || (fAllowJavaEncodings && !validJava)) { encoding = "ISO-8859-1"; throw new JspCoreException("jsp.error.xml.encodingDeclInvalid", new Object[] { encoding }); //err.jspError("jsp.error.xml.encodingDeclInvalid", encoding); // NOTE: AndyH suggested that, on failure, we use ISO Latin 1 // because every byte is a valid ISO Latin 1 character. // It may not translate correctly but if we failed on // the encoding anyway, then we're expecting the content // of the document to be bad. This will just prevent an // invalid UTF-8 sequence to be detected. This is only // important when continue-after-fatal-error is turned // on. -Ac } // try to use a Java reader String javaEncoding = EncodingMap.getIANA2JavaMapping(ENCODING); if (javaEncoding == null) { if (fAllowJavaEncodings) { javaEncoding = encoding; } else { javaEncoding = "ISO8859_1"; throw new JspCoreException("jsp.error.xml.encodingDeclInvalid", new Object[] { encoding }); //err.jspError("jsp.error.xml.encodingDeclInvalid", encoding); // see comment above. } } return new InputStreamReader(inputStream, javaEncoding); }
java
private Reader createReader(InputStream inputStream, String encoding, Boolean isBigEndian) throws IOException, JspCoreException { // normalize encoding name if (encoding == null) { encoding = "UTF-8"; } // try to use an optimized reader String ENCODING = encoding.toUpperCase(Locale.ENGLISH); if (ENCODING.equals("UTF-8")) { return new UTF8Reader(inputStream, fBufferSize); } if (ENCODING.equals("US-ASCII")) { return new ASCIIReader(inputStream, fBufferSize); } if (ENCODING.equals("ISO-10646-UCS-4")) { if (isBigEndian != null) { boolean isBE = isBigEndian.booleanValue(); if (isBE) { return new UCSReader(inputStream, UCSReader.UCS4BE); } else { return new UCSReader(inputStream, UCSReader.UCS4LE); } } else { throw new JspCoreException("jsp.error.xml.encodingByteOrderUnsupported", new Object[] { encoding }); //err.jspError("jsp.error.xml.encodingByteOrderUnsupported", // encoding); } } if (ENCODING.equals("ISO-10646-UCS-2")) { if (isBigEndian != null) { // sould never happen with this encoding... boolean isBE = isBigEndian.booleanValue(); if (isBE) { return new UCSReader(inputStream, UCSReader.UCS2BE); } else { return new UCSReader(inputStream, UCSReader.UCS2LE); } } else { throw new JspCoreException("jsp.error.xml.encodingByteOrderUnsupported", new Object[] { encoding }); //err.jspError("jsp.error.xml.encodingByteOrderUnsupported", // encoding); } } // check for valid name boolean validIANA = XMLChar.isValidIANAEncoding(encoding); boolean validJava = XMLChar.isValidJavaEncoding(encoding); if (!validIANA || (fAllowJavaEncodings && !validJava)) { encoding = "ISO-8859-1"; throw new JspCoreException("jsp.error.xml.encodingDeclInvalid", new Object[] { encoding }); //err.jspError("jsp.error.xml.encodingDeclInvalid", encoding); // NOTE: AndyH suggested that, on failure, we use ISO Latin 1 // because every byte is a valid ISO Latin 1 character. // It may not translate correctly but if we failed on // the encoding anyway, then we're expecting the content // of the document to be bad. This will just prevent an // invalid UTF-8 sequence to be detected. This is only // important when continue-after-fatal-error is turned // on. -Ac } // try to use a Java reader String javaEncoding = EncodingMap.getIANA2JavaMapping(ENCODING); if (javaEncoding == null) { if (fAllowJavaEncodings) { javaEncoding = encoding; } else { javaEncoding = "ISO8859_1"; throw new JspCoreException("jsp.error.xml.encodingDeclInvalid", new Object[] { encoding }); //err.jspError("jsp.error.xml.encodingDeclInvalid", encoding); // see comment above. } } return new InputStreamReader(inputStream, javaEncoding); }
[ "private", "Reader", "createReader", "(", "InputStream", "inputStream", ",", "String", "encoding", ",", "Boolean", "isBigEndian", ")", "throws", "IOException", ",", "JspCoreException", "{", "// normalize encoding name", "if", "(", "encoding", "==", "null", ")", "{", "encoding", "=", "\"UTF-8\"", ";", "}", "// try to use an optimized reader", "String", "ENCODING", "=", "encoding", ".", "toUpperCase", "(", "Locale", ".", "ENGLISH", ")", ";", "if", "(", "ENCODING", ".", "equals", "(", "\"UTF-8\"", ")", ")", "{", "return", "new", "UTF8Reader", "(", "inputStream", ",", "fBufferSize", ")", ";", "}", "if", "(", "ENCODING", ".", "equals", "(", "\"US-ASCII\"", ")", ")", "{", "return", "new", "ASCIIReader", "(", "inputStream", ",", "fBufferSize", ")", ";", "}", "if", "(", "ENCODING", ".", "equals", "(", "\"ISO-10646-UCS-4\"", ")", ")", "{", "if", "(", "isBigEndian", "!=", "null", ")", "{", "boolean", "isBE", "=", "isBigEndian", ".", "booleanValue", "(", ")", ";", "if", "(", "isBE", ")", "{", "return", "new", "UCSReader", "(", "inputStream", ",", "UCSReader", ".", "UCS4BE", ")", ";", "}", "else", "{", "return", "new", "UCSReader", "(", "inputStream", ",", "UCSReader", ".", "UCS4LE", ")", ";", "}", "}", "else", "{", "throw", "new", "JspCoreException", "(", "\"jsp.error.xml.encodingByteOrderUnsupported\"", ",", "new", "Object", "[", "]", "{", "encoding", "}", ")", ";", "//err.jspError(\"jsp.error.xml.encodingByteOrderUnsupported\",", "// encoding);", "}", "}", "if", "(", "ENCODING", ".", "equals", "(", "\"ISO-10646-UCS-2\"", ")", ")", "{", "if", "(", "isBigEndian", "!=", "null", ")", "{", "// sould never happen with this encoding...", "boolean", "isBE", "=", "isBigEndian", ".", "booleanValue", "(", ")", ";", "if", "(", "isBE", ")", "{", "return", "new", "UCSReader", "(", "inputStream", ",", "UCSReader", ".", "UCS2BE", ")", ";", "}", "else", "{", "return", "new", "UCSReader", "(", "inputStream", ",", "UCSReader", ".", "UCS2LE", ")", ";", "}", "}", "else", "{", "throw", "new", "JspCoreException", "(", "\"jsp.error.xml.encodingByteOrderUnsupported\"", ",", "new", "Object", "[", "]", "{", "encoding", "}", ")", ";", "//err.jspError(\"jsp.error.xml.encodingByteOrderUnsupported\",", "// encoding);", "}", "}", "// check for valid name", "boolean", "validIANA", "=", "XMLChar", ".", "isValidIANAEncoding", "(", "encoding", ")", ";", "boolean", "validJava", "=", "XMLChar", ".", "isValidJavaEncoding", "(", "encoding", ")", ";", "if", "(", "!", "validIANA", "||", "(", "fAllowJavaEncodings", "&&", "!", "validJava", ")", ")", "{", "encoding", "=", "\"ISO-8859-1\"", ";", "throw", "new", "JspCoreException", "(", "\"jsp.error.xml.encodingDeclInvalid\"", ",", "new", "Object", "[", "]", "{", "encoding", "}", ")", ";", "//err.jspError(\"jsp.error.xml.encodingDeclInvalid\", encoding);", "// NOTE: AndyH suggested that, on failure, we use ISO Latin 1", "// because every byte is a valid ISO Latin 1 character.", "// It may not translate correctly but if we failed on", "// the encoding anyway, then we're expecting the content", "// of the document to be bad. This will just prevent an", "// invalid UTF-8 sequence to be detected. This is only", "// important when continue-after-fatal-error is turned", "// on. -Ac", "}", "// try to use a Java reader", "String", "javaEncoding", "=", "EncodingMap", ".", "getIANA2JavaMapping", "(", "ENCODING", ")", ";", "if", "(", "javaEncoding", "==", "null", ")", "{", "if", "(", "fAllowJavaEncodings", ")", "{", "javaEncoding", "=", "encoding", ";", "}", "else", "{", "javaEncoding", "=", "\"ISO8859_1\"", ";", "throw", "new", "JspCoreException", "(", "\"jsp.error.xml.encodingDeclInvalid\"", ",", "new", "Object", "[", "]", "{", "encoding", "}", ")", ";", "//err.jspError(\"jsp.error.xml.encodingDeclInvalid\", encoding);", "// see comment above.", "}", "}", "return", "new", "InputStreamReader", "(", "inputStream", ",", "javaEncoding", ")", ";", "}" ]
Creates a reader capable of reading the given input stream in the specified encoding. @param inputStream The input stream. @param encoding The encoding name that the input stream is encoded using. If the user has specified that Java encoding names are allowed, then the encoding name may be a Java encoding name; otherwise, it is an ianaEncoding name. @param isBigEndian For encodings (like uCS-4), whose names cannot specify a byte order, this tells whether the order is bigEndian. null means unknown or not relevant. @return Returns a reader.
[ "Creates", "a", "reader", "capable", "of", "reading", "the", "given", "input", "stream", "in", "the", "specified", "encoding", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/translator/document/XMLEncodingDetector.java#L178-L255
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/translator/document/XMLEncodingDetector.java
XMLEncodingDetector.getEncodingName
private Object[] getEncodingName(byte[] b4, int count) { if (count < 2) { return new Object[]{"UTF-8", null, Boolean.FALSE}; } // UTF-16, with BOM int b0 = b4[0] & 0xFF; int b1 = b4[1] & 0xFF; if (b0 == 0xFE && b1 == 0xFF) { // UTF-16, big-endian return new Object [] {"UTF-16BE", Boolean.TRUE}; } if (b0 == 0xFF && b1 == 0xFE) { // UTF-16, little-endian return new Object [] {"UTF-16LE", Boolean.FALSE}; } // default to UTF-8 if we don't have enough bytes to make a // good determination of the encoding if (count < 3) { return new Object [] {"UTF-8", null, Boolean.FALSE}; } // UTF-8 with a BOM int b2 = b4[2] & 0xFF; if (b0 == 0xEF && b1 == 0xBB && b2 == 0xBF) { return new Object [] {"UTF-8", null}; } // default to UTF-8 if we don't have enough bytes to make a // good determination of the encoding if (count < 4) { return new Object [] {"UTF-8", null}; } // other encodings int b3 = b4[3] & 0xFF; if (b0 == 0x00 && b1 == 0x00 && b2 == 0x00 && b3 == 0x3C) { // UCS-4, big endian (1234) return new Object [] {"ISO-10646-UCS-4", new Boolean(true)}; } if (b0 == 0x3C && b1 == 0x00 && b2 == 0x00 && b3 == 0x00) { // UCS-4, little endian (4321) return new Object [] {"ISO-10646-UCS-4", new Boolean(false)}; } if (b0 == 0x00 && b1 == 0x00 && b2 == 0x3C && b3 == 0x00) { // UCS-4, unusual octet order (2143) // REVISIT: What should this be? return new Object [] {"ISO-10646-UCS-4", null}; } if (b0 == 0x00 && b1 == 0x3C && b2 == 0x00 && b3 == 0x00) { // UCS-4, unusual octect order (3412) // REVISIT: What should this be? return new Object [] {"ISO-10646-UCS-4", null}; } if (b0 == 0x00 && b1 == 0x3C && b2 == 0x00 && b3 == 0x3F) { // UTF-16, big-endian, no BOM // (or could turn out to be UCS-2... // REVISIT: What should this be? return new Object [] {"UTF-16BE", new Boolean(true)}; } if (b0 == 0x3C && b1 == 0x00 && b2 == 0x3F && b3 == 0x00) { // UTF-16, little-endian, no BOM // (or could turn out to be UCS-2... return new Object [] {"UTF-16LE", new Boolean(false)}; } if (b0 == 0x4C && b1 == 0x6F && b2 == 0xA7 && b3 == 0x94) { // EBCDIC // a la xerces1, return CP037 instead of EBCDIC here return new Object [] {"CP037", null}; } // default encoding return new Object [] {"UTF-8", null, Boolean.FALSE}; }
java
private Object[] getEncodingName(byte[] b4, int count) { if (count < 2) { return new Object[]{"UTF-8", null, Boolean.FALSE}; } // UTF-16, with BOM int b0 = b4[0] & 0xFF; int b1 = b4[1] & 0xFF; if (b0 == 0xFE && b1 == 0xFF) { // UTF-16, big-endian return new Object [] {"UTF-16BE", Boolean.TRUE}; } if (b0 == 0xFF && b1 == 0xFE) { // UTF-16, little-endian return new Object [] {"UTF-16LE", Boolean.FALSE}; } // default to UTF-8 if we don't have enough bytes to make a // good determination of the encoding if (count < 3) { return new Object [] {"UTF-8", null, Boolean.FALSE}; } // UTF-8 with a BOM int b2 = b4[2] & 0xFF; if (b0 == 0xEF && b1 == 0xBB && b2 == 0xBF) { return new Object [] {"UTF-8", null}; } // default to UTF-8 if we don't have enough bytes to make a // good determination of the encoding if (count < 4) { return new Object [] {"UTF-8", null}; } // other encodings int b3 = b4[3] & 0xFF; if (b0 == 0x00 && b1 == 0x00 && b2 == 0x00 && b3 == 0x3C) { // UCS-4, big endian (1234) return new Object [] {"ISO-10646-UCS-4", new Boolean(true)}; } if (b0 == 0x3C && b1 == 0x00 && b2 == 0x00 && b3 == 0x00) { // UCS-4, little endian (4321) return new Object [] {"ISO-10646-UCS-4", new Boolean(false)}; } if (b0 == 0x00 && b1 == 0x00 && b2 == 0x3C && b3 == 0x00) { // UCS-4, unusual octet order (2143) // REVISIT: What should this be? return new Object [] {"ISO-10646-UCS-4", null}; } if (b0 == 0x00 && b1 == 0x3C && b2 == 0x00 && b3 == 0x00) { // UCS-4, unusual octect order (3412) // REVISIT: What should this be? return new Object [] {"ISO-10646-UCS-4", null}; } if (b0 == 0x00 && b1 == 0x3C && b2 == 0x00 && b3 == 0x3F) { // UTF-16, big-endian, no BOM // (or could turn out to be UCS-2... // REVISIT: What should this be? return new Object [] {"UTF-16BE", new Boolean(true)}; } if (b0 == 0x3C && b1 == 0x00 && b2 == 0x3F && b3 == 0x00) { // UTF-16, little-endian, no BOM // (or could turn out to be UCS-2... return new Object [] {"UTF-16LE", new Boolean(false)}; } if (b0 == 0x4C && b1 == 0x6F && b2 == 0xA7 && b3 == 0x94) { // EBCDIC // a la xerces1, return CP037 instead of EBCDIC here return new Object [] {"CP037", null}; } // default encoding return new Object [] {"UTF-8", null, Boolean.FALSE}; }
[ "private", "Object", "[", "]", "getEncodingName", "(", "byte", "[", "]", "b4", ",", "int", "count", ")", "{", "if", "(", "count", "<", "2", ")", "{", "return", "new", "Object", "[", "]", "{", "\"UTF-8\"", ",", "null", ",", "Boolean", ".", "FALSE", "}", ";", "}", "// UTF-16, with BOM", "int", "b0", "=", "b4", "[", "0", "]", "&", "0xFF", ";", "int", "b1", "=", "b4", "[", "1", "]", "&", "0xFF", ";", "if", "(", "b0", "==", "0xFE", "&&", "b1", "==", "0xFF", ")", "{", "// UTF-16, big-endian", "return", "new", "Object", "[", "]", "{", "\"UTF-16BE\"", ",", "Boolean", ".", "TRUE", "}", ";", "}", "if", "(", "b0", "==", "0xFF", "&&", "b1", "==", "0xFE", ")", "{", "// UTF-16, little-endian", "return", "new", "Object", "[", "]", "{", "\"UTF-16LE\"", ",", "Boolean", ".", "FALSE", "}", ";", "}", "// default to UTF-8 if we don't have enough bytes to make a", "// good determination of the encoding", "if", "(", "count", "<", "3", ")", "{", "return", "new", "Object", "[", "]", "{", "\"UTF-8\"", ",", "null", ",", "Boolean", ".", "FALSE", "}", ";", "}", "// UTF-8 with a BOM", "int", "b2", "=", "b4", "[", "2", "]", "&", "0xFF", ";", "if", "(", "b0", "==", "0xEF", "&&", "b1", "==", "0xBB", "&&", "b2", "==", "0xBF", ")", "{", "return", "new", "Object", "[", "]", "{", "\"UTF-8\"", ",", "null", "}", ";", "}", "// default to UTF-8 if we don't have enough bytes to make a", "// good determination of the encoding", "if", "(", "count", "<", "4", ")", "{", "return", "new", "Object", "[", "]", "{", "\"UTF-8\"", ",", "null", "}", ";", "}", "// other encodings", "int", "b3", "=", "b4", "[", "3", "]", "&", "0xFF", ";", "if", "(", "b0", "==", "0x00", "&&", "b1", "==", "0x00", "&&", "b2", "==", "0x00", "&&", "b3", "==", "0x3C", ")", "{", "// UCS-4, big endian (1234)", "return", "new", "Object", "[", "]", "{", "\"ISO-10646-UCS-4\"", ",", "new", "Boolean", "(", "true", ")", "}", ";", "}", "if", "(", "b0", "==", "0x3C", "&&", "b1", "==", "0x00", "&&", "b2", "==", "0x00", "&&", "b3", "==", "0x00", ")", "{", "// UCS-4, little endian (4321)", "return", "new", "Object", "[", "]", "{", "\"ISO-10646-UCS-4\"", ",", "new", "Boolean", "(", "false", ")", "}", ";", "}", "if", "(", "b0", "==", "0x00", "&&", "b1", "==", "0x00", "&&", "b2", "==", "0x3C", "&&", "b3", "==", "0x00", ")", "{", "// UCS-4, unusual octet order (2143)", "// REVISIT: What should this be?", "return", "new", "Object", "[", "]", "{", "\"ISO-10646-UCS-4\"", ",", "null", "}", ";", "}", "if", "(", "b0", "==", "0x00", "&&", "b1", "==", "0x3C", "&&", "b2", "==", "0x00", "&&", "b3", "==", "0x00", ")", "{", "// UCS-4, unusual octect order (3412)", "// REVISIT: What should this be?", "return", "new", "Object", "[", "]", "{", "\"ISO-10646-UCS-4\"", ",", "null", "}", ";", "}", "if", "(", "b0", "==", "0x00", "&&", "b1", "==", "0x3C", "&&", "b2", "==", "0x00", "&&", "b3", "==", "0x3F", ")", "{", "// UTF-16, big-endian, no BOM", "// (or could turn out to be UCS-2...", "// REVISIT: What should this be?", "return", "new", "Object", "[", "]", "{", "\"UTF-16BE\"", ",", "new", "Boolean", "(", "true", ")", "}", ";", "}", "if", "(", "b0", "==", "0x3C", "&&", "b1", "==", "0x00", "&&", "b2", "==", "0x3F", "&&", "b3", "==", "0x00", ")", "{", "// UTF-16, little-endian, no BOM", "// (or could turn out to be UCS-2...", "return", "new", "Object", "[", "]", "{", "\"UTF-16LE\"", ",", "new", "Boolean", "(", "false", ")", "}", ";", "}", "if", "(", "b0", "==", "0x4C", "&&", "b1", "==", "0x6F", "&&", "b2", "==", "0xA7", "&&", "b3", "==", "0x94", ")", "{", "// EBCDIC", "// a la xerces1, return CP037 instead of EBCDIC here", "return", "new", "Object", "[", "]", "{", "\"CP037\"", ",", "null", "}", ";", "}", "// default encoding", "return", "new", "Object", "[", "]", "{", "\"UTF-8\"", ",", "null", ",", "Boolean", ".", "FALSE", "}", ";", "}" ]
Returns the IANA encoding name that is auto-detected from the bytes specified, with the endian-ness of that encoding where appropriate. @param b4 The first four bytes of the input. @param count The number of bytes actually read. @return a 2-element array: the first element, an IANA-encoding string, the second element a Boolean which is true iff the document is big endian, false if it's little-endian, and null if the distinction isn't relevant.
[ "Returns", "the", "IANA", "encoding", "name", "that", "is", "auto", "-", "detected", "from", "the", "bytes", "specified", "with", "the", "endian", "-", "ness", "of", "that", "encoding", "where", "appropriate", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/translator/document/XMLEncodingDetector.java#L271-L347
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/translator/document/XMLEncodingDetector.java
XMLEncodingDetector.load
final boolean load(int offset, boolean changeEntity) throws IOException { // read characters int length = fCurrentEntity.mayReadChunks? (fCurrentEntity.ch.length - offset): (DEFAULT_XMLDECL_BUFFER_SIZE); int count = fCurrentEntity.reader.read(fCurrentEntity.ch, offset, length); // reset count and position boolean entityChanged = false; if (count != -1) { if (count != 0) { fCurrentEntity.count = count + offset; fCurrentEntity.position = offset; } } // end of this entity else { fCurrentEntity.count = offset; fCurrentEntity.position = offset; entityChanged = true; if (changeEntity) { endEntity(); if (fCurrentEntity == null) { throw new EOFException(); } // handle the trailing edges if (fCurrentEntity.position == fCurrentEntity.count) { load(0, false); } } } return entityChanged; }
java
final boolean load(int offset, boolean changeEntity) throws IOException { // read characters int length = fCurrentEntity.mayReadChunks? (fCurrentEntity.ch.length - offset): (DEFAULT_XMLDECL_BUFFER_SIZE); int count = fCurrentEntity.reader.read(fCurrentEntity.ch, offset, length); // reset count and position boolean entityChanged = false; if (count != -1) { if (count != 0) { fCurrentEntity.count = count + offset; fCurrentEntity.position = offset; } } // end of this entity else { fCurrentEntity.count = offset; fCurrentEntity.position = offset; entityChanged = true; if (changeEntity) { endEntity(); if (fCurrentEntity == null) { throw new EOFException(); } // handle the trailing edges if (fCurrentEntity.position == fCurrentEntity.count) { load(0, false); } } } return entityChanged; }
[ "final", "boolean", "load", "(", "int", "offset", ",", "boolean", "changeEntity", ")", "throws", "IOException", "{", "// read characters", "int", "length", "=", "fCurrentEntity", ".", "mayReadChunks", "?", "(", "fCurrentEntity", ".", "ch", ".", "length", "-", "offset", ")", ":", "(", "DEFAULT_XMLDECL_BUFFER_SIZE", ")", ";", "int", "count", "=", "fCurrentEntity", ".", "reader", ".", "read", "(", "fCurrentEntity", ".", "ch", ",", "offset", ",", "length", ")", ";", "// reset count and position", "boolean", "entityChanged", "=", "false", ";", "if", "(", "count", "!=", "-", "1", ")", "{", "if", "(", "count", "!=", "0", ")", "{", "fCurrentEntity", ".", "count", "=", "count", "+", "offset", ";", "fCurrentEntity", ".", "position", "=", "offset", ";", "}", "}", "// end of this entity", "else", "{", "fCurrentEntity", ".", "count", "=", "offset", ";", "fCurrentEntity", ".", "position", "=", "offset", ";", "entityChanged", "=", "true", ";", "if", "(", "changeEntity", ")", "{", "endEntity", "(", ")", ";", "if", "(", "fCurrentEntity", "==", "null", ")", "{", "throw", "new", "EOFException", "(", ")", ";", "}", "// handle the trailing edges", "if", "(", "fCurrentEntity", ".", "position", "==", "fCurrentEntity", ".", "count", ")", "{", "load", "(", "0", ",", "false", ")", ";", "}", "}", "}", "return", "entityChanged", ";", "}" ]
Loads a chunk of text. @param offset The offset into the character buffer to read the next batch of characters. @param changeEntity True if the load should change entities at the end of the entity, otherwise leave the current entity in place and the entity boundary will be signaled by the return value. @returns Returns true if the entity changed as a result of this load operation.
[ "Loads", "a", "chunk", "of", "text", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/translator/document/XMLEncodingDetector.java#L986-L1024
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/translator/document/XMLEncodingDetector.java
XMLEncodingDetector.scanPseudoAttribute
public String scanPseudoAttribute(boolean scanningTextDecl, XMLString value) throws IOException, JspCoreException { String name = scanName(); if (name == null) { throw new JspCoreException("jsp.error.xml.pseudoAttrNameExpected"); //err.jspError("jsp.error.xml.pseudoAttrNameExpected"); } skipSpaces(); if (!skipChar('=')) { reportFatalError(scanningTextDecl ? "jsp.error.xml.eqRequiredInTextDecl" : "jsp.error.xml.eqRequiredInXMLDecl", name); } skipSpaces(); int quote = peekChar(); if (quote != '\'' && quote != '"') { reportFatalError(scanningTextDecl ? "jsp.error.xml.quoteRequiredInTextDecl" : "jsp.error.xml.quoteRequiredInXMLDecl" , name); } scanChar(); int c = scanLiteral(quote, value); if (c != quote) { fStringBuffer2.clear(); do { fStringBuffer2.append(value); if (c != -1) { if (c == '&' || c == '%' || c == '<' || c == ']') { fStringBuffer2.append((char)scanChar()); } else if (XMLChar.isHighSurrogate(c)) { scanSurrogates(fStringBuffer2); } else if (XMLChar.isInvalid(c)) { String key = scanningTextDecl ? "jsp.error.xml.invalidCharInTextDecl" : "jsp.error.xml.invalidCharInXMLDecl"; reportFatalError(key, Integer.toString(c, 16)); scanChar(); } } c = scanLiteral(quote, value); } while (c != quote); fStringBuffer2.append(value); value.setValues(fStringBuffer2); } if (!skipChar(quote)) { reportFatalError(scanningTextDecl ? "jsp.error.xml.closeQuoteMissingInTextDecl" : "jsp.error.xml.closeQuoteMissingInXMLDecl", name); } // return return name; }
java
public String scanPseudoAttribute(boolean scanningTextDecl, XMLString value) throws IOException, JspCoreException { String name = scanName(); if (name == null) { throw new JspCoreException("jsp.error.xml.pseudoAttrNameExpected"); //err.jspError("jsp.error.xml.pseudoAttrNameExpected"); } skipSpaces(); if (!skipChar('=')) { reportFatalError(scanningTextDecl ? "jsp.error.xml.eqRequiredInTextDecl" : "jsp.error.xml.eqRequiredInXMLDecl", name); } skipSpaces(); int quote = peekChar(); if (quote != '\'' && quote != '"') { reportFatalError(scanningTextDecl ? "jsp.error.xml.quoteRequiredInTextDecl" : "jsp.error.xml.quoteRequiredInXMLDecl" , name); } scanChar(); int c = scanLiteral(quote, value); if (c != quote) { fStringBuffer2.clear(); do { fStringBuffer2.append(value); if (c != -1) { if (c == '&' || c == '%' || c == '<' || c == ']') { fStringBuffer2.append((char)scanChar()); } else if (XMLChar.isHighSurrogate(c)) { scanSurrogates(fStringBuffer2); } else if (XMLChar.isInvalid(c)) { String key = scanningTextDecl ? "jsp.error.xml.invalidCharInTextDecl" : "jsp.error.xml.invalidCharInXMLDecl"; reportFatalError(key, Integer.toString(c, 16)); scanChar(); } } c = scanLiteral(quote, value); } while (c != quote); fStringBuffer2.append(value); value.setValues(fStringBuffer2); } if (!skipChar(quote)) { reportFatalError(scanningTextDecl ? "jsp.error.xml.closeQuoteMissingInTextDecl" : "jsp.error.xml.closeQuoteMissingInXMLDecl", name); } // return return name; }
[ "public", "String", "scanPseudoAttribute", "(", "boolean", "scanningTextDecl", ",", "XMLString", "value", ")", "throws", "IOException", ",", "JspCoreException", "{", "String", "name", "=", "scanName", "(", ")", ";", "if", "(", "name", "==", "null", ")", "{", "throw", "new", "JspCoreException", "(", "\"jsp.error.xml.pseudoAttrNameExpected\"", ")", ";", "//err.jspError(\"jsp.error.xml.pseudoAttrNameExpected\");", "}", "skipSpaces", "(", ")", ";", "if", "(", "!", "skipChar", "(", "'", "'", ")", ")", "{", "reportFatalError", "(", "scanningTextDecl", "?", "\"jsp.error.xml.eqRequiredInTextDecl\"", ":", "\"jsp.error.xml.eqRequiredInXMLDecl\"", ",", "name", ")", ";", "}", "skipSpaces", "(", ")", ";", "int", "quote", "=", "peekChar", "(", ")", ";", "if", "(", "quote", "!=", "'", "'", "&&", "quote", "!=", "'", "'", ")", "{", "reportFatalError", "(", "scanningTextDecl", "?", "\"jsp.error.xml.quoteRequiredInTextDecl\"", ":", "\"jsp.error.xml.quoteRequiredInXMLDecl\"", ",", "name", ")", ";", "}", "scanChar", "(", ")", ";", "int", "c", "=", "scanLiteral", "(", "quote", ",", "value", ")", ";", "if", "(", "c", "!=", "quote", ")", "{", "fStringBuffer2", ".", "clear", "(", ")", ";", "do", "{", "fStringBuffer2", ".", "append", "(", "value", ")", ";", "if", "(", "c", "!=", "-", "1", ")", "{", "if", "(", "c", "==", "'", "'", "||", "c", "==", "'", "'", "||", "c", "==", "'", "'", "||", "c", "==", "'", "'", ")", "{", "fStringBuffer2", ".", "append", "(", "(", "char", ")", "scanChar", "(", ")", ")", ";", "}", "else", "if", "(", "XMLChar", ".", "isHighSurrogate", "(", "c", ")", ")", "{", "scanSurrogates", "(", "fStringBuffer2", ")", ";", "}", "else", "if", "(", "XMLChar", ".", "isInvalid", "(", "c", ")", ")", "{", "String", "key", "=", "scanningTextDecl", "?", "\"jsp.error.xml.invalidCharInTextDecl\"", ":", "\"jsp.error.xml.invalidCharInXMLDecl\"", ";", "reportFatalError", "(", "key", ",", "Integer", ".", "toString", "(", "c", ",", "16", ")", ")", ";", "scanChar", "(", ")", ";", "}", "}", "c", "=", "scanLiteral", "(", "quote", ",", "value", ")", ";", "}", "while", "(", "c", "!=", "quote", ")", ";", "fStringBuffer2", ".", "append", "(", "value", ")", ";", "value", ".", "setValues", "(", "fStringBuffer2", ")", ";", "}", "if", "(", "!", "skipChar", "(", "quote", ")", ")", "{", "reportFatalError", "(", "scanningTextDecl", "?", "\"jsp.error.xml.closeQuoteMissingInTextDecl\"", ":", "\"jsp.error.xml.closeQuoteMissingInXMLDecl\"", ",", "name", ")", ";", "}", "// return", "return", "name", ";", "}" ]
Scans a pseudo attribute. @param scanningTextDecl True if scanning this pseudo-attribute for a TextDecl; false if scanning XMLDecl. This flag is needed to report the correct type of error. @param value The string to fill in with the attribute value. @return The name of the attribute <strong>Note:</strong> This method uses fStringBuffer2, anything in it at the time of calling is lost.
[ "Scans", "a", "pseudo", "attribute", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/translator/document/XMLEncodingDetector.java#L1460-L1520
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/translator/document/XMLEncodingDetector.java
XMLEncodingDetector.reportFatalError
private void reportFatalError(String msgId, String arg) throws JspCoreException { throw new JspCoreException(msgId, new Object[] { arg }); //err.jspError(msgId, arg); }
java
private void reportFatalError(String msgId, String arg) throws JspCoreException { throw new JspCoreException(msgId, new Object[] { arg }); //err.jspError(msgId, arg); }
[ "private", "void", "reportFatalError", "(", "String", "msgId", ",", "String", "arg", ")", "throws", "JspCoreException", "{", "throw", "new", "JspCoreException", "(", "msgId", ",", "new", "Object", "[", "]", "{", "arg", "}", ")", ";", "//err.jspError(msgId, arg);", "}" ]
Convenience function used in all XML scanners.
[ "Convenience", "function", "used", "in", "all", "XML", "scanners", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/translator/document/XMLEncodingDetector.java#L1629-L1633
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/config/ManagedBeanBuilder.java
ManagedBeanBuilder.coerceToType
@SuppressWarnings("unchecked") public static <T> T coerceToType(FacesContext facesContext, Object value, Class<? extends T> desiredClass) { if (value == null) { return null; } try { ExpressionFactory expFactory = facesContext.getApplication().getExpressionFactory(); // Use coersion implemented by JSP EL for consistency with EL // expressions. Additionally, it caches some of the coersions. return (T)expFactory.coerceToType(value, desiredClass); } catch (ELException e) { String message = "Cannot coerce " + value.getClass().getName() + " to " + desiredClass.getName(); log.log(Level.SEVERE, message , e); throw new FacesException(message, e); } }
java
@SuppressWarnings("unchecked") public static <T> T coerceToType(FacesContext facesContext, Object value, Class<? extends T> desiredClass) { if (value == null) { return null; } try { ExpressionFactory expFactory = facesContext.getApplication().getExpressionFactory(); // Use coersion implemented by JSP EL for consistency with EL // expressions. Additionally, it caches some of the coersions. return (T)expFactory.coerceToType(value, desiredClass); } catch (ELException e) { String message = "Cannot coerce " + value.getClass().getName() + " to " + desiredClass.getName(); log.log(Level.SEVERE, message , e); throw new FacesException(message, e); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", ">", "T", "coerceToType", "(", "FacesContext", "facesContext", ",", "Object", "value", ",", "Class", "<", "?", "extends", "T", ">", "desiredClass", ")", "{", "if", "(", "value", "==", "null", ")", "{", "return", "null", ";", "}", "try", "{", "ExpressionFactory", "expFactory", "=", "facesContext", ".", "getApplication", "(", ")", ".", "getExpressionFactory", "(", ")", ";", "// Use coersion implemented by JSP EL for consistency with EL", "// expressions. Additionally, it caches some of the coersions.", "return", "(", "T", ")", "expFactory", ".", "coerceToType", "(", "value", ",", "desiredClass", ")", ";", "}", "catch", "(", "ELException", "e", ")", "{", "String", "message", "=", "\"Cannot coerce \"", "+", "value", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\" to \"", "+", "desiredClass", ".", "getName", "(", ")", ";", "log", ".", "log", "(", "Level", ".", "SEVERE", ",", "message", ",", "e", ")", ";", "throw", "new", "FacesException", "(", "message", ",", "e", ")", ";", "}", "}" ]
to unified EL in JSF 1.2
[ "to", "unified", "EL", "in", "JSF", "1", ".", "2" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/config/ManagedBeanBuilder.java#L356-L378
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/config/ManagedBeanBuilder.java
ManagedBeanBuilder.getNarrowestScope
private String getNarrowestScope(FacesContext facesContext, String valueExpression) { List<String> expressions = extractExpressions(valueExpression); // exclude NONE scope, if there are more than one ValueExpressions (see Spec for details) String narrowestScope = expressions.size() == 1 ? NONE : APPLICATION; boolean scopeFound = false; for (String expression : expressions) { String valueScope = getScope(facesContext, expression); if (valueScope == null) { continue; } // we have found at least one valid scope at this point scopeFound = true; if (SCOPE_COMPARATOR.compare(valueScope, narrowestScope) < 0) { narrowestScope = valueScope; } } return scopeFound ? narrowestScope : null; }
java
private String getNarrowestScope(FacesContext facesContext, String valueExpression) { List<String> expressions = extractExpressions(valueExpression); // exclude NONE scope, if there are more than one ValueExpressions (see Spec for details) String narrowestScope = expressions.size() == 1 ? NONE : APPLICATION; boolean scopeFound = false; for (String expression : expressions) { String valueScope = getScope(facesContext, expression); if (valueScope == null) { continue; } // we have found at least one valid scope at this point scopeFound = true; if (SCOPE_COMPARATOR.compare(valueScope, narrowestScope) < 0) { narrowestScope = valueScope; } } return scopeFound ? narrowestScope : null; }
[ "private", "String", "getNarrowestScope", "(", "FacesContext", "facesContext", ",", "String", "valueExpression", ")", "{", "List", "<", "String", ">", "expressions", "=", "extractExpressions", "(", "valueExpression", ")", ";", "// exclude NONE scope, if there are more than one ValueExpressions (see Spec for details)", "String", "narrowestScope", "=", "expressions", ".", "size", "(", ")", "==", "1", "?", "NONE", ":", "APPLICATION", ";", "boolean", "scopeFound", "=", "false", ";", "for", "(", "String", "expression", ":", "expressions", ")", "{", "String", "valueScope", "=", "getScope", "(", "facesContext", ",", "expression", ")", ";", "if", "(", "valueScope", "==", "null", ")", "{", "continue", ";", "}", "// we have found at least one valid scope at this point", "scopeFound", "=", "true", ";", "if", "(", "SCOPE_COMPARATOR", ".", "compare", "(", "valueScope", ",", "narrowestScope", ")", "<", "0", ")", "{", "narrowestScope", "=", "valueScope", ";", "}", "}", "return", "scopeFound", "?", "narrowestScope", ":", "null", ";", "}" ]
Gets the narrowest scope to which the ValueExpression points. @param facesContext @param valueExpression @return
[ "Gets", "the", "narrowest", "scope", "to", "which", "the", "ValueExpression", "points", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/config/ManagedBeanBuilder.java#L457-L480
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/config/ManagedBeanBuilder.java
ManagedBeanBuilder.getFirstSegment
private String getFirstSegment(String expression) { int indexDot = expression.indexOf('.'); int indexBracket = expression.indexOf('['); if (indexBracket < 0) { return indexDot < 0 ? expression : expression.substring(0, indexDot); } if (indexDot < 0) { return expression.substring(0, indexBracket); } return expression.substring(0, Math.min(indexDot, indexBracket)); }
java
private String getFirstSegment(String expression) { int indexDot = expression.indexOf('.'); int indexBracket = expression.indexOf('['); if (indexBracket < 0) { return indexDot < 0 ? expression : expression.substring(0, indexDot); } if (indexDot < 0) { return expression.substring(0, indexBracket); } return expression.substring(0, Math.min(indexDot, indexBracket)); }
[ "private", "String", "getFirstSegment", "(", "String", "expression", ")", "{", "int", "indexDot", "=", "expression", ".", "indexOf", "(", "'", "'", ")", ";", "int", "indexBracket", "=", "expression", ".", "indexOf", "(", "'", "'", ")", ";", "if", "(", "indexBracket", "<", "0", ")", "{", "return", "indexDot", "<", "0", "?", "expression", ":", "expression", ".", "substring", "(", "0", ",", "indexDot", ")", ";", "}", "if", "(", "indexDot", "<", "0", ")", "{", "return", "expression", ".", "substring", "(", "0", ",", "indexBracket", ")", ";", "}", "return", "expression", ".", "substring", "(", "0", ",", "Math", ".", "min", "(", "indexDot", ",", "indexBracket", ")", ")", ";", "}" ]
Extract the first expression segment, that is the substring up to the first '.' or '[' @param expression @return first segment of the expression
[ "Extract", "the", "first", "expression", "segment", "that", "is", "the", "substring", "up", "to", "the", "first", ".", "or", "[" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/config/ManagedBeanBuilder.java#L607-L626
train
OpenLiberty/open-liberty
dev/com.ibm.ws.event/src/com/ibm/ws/event/internal/EventImpl.java
EventImpl.get
@SuppressWarnings("unchecked") public <T> T get(EventLocal<T> key) { EventLocalMap<EventLocal<?>, Object> map = getMap(key); if (null == map) { return key.initialValue(); } return (T) map.get(key); }
java
@SuppressWarnings("unchecked") public <T> T get(EventLocal<T> key) { EventLocalMap<EventLocal<?>, Object> map = getMap(key); if (null == map) { return key.initialValue(); } return (T) map.get(key); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "T", ">", "T", "get", "(", "EventLocal", "<", "T", ">", "key", ")", "{", "EventLocalMap", "<", "EventLocal", "<", "?", ">", ",", "Object", ">", "map", "=", "getMap", "(", "key", ")", ";", "if", "(", "null", "==", "map", ")", "{", "return", "key", ".", "initialValue", "(", ")", ";", "}", "return", "(", "T", ")", "map", ".", "get", "(", "key", ")", ";", "}" ]
Query the possible value for the provided EventLocal. @param <T> @param key @return T
[ "Query", "the", "possible", "value", "for", "the", "provided", "EventLocal", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.event/src/com/ibm/ws/event/internal/EventImpl.java#L322-L329
train
OpenLiberty/open-liberty
dev/com.ibm.ws.event/src/com/ibm/ws/event/internal/EventImpl.java
EventImpl.set
public <T> void set(EventLocal<T> key, Object value) { EventLocalMap<EventLocal<?>, Object> map = getMap(key); if (null == map) { // the call to getMap would have created the inheritable map // if appropriate, thus always create a disconnected map here map = new EventLocalMap<EventLocal<?>, Object>(); if (key.isInheritable()) { this.inheritableLocals = map; } else { this.locals = map; } } map.put(key, value); }
java
public <T> void set(EventLocal<T> key, Object value) { EventLocalMap<EventLocal<?>, Object> map = getMap(key); if (null == map) { // the call to getMap would have created the inheritable map // if appropriate, thus always create a disconnected map here map = new EventLocalMap<EventLocal<?>, Object>(); if (key.isInheritable()) { this.inheritableLocals = map; } else { this.locals = map; } } map.put(key, value); }
[ "public", "<", "T", ">", "void", "set", "(", "EventLocal", "<", "T", ">", "key", ",", "Object", "value", ")", "{", "EventLocalMap", "<", "EventLocal", "<", "?", ">", ",", "Object", ">", "map", "=", "getMap", "(", "key", ")", ";", "if", "(", "null", "==", "map", ")", "{", "// the call to getMap would have created the inheritable map", "// if appropriate, thus always create a disconnected map here", "map", "=", "new", "EventLocalMap", "<", "EventLocal", "<", "?", ">", ",", "Object", ">", "(", ")", ";", "if", "(", "key", ".", "isInheritable", "(", ")", ")", "{", "this", ".", "inheritableLocals", "=", "map", ";", "}", "else", "{", "this", ".", "locals", "=", "map", ";", "}", "}", "map", ".", "put", "(", "key", ",", "value", ")", ";", "}" ]
Set the value for the provided EventLocal on this event. @param <T> @param key @param value
[ "Set", "the", "value", "for", "the", "provided", "EventLocal", "on", "this", "event", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.event/src/com/ibm/ws/event/internal/EventImpl.java#L338-L351
train
OpenLiberty/open-liberty
dev/com.ibm.ws.event/src/com/ibm/ws/event/internal/EventImpl.java
EventImpl.remove
@SuppressWarnings("unchecked") public <T> T remove(EventLocal<T> key) { EventLocalMap<EventLocal<?>, Object> map = getMap(key); if (null != map) { return (T) map.remove(key); } return null; }
java
@SuppressWarnings("unchecked") public <T> T remove(EventLocal<T> key) { EventLocalMap<EventLocal<?>, Object> map = getMap(key); if (null != map) { return (T) map.remove(key); } return null; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "T", ">", "T", "remove", "(", "EventLocal", "<", "T", ">", "key", ")", "{", "EventLocalMap", "<", "EventLocal", "<", "?", ">", ",", "Object", ">", "map", "=", "getMap", "(", "key", ")", ";", "if", "(", "null", "!=", "map", ")", "{", "return", "(", "T", ")", "map", ".", "remove", "(", "key", ")", ";", "}", "return", "null", ";", "}" ]
Remove any existing value for the provided EventLocal. @param <T> @param key @return T, existing object being removed, null if none present
[ "Remove", "any", "existing", "value", "for", "the", "provided", "EventLocal", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.event/src/com/ibm/ws/event/internal/EventImpl.java#L360-L367
train
OpenLiberty/open-liberty
dev/com.ibm.ws.event/src/com/ibm/ws/event/internal/EventImpl.java
EventImpl.getContextData
@SuppressWarnings("unchecked") public <T> T getContextData(String name) { T rc = null; if (null != this.inheritableLocals) { rc = (T) this.inheritableLocals.get(name); } if (null == rc && null != this.locals) { rc = (T) this.locals.get(name); } return rc; }
java
@SuppressWarnings("unchecked") public <T> T getContextData(String name) { T rc = null; if (null != this.inheritableLocals) { rc = (T) this.inheritableLocals.get(name); } if (null == rc && null != this.locals) { rc = (T) this.locals.get(name); } return rc; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "T", ">", "T", "getContextData", "(", "String", "name", ")", "{", "T", "rc", "=", "null", ";", "if", "(", "null", "!=", "this", ".", "inheritableLocals", ")", "{", "rc", "=", "(", "T", ")", "this", ".", "inheritableLocals", ".", "get", "(", "name", ")", ";", "}", "if", "(", "null", "==", "rc", "&&", "null", "!=", "this", ".", "locals", ")", "{", "rc", "=", "(", "T", ")", "this", ".", "locals", ".", "get", "(", "name", ")", ";", "}", "return", "rc", ";", "}" ]
Look for the EventLocal of the given name in this particular Event instance. @param <T> @param name @return T
[ "Look", "for", "the", "EventLocal", "of", "the", "given", "name", "in", "this", "particular", "Event", "instance", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.event/src/com/ibm/ws/event/internal/EventImpl.java#L377-L387
train
OpenLiberty/open-liberty
dev/wlp.lib.extract/src/wlp/lib/extract/agent/BootstrapAgent.java
BootstrapAgent.setSystemProperties
private static void setSystemProperties() { // KernelBootstrap also sets these properties in case the bootstrap // agent wasn't used for some reason. String loggingManager = System.getProperty("java.util.logging.manager"); //if (loggingManager == null) // System.setProperty("java.util.logging.manager", "com.ibm.ws.kernel.boot.logging.WsLogManager"); String managementBuilderInitial = System.getProperty("javax.management.builder.initial"); if (managementBuilderInitial == null) System.setProperty("javax.management.builder.initial", "com.ibm.ws.kernel.boot.jmx.internal.PlatformMBeanServerBuilder"); }
java
private static void setSystemProperties() { // KernelBootstrap also sets these properties in case the bootstrap // agent wasn't used for some reason. String loggingManager = System.getProperty("java.util.logging.manager"); //if (loggingManager == null) // System.setProperty("java.util.logging.manager", "com.ibm.ws.kernel.boot.logging.WsLogManager"); String managementBuilderInitial = System.getProperty("javax.management.builder.initial"); if (managementBuilderInitial == null) System.setProperty("javax.management.builder.initial", "com.ibm.ws.kernel.boot.jmx.internal.PlatformMBeanServerBuilder"); }
[ "private", "static", "void", "setSystemProperties", "(", ")", "{", "// KernelBootstrap also sets these properties in case the bootstrap", "// agent wasn't used for some reason.", "String", "loggingManager", "=", "System", ".", "getProperty", "(", "\"java.util.logging.manager\"", ")", ";", "//if (loggingManager == null)", "// System.setProperty(\"java.util.logging.manager\", \"com.ibm.ws.kernel.boot.logging.WsLogManager\");", "String", "managementBuilderInitial", "=", "System", ".", "getProperty", "(", "\"javax.management.builder.initial\"", ")", ";", "if", "(", "managementBuilderInitial", "==", "null", ")", "System", ".", "setProperty", "(", "\"javax.management.builder.initial\"", ",", "\"com.ibm.ws.kernel.boot.jmx.internal.PlatformMBeanServerBuilder\"", ")", ";", "}" ]
Set system properties for JVM singletons.
[ "Set", "system", "properties", "for", "JVM", "singletons", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/wlp.lib.extract/src/wlp/lib/extract/agent/BootstrapAgent.java#L138-L149
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsJmsMessageImpl.java
JsJmsMessageImpl.setBodyType
final void setBodyType(JmsBodyType value) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setBodyType", value); setSubtype(value.toByte()); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setBodyType"); }
java
final void setBodyType(JmsBodyType value) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setBodyType", value); setSubtype(value.toByte()); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setBodyType"); }
[ "final", "void", "setBodyType", "(", "JmsBodyType", "value", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "this", ",", "tc", ",", "\"setBodyType\"", ",", "value", ")", ";", "setSubtype", "(", "value", ".", "toByte", "(", ")", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "this", ",", "tc", ",", "\"setBodyType\"", ")", ";", "}" ]
Set the type of the message body. This method is only used by message constructors. @param value The JmsBodyType instance indicating the type of the body i.e. Null, Bytes, Map, etc.
[ "Set", "the", "type", "of", "the", "message", "body", ".", "This", "method", "is", "only", "used", "by", "message", "constructors", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsJmsMessageImpl.java#L443-L449
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsJmsMessageImpl.java
JsJmsMessageImpl.getNonSmokeAndMirrorsPropertyNameSet
private final Set<String> getNonSmokeAndMirrorsPropertyNameSet() { /* Get the names of all the properties in the JMS Property Maps */ /* We need a copy so that we can add extra items, and so can the caller */ Set<String> names = new HashSet<String>(); // Add the names for the two flavours of properties, without creating lists // and maps unnecessarily. if (mayHaveJmsUserProperties()) { names.addAll(getJmsUserPropertyMap().keySet()); } if (mayHaveMappedJmsSystemProperties()) { names.addAll(getJmsSystemPropertyMap().keySet()); } // The MQMD properties may be in the JmsSystemPropertyMap AND the MQMSetPropertiesMap // however, the Set will cater for this as it doesn't allow duplicates. if (hasMQMDPropertiesSet()) { names.addAll(getMQMDSetPropertiesMap().keySet()); } return names; }
java
private final Set<String> getNonSmokeAndMirrorsPropertyNameSet() { /* Get the names of all the properties in the JMS Property Maps */ /* We need a copy so that we can add extra items, and so can the caller */ Set<String> names = new HashSet<String>(); // Add the names for the two flavours of properties, without creating lists // and maps unnecessarily. if (mayHaveJmsUserProperties()) { names.addAll(getJmsUserPropertyMap().keySet()); } if (mayHaveMappedJmsSystemProperties()) { names.addAll(getJmsSystemPropertyMap().keySet()); } // The MQMD properties may be in the JmsSystemPropertyMap AND the MQMSetPropertiesMap // however, the Set will cater for this as it doesn't allow duplicates. if (hasMQMDPropertiesSet()) { names.addAll(getMQMDSetPropertiesMap().keySet()); } return names; }
[ "private", "final", "Set", "<", "String", ">", "getNonSmokeAndMirrorsPropertyNameSet", "(", ")", "{", "/* Get the names of all the properties in the JMS Property Maps */", "/* We need a copy so that we can add extra items, and so can the caller */", "Set", "<", "String", ">", "names", "=", "new", "HashSet", "<", "String", ">", "(", ")", ";", "// Add the names for the two flavours of properties, without creating lists", "// and maps unnecessarily.", "if", "(", "mayHaveJmsUserProperties", "(", ")", ")", "{", "names", ".", "addAll", "(", "getJmsUserPropertyMap", "(", ")", ".", "keySet", "(", ")", ")", ";", "}", "if", "(", "mayHaveMappedJmsSystemProperties", "(", ")", ")", "{", "names", ".", "addAll", "(", "getJmsSystemPropertyMap", "(", ")", ".", "keySet", "(", ")", ")", ";", "}", "// The MQMD properties may be in the JmsSystemPropertyMap AND the MQMSetPropertiesMap", "// however, the Set will cater for this as it doesn't allow duplicates.", "if", "(", "hasMQMDPropertiesSet", "(", ")", ")", "{", "names", ".", "addAll", "(", "getMQMDSetPropertiesMap", "(", ")", ".", "keySet", "(", ")", ")", ";", "}", "return", "names", ";", "}" ]
Return a Set of just the non-smoke-and-mirrors property names @return A set containing the names of all the non-smoke-and-mirrors properties
[ "Return", "a", "Set", "of", "just", "the", "non", "-", "smoke", "-", "and", "-", "mirrors", "property", "names" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsJmsMessageImpl.java#L872-L893
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsJmsMessageImpl.java
JsJmsMessageImpl.getJMSXGroupSeq
@Override public Object getJMSXGroupSeq() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getJMSXGroupSeq"); Object result = null; if (mayHaveMappedJmsSystemProperties()) { result = getObjectProperty(SIProperties.JMSXGroupSeq); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getJMSXGroupSeq", result); return result; }
java
@Override public Object getJMSXGroupSeq() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getJMSXGroupSeq"); Object result = null; if (mayHaveMappedJmsSystemProperties()) { result = getObjectProperty(SIProperties.JMSXGroupSeq); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getJMSXGroupSeq", result); return result; }
[ "@", "Override", "public", "Object", "getJMSXGroupSeq", "(", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "this", ",", "tc", ",", "\"getJMSXGroupSeq\"", ")", ";", "Object", "result", "=", "null", ";", "if", "(", "mayHaveMappedJmsSystemProperties", "(", ")", ")", "{", "result", "=", "getObjectProperty", "(", "SIProperties", ".", "JMSXGroupSeq", ")", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "this", ",", "tc", ",", "\"getJMSXGroupSeq\"", ",", "result", ")", ";", "return", "result", ";", "}" ]
getJMSXGroupSeq Return the value of the JMSXGroupSeq property if it exists. We can return it as object, as that is all JMS API wants. Actually it only really cares whether it exists, but we'll return Object rather than changing the callng code unnecessarily. Javadoc description supplied by JsJmsMessage interface.
[ "getJMSXGroupSeq", "Return", "the", "value", "of", "the", "JMSXGroupSeq", "property", "if", "it", "exists", ".", "We", "can", "return", "it", "as", "object", "as", "that", "is", "all", "JMS", "API", "wants", ".", "Actually", "it", "only", "really", "cares", "whether", "it", "exists", "but", "we", "ll", "return", "Object", "rather", "than", "changing", "the", "callng", "code", "unnecessarily", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsJmsMessageImpl.java#L1162-L1175
train
OpenLiberty/open-liberty
dev/com.ibm.ws.security.authorization.builtin/src/com/ibm/ws/security/authorization/builtin/SecurityRoleImpl.java
SecurityRoleImpl.processSpecialSubjects
private void processSpecialSubjects(ConfigurationAdmin configAdmin, String roleName, Dictionary<String, Object> roleProps, Set<String> pids) { String[] specialSubjectPids = (String[]) roleProps.get(CFG_KEY_SPECIAL_SUBJECT); if (specialSubjectPids == null || specialSubjectPids.length == 0) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "No special subjects in role " + roleName); } } else { Set<String> badSpecialSubjects = new HashSet<String>(); for (int i = 0; i < specialSubjectPids.length; i++) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "special subject pid " + i + ": " + specialSubjectPids[i]); } pids.add(specialSubjectPids[i]); Configuration specialSubjectConfig = null; try { specialSubjectConfig = configAdmin.getConfiguration(specialSubjectPids[i], bundleLocation); } catch (IOException ioe) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Invalid special subject entry " + specialSubjectPids[i]); } continue; } if (specialSubjectConfig == null || specialSubjectConfig.getProperties() == null) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Null special subject element", specialSubjectPids[i]); } continue; } Dictionary<String, Object> specialSubjectProps = specialSubjectConfig.getProperties(); final String type = (String) specialSubjectProps.get("type"); if (type == null || type.trim().isEmpty()) { continue; } if (badSpecialSubjects.contains(type)) { // This special subject is already flagged as a duplicate continue; } // TODO: check for invalid type if (type.trim().isEmpty()) { // Empty entry, ignoring continue; } if (!specialSubjects.add(type)) { Tr.error(tc, "AUTHZ_TABLE_DUPLICATE_ROLE_MEMBER", getRoleName(), CFG_KEY_SPECIAL_SUBJECT, type); badSpecialSubjects.add(type); specialSubjects.remove(type); } } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Role " + roleName + " has special subjects:", specialSubjects); } } }
java
private void processSpecialSubjects(ConfigurationAdmin configAdmin, String roleName, Dictionary<String, Object> roleProps, Set<String> pids) { String[] specialSubjectPids = (String[]) roleProps.get(CFG_KEY_SPECIAL_SUBJECT); if (specialSubjectPids == null || specialSubjectPids.length == 0) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "No special subjects in role " + roleName); } } else { Set<String> badSpecialSubjects = new HashSet<String>(); for (int i = 0; i < specialSubjectPids.length; i++) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "special subject pid " + i + ": " + specialSubjectPids[i]); } pids.add(specialSubjectPids[i]); Configuration specialSubjectConfig = null; try { specialSubjectConfig = configAdmin.getConfiguration(specialSubjectPids[i], bundleLocation); } catch (IOException ioe) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Invalid special subject entry " + specialSubjectPids[i]); } continue; } if (specialSubjectConfig == null || specialSubjectConfig.getProperties() == null) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Null special subject element", specialSubjectPids[i]); } continue; } Dictionary<String, Object> specialSubjectProps = specialSubjectConfig.getProperties(); final String type = (String) specialSubjectProps.get("type"); if (type == null || type.trim().isEmpty()) { continue; } if (badSpecialSubjects.contains(type)) { // This special subject is already flagged as a duplicate continue; } // TODO: check for invalid type if (type.trim().isEmpty()) { // Empty entry, ignoring continue; } if (!specialSubjects.add(type)) { Tr.error(tc, "AUTHZ_TABLE_DUPLICATE_ROLE_MEMBER", getRoleName(), CFG_KEY_SPECIAL_SUBJECT, type); badSpecialSubjects.add(type); specialSubjects.remove(type); } } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Role " + roleName + " has special subjects:", specialSubjects); } } }
[ "private", "void", "processSpecialSubjects", "(", "ConfigurationAdmin", "configAdmin", ",", "String", "roleName", ",", "Dictionary", "<", "String", ",", "Object", ">", "roleProps", ",", "Set", "<", "String", ">", "pids", ")", "{", "String", "[", "]", "specialSubjectPids", "=", "(", "String", "[", "]", ")", "roleProps", ".", "get", "(", "CFG_KEY_SPECIAL_SUBJECT", ")", ";", "if", "(", "specialSubjectPids", "==", "null", "||", "specialSubjectPids", ".", "length", "==", "0", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"No special subjects in role \"", "+", "roleName", ")", ";", "}", "}", "else", "{", "Set", "<", "String", ">", "badSpecialSubjects", "=", "new", "HashSet", "<", "String", ">", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "specialSubjectPids", ".", "length", ";", "i", "++", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"special subject pid \"", "+", "i", "+", "\": \"", "+", "specialSubjectPids", "[", "i", "]", ")", ";", "}", "pids", ".", "add", "(", "specialSubjectPids", "[", "i", "]", ")", ";", "Configuration", "specialSubjectConfig", "=", "null", ";", "try", "{", "specialSubjectConfig", "=", "configAdmin", ".", "getConfiguration", "(", "specialSubjectPids", "[", "i", "]", ",", "bundleLocation", ")", ";", "}", "catch", "(", "IOException", "ioe", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Invalid special subject entry \"", "+", "specialSubjectPids", "[", "i", "]", ")", ";", "}", "continue", ";", "}", "if", "(", "specialSubjectConfig", "==", "null", "||", "specialSubjectConfig", ".", "getProperties", "(", ")", "==", "null", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Null special subject element\"", ",", "specialSubjectPids", "[", "i", "]", ")", ";", "}", "continue", ";", "}", "Dictionary", "<", "String", ",", "Object", ">", "specialSubjectProps", "=", "specialSubjectConfig", ".", "getProperties", "(", ")", ";", "final", "String", "type", "=", "(", "String", ")", "specialSubjectProps", ".", "get", "(", "\"type\"", ")", ";", "if", "(", "type", "==", "null", "||", "type", ".", "trim", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "continue", ";", "}", "if", "(", "badSpecialSubjects", ".", "contains", "(", "type", ")", ")", "{", "// This special subject is already flagged as a duplicate", "continue", ";", "}", "// TODO: check for invalid type", "if", "(", "type", ".", "trim", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "// Empty entry, ignoring", "continue", ";", "}", "if", "(", "!", "specialSubjects", ".", "add", "(", "type", ")", ")", "{", "Tr", ".", "error", "(", "tc", ",", "\"AUTHZ_TABLE_DUPLICATE_ROLE_MEMBER\"", ",", "getRoleName", "(", ")", ",", "CFG_KEY_SPECIAL_SUBJECT", ",", "type", ")", ";", "badSpecialSubjects", ".", "add", "(", "type", ")", ";", "specialSubjects", ".", "remove", "(", "type", ")", ";", "}", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Role \"", "+", "roleName", "+", "\" has special subjects:\"", ",", "specialSubjects", ")", ";", "}", "}", "}" ]
Read and process all the specialSubject elements @param configAdmin @param roleName @param roleProps @param pids TODO
[ "Read", "and", "process", "all", "the", "specialSubject", "elements" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.authorization.builtin/src/com/ibm/ws/security/authorization/builtin/SecurityRoleImpl.java#L265-L321
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transaction/src/com/ibm/ws/transaction/services/WebAppTransactionCollaboratorImpl.java
WebAppTransactionCollaboratorImpl.preInvoke
@Override public TxCollaboratorConfig preInvoke(final HttpServletRequest request, final boolean isServlet23) throws ServletException { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Calling preInvoke. Request=" + request + " | isServlet23=" + isServlet23); } //First we check if there's a global transaction try { final EmbeddableWebSphereTransactionManager tranManager = getTranMgr(); if (tranManager != null) { final Transaction incumbentTx = tranManager.getTransaction(); if (incumbentTx != null) { TransactionImpl incumbentTxImpl = null; if (incumbentTx instanceof TransactionImpl) incumbentTxImpl = (TransactionImpl) incumbentTx; if (incumbentTxImpl != null && incumbentTxImpl.getTxType() == UOWCoordinator.TXTYPE_NONINTEROP_GLOBAL) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "the tx is NONINTEROP_GLOBAL set it to null"); } // The following call should nullify the current tx on the current thread (in this special case where the // TxType is TXTYPE_NONINTEROP_GLOBAL tranManager.suspend(); } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Global transaction was present."); } //Yes! There's a global transaction. Check for timeout checkGlobalTimeout(); //Create config return object final TxCollaboratorConfig retConfig = new TxCollaboratorConfig(); retConfig.setIncumbentTx(incumbentTx); return retConfig; } } } } catch (SystemException e) { Tr.error(tc, "UNEXPECTED_TRAN_ERROR", e.toString()); ServletException se = new ServletException("Unexpected error during transaction fetching: ", e); throw se; } //Ensure we have a LocalTransactionCurrent to work with LocalTransactionCurrent ltCurrent = getLtCurrent(); if (ltCurrent == null) { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(this, tc, "Unable to resolve LocalTransactionCurrent"); } return null; } //Create config return object TxCollaboratorConfig retConfig = new TxCollaboratorConfig(); // see if there is a local transaction on the thread LocalTransactionCoordinator ltCoord = ltCurrent.getLocalTranCoord(); if (ltCoord != null) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Suspending LTC's coord: " + ltCoord); } //there was a transaction! We need to suspend it and put its coordinator into the config //so that we can resume it later retConfig.setSuspendTx(ltCurrent.suspend()); } //begin a new local transaction on the thread ltCurrent.begin(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Began LTC's coord:" + ltCurrent.getLocalTranCoord()); } return retConfig; }
java
@Override public TxCollaboratorConfig preInvoke(final HttpServletRequest request, final boolean isServlet23) throws ServletException { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Calling preInvoke. Request=" + request + " | isServlet23=" + isServlet23); } //First we check if there's a global transaction try { final EmbeddableWebSphereTransactionManager tranManager = getTranMgr(); if (tranManager != null) { final Transaction incumbentTx = tranManager.getTransaction(); if (incumbentTx != null) { TransactionImpl incumbentTxImpl = null; if (incumbentTx instanceof TransactionImpl) incumbentTxImpl = (TransactionImpl) incumbentTx; if (incumbentTxImpl != null && incumbentTxImpl.getTxType() == UOWCoordinator.TXTYPE_NONINTEROP_GLOBAL) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "the tx is NONINTEROP_GLOBAL set it to null"); } // The following call should nullify the current tx on the current thread (in this special case where the // TxType is TXTYPE_NONINTEROP_GLOBAL tranManager.suspend(); } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Global transaction was present."); } //Yes! There's a global transaction. Check for timeout checkGlobalTimeout(); //Create config return object final TxCollaboratorConfig retConfig = new TxCollaboratorConfig(); retConfig.setIncumbentTx(incumbentTx); return retConfig; } } } } catch (SystemException e) { Tr.error(tc, "UNEXPECTED_TRAN_ERROR", e.toString()); ServletException se = new ServletException("Unexpected error during transaction fetching: ", e); throw se; } //Ensure we have a LocalTransactionCurrent to work with LocalTransactionCurrent ltCurrent = getLtCurrent(); if (ltCurrent == null) { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(this, tc, "Unable to resolve LocalTransactionCurrent"); } return null; } //Create config return object TxCollaboratorConfig retConfig = new TxCollaboratorConfig(); // see if there is a local transaction on the thread LocalTransactionCoordinator ltCoord = ltCurrent.getLocalTranCoord(); if (ltCoord != null) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Suspending LTC's coord: " + ltCoord); } //there was a transaction! We need to suspend it and put its coordinator into the config //so that we can resume it later retConfig.setSuspendTx(ltCurrent.suspend()); } //begin a new local transaction on the thread ltCurrent.begin(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Began LTC's coord:" + ltCurrent.getLocalTranCoord()); } return retConfig; }
[ "@", "Override", "public", "TxCollaboratorConfig", "preInvoke", "(", "final", "HttpServletRequest", "request", ",", "final", "boolean", "isServlet23", ")", "throws", "ServletException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Calling preInvoke. Request=\"", "+", "request", "+", "\" | isServlet23=\"", "+", "isServlet23", ")", ";", "}", "//First we check if there's a global transaction", "try", "{", "final", "EmbeddableWebSphereTransactionManager", "tranManager", "=", "getTranMgr", "(", ")", ";", "if", "(", "tranManager", "!=", "null", ")", "{", "final", "Transaction", "incumbentTx", "=", "tranManager", ".", "getTransaction", "(", ")", ";", "if", "(", "incumbentTx", "!=", "null", ")", "{", "TransactionImpl", "incumbentTxImpl", "=", "null", ";", "if", "(", "incumbentTx", "instanceof", "TransactionImpl", ")", "incumbentTxImpl", "=", "(", "TransactionImpl", ")", "incumbentTx", ";", "if", "(", "incumbentTxImpl", "!=", "null", "&&", "incumbentTxImpl", ".", "getTxType", "(", ")", "==", "UOWCoordinator", ".", "TXTYPE_NONINTEROP_GLOBAL", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"the tx is NONINTEROP_GLOBAL set it to null\"", ")", ";", "}", "// The following call should nullify the current tx on the current thread (in this special case where the", "// TxType is TXTYPE_NONINTEROP_GLOBAL", "tranManager", ".", "suspend", "(", ")", ";", "}", "else", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Global transaction was present.\"", ")", ";", "}", "//Yes! There's a global transaction. Check for timeout", "checkGlobalTimeout", "(", ")", ";", "//Create config return object", "final", "TxCollaboratorConfig", "retConfig", "=", "new", "TxCollaboratorConfig", "(", ")", ";", "retConfig", ".", "setIncumbentTx", "(", "incumbentTx", ")", ";", "return", "retConfig", ";", "}", "}", "}", "}", "catch", "(", "SystemException", "e", ")", "{", "Tr", ".", "error", "(", "tc", ",", "\"UNEXPECTED_TRAN_ERROR\"", ",", "e", ".", "toString", "(", ")", ")", ";", "ServletException", "se", "=", "new", "ServletException", "(", "\"Unexpected error during transaction fetching: \"", ",", "e", ")", ";", "throw", "se", ";", "}", "//Ensure we have a LocalTransactionCurrent to work with", "LocalTransactionCurrent", "ltCurrent", "=", "getLtCurrent", "(", ")", ";", "if", "(", "ltCurrent", "==", "null", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEventEnabled", "(", ")", ")", "{", "Tr", ".", "event", "(", "this", ",", "tc", ",", "\"Unable to resolve LocalTransactionCurrent\"", ")", ";", "}", "return", "null", ";", "}", "//Create config return object ", "TxCollaboratorConfig", "retConfig", "=", "new", "TxCollaboratorConfig", "(", ")", ";", "// see if there is a local transaction on the thread", "LocalTransactionCoordinator", "ltCoord", "=", "ltCurrent", ".", "getLocalTranCoord", "(", ")", ";", "if", "(", "ltCoord", "!=", "null", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Suspending LTC's coord: \"", "+", "ltCoord", ")", ";", "}", "//there was a transaction! We need to suspend it and put its coordinator into the config", "//so that we can resume it later", "retConfig", ".", "setSuspendTx", "(", "ltCurrent", ".", "suspend", "(", ")", ")", ";", "}", "//begin a new local transaction on the thread", "ltCurrent", ".", "begin", "(", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Began LTC's coord:\"", "+", "ltCurrent", ".", "getLocalTranCoord", "(", ")", ")", ";", "}", "return", "retConfig", ";", "}" ]
Collaborator preInvoke. Called before the webapp is invoked, to ensure that a LTC is started in the absence of a global transaction. A global tran may be active on entry if the webapp that caused this dispatch left a global tran active. The WebAppRequestDispatcher ensures that any global tran started during a dispatch is rolledback if not completed during the dispatch. If there is a global tran on entry, then we don't start an LTC. If there isn't a global tran on entry, then we do start an LTC after first suspending any LTC started by a previous dispatch. If an LTC is suspended, the LTC is returned by this method and passed back to the caller who will resupply it to postInvoke() who will resume the suspended Tx. Request is not null for a proper servlet service call. It is null if called for a servlet context change, for an init or destroy servlet. @param isServlet23 represents if we're dealing with servlet 2.3
[ "Collaborator", "preInvoke", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transaction/src/com/ibm/ws/transaction/services/WebAppTransactionCollaboratorImpl.java#L198-L280
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transaction/src/com/ibm/ws/transaction/services/WebAppTransactionCollaboratorImpl.java
WebAppTransactionCollaboratorImpl.resumeSuspendedLTC
private void resumeSuspendedLTC(LocalTransactionCurrent ltCurrent, Object txConfig) throws ServletException { //Check for any suspended LTC that needs to be resumed if (txConfig instanceof TxCollaboratorConfig) { Object suspended = ((TxCollaboratorConfig) txConfig).getSuspendTx(); if (suspended instanceof LocalTransactionCoordinator) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Resuming previously suspended LTC coord:" + suspended); Tr.debug(tc, "Registering LTC callback"); } try { ltCurrent.resume(((LocalTransactionCoordinator) suspended)); } catch (IllegalStateException ex) { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "IllegalStateException", ex); } try { // Clean-up the Tx ltCurrent.cleanup(); } catch (InconsistentLocalTranException iltex) { // Absorb any exception from cleanup - it doesn't really // matter if there are inconsistencies in cleanup. if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "InconsistentLocalTranException", iltex); } } catch (RolledbackException rbe) { // We need to inform the user that completion // was affected by a call to setRollbackOnly // so rethrow as a ServletException. ServletException se = new ServletException("LocalTransaction rolled-back due to setRollbackOnly", rbe); throw se; } } } } }
java
private void resumeSuspendedLTC(LocalTransactionCurrent ltCurrent, Object txConfig) throws ServletException { //Check for any suspended LTC that needs to be resumed if (txConfig instanceof TxCollaboratorConfig) { Object suspended = ((TxCollaboratorConfig) txConfig).getSuspendTx(); if (suspended instanceof LocalTransactionCoordinator) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Resuming previously suspended LTC coord:" + suspended); Tr.debug(tc, "Registering LTC callback"); } try { ltCurrent.resume(((LocalTransactionCoordinator) suspended)); } catch (IllegalStateException ex) { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "IllegalStateException", ex); } try { // Clean-up the Tx ltCurrent.cleanup(); } catch (InconsistentLocalTranException iltex) { // Absorb any exception from cleanup - it doesn't really // matter if there are inconsistencies in cleanup. if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "InconsistentLocalTranException", iltex); } } catch (RolledbackException rbe) { // We need to inform the user that completion // was affected by a call to setRollbackOnly // so rethrow as a ServletException. ServletException se = new ServletException("LocalTransaction rolled-back due to setRollbackOnly", rbe); throw se; } } } } }
[ "private", "void", "resumeSuspendedLTC", "(", "LocalTransactionCurrent", "ltCurrent", ",", "Object", "txConfig", ")", "throws", "ServletException", "{", "//Check for any suspended LTC that needs to be resumed", "if", "(", "txConfig", "instanceof", "TxCollaboratorConfig", ")", "{", "Object", "suspended", "=", "(", "(", "TxCollaboratorConfig", ")", "txConfig", ")", ".", "getSuspendTx", "(", ")", ";", "if", "(", "suspended", "instanceof", "LocalTransactionCoordinator", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Resuming previously suspended LTC coord:\"", "+", "suspended", ")", ";", "Tr", ".", "debug", "(", "tc", ",", "\"Registering LTC callback\"", ")", ";", "}", "try", "{", "ltCurrent", ".", "resume", "(", "(", "(", "LocalTransactionCoordinator", ")", "suspended", ")", ")", ";", "}", "catch", "(", "IllegalStateException", "ex", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEventEnabled", "(", ")", ")", "{", "Tr", ".", "event", "(", "tc", ",", "\"IllegalStateException\"", ",", "ex", ")", ";", "}", "try", "{", "// Clean-up the Tx", "ltCurrent", ".", "cleanup", "(", ")", ";", "}", "catch", "(", "InconsistentLocalTranException", "iltex", ")", "{", "// Absorb any exception from cleanup - it doesn't really", "// matter if there are inconsistencies in cleanup.", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEventEnabled", "(", ")", ")", "{", "Tr", ".", "event", "(", "tc", ",", "\"InconsistentLocalTranException\"", ",", "iltex", ")", ";", "}", "}", "catch", "(", "RolledbackException", "rbe", ")", "{", "// We need to inform the user that completion", "// was affected by a call to setRollbackOnly", "// so rethrow as a ServletException.", "ServletException", "se", "=", "new", "ServletException", "(", "\"LocalTransaction rolled-back due to setRollbackOnly\"", ",", "rbe", ")", ";", "throw", "se", ";", "}", "}", "}", "}", "}" ]
Resumes the LTC that was suspended during preInvoke, if one was suspended.
[ "Resumes", "the", "LTC", "that", "was", "suspended", "during", "preInvoke", "if", "one", "was", "suspended", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transaction/src/com/ibm/ws/transaction/services/WebAppTransactionCollaboratorImpl.java#L391-L429
train
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/impl/SerializationObjectPool.java
SerializationObjectPool.getSerializationObject
public SerializationObject getSerializationObject() { SerializationObject object; synchronized (ivListOfObjects) { if (ivListOfObjects.isEmpty()) { object = createNewObject(); } else { object = ivListOfObjects.remove(ivListOfObjects.size() - 1); } } return object; }
java
public SerializationObject getSerializationObject() { SerializationObject object; synchronized (ivListOfObjects) { if (ivListOfObjects.isEmpty()) { object = createNewObject(); } else { object = ivListOfObjects.remove(ivListOfObjects.size() - 1); } } return object; }
[ "public", "SerializationObject", "getSerializationObject", "(", ")", "{", "SerializationObject", "object", ";", "synchronized", "(", "ivListOfObjects", ")", "{", "if", "(", "ivListOfObjects", ".", "isEmpty", "(", ")", ")", "{", "object", "=", "createNewObject", "(", ")", ";", "}", "else", "{", "object", "=", "ivListOfObjects", ".", "remove", "(", "ivListOfObjects", ".", "size", "(", ")", "-", "1", ")", ";", "}", "}", "return", "object", ";", "}" ]
Gets the next avaialable serialization object. @return ISerializationObject instance to do the conversation with.
[ "Gets", "the", "next", "avaialable", "serialization", "object", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/impl/SerializationObjectPool.java#L43-L53
train
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/impl/SerializationObjectPool.java
SerializationObjectPool.returnSerializationObject
public void returnSerializationObject(SerializationObject object) { synchronized (ivListOfObjects) { if (ivListOfObjects.size() < MAXIMUM_NUM_OF_OBJECTS) { ivListOfObjects.add(object); } } }
java
public void returnSerializationObject(SerializationObject object) { synchronized (ivListOfObjects) { if (ivListOfObjects.size() < MAXIMUM_NUM_OF_OBJECTS) { ivListOfObjects.add(object); } } }
[ "public", "void", "returnSerializationObject", "(", "SerializationObject", "object", ")", "{", "synchronized", "(", "ivListOfObjects", ")", "{", "if", "(", "ivListOfObjects", ".", "size", "(", ")", "<", "MAXIMUM_NUM_OF_OBJECTS", ")", "{", "ivListOfObjects", ".", "add", "(", "object", ")", ";", "}", "}", "}" ]
Returns a serialization object back into the pool. @param object an instance previously allocated with {@link #getSerializationObject()}.
[ "Returns", "a", "serialization", "object", "back", "into", "the", "pool", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/impl/SerializationObjectPool.java#L60-L66
train
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/DependencyTable.java
DependencyTable.add
public void add(Object dependency, ValueSet valueSet) { if (dependency == null) { throw new IllegalArgumentException("dependency cannot be null"); } if (valueSet != null) { dependencyToEntryTable.put(dependency, valueSet); } }
java
public void add(Object dependency, ValueSet valueSet) { if (dependency == null) { throw new IllegalArgumentException("dependency cannot be null"); } if (valueSet != null) { dependencyToEntryTable.put(dependency, valueSet); } }
[ "public", "void", "add", "(", "Object", "dependency", ",", "ValueSet", "valueSet", ")", "{", "if", "(", "dependency", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"dependency cannot be null\"", ")", ";", "}", "if", "(", "valueSet", "!=", "null", ")", "{", "dependencyToEntryTable", ".", "put", "(", "dependency", ",", "valueSet", ")", ";", "}", "}" ]
This adds a valueSet for the specified dependency. @param dependency The dependency. @param valueSet The valueSet to add.
[ "This", "adds", "a", "valueSet", "for", "the", "specified", "dependency", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/DependencyTable.java#L105-L112
train
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/DependencyTable.java
DependencyTable.removeEntry
public boolean removeEntry(Object dependency, Object entry) { //SKS-O boolean found = false; ValueSet valueSet = (ValueSet) dependencyToEntryTable.get(dependency); if (valueSet == null) { return found; } found = valueSet.remove(entry); if (valueSet.size()==0) removeDependency(dependency); return found; }
java
public boolean removeEntry(Object dependency, Object entry) { //SKS-O boolean found = false; ValueSet valueSet = (ValueSet) dependencyToEntryTable.get(dependency); if (valueSet == null) { return found; } found = valueSet.remove(entry); if (valueSet.size()==0) removeDependency(dependency); return found; }
[ "public", "boolean", "removeEntry", "(", "Object", "dependency", ",", "Object", "entry", ")", "{", "//SKS-O", "boolean", "found", "=", "false", ";", "ValueSet", "valueSet", "=", "(", "ValueSet", ")", "dependencyToEntryTable", ".", "get", "(", "dependency", ")", ";", "if", "(", "valueSet", "==", "null", ")", "{", "return", "found", ";", "}", "found", "=", "valueSet", ".", "remove", "(", "entry", ")", ";", "if", "(", "valueSet", ".", "size", "(", ")", "==", "0", ")", "removeDependency", "(", "dependency", ")", ";", "return", "found", ";", "}" ]
SKS-O
[ "SKS", "-", "O" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/DependencyTable.java#L136-L147
train
OpenLiberty/open-liberty
dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/internal/GenericSSLConfigService.java
GenericSSLConfigService.modified
protected void modified(String id, Map<String, Object> properties) { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(this, tc, "modified " + id, properties); } config = properties; myProps = null; }
java
protected void modified(String id, Map<String, Object> properties) { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(this, tc, "modified " + id, properties); } config = properties; myProps = null; }
[ "protected", "void", "modified", "(", "String", "id", ",", "Map", "<", "String", ",", "Object", ">", "properties", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEventEnabled", "(", ")", ")", "{", "Tr", ".", "event", "(", "this", ",", "tc", ",", "\"modified \"", "+", "id", ",", "properties", ")", ";", "}", "config", "=", "properties", ";", "myProps", "=", "null", ";", "}" ]
DS method to modify this component. @param properties
[ "DS", "method", "to", "modify", "this", "component", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/internal/GenericSSLConfigService.java#L47-L54
train
OpenLiberty/open-liberty
dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/LogFileHandle.java
LogFileHandle.getReadableLogRecord
protected ReadableLogRecord getReadableLogRecord(long expectedSequenceNumber) { if (tc.isEntryEnabled()) Tr.entry(tc, "getReadableLogRecord", new java.lang.Object[] { this, new Long(expectedSequenceNumber) }); if (tc.isDebugEnabled()) Tr.debug(tc, "Creating readable log record to read from file " + _fileName); final ReadableLogRecord readableLogRecord = ReadableLogRecord.read(_fileBuffer, expectedSequenceNumber, !_logFileHeader.wasShutdownClean()); if (tc.isEntryEnabled()) Tr.exit(tc, "getReadableLogRecord", readableLogRecord); return readableLogRecord; }
java
protected ReadableLogRecord getReadableLogRecord(long expectedSequenceNumber) { if (tc.isEntryEnabled()) Tr.entry(tc, "getReadableLogRecord", new java.lang.Object[] { this, new Long(expectedSequenceNumber) }); if (tc.isDebugEnabled()) Tr.debug(tc, "Creating readable log record to read from file " + _fileName); final ReadableLogRecord readableLogRecord = ReadableLogRecord.read(_fileBuffer, expectedSequenceNumber, !_logFileHeader.wasShutdownClean()); if (tc.isEntryEnabled()) Tr.exit(tc, "getReadableLogRecord", readableLogRecord); return readableLogRecord; }
[ "protected", "ReadableLogRecord", "getReadableLogRecord", "(", "long", "expectedSequenceNumber", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "tc", ",", "\"getReadableLogRecord\"", ",", "new", "java", ".", "lang", ".", "Object", "[", "]", "{", "this", ",", "new", "Long", "(", "expectedSequenceNumber", ")", "}", ")", ";", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "tc", ",", "\"Creating readable log record to read from file \"", "+", "_fileName", ")", ";", "final", "ReadableLogRecord", "readableLogRecord", "=", "ReadableLogRecord", ".", "read", "(", "_fileBuffer", ",", "expectedSequenceNumber", ",", "!", "_logFileHeader", ".", "wasShutdownClean", "(", ")", ")", ";", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"getReadableLogRecord\"", ",", "readableLogRecord", ")", ";", "return", "readableLogRecord", ";", "}" ]
Read a composite record from the disk. The caller supplies the expected sequence number of the record and this method confirms that this matches the next record recovered. @param sequenceNumber The expected sequence number @return ReadableLogRecord The composite record
[ "Read", "a", "composite", "record", "from", "the", "disk", ".", "The", "caller", "supplies", "the", "expected", "sequence", "number", "of", "the", "record", "and", "this", "method", "confirms", "that", "this", "matches", "the", "next", "record", "recovered", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/LogFileHandle.java#L232-L246
train
OpenLiberty/open-liberty
dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/LogFileHandle.java
LogFileHandle.fileClose
void fileClose() throws InternalLogException { if (tc.isEntryEnabled()) Tr.entry(tc, "fileClose", this); if (_fileChannel != null) { try { // Don't close channel as it will free a lock - wait until file close if (_outstandingWritableLogRecords.get() == 0 && !_exceptionInForce) { force(); // make sure all records really are on disk // Now we know that there are no gaps in the records and none have failed // to be written, byte by byte scanning at the next start can be avoided. _logFileHeader.setCleanShutdown(); // set the fact that shutdown was clean writeFileHeader(false); // write clean shutdown into header force(); } _file.close(); } catch (Throwable e) { FFDCFilter.processException(e, "com.ibm.ws.recoverylog.spi.LogFileHandle.fileClose", "541", this); if (tc.isEntryEnabled()) Tr.exit(tc, "fileClose", "InternalLogException"); throw new InternalLogException(e); } _fileBuffer = null; _file = null; _fileChannel = null; } if (tc.isEntryEnabled()) Tr.exit(tc, "fileClose"); }
java
void fileClose() throws InternalLogException { if (tc.isEntryEnabled()) Tr.entry(tc, "fileClose", this); if (_fileChannel != null) { try { // Don't close channel as it will free a lock - wait until file close if (_outstandingWritableLogRecords.get() == 0 && !_exceptionInForce) { force(); // make sure all records really are on disk // Now we know that there are no gaps in the records and none have failed // to be written, byte by byte scanning at the next start can be avoided. _logFileHeader.setCleanShutdown(); // set the fact that shutdown was clean writeFileHeader(false); // write clean shutdown into header force(); } _file.close(); } catch (Throwable e) { FFDCFilter.processException(e, "com.ibm.ws.recoverylog.spi.LogFileHandle.fileClose", "541", this); if (tc.isEntryEnabled()) Tr.exit(tc, "fileClose", "InternalLogException"); throw new InternalLogException(e); } _fileBuffer = null; _file = null; _fileChannel = null; } if (tc.isEntryEnabled()) Tr.exit(tc, "fileClose"); }
[ "void", "fileClose", "(", ")", "throws", "InternalLogException", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "tc", ",", "\"fileClose\"", ",", "this", ")", ";", "if", "(", "_fileChannel", "!=", "null", ")", "{", "try", "{", "// Don't close channel as it will free a lock - wait until file close", "if", "(", "_outstandingWritableLogRecords", ".", "get", "(", ")", "==", "0", "&&", "!", "_exceptionInForce", ")", "{", "force", "(", ")", ";", "// make sure all records really are on disk", "// Now we know that there are no gaps in the records and none have failed", "// to be written, byte by byte scanning at the next start can be avoided.", "_logFileHeader", ".", "setCleanShutdown", "(", ")", ";", "// set the fact that shutdown was clean", "writeFileHeader", "(", "false", ")", ";", "// write clean shutdown into header", "force", "(", ")", ";", "}", "_file", ".", "close", "(", ")", ";", "}", "catch", "(", "Throwable", "e", ")", "{", "FFDCFilter", ".", "processException", "(", "e", ",", "\"com.ibm.ws.recoverylog.spi.LogFileHandle.fileClose\"", ",", "\"541\"", ",", "this", ")", ";", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"fileClose\"", ",", "\"InternalLogException\"", ")", ";", "throw", "new", "InternalLogException", "(", "e", ")", ";", "}", "_fileBuffer", "=", "null", ";", "_file", "=", "null", ";", "_fileChannel", "=", "null", ";", "}", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"fileClose\"", ")", ";", "}" ]
Close the file managed by this LogFileHandle instance. @exception InternalLogException An unexpected error has occured.
[ "Close", "the", "file", "managed", "by", "this", "LogFileHandle", "instance", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/LogFileHandle.java#L585-L623
train
OpenLiberty/open-liberty
dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/LogFileHandle.java
LogFileHandle.getWriteableLogRecord
public WriteableLogRecord getWriteableLogRecord(int recordLength, long sequenceNumber) throws InternalLogException { if (!_headerFlushedFollowingRestart) { // ensure header is updated now we start to write records for the first time // synchronization is assured through locks in LogHandle.getWriteableLogRecord writeFileHeader(true); _headerFlushedFollowingRestart = true; } if (tc.isEntryEnabled()) Tr.entry(tc, "getWriteableLogRecord", new Object[] { new Integer(recordLength), new Long(sequenceNumber), this }); // Create a slice of the file buffer and reset its limit to the size of the WriteableLogRecord. // The view buffer's content is a shared subsequence of the file buffer. // No other log records have access to this log record's view buffer. ByteBuffer viewBuffer = (ByteBuffer) _fileBuffer.slice().limit(recordLength + WriteableLogRecord.HEADER_SIZE); WriteableLogRecord writeableLogRecord = new WriteableLogRecord(viewBuffer, sequenceNumber, recordLength, _fileBuffer.position()); // Advance the file buffer's position to the end of the newly created WriteableLogRecord _fileBuffer.position(_fileBuffer.position() + recordLength + WriteableLogRecord.HEADER_SIZE); _outstandingWritableLogRecords.incrementAndGet(); if (tc.isEntryEnabled()) Tr.exit(tc, "getWriteableLogRecord", writeableLogRecord); return writeableLogRecord; }
java
public WriteableLogRecord getWriteableLogRecord(int recordLength, long sequenceNumber) throws InternalLogException { if (!_headerFlushedFollowingRestart) { // ensure header is updated now we start to write records for the first time // synchronization is assured through locks in LogHandle.getWriteableLogRecord writeFileHeader(true); _headerFlushedFollowingRestart = true; } if (tc.isEntryEnabled()) Tr.entry(tc, "getWriteableLogRecord", new Object[] { new Integer(recordLength), new Long(sequenceNumber), this }); // Create a slice of the file buffer and reset its limit to the size of the WriteableLogRecord. // The view buffer's content is a shared subsequence of the file buffer. // No other log records have access to this log record's view buffer. ByteBuffer viewBuffer = (ByteBuffer) _fileBuffer.slice().limit(recordLength + WriteableLogRecord.HEADER_SIZE); WriteableLogRecord writeableLogRecord = new WriteableLogRecord(viewBuffer, sequenceNumber, recordLength, _fileBuffer.position()); // Advance the file buffer's position to the end of the newly created WriteableLogRecord _fileBuffer.position(_fileBuffer.position() + recordLength + WriteableLogRecord.HEADER_SIZE); _outstandingWritableLogRecords.incrementAndGet(); if (tc.isEntryEnabled()) Tr.exit(tc, "getWriteableLogRecord", writeableLogRecord); return writeableLogRecord; }
[ "public", "WriteableLogRecord", "getWriteableLogRecord", "(", "int", "recordLength", ",", "long", "sequenceNumber", ")", "throws", "InternalLogException", "{", "if", "(", "!", "_headerFlushedFollowingRestart", ")", "{", "// ensure header is updated now we start to write records for the first time", "// synchronization is assured through locks in LogHandle.getWriteableLogRecord", "writeFileHeader", "(", "true", ")", ";", "_headerFlushedFollowingRestart", "=", "true", ";", "}", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "tc", ",", "\"getWriteableLogRecord\"", ",", "new", "Object", "[", "]", "{", "new", "Integer", "(", "recordLength", ")", ",", "new", "Long", "(", "sequenceNumber", ")", ",", "this", "}", ")", ";", "// Create a slice of the file buffer and reset its limit to the size of the WriteableLogRecord.", "// The view buffer's content is a shared subsequence of the file buffer.", "// No other log records have access to this log record's view buffer.", "ByteBuffer", "viewBuffer", "=", "(", "ByteBuffer", ")", "_fileBuffer", ".", "slice", "(", ")", ".", "limit", "(", "recordLength", "+", "WriteableLogRecord", ".", "HEADER_SIZE", ")", ";", "WriteableLogRecord", "writeableLogRecord", "=", "new", "WriteableLogRecord", "(", "viewBuffer", ",", "sequenceNumber", ",", "recordLength", ",", "_fileBuffer", ".", "position", "(", ")", ")", ";", "// Advance the file buffer's position to the end of the newly created WriteableLogRecord", "_fileBuffer", ".", "position", "(", "_fileBuffer", ".", "position", "(", ")", "+", "recordLength", "+", "WriteableLogRecord", ".", "HEADER_SIZE", ")", ";", "_outstandingWritableLogRecords", ".", "incrementAndGet", "(", ")", ";", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"getWriteableLogRecord\"", ",", "writeableLogRecord", ")", ";", "return", "writeableLogRecord", ";", "}" ]
Get a new WritableLogRecord for the log file managed by this LogFileHandleInstance. The size of the record must be specified along with the record's sequence number. It is the caller's responsbility to ensure that both the sequence number is correct and that the record written using the returned WritableLogRecord is of the given length. @param recordLength The length of the record to be created @param sequenceNumber The newly created record's sequence number @return WriteableLogRecord A new writeable log record of the specified size
[ "Get", "a", "new", "WritableLogRecord", "for", "the", "log", "file", "managed", "by", "this", "LogFileHandleInstance", ".", "The", "size", "of", "the", "record", "must", "be", "specified", "along", "with", "the", "record", "s", "sequence", "number", ".", "It", "is", "the", "caller", "s", "responsbility", "to", "ensure", "that", "both", "the", "sequence", "number", "is", "correct", "and", "that", "the", "record", "written", "using", "the", "returned", "WritableLogRecord", "is", "of", "the", "given", "length", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/LogFileHandle.java#L639-L666
train
OpenLiberty/open-liberty
dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/LogFileHandle.java
LogFileHandle.writeFileHeader
private void writeFileHeader(boolean maintainPosition) throws InternalLogException { if (tc.isEntryEnabled()) Tr.entry(tc, "writeFileHeader", new java.lang.Object[] { this, new Boolean(maintainPosition) }); // Build the buffer that forms the major part of the file header and // then convert this into a byte array. try { if (tc.isDebugEnabled()) Tr.debug(tc, "Writing header for log file " + _fileName); _logFileHeader.write(_fileBuffer, maintainPosition); force(); } catch (InternalLogException exc) { FFDCFilter.processException(exc, "com.ibm.ws.recoverylog.spi.LogFileHandle.writeFileHeader", "706", this); if (tc.isEntryEnabled()) Tr.exit(tc, "writeFileHeader", exc); throw exc; } catch (Throwable exc) { FFDCFilter.processException(exc, "com.ibm.ws.recoverylog.spi.LogFileHandle.writeFileHeader", "712", this); if (tc.isEntryEnabled()) Tr.exit(tc, "writeFileHeader", "InternalLogException"); throw new InternalLogException(exc); } if (tc.isEntryEnabled()) Tr.exit(tc, "writeFileHeader"); }
java
private void writeFileHeader(boolean maintainPosition) throws InternalLogException { if (tc.isEntryEnabled()) Tr.entry(tc, "writeFileHeader", new java.lang.Object[] { this, new Boolean(maintainPosition) }); // Build the buffer that forms the major part of the file header and // then convert this into a byte array. try { if (tc.isDebugEnabled()) Tr.debug(tc, "Writing header for log file " + _fileName); _logFileHeader.write(_fileBuffer, maintainPosition); force(); } catch (InternalLogException exc) { FFDCFilter.processException(exc, "com.ibm.ws.recoverylog.spi.LogFileHandle.writeFileHeader", "706", this); if (tc.isEntryEnabled()) Tr.exit(tc, "writeFileHeader", exc); throw exc; } catch (Throwable exc) { FFDCFilter.processException(exc, "com.ibm.ws.recoverylog.spi.LogFileHandle.writeFileHeader", "712", this); if (tc.isEntryEnabled()) Tr.exit(tc, "writeFileHeader", "InternalLogException"); throw new InternalLogException(exc); } if (tc.isEntryEnabled()) Tr.exit(tc, "writeFileHeader"); }
[ "private", "void", "writeFileHeader", "(", "boolean", "maintainPosition", ")", "throws", "InternalLogException", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "tc", ",", "\"writeFileHeader\"", ",", "new", "java", ".", "lang", ".", "Object", "[", "]", "{", "this", ",", "new", "Boolean", "(", "maintainPosition", ")", "}", ")", ";", "// Build the buffer that forms the major part of the file header and", "// then convert this into a byte array.", "try", "{", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "tc", ",", "\"Writing header for log file \"", "+", "_fileName", ")", ";", "_logFileHeader", ".", "write", "(", "_fileBuffer", ",", "maintainPosition", ")", ";", "force", "(", ")", ";", "}", "catch", "(", "InternalLogException", "exc", ")", "{", "FFDCFilter", ".", "processException", "(", "exc", ",", "\"com.ibm.ws.recoverylog.spi.LogFileHandle.writeFileHeader\"", ",", "\"706\"", ",", "this", ")", ";", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"writeFileHeader\"", ",", "exc", ")", ";", "throw", "exc", ";", "}", "catch", "(", "Throwable", "exc", ")", "{", "FFDCFilter", ".", "processException", "(", "exc", ",", "\"com.ibm.ws.recoverylog.spi.LogFileHandle.writeFileHeader\"", ",", "\"712\"", ",", "this", ")", ";", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"writeFileHeader\"", ",", "\"InternalLogException\"", ")", ";", "throw", "new", "InternalLogException", "(", "exc", ")", ";", "}", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"writeFileHeader\"", ")", ";", "}" ]
Writes the file header stored in '_logFileHeader' to the file managed by this LogFileHandle instance. @param maintainPosition Flag to indicate if file pointer before the header write needs to be restored after the header write (ie retain the file pointer position) @exception InternalLogException An unexpected error has occured.
[ "Writes", "the", "file", "header", "stored", "in", "_logFileHeader", "to", "the", "file", "managed", "by", "this", "LogFileHandle", "instance", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/LogFileHandle.java#L681-L710
train
OpenLiberty/open-liberty
dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/LogFileHandle.java
LogFileHandle.writeFileStatus
private void writeFileStatus(boolean maintainPosition) throws InternalLogException { if (tc.isEntryEnabled()) Tr.entry(tc, "writeFileStatus", new java.lang.Object[] { this, new Boolean(maintainPosition) }); if (_logFileHeader.status() == LogFileHeader.STATUS_INVALID) { if (tc.isEntryEnabled()) Tr.exit(tc, "writeFileStatus", "InternalLogException"); throw new InternalLogException(null); } try { int currentFilePointer = 0; if (maintainPosition) { // If the caller wishes the file pointer's current // position to be maintained cache it's position // here so that it can be reset once the header // has been written. currentFilePointer = _fileBuffer.position(); } // Move the buffer's pointer to the header status // field and perform a forced write of the new status _fileBuffer.position(STATUS_FIELD_FILE_OFFSET); _fileBuffer.putInt(_logFileHeader.status()); force(); if (maintainPosition) { // Reinstate the fileBuffer's pointer to its original position. _fileBuffer.position(currentFilePointer); } } catch (Throwable exc) { FFDCFilter.processException(exc, "com.ibm.ws.recoverylog.spi.LogFileHandle.writeFileStatus", "797", this); if (tc.isEntryEnabled()) Tr.exit(tc, "writeFileStatus", "WriteOperationFailedException"); throw new WriteOperationFailedException(exc); } if (tc.isEntryEnabled()) Tr.exit(tc, "writeFileStatus"); }
java
private void writeFileStatus(boolean maintainPosition) throws InternalLogException { if (tc.isEntryEnabled()) Tr.entry(tc, "writeFileStatus", new java.lang.Object[] { this, new Boolean(maintainPosition) }); if (_logFileHeader.status() == LogFileHeader.STATUS_INVALID) { if (tc.isEntryEnabled()) Tr.exit(tc, "writeFileStatus", "InternalLogException"); throw new InternalLogException(null); } try { int currentFilePointer = 0; if (maintainPosition) { // If the caller wishes the file pointer's current // position to be maintained cache it's position // here so that it can be reset once the header // has been written. currentFilePointer = _fileBuffer.position(); } // Move the buffer's pointer to the header status // field and perform a forced write of the new status _fileBuffer.position(STATUS_FIELD_FILE_OFFSET); _fileBuffer.putInt(_logFileHeader.status()); force(); if (maintainPosition) { // Reinstate the fileBuffer's pointer to its original position. _fileBuffer.position(currentFilePointer); } } catch (Throwable exc) { FFDCFilter.processException(exc, "com.ibm.ws.recoverylog.spi.LogFileHandle.writeFileStatus", "797", this); if (tc.isEntryEnabled()) Tr.exit(tc, "writeFileStatus", "WriteOperationFailedException"); throw new WriteOperationFailedException(exc); } if (tc.isEntryEnabled()) Tr.exit(tc, "writeFileStatus"); }
[ "private", "void", "writeFileStatus", "(", "boolean", "maintainPosition", ")", "throws", "InternalLogException", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "tc", ",", "\"writeFileStatus\"", ",", "new", "java", ".", "lang", ".", "Object", "[", "]", "{", "this", ",", "new", "Boolean", "(", "maintainPosition", ")", "}", ")", ";", "if", "(", "_logFileHeader", ".", "status", "(", ")", "==", "LogFileHeader", ".", "STATUS_INVALID", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"writeFileStatus\"", ",", "\"InternalLogException\"", ")", ";", "throw", "new", "InternalLogException", "(", "null", ")", ";", "}", "try", "{", "int", "currentFilePointer", "=", "0", ";", "if", "(", "maintainPosition", ")", "{", "// If the caller wishes the file pointer's current", "// position to be maintained cache it's position", "// here so that it can be reset once the header", "// has been written.", "currentFilePointer", "=", "_fileBuffer", ".", "position", "(", ")", ";", "}", "// Move the buffer's pointer to the header status", "// field and perform a forced write of the new status", "_fileBuffer", ".", "position", "(", "STATUS_FIELD_FILE_OFFSET", ")", ";", "_fileBuffer", ".", "putInt", "(", "_logFileHeader", ".", "status", "(", ")", ")", ";", "force", "(", ")", ";", "if", "(", "maintainPosition", ")", "{", "// Reinstate the fileBuffer's pointer to its original position.", "_fileBuffer", ".", "position", "(", "currentFilePointer", ")", ";", "}", "}", "catch", "(", "Throwable", "exc", ")", "{", "FFDCFilter", ".", "processException", "(", "exc", ",", "\"com.ibm.ws.recoverylog.spi.LogFileHandle.writeFileStatus\"", ",", "\"797\"", ",", "this", ")", ";", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"writeFileStatus\"", ",", "\"WriteOperationFailedException\"", ")", ";", "throw", "new", "WriteOperationFailedException", "(", "exc", ")", ";", "}", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"writeFileStatus\"", ")", ";", "}" ]
Updates the status field of the file managed by this LogFileHandle instance. The status field is stored in '_logFileHeader'. @param maintainPosition Flag to indicate if file pointer before the header write needs to be restored after the header write (ie retain the file pointer position) @exception InternalLogException An unexpected error has occured.
[ "Updates", "the", "status", "field", "of", "the", "file", "managed", "by", "this", "LogFileHandle", "instance", ".", "The", "status", "field", "is", "stored", "in", "_logFileHeader", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/LogFileHandle.java#L725-L771
train
OpenLiberty/open-liberty
dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/LogFileHandle.java
LogFileHandle.logFileHeader
protected LogFileHeader logFileHeader() { if (tc.isEntryEnabled()) Tr.entry(tc, "logFileHeader", this); if (tc.isEntryEnabled()) Tr.exit(tc, "logFileHeader", _logFileHeader); return _logFileHeader; }
java
protected LogFileHeader logFileHeader() { if (tc.isEntryEnabled()) Tr.entry(tc, "logFileHeader", this); if (tc.isEntryEnabled()) Tr.exit(tc, "logFileHeader", _logFileHeader); return _logFileHeader; }
[ "protected", "LogFileHeader", "logFileHeader", "(", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "tc", ",", "\"logFileHeader\"", ",", "this", ")", ";", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"logFileHeader\"", ",", "_logFileHeader", ")", ";", "return", "_logFileHeader", ";", "}" ]
Accessor for the log file header object assoicated with this LogFileHandle instance. @return LogFileHeader The log file header object associated with this LogFileHandle instance.
[ "Accessor", "for", "the", "log", "file", "header", "object", "assoicated", "with", "this", "LogFileHandle", "instance", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/LogFileHandle.java#L879-L886
train
OpenLiberty/open-liberty
dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/LogFileHandle.java
LogFileHandle.getServiceData
public byte[] getServiceData() { if (tc.isEntryEnabled()) Tr.entry(tc, "getServiceData", this); byte[] serviceData = null; if (_logFileHeader != null) { serviceData = _logFileHeader.getServiceData(); } if (tc.isEntryEnabled()) Tr.exit(tc, "getServiceData", RLSUtils.toHexString(serviceData, RLSUtils.MAX_DISPLAY_BYTES)); return serviceData; }
java
public byte[] getServiceData() { if (tc.isEntryEnabled()) Tr.entry(tc, "getServiceData", this); byte[] serviceData = null; if (_logFileHeader != null) { serviceData = _logFileHeader.getServiceData(); } if (tc.isEntryEnabled()) Tr.exit(tc, "getServiceData", RLSUtils.toHexString(serviceData, RLSUtils.MAX_DISPLAY_BYTES)); return serviceData; }
[ "public", "byte", "[", "]", "getServiceData", "(", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "tc", ",", "\"getServiceData\"", ",", "this", ")", ";", "byte", "[", "]", "serviceData", "=", "null", ";", "if", "(", "_logFileHeader", "!=", "null", ")", "{", "serviceData", "=", "_logFileHeader", ".", "getServiceData", "(", ")", ";", "}", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"getServiceData\"", ",", "RLSUtils", ".", "toHexString", "(", "serviceData", ",", "RLSUtils", ".", "MAX_DISPLAY_BYTES", ")", ")", ";", "return", "serviceData", ";", "}" ]
Accessor for the service data assoicated with this LogFileHandle instance. @return byte[] The service data associated with this LogFileHandle instance or null if none exists.
[ "Accessor", "for", "the", "service", "data", "assoicated", "with", "this", "LogFileHandle", "instance", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/LogFileHandle.java#L897-L912
train
OpenLiberty/open-liberty
dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/LogFileHandle.java
LogFileHandle.freeBytes
public int freeBytes() { if (tc.isEntryEnabled()) Tr.entry(tc, "freeBytes", this); int freeBytes = 0; try { int currentCursorPosition = _fileBuffer.position(); int fileLength = _fileBuffer.capacity(); freeBytes = fileLength - currentCursorPosition; if (freeBytes < 0) { freeBytes = 0; } } catch (Throwable exc) { FFDCFilter.processException(exc, "com.ibm.ws.recoverylog.spi.LogFileHandle.freeBytes", "956", this); freeBytes = 0; } if (tc.isEntryEnabled()) Tr.exit(tc, "freeBytes", new Integer(freeBytes)); return freeBytes; }
java
public int freeBytes() { if (tc.isEntryEnabled()) Tr.entry(tc, "freeBytes", this); int freeBytes = 0; try { int currentCursorPosition = _fileBuffer.position(); int fileLength = _fileBuffer.capacity(); freeBytes = fileLength - currentCursorPosition; if (freeBytes < 0) { freeBytes = 0; } } catch (Throwable exc) { FFDCFilter.processException(exc, "com.ibm.ws.recoverylog.spi.LogFileHandle.freeBytes", "956", this); freeBytes = 0; } if (tc.isEntryEnabled()) Tr.exit(tc, "freeBytes", new Integer(freeBytes)); return freeBytes; }
[ "public", "int", "freeBytes", "(", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "tc", ",", "\"freeBytes\"", ",", "this", ")", ";", "int", "freeBytes", "=", "0", ";", "try", "{", "int", "currentCursorPosition", "=", "_fileBuffer", ".", "position", "(", ")", ";", "int", "fileLength", "=", "_fileBuffer", ".", "capacity", "(", ")", ";", "freeBytes", "=", "fileLength", "-", "currentCursorPosition", ";", "if", "(", "freeBytes", "<", "0", ")", "{", "freeBytes", "=", "0", ";", "}", "}", "catch", "(", "Throwable", "exc", ")", "{", "FFDCFilter", ".", "processException", "(", "exc", ",", "\"com.ibm.ws.recoverylog.spi.LogFileHandle.freeBytes\"", ",", "\"956\"", ",", "this", ")", ";", "freeBytes", "=", "0", ";", "}", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"freeBytes\"", ",", "new", "Integer", "(", "freeBytes", ")", ")", ";", "return", "freeBytes", ";", "}" ]
Returns the number of free bytes remaining in the file associated with this LogFileHandle instance. @return long The number of free bytes remaining.
[ "Returns", "the", "number", "of", "free", "bytes", "remaining", "in", "the", "file", "associated", "with", "this", "LogFileHandle", "instance", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/LogFileHandle.java#L923-L951
train
OpenLiberty/open-liberty
dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/LogFileHandle.java
LogFileHandle.fileName
public String fileName() { if (tc.isEntryEnabled()) Tr.entry(tc, "fileName", this); if (tc.isEntryEnabled()) Tr.exit(tc, "fileName", _fileName); return _fileName; }
java
public String fileName() { if (tc.isEntryEnabled()) Tr.entry(tc, "fileName", this); if (tc.isEntryEnabled()) Tr.exit(tc, "fileName", _fileName); return _fileName; }
[ "public", "String", "fileName", "(", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "tc", ",", "\"fileName\"", ",", "this", ")", ";", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"fileName\"", ",", "_fileName", ")", ";", "return", "_fileName", ";", "}" ]
Returns the name of the file associated with this LogFileHandle instance @return String The name of the file associated with this LogFileHandle instance
[ "Returns", "the", "name", "of", "the", "file", "associated", "with", "this", "LogFileHandle", "instance" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/LogFileHandle.java#L984-L991
train
OpenLiberty/open-liberty
dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/LogFileHandle.java
LogFileHandle.keypointStarting
void keypointStarting(long nextRecordSequenceNumber) throws InternalLogException { if (tc.isEntryEnabled()) Tr.entry(tc, "keypointStarting", new Object[] { new Long(nextRecordSequenceNumber), this }); // Set the header to indicate a keypoint operation. This also marks the header // as valid. _logFileHeader.keypointStarting(nextRecordSequenceNumber); try { writeFileHeader(false); } catch (InternalLogException exc) { FFDCFilter.processException(exc, "com.ibm.ws.recoverylog.spi.LogFileHandle.keypointStarting", "1073", this); if (tc.isEntryEnabled()) Tr.exit(tc, "keypointStarting", exc); throw exc; } catch (Throwable exc) { FFDCFilter.processException(exc, "com.ibm.ws.recoverylog.spi.LogFileHandle.keypointStarting", "1079", this); if (tc.isEntryEnabled()) Tr.exit(tc, "keypointStarting", "InternalLogException"); throw new InternalLogException(exc); } if (tc.isEntryEnabled()) Tr.exit(tc, "keypointStarting"); }
java
void keypointStarting(long nextRecordSequenceNumber) throws InternalLogException { if (tc.isEntryEnabled()) Tr.entry(tc, "keypointStarting", new Object[] { new Long(nextRecordSequenceNumber), this }); // Set the header to indicate a keypoint operation. This also marks the header // as valid. _logFileHeader.keypointStarting(nextRecordSequenceNumber); try { writeFileHeader(false); } catch (InternalLogException exc) { FFDCFilter.processException(exc, "com.ibm.ws.recoverylog.spi.LogFileHandle.keypointStarting", "1073", this); if (tc.isEntryEnabled()) Tr.exit(tc, "keypointStarting", exc); throw exc; } catch (Throwable exc) { FFDCFilter.processException(exc, "com.ibm.ws.recoverylog.spi.LogFileHandle.keypointStarting", "1079", this); if (tc.isEntryEnabled()) Tr.exit(tc, "keypointStarting", "InternalLogException"); throw new InternalLogException(exc); } if (tc.isEntryEnabled()) Tr.exit(tc, "keypointStarting"); }
[ "void", "keypointStarting", "(", "long", "nextRecordSequenceNumber", ")", "throws", "InternalLogException", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "tc", ",", "\"keypointStarting\"", ",", "new", "Object", "[", "]", "{", "new", "Long", "(", "nextRecordSequenceNumber", ")", ",", "this", "}", ")", ";", "// Set the header to indicate a keypoint operation. This also marks the header", "// as valid.", "_logFileHeader", ".", "keypointStarting", "(", "nextRecordSequenceNumber", ")", ";", "try", "{", "writeFileHeader", "(", "false", ")", ";", "}", "catch", "(", "InternalLogException", "exc", ")", "{", "FFDCFilter", ".", "processException", "(", "exc", ",", "\"com.ibm.ws.recoverylog.spi.LogFileHandle.keypointStarting\"", ",", "\"1073\"", ",", "this", ")", ";", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"keypointStarting\"", ",", "exc", ")", ";", "throw", "exc", ";", "}", "catch", "(", "Throwable", "exc", ")", "{", "FFDCFilter", ".", "processException", "(", "exc", ",", "\"com.ibm.ws.recoverylog.spi.LogFileHandle.keypointStarting\"", ",", "\"1079\"", ",", "this", ")", ";", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"keypointStarting\"", ",", "\"InternalLogException\"", ")", ";", "throw", "new", "InternalLogException", "(", "exc", ")", ";", "}", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"keypointStarting\"", ")", ";", "}" ]
Informs the LogFileHandle instance that a keypoint operation is about begin into the file associated with this LogFileHandle instance. The status of the log file is updated to KEYPOINTING and written to disk. @param nextRecordSequenceNumber The sequence number to be used for the first record in the file. @exception InternalLogException An unexpected error has occured.
[ "Informs", "the", "LogFileHandle", "instance", "that", "a", "keypoint", "operation", "is", "about", "begin", "into", "the", "file", "associated", "with", "this", "LogFileHandle", "instance", ".", "The", "status", "of", "the", "log", "file", "is", "updated", "to", "KEYPOINTING", "and", "written", "to", "disk", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/LogFileHandle.java#L1006-L1033
train
OpenLiberty/open-liberty
dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/LogFileHandle.java
LogFileHandle.keypointComplete
void keypointComplete() throws InternalLogException { if (tc.isEntryEnabled()) Tr.entry(tc, "keypointComplete", this); _logFileHeader.keypointComplete(); try { writeFileStatus(true); } catch (InternalLogException exc) { FFDCFilter.processException(exc, "com.ibm.ws.recoverylog.spi.LogFileHandle.keypointComplete", "1117", this); if (tc.isEntryEnabled()) Tr.exit(tc, "keypointComplete", exc); throw exc; } catch (Throwable exc) { FFDCFilter.processException(exc, "com.ibm.ws.recoverylog.spi.LogFileHandle.keypointComplete", "1123", this); if (tc.isEntryEnabled()) Tr.exit(tc, "keypointComplete", "InternalLogException"); throw new InternalLogException(exc); } if (tc.isEntryEnabled()) Tr.exit(tc, "keypointComplete"); }
java
void keypointComplete() throws InternalLogException { if (tc.isEntryEnabled()) Tr.entry(tc, "keypointComplete", this); _logFileHeader.keypointComplete(); try { writeFileStatus(true); } catch (InternalLogException exc) { FFDCFilter.processException(exc, "com.ibm.ws.recoverylog.spi.LogFileHandle.keypointComplete", "1117", this); if (tc.isEntryEnabled()) Tr.exit(tc, "keypointComplete", exc); throw exc; } catch (Throwable exc) { FFDCFilter.processException(exc, "com.ibm.ws.recoverylog.spi.LogFileHandle.keypointComplete", "1123", this); if (tc.isEntryEnabled()) Tr.exit(tc, "keypointComplete", "InternalLogException"); throw new InternalLogException(exc); } if (tc.isEntryEnabled()) Tr.exit(tc, "keypointComplete"); }
[ "void", "keypointComplete", "(", ")", "throws", "InternalLogException", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "tc", ",", "\"keypointComplete\"", ",", "this", ")", ";", "_logFileHeader", ".", "keypointComplete", "(", ")", ";", "try", "{", "writeFileStatus", "(", "true", ")", ";", "}", "catch", "(", "InternalLogException", "exc", ")", "{", "FFDCFilter", ".", "processException", "(", "exc", ",", "\"com.ibm.ws.recoverylog.spi.LogFileHandle.keypointComplete\"", ",", "\"1117\"", ",", "this", ")", ";", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"keypointComplete\"", ",", "exc", ")", ";", "throw", "exc", ";", "}", "catch", "(", "Throwable", "exc", ")", "{", "FFDCFilter", ".", "processException", "(", "exc", ",", "\"com.ibm.ws.recoverylog.spi.LogFileHandle.keypointComplete\"", ",", "\"1123\"", ",", "this", ")", ";", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"keypointComplete\"", ",", "\"InternalLogException\"", ")", ";", "throw", "new", "InternalLogException", "(", "exc", ")", ";", "}", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"keypointComplete\"", ")", ";", "}" ]
Informs the LogFileHandle instance that a keypoint operation into the file has completed. The status of the log file is updated to ACTIVE and written to disk. @exception InternalLogException An unexpected error has occured.
[ "Informs", "the", "LogFileHandle", "instance", "that", "a", "keypoint", "operation", "into", "the", "file", "has", "completed", ".", "The", "status", "of", "the", "log", "file", "is", "updated", "to", "ACTIVE", "and", "written", "to", "disk", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/LogFileHandle.java#L1045-L1070
train
OpenLiberty/open-liberty
dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/LogFileHandle.java
LogFileHandle.becomeInactive
void becomeInactive() throws InternalLogException { if (tc.isEntryEnabled()) Tr.entry(tc, "becomeInactive", this); _logFileHeader.changeStatus(LogFileHeader.STATUS_INACTIVE); try { writeFileStatus(false); } catch (InternalLogException exc) { FFDCFilter.processException(exc, "com.ibm.ws.recoverylog.spi.LogFileHandle.becomeInactive", "1161", this); if (tc.isEntryEnabled()) Tr.exit(tc, "becomeInactive", exc); throw exc; } catch (Throwable exc) { FFDCFilter.processException(exc, "com.ibm.ws.recoverylog.spi.LogFileHandle.becomeInactive", "1167", this); if (tc.isEntryEnabled()) Tr.exit(tc, "becomeInactive", "InternalLogException"); throw new InternalLogException(exc); } if (tc.isEntryEnabled()) Tr.entry(tc, "becomeInactive", this); }
java
void becomeInactive() throws InternalLogException { if (tc.isEntryEnabled()) Tr.entry(tc, "becomeInactive", this); _logFileHeader.changeStatus(LogFileHeader.STATUS_INACTIVE); try { writeFileStatus(false); } catch (InternalLogException exc) { FFDCFilter.processException(exc, "com.ibm.ws.recoverylog.spi.LogFileHandle.becomeInactive", "1161", this); if (tc.isEntryEnabled()) Tr.exit(tc, "becomeInactive", exc); throw exc; } catch (Throwable exc) { FFDCFilter.processException(exc, "com.ibm.ws.recoverylog.spi.LogFileHandle.becomeInactive", "1167", this); if (tc.isEntryEnabled()) Tr.exit(tc, "becomeInactive", "InternalLogException"); throw new InternalLogException(exc); } if (tc.isEntryEnabled()) Tr.entry(tc, "becomeInactive", this); }
[ "void", "becomeInactive", "(", ")", "throws", "InternalLogException", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "tc", ",", "\"becomeInactive\"", ",", "this", ")", ";", "_logFileHeader", ".", "changeStatus", "(", "LogFileHeader", ".", "STATUS_INACTIVE", ")", ";", "try", "{", "writeFileStatus", "(", "false", ")", ";", "}", "catch", "(", "InternalLogException", "exc", ")", "{", "FFDCFilter", ".", "processException", "(", "exc", ",", "\"com.ibm.ws.recoverylog.spi.LogFileHandle.becomeInactive\"", ",", "\"1161\"", ",", "this", ")", ";", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"becomeInactive\"", ",", "exc", ")", ";", "throw", "exc", ";", "}", "catch", "(", "Throwable", "exc", ")", "{", "FFDCFilter", ".", "processException", "(", "exc", ",", "\"com.ibm.ws.recoverylog.spi.LogFileHandle.becomeInactive\"", ",", "\"1167\"", ",", "this", ")", ";", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"becomeInactive\"", ",", "\"InternalLogException\"", ")", ";", "throw", "new", "InternalLogException", "(", "exc", ")", ";", "}", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "tc", ",", "\"becomeInactive\"", ",", "this", ")", ";", "}" ]
This method is invoked to inform the LogFileHandle instance that the file it manages is no longer required by the recovery log serivce. The status field stored in the header is updated to INACTIVE. @exception InternalLogException An unexpected error has occured.
[ "This", "method", "is", "invoked", "to", "inform", "the", "LogFileHandle", "instance", "that", "the", "file", "it", "manages", "is", "no", "longer", "required", "by", "the", "recovery", "log", "serivce", ".", "The", "status", "field", "stored", "in", "the", "header", "is", "updated", "to", "INACTIVE", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/LogFileHandle.java#L1082-L1107
train
OpenLiberty/open-liberty
dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/LogFileHandle.java
LogFileHandle.fileExtend
public void fileExtend(int newFileSize) throws LogAllocationException { if (tc.isEntryEnabled()) Tr.entry(tc, "fileExtend", new Object[] { new Integer(newFileSize), this }); final int fileLength = _fileBuffer.capacity(); if (fileLength < newFileSize) { try { // Expand the file to the new size ensuring that its pointer // remains in its current position. int originalPosition = _fileBuffer.position(); // TODO // Tr.uncondEvent(tc, "Expanding log file to size of " + newFileSize + " bytes."); Tr.event(tc, "Expanding log file to size of " + newFileSize + " bytes."); if (_isMapped) { _fileBuffer = _fileChannel.map(FileChannel.MapMode.READ_WRITE, 0, newFileSize); } else { // The file is not mapped. // Allocate a new DirectByteBuffer, copy the old ByteBuffer into the new one, // then write the new ByteBuffer to the FileChannel (automatically expanding it). if (tc.isDebugEnabled()) Tr.debug(tc, "File is NOT mapped. Allocating new DirectByteBuffer"); _fileBuffer.position(0); final ByteBuffer newByteBuffer = ByteBuffer.allocateDirect(newFileSize); newByteBuffer.put(_fileBuffer); newByteBuffer.position(0); _fileChannel.write(newByteBuffer, 0); _fileBuffer = newByteBuffer; } _fileBuffer.position(originalPosition); _fileSize = newFileSize; } catch (Exception exc) { FFDCFilter.processException(exc, "com.ibm.ws.recoverylog.spi.LogFileHandle.fileExtend", "1266", this); if (tc.isEntryEnabled()) Tr.event(tc, "Unable to extend file " + _fileName + " to " + newFileSize + " bytes"); if (tc.isEntryEnabled()) Tr.exit(tc, "fileExtend", "LogAllocationException"); throw new LogAllocationException(exc); } } if (tc.isEntryEnabled()) Tr.exit(tc, "fileExtend"); }
java
public void fileExtend(int newFileSize) throws LogAllocationException { if (tc.isEntryEnabled()) Tr.entry(tc, "fileExtend", new Object[] { new Integer(newFileSize), this }); final int fileLength = _fileBuffer.capacity(); if (fileLength < newFileSize) { try { // Expand the file to the new size ensuring that its pointer // remains in its current position. int originalPosition = _fileBuffer.position(); // TODO // Tr.uncondEvent(tc, "Expanding log file to size of " + newFileSize + " bytes."); Tr.event(tc, "Expanding log file to size of " + newFileSize + " bytes."); if (_isMapped) { _fileBuffer = _fileChannel.map(FileChannel.MapMode.READ_WRITE, 0, newFileSize); } else { // The file is not mapped. // Allocate a new DirectByteBuffer, copy the old ByteBuffer into the new one, // then write the new ByteBuffer to the FileChannel (automatically expanding it). if (tc.isDebugEnabled()) Tr.debug(tc, "File is NOT mapped. Allocating new DirectByteBuffer"); _fileBuffer.position(0); final ByteBuffer newByteBuffer = ByteBuffer.allocateDirect(newFileSize); newByteBuffer.put(_fileBuffer); newByteBuffer.position(0); _fileChannel.write(newByteBuffer, 0); _fileBuffer = newByteBuffer; } _fileBuffer.position(originalPosition); _fileSize = newFileSize; } catch (Exception exc) { FFDCFilter.processException(exc, "com.ibm.ws.recoverylog.spi.LogFileHandle.fileExtend", "1266", this); if (tc.isEntryEnabled()) Tr.event(tc, "Unable to extend file " + _fileName + " to " + newFileSize + " bytes"); if (tc.isEntryEnabled()) Tr.exit(tc, "fileExtend", "LogAllocationException"); throw new LogAllocationException(exc); } } if (tc.isEntryEnabled()) Tr.exit(tc, "fileExtend"); }
[ "public", "void", "fileExtend", "(", "int", "newFileSize", ")", "throws", "LogAllocationException", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "tc", ",", "\"fileExtend\"", ",", "new", "Object", "[", "]", "{", "new", "Integer", "(", "newFileSize", ")", ",", "this", "}", ")", ";", "final", "int", "fileLength", "=", "_fileBuffer", ".", "capacity", "(", ")", ";", "if", "(", "fileLength", "<", "newFileSize", ")", "{", "try", "{", "// Expand the file to the new size ensuring that its pointer", "// remains in its current position.", "int", "originalPosition", "=", "_fileBuffer", ".", "position", "(", ")", ";", "// TODO", "// Tr.uncondEvent(tc, \"Expanding log file to size of \" + newFileSize + \" bytes.\");", "Tr", ".", "event", "(", "tc", ",", "\"Expanding log file to size of \"", "+", "newFileSize", "+", "\" bytes.\"", ")", ";", "if", "(", "_isMapped", ")", "{", "_fileBuffer", "=", "_fileChannel", ".", "map", "(", "FileChannel", ".", "MapMode", ".", "READ_WRITE", ",", "0", ",", "newFileSize", ")", ";", "}", "else", "{", "// The file is not mapped.", "// Allocate a new DirectByteBuffer, copy the old ByteBuffer into the new one,", "// then write the new ByteBuffer to the FileChannel (automatically expanding it).", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "tc", ",", "\"File is NOT mapped. Allocating new DirectByteBuffer\"", ")", ";", "_fileBuffer", ".", "position", "(", "0", ")", ";", "final", "ByteBuffer", "newByteBuffer", "=", "ByteBuffer", ".", "allocateDirect", "(", "newFileSize", ")", ";", "newByteBuffer", ".", "put", "(", "_fileBuffer", ")", ";", "newByteBuffer", ".", "position", "(", "0", ")", ";", "_fileChannel", ".", "write", "(", "newByteBuffer", ",", "0", ")", ";", "_fileBuffer", "=", "newByteBuffer", ";", "}", "_fileBuffer", ".", "position", "(", "originalPosition", ")", ";", "_fileSize", "=", "newFileSize", ";", "}", "catch", "(", "Exception", "exc", ")", "{", "FFDCFilter", ".", "processException", "(", "exc", ",", "\"com.ibm.ws.recoverylog.spi.LogFileHandle.fileExtend\"", ",", "\"1266\"", ",", "this", ")", ";", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "event", "(", "tc", ",", "\"Unable to extend file \"", "+", "_fileName", "+", "\" to \"", "+", "newFileSize", "+", "\" bytes\"", ")", ";", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"fileExtend\"", ",", "\"LogAllocationException\"", ")", ";", "throw", "new", "LogAllocationException", "(", "exc", ")", ";", "}", "}", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"fileExtend\"", ")", ";", "}" ]
Extend the physical log file. If 'newFileSize' is larger than the current file size, the log file will extended so that it is 'newFileSize' kilobytes long. If 'newFileSize' is equal to or less than the current file size, the current log file will be unchanged. @param newFileSize The new file size for the physical log file (in kbytes). @exception LogAllocationException The system was unable to expand the log file.
[ "Extend", "the", "physical", "log", "file", ".", "If", "newFileSize", "is", "larger", "than", "the", "current", "file", "size", "the", "log", "file", "will", "extended", "so", "that", "it", "is", "newFileSize", "kilobytes", "long", ".", "If", "newFileSize", "is", "equal", "to", "or", "less", "than", "the", "current", "file", "size", "the", "current", "log", "file", "will", "be", "unchanged", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/LogFileHandle.java#L1143-L1199
train
OpenLiberty/open-liberty
dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/LogFileHandle.java
LogFileHandle.force
protected void force() throws InternalLogException { if (tc.isEntryEnabled()) Tr.entry(tc, "force", this); try { if (_isMapped) { // Note: on Win2K we can get an IOException from this even though it is not declared ((MappedByteBuffer) _fileBuffer).force(); } else { // Write the "pending" WritableLogRecords. writePendingToFile(); _fileChannel.force(false); } } catch (java.io.IOException ioe) { FFDCFilter.processException(ioe, "com.ibm.ws.recoverylog.spi.LogFileHandle.force", "1049", this); _exceptionInForce = true; if (tc.isEventEnabled()) Tr.event(tc, "Unable to force file " + _fileName); // d453958: moved terminateserver code to MultiScopeRecoveryLog.markFailed method. if (tc.isEntryEnabled()) Tr.exit(tc, "force", "InternalLogException"); throw new InternalLogException(ioe); } catch (InternalLogException exc) { FFDCFilter.processException(exc, "com.ibm.ws.recoverylog.spi.LogFileHandle.force", "1056", this); _exceptionInForce = true; if (tc.isEventEnabled()) Tr.event(tc, "Unable to force file " + _fileName); if (tc.isEntryEnabled()) Tr.exit(tc, "force", "InternalLogException"); throw exc; } catch (LogIncompatibleException exc) { FFDCFilter.processException(exc, "com.ibm.ws.recoverylog.spi.LogFileHandle.force", "1096", this); _exceptionInForce = true; if (tc.isEventEnabled()) Tr.event(tc, "Unable to force file " + _fileName); if (tc.isEntryEnabled()) Tr.exit(tc, "force", "InternalLogException"); throw new InternalLogException(exc); } if (tc.isEntryEnabled()) Tr.exit(tc, "force"); }
java
protected void force() throws InternalLogException { if (tc.isEntryEnabled()) Tr.entry(tc, "force", this); try { if (_isMapped) { // Note: on Win2K we can get an IOException from this even though it is not declared ((MappedByteBuffer) _fileBuffer).force(); } else { // Write the "pending" WritableLogRecords. writePendingToFile(); _fileChannel.force(false); } } catch (java.io.IOException ioe) { FFDCFilter.processException(ioe, "com.ibm.ws.recoverylog.spi.LogFileHandle.force", "1049", this); _exceptionInForce = true; if (tc.isEventEnabled()) Tr.event(tc, "Unable to force file " + _fileName); // d453958: moved terminateserver code to MultiScopeRecoveryLog.markFailed method. if (tc.isEntryEnabled()) Tr.exit(tc, "force", "InternalLogException"); throw new InternalLogException(ioe); } catch (InternalLogException exc) { FFDCFilter.processException(exc, "com.ibm.ws.recoverylog.spi.LogFileHandle.force", "1056", this); _exceptionInForce = true; if (tc.isEventEnabled()) Tr.event(tc, "Unable to force file " + _fileName); if (tc.isEntryEnabled()) Tr.exit(tc, "force", "InternalLogException"); throw exc; } catch (LogIncompatibleException exc) { FFDCFilter.processException(exc, "com.ibm.ws.recoverylog.spi.LogFileHandle.force", "1096", this); _exceptionInForce = true; if (tc.isEventEnabled()) Tr.event(tc, "Unable to force file " + _fileName); if (tc.isEntryEnabled()) Tr.exit(tc, "force", "InternalLogException"); throw new InternalLogException(exc); } if (tc.isEntryEnabled()) Tr.exit(tc, "force"); }
[ "protected", "void", "force", "(", ")", "throws", "InternalLogException", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "tc", ",", "\"force\"", ",", "this", ")", ";", "try", "{", "if", "(", "_isMapped", ")", "{", "// Note: on Win2K we can get an IOException from this even though it is not declared", "(", "(", "MappedByteBuffer", ")", "_fileBuffer", ")", ".", "force", "(", ")", ";", "}", "else", "{", "// Write the \"pending\" WritableLogRecords.", "writePendingToFile", "(", ")", ";", "_fileChannel", ".", "force", "(", "false", ")", ";", "}", "}", "catch", "(", "java", ".", "io", ".", "IOException", "ioe", ")", "{", "FFDCFilter", ".", "processException", "(", "ioe", ",", "\"com.ibm.ws.recoverylog.spi.LogFileHandle.force\"", ",", "\"1049\"", ",", "this", ")", ";", "_exceptionInForce", "=", "true", ";", "if", "(", "tc", ".", "isEventEnabled", "(", ")", ")", "Tr", ".", "event", "(", "tc", ",", "\"Unable to force file \"", "+", "_fileName", ")", ";", "// d453958: moved terminateserver code to MultiScopeRecoveryLog.markFailed method.", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"force\"", ",", "\"InternalLogException\"", ")", ";", "throw", "new", "InternalLogException", "(", "ioe", ")", ";", "}", "catch", "(", "InternalLogException", "exc", ")", "{", "FFDCFilter", ".", "processException", "(", "exc", ",", "\"com.ibm.ws.recoverylog.spi.LogFileHandle.force\"", ",", "\"1056\"", ",", "this", ")", ";", "_exceptionInForce", "=", "true", ";", "if", "(", "tc", ".", "isEventEnabled", "(", ")", ")", "Tr", ".", "event", "(", "tc", ",", "\"Unable to force file \"", "+", "_fileName", ")", ";", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"force\"", ",", "\"InternalLogException\"", ")", ";", "throw", "exc", ";", "}", "catch", "(", "LogIncompatibleException", "exc", ")", "{", "FFDCFilter", ".", "processException", "(", "exc", ",", "\"com.ibm.ws.recoverylog.spi.LogFileHandle.force\"", ",", "\"1096\"", ",", "this", ")", ";", "_exceptionInForce", "=", "true", ";", "if", "(", "tc", ".", "isEventEnabled", "(", ")", ")", "Tr", ".", "event", "(", "tc", ",", "\"Unable to force file \"", "+", "_fileName", ")", ";", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"force\"", ",", "\"InternalLogException\"", ")", ";", "throw", "new", "InternalLogException", "(", "exc", ")", ";", "}", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"force\"", ")", ";", "}" ]
Forces the contents of the memory-mapped view of the log file to disk. Having invoked this method the caller can be certain that any data added to the log as part of a prior log write is now stored persistently on disk.
[ "Forces", "the", "contents", "of", "the", "memory", "-", "mapped", "view", "of", "the", "log", "file", "to", "disk", ".", "Having", "invoked", "this", "method", "the", "caller", "can", "be", "certain", "that", "any", "data", "added", "to", "the", "log", "as", "part", "of", "a", "prior", "log", "write", "is", "now", "stored", "persistently", "on", "disk", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/LogFileHandle.java#L1209-L1261
train
OpenLiberty/open-liberty
dev/com.ibm.ws.container.service.compat/src/com/ibm/ws/util/VirtualHostMapper.java
VirtualHostMapper.normalize
private String normalize(String alias) { // replace all the '.'s to '\.'s String regExp = alias.replaceAll("[\\.]", "\\\\\\."); // replace all the '*'s to '.*'s regExp = regExp.replaceAll("[*]", "\\.\\*"); // System.out.println("Normalized "+alias+" to "+regExp); return regExp; }
java
private String normalize(String alias) { // replace all the '.'s to '\.'s String regExp = alias.replaceAll("[\\.]", "\\\\\\."); // replace all the '*'s to '.*'s regExp = regExp.replaceAll("[*]", "\\.\\*"); // System.out.println("Normalized "+alias+" to "+regExp); return regExp; }
[ "private", "String", "normalize", "(", "String", "alias", ")", "{", "// replace all the '.'s to '\\.'s", "String", "regExp", "=", "alias", ".", "replaceAll", "(", "\"[\\\\.]\"", ",", "\"\\\\\\\\\\\\.\"", ")", ";", "// replace all the '*'s to '.*'s", "regExp", "=", "regExp", ".", "replaceAll", "(", "\"[*]\"", ",", "\"\\\\.\\\\*\"", ")", ";", "// System.out.println(\"Normalized \"+alias+\" to \"+regExp);", "return", "regExp", ";", "}" ]
This method normalizes the alias into a valid regular expression
[ "This", "method", "normalizes", "the", "alias", "into", "a", "valid", "regular", "expression" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.container.service.compat/src/com/ibm/ws/util/VirtualHostMapper.java#L56-L66
train
OpenLiberty/open-liberty
dev/com.ibm.ws.container.service.compat/src/com/ibm/ws/util/VirtualHostMapper.java
VirtualHostMapper.targetMappings
public Iterator targetMappings() { // System.out.println("TargetMappings called"); // return vHostTable.values().iterator(); 316624 Collection vHosts = vHostTable.values(); // 316624 List l = new ArrayList(); // 316624 l.addAll(vHosts); // 316624 return l.listIterator(); // 316624 }
java
public Iterator targetMappings() { // System.out.println("TargetMappings called"); // return vHostTable.values().iterator(); 316624 Collection vHosts = vHostTable.values(); // 316624 List l = new ArrayList(); // 316624 l.addAll(vHosts); // 316624 return l.listIterator(); // 316624 }
[ "public", "Iterator", "targetMappings", "(", ")", "{", "// System.out.println(\"TargetMappings called\");", "// return vHostTable.values().iterator(); 316624", "Collection", "vHosts", "=", "vHostTable", ".", "values", "(", ")", ";", "// 316624", "List", "l", "=", "new", "ArrayList", "(", ")", ";", "// 316624", "l", ".", "addAll", "(", "vHosts", ")", ";", "// 316624", "return", "l", ".", "listIterator", "(", ")", ";", "// 316624", "}" ]
Returns an enumeration of all the target mappings added to this mapper
[ "Returns", "an", "enumeration", "of", "all", "the", "target", "mappings", "added", "to", "this", "mapper" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.container.service.compat/src/com/ibm/ws/util/VirtualHostMapper.java#L79-L86
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/list/BehindRefList.java
BehindRefList.insert
public final BehindRef insert(final AbstractItemLink insertAil) { final long insertPosition = insertAil.getPosition(); boolean inserted = false; BehindRef addref = null; // Loop backwards through the list in order of decreasing sequence number // (addition usually near the end) until we have inserted the entry BehindRef lookat = _lastLinkBehind; while (!inserted && (lookat != null)) { AbstractItemLink lookatAil = lookat.getAIL(); if (lookatAil != null) { long lookatPosition = lookatAil.getPosition(); if (insertPosition > lookatPosition) { // This is where it goes then addref = new BehindRef(insertAil); if (lookat._next == null) { // It's now the last one in the list _lastLinkBehind = addref; } else { // It's going in the middle of the list addref._next = lookat._next; lookat._next._prev = addref; } addref._prev = lookat; lookat._next = addref; inserted = true; } else if (insertPosition == lookatPosition) { // A duplicate. OK, it's been made reavailable more than once addref = lookat; inserted = true; } else { // Need to move backwards lookat = lookat._prev; } } else { BehindRef newlookat = lookat._prev; _remove(lookat); lookat = newlookat; } } // If we have not inserted it yet, it's going to be the first in the list if (!inserted) { addref = new BehindRef(insertAil); if (_firstLinkBehind != null) { addref._next = _firstLinkBehind; _firstLinkBehind._prev = addref; _firstLinkBehind = addref; } else { _firstLinkBehind = addref; _lastLinkBehind = addref; } } return addref; }
java
public final BehindRef insert(final AbstractItemLink insertAil) { final long insertPosition = insertAil.getPosition(); boolean inserted = false; BehindRef addref = null; // Loop backwards through the list in order of decreasing sequence number // (addition usually near the end) until we have inserted the entry BehindRef lookat = _lastLinkBehind; while (!inserted && (lookat != null)) { AbstractItemLink lookatAil = lookat.getAIL(); if (lookatAil != null) { long lookatPosition = lookatAil.getPosition(); if (insertPosition > lookatPosition) { // This is where it goes then addref = new BehindRef(insertAil); if (lookat._next == null) { // It's now the last one in the list _lastLinkBehind = addref; } else { // It's going in the middle of the list addref._next = lookat._next; lookat._next._prev = addref; } addref._prev = lookat; lookat._next = addref; inserted = true; } else if (insertPosition == lookatPosition) { // A duplicate. OK, it's been made reavailable more than once addref = lookat; inserted = true; } else { // Need to move backwards lookat = lookat._prev; } } else { BehindRef newlookat = lookat._prev; _remove(lookat); lookat = newlookat; } } // If we have not inserted it yet, it's going to be the first in the list if (!inserted) { addref = new BehindRef(insertAil); if (_firstLinkBehind != null) { addref._next = _firstLinkBehind; _firstLinkBehind._prev = addref; _firstLinkBehind = addref; } else { _firstLinkBehind = addref; _lastLinkBehind = addref; } } return addref; }
[ "public", "final", "BehindRef", "insert", "(", "final", "AbstractItemLink", "insertAil", ")", "{", "final", "long", "insertPosition", "=", "insertAil", ".", "getPosition", "(", ")", ";", "boolean", "inserted", "=", "false", ";", "BehindRef", "addref", "=", "null", ";", "// Loop backwards through the list in order of decreasing sequence number", "// (addition usually near the end) until we have inserted the entry", "BehindRef", "lookat", "=", "_lastLinkBehind", ";", "while", "(", "!", "inserted", "&&", "(", "lookat", "!=", "null", ")", ")", "{", "AbstractItemLink", "lookatAil", "=", "lookat", ".", "getAIL", "(", ")", ";", "if", "(", "lookatAil", "!=", "null", ")", "{", "long", "lookatPosition", "=", "lookatAil", ".", "getPosition", "(", ")", ";", "if", "(", "insertPosition", ">", "lookatPosition", ")", "{", "// This is where it goes then", "addref", "=", "new", "BehindRef", "(", "insertAil", ")", ";", "if", "(", "lookat", ".", "_next", "==", "null", ")", "{", "// It's now the last one in the list", "_lastLinkBehind", "=", "addref", ";", "}", "else", "{", "// It's going in the middle of the list", "addref", ".", "_next", "=", "lookat", ".", "_next", ";", "lookat", ".", "_next", ".", "_prev", "=", "addref", ";", "}", "addref", ".", "_prev", "=", "lookat", ";", "lookat", ".", "_next", "=", "addref", ";", "inserted", "=", "true", ";", "}", "else", "if", "(", "insertPosition", "==", "lookatPosition", ")", "{", "// A duplicate. OK, it's been made reavailable more than once", "addref", "=", "lookat", ";", "inserted", "=", "true", ";", "}", "else", "{", "// Need to move backwards", "lookat", "=", "lookat", ".", "_prev", ";", "}", "}", "else", "{", "BehindRef", "newlookat", "=", "lookat", ".", "_prev", ";", "_remove", "(", "lookat", ")", ";", "lookat", "=", "newlookat", ";", "}", "}", "// If we have not inserted it yet, it's going to be the first in the list", "if", "(", "!", "inserted", ")", "{", "addref", "=", "new", "BehindRef", "(", "insertAil", ")", ";", "if", "(", "_firstLinkBehind", "!=", "null", ")", "{", "addref", ".", "_next", "=", "_firstLinkBehind", ";", "_firstLinkBehind", ".", "_prev", "=", "addref", ";", "_firstLinkBehind", "=", "addref", ";", "}", "else", "{", "_firstLinkBehind", "=", "addref", ";", "_lastLinkBehind", "=", "addref", ";", "}", "}", "return", "addref", ";", "}" ]
Inserts a reference to an AIL in the list of AILs behind the curent position of the cursor. The insertion is performed in position order. The list is composed of weak references and any which are discovered to refer to objects no longer on the heap are removed as we go. @param insertAil
[ "Inserts", "a", "reference", "to", "an", "AIL", "in", "the", "list", "of", "AILs", "behind", "the", "curent", "position", "of", "the", "cursor", ".", "The", "insertion", "is", "performed", "in", "position", "order", ".", "The", "list", "is", "composed", "of", "weak", "references", "and", "any", "which", "are", "discovered", "to", "refer", "to", "objects", "no", "longer", "on", "the", "heap", "are", "removed", "as", "we", "go", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/list/BehindRefList.java#L85-L157
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/list/BehindRefList.java
BehindRefList._remove
private final void _remove(final BehindRef removeref) { if (_firstLinkBehind != null) { if (removeref == _firstLinkBehind) { // It's the first in the list ... if (removeref == _lastLinkBehind) { // ... and the only entry, the list is now empty _firstLinkBehind = null; _lastLinkBehind = null; } else { // ... and there are more entries, the first will change BehindRef nextref = removeref._next; removeref._next = null; nextref._prev = null; _firstLinkBehind = nextref; } } else if (removeref == _lastLinkBehind) { // It's the list in the list and not the first also, the last will change BehindRef prevref = removeref._prev; removeref._prev = null; prevref._next = null; _lastLinkBehind = prevref; } else { // It's in the middle of the list BehindRef prevref = removeref._prev; BehindRef nextref = removeref._next; removeref._next = null; removeref._prev = null; prevref._next = nextref; nextref._prev = prevref; } } }
java
private final void _remove(final BehindRef removeref) { if (_firstLinkBehind != null) { if (removeref == _firstLinkBehind) { // It's the first in the list ... if (removeref == _lastLinkBehind) { // ... and the only entry, the list is now empty _firstLinkBehind = null; _lastLinkBehind = null; } else { // ... and there are more entries, the first will change BehindRef nextref = removeref._next; removeref._next = null; nextref._prev = null; _firstLinkBehind = nextref; } } else if (removeref == _lastLinkBehind) { // It's the list in the list and not the first also, the last will change BehindRef prevref = removeref._prev; removeref._prev = null; prevref._next = null; _lastLinkBehind = prevref; } else { // It's in the middle of the list BehindRef prevref = removeref._prev; BehindRef nextref = removeref._next; removeref._next = null; removeref._prev = null; prevref._next = nextref; nextref._prev = prevref; } } }
[ "private", "final", "void", "_remove", "(", "final", "BehindRef", "removeref", ")", "{", "if", "(", "_firstLinkBehind", "!=", "null", ")", "{", "if", "(", "removeref", "==", "_firstLinkBehind", ")", "{", "// It's the first in the list ...", "if", "(", "removeref", "==", "_lastLinkBehind", ")", "{", "// ... and the only entry, the list is now empty", "_firstLinkBehind", "=", "null", ";", "_lastLinkBehind", "=", "null", ";", "}", "else", "{", "// ... and there are more entries, the first will change", "BehindRef", "nextref", "=", "removeref", ".", "_next", ";", "removeref", ".", "_next", "=", "null", ";", "nextref", ".", "_prev", "=", "null", ";", "_firstLinkBehind", "=", "nextref", ";", "}", "}", "else", "if", "(", "removeref", "==", "_lastLinkBehind", ")", "{", "// It's the list in the list and not the first also, the last will change", "BehindRef", "prevref", "=", "removeref", ".", "_prev", ";", "removeref", ".", "_prev", "=", "null", ";", "prevref", ".", "_next", "=", "null", ";", "_lastLinkBehind", "=", "prevref", ";", "}", "else", "{", "// It's in the middle of the list", "BehindRef", "prevref", "=", "removeref", ".", "_prev", ";", "BehindRef", "nextref", "=", "removeref", ".", "_next", ";", "removeref", ".", "_next", "=", "null", ";", "removeref", ".", "_prev", "=", "null", ";", "prevref", ".", "_next", "=", "nextref", ";", "nextref", ".", "_prev", "=", "prevref", ";", "}", "}", "}" ]
Removes the first AIL in the list of AILs behind the current position of the cursor. The list may empty completely as a result.
[ "Removes", "the", "first", "AIL", "in", "the", "list", "of", "AILs", "behind", "the", "current", "position", "of", "the", "cursor", ".", "The", "list", "may", "empty", "completely", "as", "a", "result", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/list/BehindRefList.java#L165-L206
train
OpenLiberty/open-liberty
dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/BaseTraceService.java
BaseTraceService.invokeTraceRouters
protected boolean invokeTraceRouters(RoutedMessage routedTrace) { boolean retMe = true; LogRecord logRecord = routedTrace.getLogRecord(); /* * Avoid any feedback traces that are emitted after this point. * The first time the counter increments is the first pass-through. * The second time the counter increments is the second pass-through due * to trace emitted. We do not want any more pass-throughs. */ try { if (!(counterForTraceRouter.incrementCount() > 2)) { if (logRecord != null) { Level level = logRecord.getLevel(); int levelValue = level.intValue(); if (levelValue < Level.INFO.intValue()) { String levelName = level.getName(); if (!(levelName.equals("SystemOut") || levelName.equals("SystemErr"))) { //SystemOut/Err=700 WsTraceRouter internalTrRouter = internalTraceRouter.get(); if (internalTrRouter != null) { retMe &= internalTrRouter.route(routedTrace); } else if (earlierTraces != null) { synchronized (this) { if (earlierTraces != null) { earlierTraces.add(routedTrace); } } } } } } } } finally { counterForTraceRouter.decrementCount(); } return retMe; }
java
protected boolean invokeTraceRouters(RoutedMessage routedTrace) { boolean retMe = true; LogRecord logRecord = routedTrace.getLogRecord(); /* * Avoid any feedback traces that are emitted after this point. * The first time the counter increments is the first pass-through. * The second time the counter increments is the second pass-through due * to trace emitted. We do not want any more pass-throughs. */ try { if (!(counterForTraceRouter.incrementCount() > 2)) { if (logRecord != null) { Level level = logRecord.getLevel(); int levelValue = level.intValue(); if (levelValue < Level.INFO.intValue()) { String levelName = level.getName(); if (!(levelName.equals("SystemOut") || levelName.equals("SystemErr"))) { //SystemOut/Err=700 WsTraceRouter internalTrRouter = internalTraceRouter.get(); if (internalTrRouter != null) { retMe &= internalTrRouter.route(routedTrace); } else if (earlierTraces != null) { synchronized (this) { if (earlierTraces != null) { earlierTraces.add(routedTrace); } } } } } } } } finally { counterForTraceRouter.decrementCount(); } return retMe; }
[ "protected", "boolean", "invokeTraceRouters", "(", "RoutedMessage", "routedTrace", ")", "{", "boolean", "retMe", "=", "true", ";", "LogRecord", "logRecord", "=", "routedTrace", ".", "getLogRecord", "(", ")", ";", "/*\n * Avoid any feedback traces that are emitted after this point.\n * The first time the counter increments is the first pass-through.\n * The second time the counter increments is the second pass-through due\n * to trace emitted. We do not want any more pass-throughs.\n */", "try", "{", "if", "(", "!", "(", "counterForTraceRouter", ".", "incrementCount", "(", ")", ">", "2", ")", ")", "{", "if", "(", "logRecord", "!=", "null", ")", "{", "Level", "level", "=", "logRecord", ".", "getLevel", "(", ")", ";", "int", "levelValue", "=", "level", ".", "intValue", "(", ")", ";", "if", "(", "levelValue", "<", "Level", ".", "INFO", ".", "intValue", "(", ")", ")", "{", "String", "levelName", "=", "level", ".", "getName", "(", ")", ";", "if", "(", "!", "(", "levelName", ".", "equals", "(", "\"SystemOut\"", ")", "||", "levelName", ".", "equals", "(", "\"SystemErr\"", ")", ")", ")", "{", "//SystemOut/Err=700", "WsTraceRouter", "internalTrRouter", "=", "internalTraceRouter", ".", "get", "(", ")", ";", "if", "(", "internalTrRouter", "!=", "null", ")", "{", "retMe", "&=", "internalTrRouter", ".", "route", "(", "routedTrace", ")", ";", "}", "else", "if", "(", "earlierTraces", "!=", "null", ")", "{", "synchronized", "(", "this", ")", "{", "if", "(", "earlierTraces", "!=", "null", ")", "{", "earlierTraces", ".", "add", "(", "routedTrace", ")", ";", "}", "}", "}", "}", "}", "}", "}", "}", "finally", "{", "counterForTraceRouter", ".", "decrementCount", "(", ")", ";", "}", "return", "retMe", ";", "}" ]
Route only trace log records.Messages including Systemout,err will not be routed to trace source to avoid duplicate entries
[ "Route", "only", "trace", "log", "records", ".", "Messages", "including", "Systemout", "err", "will", "not", "be", "routed", "to", "trace", "source", "to", "avoid", "duplicate", "entries" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/BaseTraceService.java#L730-L766
train
OpenLiberty/open-liberty
dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/BaseTraceService.java
BaseTraceService.publishTraceLogRecord
protected void publishTraceLogRecord(TraceWriter detailLog, LogRecord logRecord, Object id, String formattedMsg, String formattedVerboseMsg) { //check if tracefilename is stdout if (formattedVerboseMsg == null) { formattedVerboseMsg = formatter.formatVerboseMessage(logRecord, formattedMsg, false); } RoutedMessage routedTrace = new RoutedMessageImpl(formattedMsg, formattedVerboseMsg, null, logRecord); invokeTraceRouters(routedTrace); /* * Avoid any feedback traces that are emitted after this point. * The first time the counter increments is the first pass-through. * The second time the counter increments is the second pass-through due * to trace emitted. We do not want any more pass-throughs. */ try { if (!(counterForTraceSource.incrementCount() > 2)) { if (logRecord != null) { Level level = logRecord.getLevel(); int levelValue = level.intValue(); if (levelValue < Level.INFO.intValue()) { String levelName = level.getName(); if (!(levelName.equals("SystemOut") || levelName.equals("SystemErr"))) { //SystemOut/Err=700 if (traceSource != null) { traceSource.publish(routedTrace, id); } } } } } } finally { counterForTraceSource.decrementCount(); } try { if (!(counterForTraceWriter.incrementCount() > 1)) { // write to trace.log if (detailLog != systemOut) { String traceDetail = formatter.traceLogFormat(logRecord, id, formattedMsg, formattedVerboseMsg); detailLog.writeRecord(traceDetail); } } } finally { counterForTraceWriter.decrementCount(); } }
java
protected void publishTraceLogRecord(TraceWriter detailLog, LogRecord logRecord, Object id, String formattedMsg, String formattedVerboseMsg) { //check if tracefilename is stdout if (formattedVerboseMsg == null) { formattedVerboseMsg = formatter.formatVerboseMessage(logRecord, formattedMsg, false); } RoutedMessage routedTrace = new RoutedMessageImpl(formattedMsg, formattedVerboseMsg, null, logRecord); invokeTraceRouters(routedTrace); /* * Avoid any feedback traces that are emitted after this point. * The first time the counter increments is the first pass-through. * The second time the counter increments is the second pass-through due * to trace emitted. We do not want any more pass-throughs. */ try { if (!(counterForTraceSource.incrementCount() > 2)) { if (logRecord != null) { Level level = logRecord.getLevel(); int levelValue = level.intValue(); if (levelValue < Level.INFO.intValue()) { String levelName = level.getName(); if (!(levelName.equals("SystemOut") || levelName.equals("SystemErr"))) { //SystemOut/Err=700 if (traceSource != null) { traceSource.publish(routedTrace, id); } } } } } } finally { counterForTraceSource.decrementCount(); } try { if (!(counterForTraceWriter.incrementCount() > 1)) { // write to trace.log if (detailLog != systemOut) { String traceDetail = formatter.traceLogFormat(logRecord, id, formattedMsg, formattedVerboseMsg); detailLog.writeRecord(traceDetail); } } } finally { counterForTraceWriter.decrementCount(); } }
[ "protected", "void", "publishTraceLogRecord", "(", "TraceWriter", "detailLog", ",", "LogRecord", "logRecord", ",", "Object", "id", ",", "String", "formattedMsg", ",", "String", "formattedVerboseMsg", ")", "{", "//check if tracefilename is stdout", "if", "(", "formattedVerboseMsg", "==", "null", ")", "{", "formattedVerboseMsg", "=", "formatter", ".", "formatVerboseMessage", "(", "logRecord", ",", "formattedMsg", ",", "false", ")", ";", "}", "RoutedMessage", "routedTrace", "=", "new", "RoutedMessageImpl", "(", "formattedMsg", ",", "formattedVerboseMsg", ",", "null", ",", "logRecord", ")", ";", "invokeTraceRouters", "(", "routedTrace", ")", ";", "/*\n * Avoid any feedback traces that are emitted after this point.\n * The first time the counter increments is the first pass-through.\n * The second time the counter increments is the second pass-through due\n * to trace emitted. We do not want any more pass-throughs.\n */", "try", "{", "if", "(", "!", "(", "counterForTraceSource", ".", "incrementCount", "(", ")", ">", "2", ")", ")", "{", "if", "(", "logRecord", "!=", "null", ")", "{", "Level", "level", "=", "logRecord", ".", "getLevel", "(", ")", ";", "int", "levelValue", "=", "level", ".", "intValue", "(", ")", ";", "if", "(", "levelValue", "<", "Level", ".", "INFO", ".", "intValue", "(", ")", ")", "{", "String", "levelName", "=", "level", ".", "getName", "(", ")", ";", "if", "(", "!", "(", "levelName", ".", "equals", "(", "\"SystemOut\"", ")", "||", "levelName", ".", "equals", "(", "\"SystemErr\"", ")", ")", ")", "{", "//SystemOut/Err=700", "if", "(", "traceSource", "!=", "null", ")", "{", "traceSource", ".", "publish", "(", "routedTrace", ",", "id", ")", ";", "}", "}", "}", "}", "}", "}", "finally", "{", "counterForTraceSource", ".", "decrementCount", "(", ")", ";", "}", "try", "{", "if", "(", "!", "(", "counterForTraceWriter", ".", "incrementCount", "(", ")", ">", "1", ")", ")", "{", "// write to trace.log", "if", "(", "detailLog", "!=", "systemOut", ")", "{", "String", "traceDetail", "=", "formatter", ".", "traceLogFormat", "(", "logRecord", ",", "id", ",", "formattedMsg", ",", "formattedVerboseMsg", ")", ";", "detailLog", ".", "writeRecord", "(", "traceDetail", ")", ";", "}", "}", "}", "finally", "{", "counterForTraceWriter", ".", "decrementCount", "(", ")", ";", "}", "}" ]
Publish a trace log record. @param detailLog the trace writer @param logRecord @param id the trace object id @param formattedMsg the result of {@link BaseTraceFormatter#formatMessage} @param formattedVerboseMsg the result of {@link BaseTraceFormatter#formatVerboseMessage}
[ "Publish", "a", "trace", "log", "record", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/BaseTraceService.java#L856-L901
train
OpenLiberty/open-liberty
dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/BaseTraceService.java
BaseTraceService.setMessageRouter
@Override public void setMessageRouter(MessageRouter msgRouter) { externalMessageRouter.set(msgRouter); if (msgRouter instanceof WsMessageRouter) { setWsMessageRouter((WsMessageRouter) msgRouter); } }
java
@Override public void setMessageRouter(MessageRouter msgRouter) { externalMessageRouter.set(msgRouter); if (msgRouter instanceof WsMessageRouter) { setWsMessageRouter((WsMessageRouter) msgRouter); } }
[ "@", "Override", "public", "void", "setMessageRouter", "(", "MessageRouter", "msgRouter", ")", "{", "externalMessageRouter", ".", "set", "(", "msgRouter", ")", ";", "if", "(", "msgRouter", "instanceof", "WsMessageRouter", ")", "{", "setWsMessageRouter", "(", "(", "WsMessageRouter", ")", "msgRouter", ")", ";", "}", "}" ]
Inject the SPI MessageRouter. This is injected by TrConfigurator, which is also SPI. So it's possible for third-party code to implement and inject their own MessageRouter.
[ "Inject", "the", "SPI", "MessageRouter", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/BaseTraceService.java#L909-L917
train
OpenLiberty/open-liberty
dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/BaseTraceService.java
BaseTraceService.unsetMessageRouter
@Override public void unsetMessageRouter(MessageRouter msgRouter) { externalMessageRouter.compareAndSet(msgRouter, null); if (msgRouter instanceof WsMessageRouter) { unsetWsMessageRouter((WsMessageRouter) msgRouter); } }
java
@Override public void unsetMessageRouter(MessageRouter msgRouter) { externalMessageRouter.compareAndSet(msgRouter, null); if (msgRouter instanceof WsMessageRouter) { unsetWsMessageRouter((WsMessageRouter) msgRouter); } }
[ "@", "Override", "public", "void", "unsetMessageRouter", "(", "MessageRouter", "msgRouter", ")", "{", "externalMessageRouter", ".", "compareAndSet", "(", "msgRouter", ",", "null", ")", ";", "if", "(", "msgRouter", "instanceof", "WsMessageRouter", ")", "{", "unsetWsMessageRouter", "(", "(", "WsMessageRouter", ")", "msgRouter", ")", ";", "}", "}" ]
Un-inject.
[ "Un", "-", "inject", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/BaseTraceService.java#L922-L929
train
OpenLiberty/open-liberty
dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/BaseTraceService.java
BaseTraceService.initializeWriters
protected void initializeWriters(LogProviderConfigImpl config) { // createFileLog may or may not return the original log holder.. messagesLog = FileLogHolder.createFileLogHolder(messagesLog, newFileLogHeader(false, config), config.getLogDirectory(), config.getMessageFileName(), config.getMaxFiles(), config.getMaxFileBytes(), config.getNewLogsOnStart()); // Always create a traceLog when using Tr -- this file won't actually be // created until something is logged to it... TraceWriter oldWriter = traceLog; String fileName = config.getTraceFileName(); if (fileName.equals("stdout")) { traceLog = systemOut; LoggingFileUtils.tryToClose(oldWriter); } else { traceLog = FileLogHolder.createFileLogHolder(oldWriter == systemOut ? null : oldWriter, newFileLogHeader(true, config), config.getLogDirectory(), config.getTraceFileName(), config.getMaxFiles(), config.getMaxFileBytes(), config.getNewLogsOnStart()); if (!TraceComponent.isAnyTracingEnabled()) { ((FileLogHolder) traceLog).releaseFile(); } } }
java
protected void initializeWriters(LogProviderConfigImpl config) { // createFileLog may or may not return the original log holder.. messagesLog = FileLogHolder.createFileLogHolder(messagesLog, newFileLogHeader(false, config), config.getLogDirectory(), config.getMessageFileName(), config.getMaxFiles(), config.getMaxFileBytes(), config.getNewLogsOnStart()); // Always create a traceLog when using Tr -- this file won't actually be // created until something is logged to it... TraceWriter oldWriter = traceLog; String fileName = config.getTraceFileName(); if (fileName.equals("stdout")) { traceLog = systemOut; LoggingFileUtils.tryToClose(oldWriter); } else { traceLog = FileLogHolder.createFileLogHolder(oldWriter == systemOut ? null : oldWriter, newFileLogHeader(true, config), config.getLogDirectory(), config.getTraceFileName(), config.getMaxFiles(), config.getMaxFileBytes(), config.getNewLogsOnStart()); if (!TraceComponent.isAnyTracingEnabled()) { ((FileLogHolder) traceLog).releaseFile(); } } }
[ "protected", "void", "initializeWriters", "(", "LogProviderConfigImpl", "config", ")", "{", "// createFileLog may or may not return the original log holder..", "messagesLog", "=", "FileLogHolder", ".", "createFileLogHolder", "(", "messagesLog", ",", "newFileLogHeader", "(", "false", ",", "config", ")", ",", "config", ".", "getLogDirectory", "(", ")", ",", "config", ".", "getMessageFileName", "(", ")", ",", "config", ".", "getMaxFiles", "(", ")", ",", "config", ".", "getMaxFileBytes", "(", ")", ",", "config", ".", "getNewLogsOnStart", "(", ")", ")", ";", "// Always create a traceLog when using Tr -- this file won't actually be", "// created until something is logged to it...", "TraceWriter", "oldWriter", "=", "traceLog", ";", "String", "fileName", "=", "config", ".", "getTraceFileName", "(", ")", ";", "if", "(", "fileName", ".", "equals", "(", "\"stdout\"", ")", ")", "{", "traceLog", "=", "systemOut", ";", "LoggingFileUtils", ".", "tryToClose", "(", "oldWriter", ")", ";", "}", "else", "{", "traceLog", "=", "FileLogHolder", ".", "createFileLogHolder", "(", "oldWriter", "==", "systemOut", "?", "null", ":", "oldWriter", ",", "newFileLogHeader", "(", "true", ",", "config", ")", ",", "config", ".", "getLogDirectory", "(", ")", ",", "config", ".", "getTraceFileName", "(", ")", ",", "config", ".", "getMaxFiles", "(", ")", ",", "config", ".", "getMaxFileBytes", "(", ")", ",", "config", ".", "getNewLogsOnStart", "(", ")", ")", ";", "if", "(", "!", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", ")", "{", "(", "(", "FileLogHolder", ")", "traceLog", ")", ".", "releaseFile", "(", ")", ";", "}", "}", "}" ]
Initialize the log holders for messages and trace. If the TrService is configured at bootstrap time to use JSR-47 logging, the traceLog will not be created here, as the LogRecord should be routed to logger rather than being formatted for the trace file. @param config a {@link LogProviderConfigImpl} containing TrService configuration from bootstrap properties
[ "Initialize", "the", "log", "holders", "for", "messages", "and", "trace", ".", "If", "the", "TrService", "is", "configured", "at", "bootstrap", "time", "to", "use", "JSR", "-", "47", "logging", "the", "traceLog", "will", "not", "be", "created", "here", "as", "the", "LogRecord", "should", "be", "routed", "to", "logger", "rather", "than", "being", "formatted", "for", "the", "trace", "file", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/BaseTraceService.java#L1002-L1032
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jbatch.cdi/src/com/ibm/ws/jbatch/cdi/internal/CDIBatchArtifactFactoryImpl.java
CDIBatchArtifactFactoryImpl.load
@Override public Object load(String batchId) { Object loadedArtifact; loadedArtifact = getArtifactById(batchId); if (loadedArtifact != null) { if (logger.isLoggable(Level.FINEST)) { logger.finest("load: batchId: " + batchId + ", artifact: " + loadedArtifact + ", artifact class: " + loadedArtifact.getClass().getCanonicalName()); } } return loadedArtifact; }
java
@Override public Object load(String batchId) { Object loadedArtifact; loadedArtifact = getArtifactById(batchId); if (loadedArtifact != null) { if (logger.isLoggable(Level.FINEST)) { logger.finest("load: batchId: " + batchId + ", artifact: " + loadedArtifact + ", artifact class: " + loadedArtifact.getClass().getCanonicalName()); } } return loadedArtifact; }
[ "@", "Override", "public", "Object", "load", "(", "String", "batchId", ")", "{", "Object", "loadedArtifact", ";", "loadedArtifact", "=", "getArtifactById", "(", "batchId", ")", ";", "if", "(", "loadedArtifact", "!=", "null", ")", "{", "if", "(", "logger", ".", "isLoggable", "(", "Level", ".", "FINEST", ")", ")", "{", "logger", ".", "finest", "(", "\"load: batchId: \"", "+", "batchId", "+", "\", artifact: \"", "+", "loadedArtifact", "+", "\", artifact class: \"", "+", "loadedArtifact", ".", "getClass", "(", ")", ".", "getCanonicalName", "(", ")", ")", ";", "}", "}", "return", "loadedArtifact", ";", "}" ]
Use CDI to load the artifact with the given ID. @return the loaded artifact; or null if CDI is not enabled for the app.
[ "Use", "CDI", "to", "load", "the", "artifact", "with", "the", "given", "ID", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jbatch.cdi/src/com/ibm/ws/jbatch/cdi/internal/CDIBatchArtifactFactoryImpl.java#L59-L75
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jbatch.cdi/src/com/ibm/ws/jbatch/cdi/internal/CDIBatchArtifactFactoryImpl.java
CDIBatchArtifactFactoryImpl.getUniqueBeanByBeanName
protected Bean<?> getUniqueBeanByBeanName(BeanManager bm, String batchId) { Bean<?> match = null; // Get all beans with the given EL name (id). EL names are applied via @Named. // If the bean is not annotated with @Named, then it does not have an EL name // and therefore can't be looked up that way. Set<Bean<?>> beans = bm.getBeans(batchId); try { match = bm.resolve(beans); } catch (AmbiguousResolutionException e) { return null; } return match; }
java
protected Bean<?> getUniqueBeanByBeanName(BeanManager bm, String batchId) { Bean<?> match = null; // Get all beans with the given EL name (id). EL names are applied via @Named. // If the bean is not annotated with @Named, then it does not have an EL name // and therefore can't be looked up that way. Set<Bean<?>> beans = bm.getBeans(batchId); try { match = bm.resolve(beans); } catch (AmbiguousResolutionException e) { return null; } return match; }
[ "protected", "Bean", "<", "?", ">", "getUniqueBeanByBeanName", "(", "BeanManager", "bm", ",", "String", "batchId", ")", "{", "Bean", "<", "?", ">", "match", "=", "null", ";", "// Get all beans with the given EL name (id). EL names are applied via @Named.", "// If the bean is not annotated with @Named, then it does not have an EL name", "// and therefore can't be looked up that way. ", "Set", "<", "Bean", "<", "?", ">", ">", "beans", "=", "bm", ".", "getBeans", "(", "batchId", ")", ";", "try", "{", "match", "=", "bm", ".", "resolve", "(", "beans", ")", ";", "}", "catch", "(", "AmbiguousResolutionException", "e", ")", "{", "return", "null", ";", "}", "return", "match", ";", "}" ]
Use the given BeanManager to lookup a unique CDI-registered bean with bean name equal to 'batchId', using EL matching rules. @return the bean with the given bean name, or 'null' if there is an ambiguous resolution
[ "Use", "the", "given", "BeanManager", "to", "lookup", "a", "unique", "CDI", "-", "registered", "bean", "with", "bean", "name", "equal", "to", "batchId", "using", "EL", "matching", "rules", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jbatch.cdi/src/com/ibm/ws/jbatch/cdi/internal/CDIBatchArtifactFactoryImpl.java#L132-L146
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jbatch.cdi/src/com/ibm/ws/jbatch/cdi/internal/CDIBatchArtifactFactoryImpl.java
CDIBatchArtifactFactoryImpl.getUniqueBeanForBatchXMLEntry
@FFDCIgnore(BatchCDIAmbiguousResolutionCheckedException.class) protected Bean<?> getUniqueBeanForBatchXMLEntry(BeanManager bm, String batchId) { ClassLoader loader = getContextClassLoader(); BatchXMLMapper batchXMLMapper = new BatchXMLMapper(loader); Class<?> clazz = batchXMLMapper.getArtifactById(batchId); if (clazz != null) { try { return findUniqueBeanForClass(bm, clazz); } catch (BatchCDIAmbiguousResolutionCheckedException e) { if (logger.isLoggable(Level.FINER)) { logger.finer("getBeanForBatchXML: BatchCDIAmbiguousResolutionCheckedException: " + e.getMessage()); } return null; } } else { return null; } }
java
@FFDCIgnore(BatchCDIAmbiguousResolutionCheckedException.class) protected Bean<?> getUniqueBeanForBatchXMLEntry(BeanManager bm, String batchId) { ClassLoader loader = getContextClassLoader(); BatchXMLMapper batchXMLMapper = new BatchXMLMapper(loader); Class<?> clazz = batchXMLMapper.getArtifactById(batchId); if (clazz != null) { try { return findUniqueBeanForClass(bm, clazz); } catch (BatchCDIAmbiguousResolutionCheckedException e) { if (logger.isLoggable(Level.FINER)) { logger.finer("getBeanForBatchXML: BatchCDIAmbiguousResolutionCheckedException: " + e.getMessage()); } return null; } } else { return null; } }
[ "@", "FFDCIgnore", "(", "BatchCDIAmbiguousResolutionCheckedException", ".", "class", ")", "protected", "Bean", "<", "?", ">", "getUniqueBeanForBatchXMLEntry", "(", "BeanManager", "bm", ",", "String", "batchId", ")", "{", "ClassLoader", "loader", "=", "getContextClassLoader", "(", ")", ";", "BatchXMLMapper", "batchXMLMapper", "=", "new", "BatchXMLMapper", "(", "loader", ")", ";", "Class", "<", "?", ">", "clazz", "=", "batchXMLMapper", ".", "getArtifactById", "(", "batchId", ")", ";", "if", "(", "clazz", "!=", "null", ")", "{", "try", "{", "return", "findUniqueBeanForClass", "(", "bm", ",", "clazz", ")", ";", "}", "catch", "(", "BatchCDIAmbiguousResolutionCheckedException", "e", ")", "{", "if", "(", "logger", ".", "isLoggable", "(", "Level", ".", "FINER", ")", ")", "{", "logger", ".", "finer", "(", "\"getBeanForBatchXML: BatchCDIAmbiguousResolutionCheckedException: \"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "return", "null", ";", "}", "}", "else", "{", "return", "null", ";", "}", "}" ]
Use the given BeanManager to lookup a unique CDI-registered bean with bean class equal to the batch.xml entry mapped to be the batchId parameter @return the bean with the given className. It returns null if there are zero matches or if there is no umabiguous resolution (i.e. more than 1 match)
[ "Use", "the", "given", "BeanManager", "to", "lookup", "a", "unique", "CDI", "-", "registered", "bean", "with", "bean", "class", "equal", "to", "the", "batch", ".", "xml", "entry", "mapped", "to", "be", "the", "batchId", "parameter" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jbatch.cdi/src/com/ibm/ws/jbatch/cdi/internal/CDIBatchArtifactFactoryImpl.java#L154-L171
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jbatch.cdi/src/com/ibm/ws/jbatch/cdi/internal/CDIBatchArtifactFactoryImpl.java
CDIBatchArtifactFactoryImpl.getUniqueBeanForClassName
@FFDCIgnore({ ClassNotFoundException.class, BatchCDIAmbiguousResolutionCheckedException.class }) protected Bean<?> getUniqueBeanForClassName(BeanManager bm, String className) { // Ignore exceptions since will just failover to another loading mechanism try { Class<?> clazz = getContextClassLoader().loadClass(className); return findUniqueBeanForClass(bm, clazz); } catch (BatchCDIAmbiguousResolutionCheckedException e) { if (logger.isLoggable(Level.FINER)) { logger.finer("getBeanForClassName: BatchCDIAmbiguousResolutionCheckedException: " + e.getMessage()); } return null; } catch (ClassNotFoundException cnfe) { if (logger.isLoggable(Level.FINER)) { logger.finer("getBeanForClassName: ClassNotFoundException for " + className + ": " + cnfe); } return null; } }
java
@FFDCIgnore({ ClassNotFoundException.class, BatchCDIAmbiguousResolutionCheckedException.class }) protected Bean<?> getUniqueBeanForClassName(BeanManager bm, String className) { // Ignore exceptions since will just failover to another loading mechanism try { Class<?> clazz = getContextClassLoader().loadClass(className); return findUniqueBeanForClass(bm, clazz); } catch (BatchCDIAmbiguousResolutionCheckedException e) { if (logger.isLoggable(Level.FINER)) { logger.finer("getBeanForClassName: BatchCDIAmbiguousResolutionCheckedException: " + e.getMessage()); } return null; } catch (ClassNotFoundException cnfe) { if (logger.isLoggable(Level.FINER)) { logger.finer("getBeanForClassName: ClassNotFoundException for " + className + ": " + cnfe); } return null; } }
[ "@", "FFDCIgnore", "(", "{", "ClassNotFoundException", ".", "class", ",", "BatchCDIAmbiguousResolutionCheckedException", ".", "class", "}", ")", "protected", "Bean", "<", "?", ">", "getUniqueBeanForClassName", "(", "BeanManager", "bm", ",", "String", "className", ")", "{", "// Ignore exceptions since will just failover to another loading mechanism", "try", "{", "Class", "<", "?", ">", "clazz", "=", "getContextClassLoader", "(", ")", ".", "loadClass", "(", "className", ")", ";", "return", "findUniqueBeanForClass", "(", "bm", ",", "clazz", ")", ";", "}", "catch", "(", "BatchCDIAmbiguousResolutionCheckedException", "e", ")", "{", "if", "(", "logger", ".", "isLoggable", "(", "Level", ".", "FINER", ")", ")", "{", "logger", ".", "finer", "(", "\"getBeanForClassName: BatchCDIAmbiguousResolutionCheckedException: \"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "return", "null", ";", "}", "catch", "(", "ClassNotFoundException", "cnfe", ")", "{", "if", "(", "logger", ".", "isLoggable", "(", "Level", ".", "FINER", ")", ")", "{", "logger", ".", "finer", "(", "\"getBeanForClassName: ClassNotFoundException for \"", "+", "className", "+", "\": \"", "+", "cnfe", ")", ";", "}", "return", "null", ";", "}", "}" ]
Use the given BeanManager to lookup the set of CDI-registered beans with the given class name. @return the bean with the given className. It returns null if there are zero matches or if there is no umabiguous resolution (i.e. more than 1 match)
[ "Use", "the", "given", "BeanManager", "to", "lookup", "the", "set", "of", "CDI", "-", "registered", "beans", "with", "the", "given", "class", "name", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jbatch.cdi/src/com/ibm/ws/jbatch/cdi/internal/CDIBatchArtifactFactoryImpl.java#L179-L196
train
OpenLiberty/open-liberty
dev/com.ibm.ws.threading/src/com/ibm/ws/threading/internal/ExecutorServiceImpl.java
ExecutorServiceImpl.createExecutor
private synchronized void createExecutor() { if (componentConfig == null) { // this is a completely normal occurrence and can happen if a ThreadFactory is bound prior to // component activation... the proper thing to do is to do nothing and wait for activation return; } if (threadPoolController != null) threadPoolController.deactivate(); ThreadPoolExecutor oldPool = threadPool; poolName = (String) componentConfig.get("name"); String threadGroupName = poolName + " Thread Group"; int coreThreads = Integer.parseInt(String.valueOf(componentConfig.get("coreThreads"))); int maxThreads = Integer.parseInt(String.valueOf(componentConfig.get("maxThreads"))); if (maxThreads <= 0) { maxThreads = Integer.MAX_VALUE; } if (coreThreads < 0) { coreThreads = 2 * CpuInfo.getAvailableProcessors(); } // Make sure coreThreads is not bigger than maxThreads, subject to MINIMUM_POOL_SIZE limit coreThreads = Math.max(MINIMUM_POOL_SIZE, Math.min(coreThreads, maxThreads)); // ... and then make sure maxThreads is not smaller than coreThreads ... maxThreads = Math.max(coreThreads, maxThreads); BlockingQueue<Runnable> workQueue = new BoundedBuffer<Runnable>(java.lang.Runnable.class, 1000, 1000); RejectedExecutionHandler rejectedExecutionHandler = new ExpandPolicy(workQueue, this); threadPool = new ThreadPoolExecutor(coreThreads, maxThreads, 0, TimeUnit.MILLISECONDS, workQueue, threadFactory != null ? threadFactory : new ThreadFactoryImpl(poolName, threadGroupName), rejectedExecutionHandler); threadPoolController = new ThreadPoolController(this, threadPool); if (oldPool != null) { softShutdown(oldPool); } }
java
private synchronized void createExecutor() { if (componentConfig == null) { // this is a completely normal occurrence and can happen if a ThreadFactory is bound prior to // component activation... the proper thing to do is to do nothing and wait for activation return; } if (threadPoolController != null) threadPoolController.deactivate(); ThreadPoolExecutor oldPool = threadPool; poolName = (String) componentConfig.get("name"); String threadGroupName = poolName + " Thread Group"; int coreThreads = Integer.parseInt(String.valueOf(componentConfig.get("coreThreads"))); int maxThreads = Integer.parseInt(String.valueOf(componentConfig.get("maxThreads"))); if (maxThreads <= 0) { maxThreads = Integer.MAX_VALUE; } if (coreThreads < 0) { coreThreads = 2 * CpuInfo.getAvailableProcessors(); } // Make sure coreThreads is not bigger than maxThreads, subject to MINIMUM_POOL_SIZE limit coreThreads = Math.max(MINIMUM_POOL_SIZE, Math.min(coreThreads, maxThreads)); // ... and then make sure maxThreads is not smaller than coreThreads ... maxThreads = Math.max(coreThreads, maxThreads); BlockingQueue<Runnable> workQueue = new BoundedBuffer<Runnable>(java.lang.Runnable.class, 1000, 1000); RejectedExecutionHandler rejectedExecutionHandler = new ExpandPolicy(workQueue, this); threadPool = new ThreadPoolExecutor(coreThreads, maxThreads, 0, TimeUnit.MILLISECONDS, workQueue, threadFactory != null ? threadFactory : new ThreadFactoryImpl(poolName, threadGroupName), rejectedExecutionHandler); threadPoolController = new ThreadPoolController(this, threadPool); if (oldPool != null) { softShutdown(oldPool); } }
[ "private", "synchronized", "void", "createExecutor", "(", ")", "{", "if", "(", "componentConfig", "==", "null", ")", "{", "// this is a completely normal occurrence and can happen if a ThreadFactory is bound prior to", "// component activation... the proper thing to do is to do nothing and wait for activation", "return", ";", "}", "if", "(", "threadPoolController", "!=", "null", ")", "threadPoolController", ".", "deactivate", "(", ")", ";", "ThreadPoolExecutor", "oldPool", "=", "threadPool", ";", "poolName", "=", "(", "String", ")", "componentConfig", ".", "get", "(", "\"name\"", ")", ";", "String", "threadGroupName", "=", "poolName", "+", "\" Thread Group\"", ";", "int", "coreThreads", "=", "Integer", ".", "parseInt", "(", "String", ".", "valueOf", "(", "componentConfig", ".", "get", "(", "\"coreThreads\"", ")", ")", ")", ";", "int", "maxThreads", "=", "Integer", ".", "parseInt", "(", "String", ".", "valueOf", "(", "componentConfig", ".", "get", "(", "\"maxThreads\"", ")", ")", ")", ";", "if", "(", "maxThreads", "<=", "0", ")", "{", "maxThreads", "=", "Integer", ".", "MAX_VALUE", ";", "}", "if", "(", "coreThreads", "<", "0", ")", "{", "coreThreads", "=", "2", "*", "CpuInfo", ".", "getAvailableProcessors", "(", ")", ";", "}", "// Make sure coreThreads is not bigger than maxThreads, subject to MINIMUM_POOL_SIZE limit", "coreThreads", "=", "Math", ".", "max", "(", "MINIMUM_POOL_SIZE", ",", "Math", ".", "min", "(", "coreThreads", ",", "maxThreads", ")", ")", ";", "// ... and then make sure maxThreads is not smaller than coreThreads ...", "maxThreads", "=", "Math", ".", "max", "(", "coreThreads", ",", "maxThreads", ")", ";", "BlockingQueue", "<", "Runnable", ">", "workQueue", "=", "new", "BoundedBuffer", "<", "Runnable", ">", "(", "java", ".", "lang", ".", "Runnable", ".", "class", ",", "1000", ",", "1000", ")", ";", "RejectedExecutionHandler", "rejectedExecutionHandler", "=", "new", "ExpandPolicy", "(", "workQueue", ",", "this", ")", ";", "threadPool", "=", "new", "ThreadPoolExecutor", "(", "coreThreads", ",", "maxThreads", ",", "0", ",", "TimeUnit", ".", "MILLISECONDS", ",", "workQueue", ",", "threadFactory", "!=", "null", "?", "threadFactory", ":", "new", "ThreadFactoryImpl", "(", "poolName", ",", "threadGroupName", ")", ",", "rejectedExecutionHandler", ")", ";", "threadPoolController", "=", "new", "ThreadPoolController", "(", "this", ",", "threadPool", ")", ";", "if", "(", "oldPool", "!=", "null", ")", "{", "softShutdown", "(", "oldPool", ")", ";", "}", "}" ]
Create a thread pool executor with the configured attributes from this component config.
[ "Create", "a", "thread", "pool", "executor", "with", "the", "configured", "attributes", "from", "this", "component", "config", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.threading/src/com/ibm/ws/threading/internal/ExecutorServiceImpl.java#L177-L219
train
OpenLiberty/open-liberty
dev/com.ibm.ws.threading/src/com/ibm/ws/threading/internal/ExecutorServiceImpl.java
ExecutorServiceImpl.wrap
private <T> Collection<? extends Callable<T>> wrap(Collection<? extends Callable<T>> tasks) { List<Callable<T>> wrappedTasks = new ArrayList<Callable<T>>(); Iterator<? extends Callable<T>> i = tasks.iterator(); while (i.hasNext()) { Callable<T> c = wrap(i.next()); if (serverStopping) wrappedTasks.add(c); else wrappedTasks.add(new CallableWrapper<T>(c)); } return wrappedTasks; }
java
private <T> Collection<? extends Callable<T>> wrap(Collection<? extends Callable<T>> tasks) { List<Callable<T>> wrappedTasks = new ArrayList<Callable<T>>(); Iterator<? extends Callable<T>> i = tasks.iterator(); while (i.hasNext()) { Callable<T> c = wrap(i.next()); if (serverStopping) wrappedTasks.add(c); else wrappedTasks.add(new CallableWrapper<T>(c)); } return wrappedTasks; }
[ "private", "<", "T", ">", "Collection", "<", "?", "extends", "Callable", "<", "T", ">", ">", "wrap", "(", "Collection", "<", "?", "extends", "Callable", "<", "T", ">", ">", "tasks", ")", "{", "List", "<", "Callable", "<", "T", ">>", "wrappedTasks", "=", "new", "ArrayList", "<", "Callable", "<", "T", ">", ">", "(", ")", ";", "Iterator", "<", "?", "extends", "Callable", "<", "T", ">", ">", "i", "=", "tasks", ".", "iterator", "(", ")", ";", "while", "(", "i", ".", "hasNext", "(", ")", ")", "{", "Callable", "<", "T", ">", "c", "=", "wrap", "(", "i", ".", "next", "(", ")", ")", ";", "if", "(", "serverStopping", ")", "wrappedTasks", ".", "add", "(", "c", ")", ";", "else", "wrappedTasks", ".", "add", "(", "new", "CallableWrapper", "<", "T", ">", "(", "c", ")", ")", ";", "}", "return", "wrappedTasks", ";", "}" ]
This is private, so handling both interceptors and wrapping in this method for simplicity
[ "This", "is", "private", "so", "handling", "both", "interceptors", "and", "wrapping", "in", "this", "method", "for", "simplicity" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.threading/src/com/ibm/ws/threading/internal/ExecutorServiceImpl.java#L489-L500
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/impl/BrowserProxyQueueImpl.java
BrowserProxyQueueImpl.next
public JsMessage next() throws MessageDecodeFailedException, SISessionUnavailableException, SISessionDroppedException, SIConnectionUnavailableException, SIConnectionDroppedException, SIResourceException, SIConnectionLostException, SIErrorException, SINotAuthorizedException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "next"); JsMessage retMsg = null; // begin D249096 retMsg = queue.get(proxyQueueId); if (retMsg == null) { convHelper.flushConsumer(); retMsg = queue.get(proxyQueueId); } // end D249096 if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "next", retMsg); return retMsg; }
java
public JsMessage next() throws MessageDecodeFailedException, SISessionUnavailableException, SISessionDroppedException, SIConnectionUnavailableException, SIConnectionDroppedException, SIResourceException, SIConnectionLostException, SIErrorException, SINotAuthorizedException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "next"); JsMessage retMsg = null; // begin D249096 retMsg = queue.get(proxyQueueId); if (retMsg == null) { convHelper.flushConsumer(); retMsg = queue.get(proxyQueueId); } // end D249096 if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "next", retMsg); return retMsg; }
[ "public", "JsMessage", "next", "(", ")", "throws", "MessageDecodeFailedException", ",", "SISessionUnavailableException", ",", "SISessionDroppedException", ",", "SIConnectionUnavailableException", ",", "SIConnectionDroppedException", ",", "SIResourceException", ",", "SIConnectionLostException", ",", "SIErrorException", ",", "SINotAuthorizedException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"next\"", ")", ";", "JsMessage", "retMsg", "=", "null", ";", "// begin D249096 ", "retMsg", "=", "queue", ".", "get", "(", "proxyQueueId", ")", ";", "if", "(", "retMsg", "==", "null", ")", "{", "convHelper", ".", "flushConsumer", "(", ")", ";", "retMsg", "=", "queue", ".", "get", "(", "proxyQueueId", ")", ";", "}", "// end D249096", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"next\"", ",", "retMsg", ")", ";", "return", "retMsg", ";", "}" ]
Returns the next message for a browse. @see com.ibm.ws.sib.comms.client.proxyqueue.BrowserProxyQueue#next()
[ "Returns", "the", "next", "message", "for", "a", "browse", "." ]
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/BrowserProxyQueueImpl.java#L126-L150
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/impl/BrowserProxyQueueImpl.java
BrowserProxyQueueImpl.close
public void close() throws SIResourceException, SIConnectionLostException, SIErrorException, SIConnectionDroppedException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "close"); if (!closed) { // begin D249096 convHelper.closeSession(); queue.purge(proxyQueueId); owningGroup.notifyClose(this); closed = true; // end D249096 } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "close"); }
java
public void close() throws SIResourceException, SIConnectionLostException, SIErrorException, SIConnectionDroppedException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "close"); if (!closed) { // begin D249096 convHelper.closeSession(); queue.purge(proxyQueueId); owningGroup.notifyClose(this); closed = true; // end D249096 } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "close"); }
[ "public", "void", "close", "(", ")", "throws", "SIResourceException", ",", "SIConnectionLostException", ",", "SIErrorException", ",", "SIConnectionDroppedException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"close\"", ")", ";", "if", "(", "!", "closed", ")", "{", "// begin D249096", "convHelper", ".", "closeSession", "(", ")", ";", "queue", ".", "purge", "(", "proxyQueueId", ")", ";", "owningGroup", ".", "notifyClose", "(", "this", ")", ";", "closed", "=", "true", ";", "// end D249096", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"close\"", ")", ";", "}" ]
Closes the proxy queue. @see com.ibm.ws.sib.comms.client.proxyqueue.BrowserProxyQueue#close()
[ "Closes", "the", "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/BrowserProxyQueueImpl.java#L157-L174
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/impl/BrowserProxyQueueImpl.java
BrowserProxyQueueImpl.put
public void put(CommsByteBuffer msgBuffer, short msgBatch, boolean lastInBatch, boolean chunk) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "put", new Object[]{msgBuffer, msgBatch, lastInBatch, chunk}); QueueData queueData = null; // If this data represents a chunk we need to read the flags from the buffer. This // will indicate to us whether we need to create some new queue data to stash on the // queue or if (chunk) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Dealing with a chunked message"); // Get the flags from the buffer byte flags = msgBuffer.get(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Flags:", ""+flags); // Is this the first chunk? if ((flags & CommsConstants.CHUNKED_MESSAGE_FIRST) == CommsConstants.CHUNKED_MESSAGE_FIRST) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "First chunk received"); // If it is, create some new queue data to place on the queue with the initial // chunk queueData = new QueueData(this, lastInBatch, chunk, msgBuffer); // Put the data to the queue queue.put(queueData, msgBatch); } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Middle / Last chunk received"); // Otherwise, we need to append to the chunks already collected. We do this by // finding the chunk to append to. This will be the last message on the queue // (i.e. at the back). This works for all cases as an async consumer cannot be // driven concurrently (so the last incomplete message on the queue will be the // one we want). boolean lastChunk = ((flags & CommsConstants.CHUNKED_MESSAGE_LAST) == CommsConstants.CHUNKED_MESSAGE_LAST); queue.appendToLastMessage(msgBuffer, lastChunk); } } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Dealing with the entire message"); queueData = new QueueData(this, lastInBatch, chunk, msgBuffer); // Put the data to the queue queue.put(queueData, msgBatch); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "put"); }
java
public void put(CommsByteBuffer msgBuffer, short msgBatch, boolean lastInBatch, boolean chunk) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "put", new Object[]{msgBuffer, msgBatch, lastInBatch, chunk}); QueueData queueData = null; // If this data represents a chunk we need to read the flags from the buffer. This // will indicate to us whether we need to create some new queue data to stash on the // queue or if (chunk) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Dealing with a chunked message"); // Get the flags from the buffer byte flags = msgBuffer.get(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Flags:", ""+flags); // Is this the first chunk? if ((flags & CommsConstants.CHUNKED_MESSAGE_FIRST) == CommsConstants.CHUNKED_MESSAGE_FIRST) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "First chunk received"); // If it is, create some new queue data to place on the queue with the initial // chunk queueData = new QueueData(this, lastInBatch, chunk, msgBuffer); // Put the data to the queue queue.put(queueData, msgBatch); } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Middle / Last chunk received"); // Otherwise, we need to append to the chunks already collected. We do this by // finding the chunk to append to. This will be the last message on the queue // (i.e. at the back). This works for all cases as an async consumer cannot be // driven concurrently (so the last incomplete message on the queue will be the // one we want). boolean lastChunk = ((flags & CommsConstants.CHUNKED_MESSAGE_LAST) == CommsConstants.CHUNKED_MESSAGE_LAST); queue.appendToLastMessage(msgBuffer, lastChunk); } } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Dealing with the entire message"); queueData = new QueueData(this, lastInBatch, chunk, msgBuffer); // Put the data to the queue queue.put(queueData, msgBatch); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "put"); }
[ "public", "void", "put", "(", "CommsByteBuffer", "msgBuffer", ",", "short", "msgBatch", ",", "boolean", "lastInBatch", ",", "boolean", "chunk", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "this", ",", "tc", ",", "\"put\"", ",", "new", "Object", "[", "]", "{", "msgBuffer", ",", "msgBatch", ",", "lastInBatch", ",", "chunk", "}", ")", ";", "QueueData", "queueData", "=", "null", ";", "// If this data represents a chunk we need to read the flags from the buffer. This ", "// will indicate to us whether we need to create some new queue data to stash on the ", "// queue or ", "if", "(", "chunk", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "SibTr", ".", "debug", "(", "this", ",", "tc", ",", "\"Dealing with a chunked message\"", ")", ";", "// Get the flags from the buffer", "byte", "flags", "=", "msgBuffer", ".", "get", "(", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "SibTr", ".", "debug", "(", "this", ",", "tc", ",", "\"Flags:\"", ",", "\"\"", "+", "flags", ")", ";", "// Is this the first chunk?", "if", "(", "(", "flags", "&", "CommsConstants", ".", "CHUNKED_MESSAGE_FIRST", ")", "==", "CommsConstants", ".", "CHUNKED_MESSAGE_FIRST", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "SibTr", ".", "debug", "(", "this", ",", "tc", ",", "\"First chunk received\"", ")", ";", "// If it is, create some new queue data to place on the queue with the initial", "// chunk", "queueData", "=", "new", "QueueData", "(", "this", ",", "lastInBatch", ",", "chunk", ",", "msgBuffer", ")", ";", "// Put the data to the queue", "queue", ".", "put", "(", "queueData", ",", "msgBatch", ")", ";", "}", "else", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "SibTr", ".", "debug", "(", "this", ",", "tc", ",", "\"Middle / Last chunk received\"", ")", ";", "// Otherwise, we need to append to the chunks already collected. We do this by", "// finding the chunk to append to. This will be the last message on the queue", "// (i.e. at the back). This works for all cases as an async consumer cannot be", "// driven concurrently (so the last incomplete message on the queue will be the", "// one we want).", "boolean", "lastChunk", "=", "(", "(", "flags", "&", "CommsConstants", ".", "CHUNKED_MESSAGE_LAST", ")", "==", "CommsConstants", ".", "CHUNKED_MESSAGE_LAST", ")", ";", "queue", ".", "appendToLastMessage", "(", "msgBuffer", ",", "lastChunk", ")", ";", "}", "}", "else", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "SibTr", ".", "debug", "(", "this", ",", "tc", ",", "\"Dealing with the entire message\"", ")", ";", "queueData", "=", "new", "QueueData", "(", "this", ",", "lastInBatch", ",", "chunk", ",", "msgBuffer", ")", ";", "// Put the data to the queue", "queue", ".", "put", "(", "queueData", ",", "msgBatch", ")", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"put\"", ")", ";", "}" ]
Places a browse message on the queue. @see com.ibm.ws.sib.comms.client.proxyqueue.ProxyQueue#put(com.ibm.ws.sib.comms.common.CommsByteBuffer, short, boolean, boolean)
[ "Places", "a", "browse", "message", "on", "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/BrowserProxyQueueImpl.java#L189-L241
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/impl/BrowserProxyQueueImpl.java
BrowserProxyQueueImpl.setBrowserSession
public void setBrowserSession(BrowserSessionProxy browserSession) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "setBrowserSession", browserSession); if (this.browserSession != null) { // We are flagging this here as we should never call setBrowserSession() twice. // A proxy queue is associated with a session for the lifetime of the session and calling // it twice is badness. SIErrorException e = new SIErrorException( nls.getFormattedMessage("RESET_OF_BROWSER_SESSION_SICO1035", null, null) ); FFDCFilter.processException(e, CLASS_NAME + ".setBrowserSession", CommsConstants.BROWSERPQ_SETBROWSERSESS_01, this); throw e; } if (browserSession == null) { // You can't pass in a null you complete badger SIErrorException e = new SIErrorException( nls.getFormattedMessage("NULL_BROWSER_SESSION_SICO1036", null, null) ); FFDCFilter.processException(e, CLASS_NAME + ".setBrowserSession", CommsConstants.BROWSERPQ_SETBROWSERSESS_02, this); throw e; } this.browserSession = browserSession; convHelper.setSessionId(browserSession.getProxyID()); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "setBrowserSession"); }
java
public void setBrowserSession(BrowserSessionProxy browserSession) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "setBrowserSession", browserSession); if (this.browserSession != null) { // We are flagging this here as we should never call setBrowserSession() twice. // A proxy queue is associated with a session for the lifetime of the session and calling // it twice is badness. SIErrorException e = new SIErrorException( nls.getFormattedMessage("RESET_OF_BROWSER_SESSION_SICO1035", null, null) ); FFDCFilter.processException(e, CLASS_NAME + ".setBrowserSession", CommsConstants.BROWSERPQ_SETBROWSERSESS_01, this); throw e; } if (browserSession == null) { // You can't pass in a null you complete badger SIErrorException e = new SIErrorException( nls.getFormattedMessage("NULL_BROWSER_SESSION_SICO1036", null, null) ); FFDCFilter.processException(e, CLASS_NAME + ".setBrowserSession", CommsConstants.BROWSERPQ_SETBROWSERSESS_02, this); throw e; } this.browserSession = browserSession; convHelper.setSessionId(browserSession.getProxyID()); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "setBrowserSession"); }
[ "public", "void", "setBrowserSession", "(", "BrowserSessionProxy", "browserSession", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"setBrowserSession\"", ",", "browserSession", ")", ";", "if", "(", "this", ".", "browserSession", "!=", "null", ")", "{", "// We are flagging this here as we should never call setBrowserSession() twice. ", "// A proxy queue is associated with a session for the lifetime of the session and calling", "// it twice is badness.", "SIErrorException", "e", "=", "new", "SIErrorException", "(", "nls", ".", "getFormattedMessage", "(", "\"RESET_OF_BROWSER_SESSION_SICO1035\"", ",", "null", ",", "null", ")", ")", ";", "FFDCFilter", ".", "processException", "(", "e", ",", "CLASS_NAME", "+", "\".setBrowserSession\"", ",", "CommsConstants", ".", "BROWSERPQ_SETBROWSERSESS_01", ",", "this", ")", ";", "throw", "e", ";", "}", "if", "(", "browserSession", "==", "null", ")", "{", "// You can't pass in a null you complete badger", "SIErrorException", "e", "=", "new", "SIErrorException", "(", "nls", ".", "getFormattedMessage", "(", "\"NULL_BROWSER_SESSION_SICO1036\"", ",", "null", ",", "null", ")", ")", ";", "FFDCFilter", ".", "processException", "(", "e", ",", "CLASS_NAME", "+", "\".setBrowserSession\"", ",", "CommsConstants", ".", "BROWSERPQ_SETBROWSERSESS_02", ",", "this", ")", ";", "throw", "e", ";", "}", "this", ".", "browserSession", "=", "browserSession", ";", "convHelper", ".", "setSessionId", "(", "browserSession", ".", "getProxyID", "(", ")", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"setBrowserSession\"", ")", ";", "}" ]
Sets the browser session this proxy queue is being used in conjunction with. @see com.ibm.ws.sib.comms.client.proxyqueue.BrowserProxyQueue#setBrowserSession(BrowserSessionProxy)
[ "Sets", "the", "browser", "session", "this", "proxy", "queue", "is", "being", "used", "in", "conjunction", "with", "." ]
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/BrowserProxyQueueImpl.java#L248-L284
train
OpenLiberty/open-liberty
dev/com.ibm.ws.security.mp.jwt/src/com/ibm/ws/security/mp/jwt/impl/DefaultJsonWebTokenImpl.java
DefaultJsonWebTokenImpl.readObject
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { GetField fields = in.readFields(); principal = (String) fields.get(PRINCIPAL, null); jwt = (String) fields.get(JWT, null); type = (String) fields.get(TYPE, null); handleClaims(jwt); }
java
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { GetField fields = in.readFields(); principal = (String) fields.get(PRINCIPAL, null); jwt = (String) fields.get(JWT, null); type = (String) fields.get(TYPE, null); handleClaims(jwt); }
[ "private", "void", "readObject", "(", "ObjectInputStream", "in", ")", "throws", "IOException", ",", "ClassNotFoundException", "{", "GetField", "fields", "=", "in", ".", "readFields", "(", ")", ";", "principal", "=", "(", "String", ")", "fields", ".", "get", "(", "PRINCIPAL", ",", "null", ")", ";", "jwt", "=", "(", "String", ")", "fields", ".", "get", "(", "JWT", ",", "null", ")", ";", "type", "=", "(", "String", ")", "fields", ".", "get", "(", "TYPE", ",", "null", ")", ";", "handleClaims", "(", "jwt", ")", ";", "}" ]
Deserialize json web token. @param in The stream from which this object is read. @throws IOException @throws ClassNotFoundException
[ "Deserialize", "json", "web", "token", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.mp.jwt/src/com/ibm/ws/security/mp/jwt/impl/DefaultJsonWebTokenImpl.java#L216-L222
train
OpenLiberty/open-liberty
dev/com.ibm.ws.security.mp.jwt/src/com/ibm/ws/security/mp/jwt/impl/DefaultJsonWebTokenImpl.java
DefaultJsonWebTokenImpl.writeObject
private void writeObject(ObjectOutputStream out) throws IOException { PutField fields = out.putFields(); fields.put(PRINCIPAL, principal); fields.put(JWT, jwt); fields.put(TYPE, type); out.writeFields(); }
java
private void writeObject(ObjectOutputStream out) throws IOException { PutField fields = out.putFields(); fields.put(PRINCIPAL, principal); fields.put(JWT, jwt); fields.put(TYPE, type); out.writeFields(); }
[ "private", "void", "writeObject", "(", "ObjectOutputStream", "out", ")", "throws", "IOException", "{", "PutField", "fields", "=", "out", ".", "putFields", "(", ")", ";", "fields", ".", "put", "(", "PRINCIPAL", ",", "principal", ")", ";", "fields", ".", "put", "(", "JWT", ",", "jwt", ")", ";", "fields", ".", "put", "(", "TYPE", ",", "type", ")", ";", "out", ".", "writeFields", "(", ")", ";", "}" ]
Serialize json web token. @param out The stream to which this object is serialized. @throws IOException
[ "Serialize", "json", "web", "token", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.mp.jwt/src/com/ibm/ws/security/mp/jwt/impl/DefaultJsonWebTokenImpl.java#L232-L238
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/config/annotation/DefaultAnnotationProvider.java
DefaultAnnotationProvider._getAlternativeJarFile
private static JarFile _getAlternativeJarFile(URL url) throws IOException { String urlFile = url.getFile(); // Trim off any suffix - which is prefixed by "!/" on Weblogic int separatorIndex = urlFile.indexOf("!/"); // OK, didn't find that. Try the less safe "!", used on OC4J if (separatorIndex == -1) { separatorIndex = urlFile.indexOf('!'); } if (separatorIndex != -1) { String jarFileUrl = urlFile.substring(0, separatorIndex); // And trim off any "file:" prefix. if (jarFileUrl.startsWith("file:")) { jarFileUrl = jarFileUrl.substring("file:".length()); } return new JarFile(jarFileUrl); } return null; }
java
private static JarFile _getAlternativeJarFile(URL url) throws IOException { String urlFile = url.getFile(); // Trim off any suffix - which is prefixed by "!/" on Weblogic int separatorIndex = urlFile.indexOf("!/"); // OK, didn't find that. Try the less safe "!", used on OC4J if (separatorIndex == -1) { separatorIndex = urlFile.indexOf('!'); } if (separatorIndex != -1) { String jarFileUrl = urlFile.substring(0, separatorIndex); // And trim off any "file:" prefix. if (jarFileUrl.startsWith("file:")) { jarFileUrl = jarFileUrl.substring("file:".length()); } return new JarFile(jarFileUrl); } return null; }
[ "private", "static", "JarFile", "_getAlternativeJarFile", "(", "URL", "url", ")", "throws", "IOException", "{", "String", "urlFile", "=", "url", ".", "getFile", "(", ")", ";", "// Trim off any suffix - which is prefixed by \"!/\" on Weblogic", "int", "separatorIndex", "=", "urlFile", ".", "indexOf", "(", "\"!/\"", ")", ";", "// OK, didn't find that. Try the less safe \"!\", used on OC4J", "if", "(", "separatorIndex", "==", "-", "1", ")", "{", "separatorIndex", "=", "urlFile", ".", "indexOf", "(", "'", "'", ")", ";", "}", "if", "(", "separatorIndex", "!=", "-", "1", ")", "{", "String", "jarFileUrl", "=", "urlFile", ".", "substring", "(", "0", ",", "separatorIndex", ")", ";", "// And trim off any \"file:\" prefix.", "if", "(", "jarFileUrl", ".", "startsWith", "(", "\"file:\"", ")", ")", "{", "jarFileUrl", "=", "jarFileUrl", ".", "substring", "(", "\"file:\"", ".", "length", "(", ")", ")", ";", "}", "return", "new", "JarFile", "(", "jarFileUrl", ")", ";", "}", "return", "null", ";", "}" ]
taken from org.apache.myfaces.view.facelets.util.Classpath For URLs to JARs that do not use JarURLConnection - allowed by the servlet spec - attempt to produce a JarFile object all the same. Known servlet engines that function like this include Weblogic and OC4J. This is not a full solution, since an unpacked WAR or EAR will not have JAR "files" as such.
[ "taken", "from", "org", ".", "apache", ".", "myfaces", ".", "view", ".", "facelets", ".", "util", ".", "Classpath" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/config/annotation/DefaultAnnotationProvider.java#L698-L724
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/lifecycle/LifecycleImpl.java
LifecycleImpl.requestProcessed
private void requestProcessed(FacesContext facesContext) { if(!_firstRequestProcessed) { // The order here is important. First it is necessary to put // the value on application map before change the value here. // If multiple threads reach this point concurrently, the // variable will be written on the application map at the same // time but always with the same value. facesContext.getExternalContext().getApplicationMap() .put(FIRST_REQUEST_PROCESSED_PARAM, Boolean.TRUE); _firstRequestProcessed = true; } }
java
private void requestProcessed(FacesContext facesContext) { if(!_firstRequestProcessed) { // The order here is important. First it is necessary to put // the value on application map before change the value here. // If multiple threads reach this point concurrently, the // variable will be written on the application map at the same // time but always with the same value. facesContext.getExternalContext().getApplicationMap() .put(FIRST_REQUEST_PROCESSED_PARAM, Boolean.TRUE); _firstRequestProcessed = true; } }
[ "private", "void", "requestProcessed", "(", "FacesContext", "facesContext", ")", "{", "if", "(", "!", "_firstRequestProcessed", ")", "{", "// The order here is important. First it is necessary to put", "// the value on application map before change the value here.", "// If multiple threads reach this point concurrently, the", "// variable will be written on the application map at the same", "// time but always with the same value.", "facesContext", ".", "getExternalContext", "(", ")", ".", "getApplicationMap", "(", ")", ".", "put", "(", "FIRST_REQUEST_PROCESSED_PARAM", ",", "Boolean", ".", "TRUE", ")", ";", "_firstRequestProcessed", "=", "true", ";", "}", "}" ]
This method places an attribute on the application map to indicate that the first request has been processed. This attribute is used by several methods in ApplicationImpl to determine whether or not to throw an IllegalStateException @param facesContext
[ "This", "method", "places", "an", "attribute", "on", "the", "application", "map", "to", "indicate", "that", "the", "first", "request", "has", "been", "processed", ".", "This", "attribute", "is", "used", "by", "several", "methods", "in", "ApplicationImpl", "to", "determine", "whether", "or", "not", "to", "throw", "an", "IllegalStateException" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/lifecycle/LifecycleImpl.java#L396-L410
train
OpenLiberty/open-liberty
dev/com.ibm.jbatch.jsl.model/src/com/ibm/jbatch/jsl/model/JSLProperties.java
JSLProperties.getPropertyList
@Generated(value = "com.ibm.jtc.jax.tools.xjc.Driver", date = "2014-06-11T05:49:00-04:00", comments = "JAXB RI v2.2.3-11/28/2011 06:21 AM(foreman)-") public List<Property> getPropertyList() { if (propertyList == null) { propertyList = new ArrayList<Property>(); } return this.propertyList; }
java
@Generated(value = "com.ibm.jtc.jax.tools.xjc.Driver", date = "2014-06-11T05:49:00-04:00", comments = "JAXB RI v2.2.3-11/28/2011 06:21 AM(foreman)-") public List<Property> getPropertyList() { if (propertyList == null) { propertyList = new ArrayList<Property>(); } return this.propertyList; }
[ "@", "Generated", "(", "value", "=", "\"com.ibm.jtc.jax.tools.xjc.Driver\"", ",", "date", "=", "\"2014-06-11T05:49:00-04:00\"", ",", "comments", "=", "\"JAXB RI v2.2.3-11/28/2011 06:21 AM(foreman)-\"", ")", "public", "List", "<", "Property", ">", "getPropertyList", "(", ")", "{", "if", "(", "propertyList", "==", "null", ")", "{", "propertyList", "=", "new", "ArrayList", "<", "Property", ">", "(", ")", ";", "}", "return", "this", ".", "propertyList", ";", "}" ]
Gets the value of the propertyList property. <p> This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you make to the returned list will be present inside the JAXB object. This is why there is not a <CODE>set</CODE> method for the propertyList property. <p> For example, to add a new item, do as follows: <pre> getPropertyList().add(newItem); </pre> <p> Objects of the following type(s) are allowed in the list {@link Property }
[ "Gets", "the", "value", "of", "the", "propertyList", "property", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.jbatch.jsl.model/src/com/ibm/jbatch/jsl/model/JSLProperties.java#L77-L83
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/Token.java
Token.current
protected Token current() { final String methodName = "current"; Token currentToken; if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.entry(this, cclass , methodName + toString() ); currentToken = objectStore.like(this); if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.exit(this, cclass , methodName , new Object[] { currentToken, Integer.toHexString(currentToken.hashCode()) }); return currentToken; }
java
protected Token current() { final String methodName = "current"; Token currentToken; if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.entry(this, cclass , methodName + toString() ); currentToken = objectStore.like(this); if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.exit(this, cclass , methodName , new Object[] { currentToken, Integer.toHexString(currentToken.hashCode()) }); return currentToken; }
[ "protected", "Token", "current", "(", ")", "{", "final", "String", "methodName", "=", "\"current\"", ";", "Token", "currentToken", ";", "if", "(", "Tracing", ".", "isAnyTracingEnabled", "(", ")", "&&", "trace", ".", "isEntryEnabled", "(", ")", ")", "trace", ".", "entry", "(", "this", ",", "cclass", ",", "methodName", "+", "toString", "(", ")", ")", ";", "currentToken", "=", "objectStore", ".", "like", "(", "this", ")", ";", "if", "(", "Tracing", ".", "isAnyTracingEnabled", "(", ")", "&&", "trace", ".", "isEntryEnabled", "(", ")", ")", "trace", ".", "exit", "(", "this", ",", "cclass", ",", "methodName", ",", "new", "Object", "[", "]", "{", "currentToken", ",", "Integer", ".", "toHexString", "(", "currentToken", ".", "hashCode", "(", ")", ")", "}", ")", ";", "return", "currentToken", ";", "}" ]
Give back the current token if there is already one known to the Object Store for the same ManagedObject. @return Token already known to the ObjectStore.
[ "Give", "back", "the", "current", "token", "if", "there", "is", "already", "one", "known", "to", "the", "Object", "Store", "for", "the", "same", "ManagedObject", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/Token.java#L113-L130
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/Token.java
Token.getManagedObject
public final ManagedObject getManagedObject() throws ObjectManagerException { // final String methodName = "getManagedObject"; // if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) // trace.entry(this, // cclass, // methodName); // Get the object if is already in memory. ManagedObject managedObject = null; if (managedObjectReference != null) managedObject = (ManagedObject) managedObjectReference.get(); if (managedObject == null) { // See if we can avoid synchronizing. synchronized (this) { if (managedObjectReference != null) managedObject = (ManagedObject) managedObjectReference.get(); if (managedObject == null) { managedObject = objectStore.get(this); if (managedObject != null) { managedObject.owningToken = this; // PM22584 Set the owning token first managedObjectReference = new java.lang.ref.WeakReference(managedObject); } // if (managedObject != null). } // if (managedObject == null). } // synchronize (this). } // if (managedObject == null). // if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) // trace.exit(this, // cclass, // methodName, // new Object[] {managedObject}); return managedObject; }
java
public final ManagedObject getManagedObject() throws ObjectManagerException { // final String methodName = "getManagedObject"; // if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) // trace.entry(this, // cclass, // methodName); // Get the object if is already in memory. ManagedObject managedObject = null; if (managedObjectReference != null) managedObject = (ManagedObject) managedObjectReference.get(); if (managedObject == null) { // See if we can avoid synchronizing. synchronized (this) { if (managedObjectReference != null) managedObject = (ManagedObject) managedObjectReference.get(); if (managedObject == null) { managedObject = objectStore.get(this); if (managedObject != null) { managedObject.owningToken = this; // PM22584 Set the owning token first managedObjectReference = new java.lang.ref.WeakReference(managedObject); } // if (managedObject != null). } // if (managedObject == null). } // synchronize (this). } // if (managedObject == null). // if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) // trace.exit(this, // cclass, // methodName, // new Object[] {managedObject}); return managedObject; }
[ "public", "final", "ManagedObject", "getManagedObject", "(", ")", "throws", "ObjectManagerException", "{", "// final String methodName = \"getManagedObject\";", "// if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())", "// trace.entry(this,", "// cclass,", "// methodName);", "// Get the object if is already in memory.", "ManagedObject", "managedObject", "=", "null", ";", "if", "(", "managedObjectReference", "!=", "null", ")", "managedObject", "=", "(", "ManagedObject", ")", "managedObjectReference", ".", "get", "(", ")", ";", "if", "(", "managedObject", "==", "null", ")", "{", "// See if we can avoid synchronizing.", "synchronized", "(", "this", ")", "{", "if", "(", "managedObjectReference", "!=", "null", ")", "managedObject", "=", "(", "ManagedObject", ")", "managedObjectReference", ".", "get", "(", ")", ";", "if", "(", "managedObject", "==", "null", ")", "{", "managedObject", "=", "objectStore", ".", "get", "(", "this", ")", ";", "if", "(", "managedObject", "!=", "null", ")", "{", "managedObject", ".", "owningToken", "=", "this", ";", "// PM22584 Set the owning token first", "managedObjectReference", "=", "new", "java", ".", "lang", ".", "ref", ".", "WeakReference", "(", "managedObject", ")", ";", "}", "// if (managedObject != null). ", "}", "// if (managedObject == null).", "}", "// synchronize (this).", "}", "// if (managedObject == null).", "// if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())", "// trace.exit(this,", "// cclass,", "// methodName,", "// new Object[] {managedObject}); ", "return", "managedObject", ";", "}" ]
Find the ManagedObject handled by this token. @return ManagedObject the underlying ManagedObject represented by the token. @throws ObjectManagerException
[ "Find", "the", "ManagedObject", "handled", "by", "this", "token", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/Token.java#L138-L171
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/Token.java
Token.setManagedObject
protected synchronized ManagedObject setManagedObject(ManagedObject managedObject) throws ObjectManagerException { if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.entry(this, cclass , "setManagedObject" + "managedObject=" + managedObject + "(ManagedObject)" + toString() ); ManagedObject managedObjectSet; // For return. // Has any ManagedObject ever been associated with tis Token? if (managedObjectReference == null) { // Nothing currently known so use the version given. managedObject.owningToken = this; // PM22584 Set the owning token first managedObjectReference = new java.lang.ref.WeakReference(managedObject); managedObjectSet = managedObject; } else { ManagedObject existingManagedObject = (ManagedObject) managedObjectReference.get(); if (existingManagedObject == null) { // Is it still accessible? managedObject.owningToken = this; // PM22584 Set the owning token first managedObjectReference = new java.lang.ref.WeakReference(managedObject); managedObjectSet = managedObject; } else { // In memory and accessible. // During recovery another object already recovered may have refered // to this one causing it to already be resident in memory. // Replace what we already have with this version. existingManagedObject.becomeCloneOf(managedObject); managedObjectSet = existingManagedObject; } // if (existingManagedObject == null). } // if(managedObjectReference == null). if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.exit(this, cclass , "setManagedObject" , new Object[] { managedObjectSet }); return managedObjectSet; }
java
protected synchronized ManagedObject setManagedObject(ManagedObject managedObject) throws ObjectManagerException { if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.entry(this, cclass , "setManagedObject" + "managedObject=" + managedObject + "(ManagedObject)" + toString() ); ManagedObject managedObjectSet; // For return. // Has any ManagedObject ever been associated with tis Token? if (managedObjectReference == null) { // Nothing currently known so use the version given. managedObject.owningToken = this; // PM22584 Set the owning token first managedObjectReference = new java.lang.ref.WeakReference(managedObject); managedObjectSet = managedObject; } else { ManagedObject existingManagedObject = (ManagedObject) managedObjectReference.get(); if (existingManagedObject == null) { // Is it still accessible? managedObject.owningToken = this; // PM22584 Set the owning token first managedObjectReference = new java.lang.ref.WeakReference(managedObject); managedObjectSet = managedObject; } else { // In memory and accessible. // During recovery another object already recovered may have refered // to this one causing it to already be resident in memory. // Replace what we already have with this version. existingManagedObject.becomeCloneOf(managedObject); managedObjectSet = existingManagedObject; } // if (existingManagedObject == null). } // if(managedObjectReference == null). if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.exit(this, cclass , "setManagedObject" , new Object[] { managedObjectSet }); return managedObjectSet; }
[ "protected", "synchronized", "ManagedObject", "setManagedObject", "(", "ManagedObject", "managedObject", ")", "throws", "ObjectManagerException", "{", "if", "(", "Tracing", ".", "isAnyTracingEnabled", "(", ")", "&&", "trace", ".", "isEntryEnabled", "(", ")", ")", "trace", ".", "entry", "(", "this", ",", "cclass", ",", "\"setManagedObject\"", "+", "\"managedObject=\"", "+", "managedObject", "+", "\"(ManagedObject)\"", "+", "toString", "(", ")", ")", ";", "ManagedObject", "managedObjectSet", ";", "// For return.", "// Has any ManagedObject ever been associated with tis Token?", "if", "(", "managedObjectReference", "==", "null", ")", "{", "// Nothing currently known so use the version given.", "managedObject", ".", "owningToken", "=", "this", ";", "// PM22584 Set the owning token first", "managedObjectReference", "=", "new", "java", ".", "lang", ".", "ref", ".", "WeakReference", "(", "managedObject", ")", ";", "managedObjectSet", "=", "managedObject", ";", "}", "else", "{", "ManagedObject", "existingManagedObject", "=", "(", "ManagedObject", ")", "managedObjectReference", ".", "get", "(", ")", ";", "if", "(", "existingManagedObject", "==", "null", ")", "{", "// Is it still accessible? ", "managedObject", ".", "owningToken", "=", "this", ";", "// PM22584 Set the owning token first", "managedObjectReference", "=", "new", "java", ".", "lang", ".", "ref", ".", "WeakReference", "(", "managedObject", ")", ";", "managedObjectSet", "=", "managedObject", ";", "}", "else", "{", "// In memory and accessible. ", "// During recovery another object already recovered may have refered ", "// to this one causing it to already be resident in memory. ", "// Replace what we already have with this version.", "existingManagedObject", ".", "becomeCloneOf", "(", "managedObject", ")", ";", "managedObjectSet", "=", "existingManagedObject", ";", "}", "// if (existingManagedObject == null).", "}", "// if(managedObjectReference == null).", "if", "(", "Tracing", ".", "isAnyTracingEnabled", "(", ")", "&&", "trace", ".", "isEntryEnabled", "(", ")", ")", "trace", ".", "exit", "(", "this", ",", "cclass", ",", "\"setManagedObject\"", ",", "new", "Object", "[", "]", "{", "managedObjectSet", "}", ")", ";", "return", "managedObjectSet", ";", "}" ]
Associate a new ManagedObject with this token. If there is already a managedObject associated with the Token it is replaced by making it a clone of the new ManagedObject so that existing references to the old ManagedObject becone refrences to the new one. @param ManagedObject to be associated with this Token. @return ManagedObject now associated with this Token. @throws ObjectManagerException
[ "Associate", "a", "new", "ManagedObject", "with", "this", "token", ".", "If", "there", "is", "already", "a", "managedObject", "associated", "with", "the", "Token", "it", "is", "replaced", "by", "making", "it", "a", "clone", "of", "the", "new", "ManagedObject", "so", "that", "existing", "references", "to", "the", "old", "ManagedObject", "becone", "refrences", "to", "the", "new", "one", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/Token.java#L183-L220
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/Token.java
Token.invalidate
void invalidate() { if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.entry(this, cclass , "invalidate" ); // Prevent any attempt to load the object. objectStore = null; // If the ManagedObject is already in memory access it, otherwise there is nothing // we need to do to it. if (managedObjectReference != null) { ManagedObject managedObject = (ManagedObject) managedObjectReference.get(); if (managedObject != null) managedObject.state = ManagedObject.stateError; } // if (managedObjectReference != null). if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.exit(this, cclass , "invalidate" ); }
java
void invalidate() { if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.entry(this, cclass , "invalidate" ); // Prevent any attempt to load the object. objectStore = null; // If the ManagedObject is already in memory access it, otherwise there is nothing // we need to do to it. if (managedObjectReference != null) { ManagedObject managedObject = (ManagedObject) managedObjectReference.get(); if (managedObject != null) managedObject.state = ManagedObject.stateError; } // if (managedObjectReference != null). if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.exit(this, cclass , "invalidate" ); }
[ "void", "invalidate", "(", ")", "{", "if", "(", "Tracing", ".", "isAnyTracingEnabled", "(", ")", "&&", "trace", ".", "isEntryEnabled", "(", ")", ")", "trace", ".", "entry", "(", "this", ",", "cclass", ",", "\"invalidate\"", ")", ";", "// Prevent any attempt to load the object.", "objectStore", "=", "null", ";", "// If the ManagedObject is already in memory access it, otherwise there is nothing", "// we need to do to it.", "if", "(", "managedObjectReference", "!=", "null", ")", "{", "ManagedObject", "managedObject", "=", "(", "ManagedObject", ")", "managedObjectReference", ".", "get", "(", ")", ";", "if", "(", "managedObject", "!=", "null", ")", "managedObject", ".", "state", "=", "ManagedObject", ".", "stateError", ";", "}", "// if (managedObjectReference != null).", "if", "(", "Tracing", ".", "isAnyTracingEnabled", "(", ")", "&&", "trace", ".", "isEntryEnabled", "(", ")", ")", "trace", ".", "exit", "(", "this", ",", "cclass", ",", "\"invalidate\"", ")", ";", "}" ]
Make the token and any ManagedObject it refers to invalid. Used at shutdown to prevent accidental use of a ManagedObject in the ObjectManager that instantiated it or any other Object Manager.
[ "Make", "the", "token", "and", "any", "ManagedObject", "it", "refers", "to", "invalid", ".", "Used", "at", "shutdown", "to", "prevent", "accidental", "use", "of", "a", "ManagedObject", "in", "the", "ObjectManager", "that", "instantiated", "it", "or", "any", "other", "Object", "Manager", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/Token.java#L227-L249
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/Token.java
Token.restore
public static final Token restore(java.io.DataInputStream dataInputStream, ObjectManagerState objectManagerState) throws ObjectManagerException { if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.entry(cclass , "restore" , new Object[] { dataInputStream, objectManagerState }); int objectStoreIdentifier; long storedObjectIdentifier; try { byte version = dataInputStream.readByte(); if (Tracing.isAnyTracingEnabled() && trace.isDebugEnabled()) trace.debug(cclass, "restore", new Object[] { new Byte(version) }); objectStoreIdentifier = dataInputStream.readInt(); storedObjectIdentifier = dataInputStream.readLong(); } catch (java.io.IOException exception) { // No FFDC Code Needed. ObjectManager.ffdc.processException(cclass, "restore", exception, "1:400:1.14"); if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.exit(cclass, "restore", "via PermanentIOException"); throw new PermanentIOException(cclass, exception); } // catch (java.io.IOException exception). Token tokenToReturn = new Token(objectManagerState.getObjectStore(objectStoreIdentifier), storedObjectIdentifier); // Swap for the definitive Token. // TODO should have a smarter version of like() which takes a storedObjectIdentifier, // instead of requiring a new Token(). tokenToReturn = tokenToReturn.current(); if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.exit(cclass , "restore" , "returns token=" + tokenToReturn + "(Token)" ); return tokenToReturn; }
java
public static final Token restore(java.io.DataInputStream dataInputStream, ObjectManagerState objectManagerState) throws ObjectManagerException { if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.entry(cclass , "restore" , new Object[] { dataInputStream, objectManagerState }); int objectStoreIdentifier; long storedObjectIdentifier; try { byte version = dataInputStream.readByte(); if (Tracing.isAnyTracingEnabled() && trace.isDebugEnabled()) trace.debug(cclass, "restore", new Object[] { new Byte(version) }); objectStoreIdentifier = dataInputStream.readInt(); storedObjectIdentifier = dataInputStream.readLong(); } catch (java.io.IOException exception) { // No FFDC Code Needed. ObjectManager.ffdc.processException(cclass, "restore", exception, "1:400:1.14"); if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.exit(cclass, "restore", "via PermanentIOException"); throw new PermanentIOException(cclass, exception); } // catch (java.io.IOException exception). Token tokenToReturn = new Token(objectManagerState.getObjectStore(objectStoreIdentifier), storedObjectIdentifier); // Swap for the definitive Token. // TODO should have a smarter version of like() which takes a storedObjectIdentifier, // instead of requiring a new Token(). tokenToReturn = tokenToReturn.current(); if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.exit(cclass , "restore" , "returns token=" + tokenToReturn + "(Token)" ); return tokenToReturn; }
[ "public", "static", "final", "Token", "restore", "(", "java", ".", "io", ".", "DataInputStream", "dataInputStream", ",", "ObjectManagerState", "objectManagerState", ")", "throws", "ObjectManagerException", "{", "if", "(", "Tracing", ".", "isAnyTracingEnabled", "(", ")", "&&", "trace", ".", "isEntryEnabled", "(", ")", ")", "trace", ".", "entry", "(", "cclass", ",", "\"restore\"", ",", "new", "Object", "[", "]", "{", "dataInputStream", ",", "objectManagerState", "}", ")", ";", "int", "objectStoreIdentifier", ";", "long", "storedObjectIdentifier", ";", "try", "{", "byte", "version", "=", "dataInputStream", ".", "readByte", "(", ")", ";", "if", "(", "Tracing", ".", "isAnyTracingEnabled", "(", ")", "&&", "trace", ".", "isDebugEnabled", "(", ")", ")", "trace", ".", "debug", "(", "cclass", ",", "\"restore\"", ",", "new", "Object", "[", "]", "{", "new", "Byte", "(", "version", ")", "}", ")", ";", "objectStoreIdentifier", "=", "dataInputStream", ".", "readInt", "(", ")", ";", "storedObjectIdentifier", "=", "dataInputStream", ".", "readLong", "(", ")", ";", "}", "catch", "(", "java", ".", "io", ".", "IOException", "exception", ")", "{", "// No FFDC Code Needed.", "ObjectManager", ".", "ffdc", ".", "processException", "(", "cclass", ",", "\"restore\"", ",", "exception", ",", "\"1:400:1.14\"", ")", ";", "if", "(", "Tracing", ".", "isAnyTracingEnabled", "(", ")", "&&", "trace", ".", "isEntryEnabled", "(", ")", ")", "trace", ".", "exit", "(", "cclass", ",", "\"restore\"", ",", "\"via PermanentIOException\"", ")", ";", "throw", "new", "PermanentIOException", "(", "cclass", ",", "exception", ")", ";", "}", "// catch (java.io.IOException exception).", "Token", "tokenToReturn", "=", "new", "Token", "(", "objectManagerState", ".", "getObjectStore", "(", "objectStoreIdentifier", ")", ",", "storedObjectIdentifier", ")", ";", "// Swap for the definitive Token.", "// TODO should have a smarter version of like() which takes a storedObjectIdentifier, ", "// instead of requiring a new Token().", "tokenToReturn", "=", "tokenToReturn", ".", "current", "(", ")", ";", "if", "(", "Tracing", ".", "isAnyTracingEnabled", "(", ")", "&&", "trace", ".", "isEntryEnabled", "(", ")", ")", "trace", ".", "exit", "(", "cclass", ",", "\"restore\"", ",", "\"returns token=\"", "+", "tokenToReturn", "+", "\"(Token)\"", ")", ";", "return", "tokenToReturn", ";", "}" ]
Recover the token described by a dataInputStream and resolve it ot the definitive token. @param dataInputStream containing the serialized Token. @param objectManagerState of the objectManager reconstructing the Token. @return Token matching the next bytes in the dataInputStream. @throws ObjectManagerException
[ "Recover", "the", "token", "described", "by", "a", "dataInputStream", "and", "resolve", "it", "ot", "the", "definitive", "token", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/Token.java#L377-L424
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/internal/HttpEndpointList.java
HttpEndpointList.findEndpoint
public static HttpEndpointImpl findEndpoint(String endpointId) { for (HttpEndpointImpl i : instance.get()) { if (i.getName().equals(endpointId)) return i; } return null; }
java
public static HttpEndpointImpl findEndpoint(String endpointId) { for (HttpEndpointImpl i : instance.get()) { if (i.getName().equals(endpointId)) return i; } return null; }
[ "public", "static", "HttpEndpointImpl", "findEndpoint", "(", "String", "endpointId", ")", "{", "for", "(", "HttpEndpointImpl", "i", ":", "instance", ".", "get", "(", ")", ")", "{", "if", "(", "i", ".", "getName", "(", ")", ".", "equals", "(", "endpointId", ")", ")", "return", "i", ";", "}", "return", "null", ";", "}" ]
Return the endpoint for the given id. @param endpointId @return The endpoint associated with the id, or null.
[ "Return", "the", "endpoint", "for", "the", "given", "id", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/internal/HttpEndpointList.java#L55-L61
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/ControllableStream.java
ControllableStream.getTicksOnStream
public synchronized List<Long> getTicksOnStream() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getTicksOnStream"); List<Long> msgs = new ArrayList<Long>(); StateStream stateStream = getStateStream(); // Initial range in stream is always completed Range stateStream.setCursor(0); // skip this and move to next range stateStream.getNext(); // Get the first TickRange after completed range and move cursor to the next one TickRange tr = stateStream.getNext(); // Iterate until we reach final Unknown range while (tr.endstamp < RangeList.INFINITY) { if( !(tr.type == TickRange.Completed) ) { msgs.add(new Long(tr.startstamp)); } tr = stateStream.getNext(); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getTicksOnStream", msgs); return msgs; }
java
public synchronized List<Long> getTicksOnStream() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getTicksOnStream"); List<Long> msgs = new ArrayList<Long>(); StateStream stateStream = getStateStream(); // Initial range in stream is always completed Range stateStream.setCursor(0); // skip this and move to next range stateStream.getNext(); // Get the first TickRange after completed range and move cursor to the next one TickRange tr = stateStream.getNext(); // Iterate until we reach final Unknown range while (tr.endstamp < RangeList.INFINITY) { if( !(tr.type == TickRange.Completed) ) { msgs.add(new Long(tr.startstamp)); } tr = stateStream.getNext(); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getTicksOnStream", msgs); return msgs; }
[ "public", "synchronized", "List", "<", "Long", ">", "getTicksOnStream", "(", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"getTicksOnStream\"", ")", ";", "List", "<", "Long", ">", "msgs", "=", "new", "ArrayList", "<", "Long", ">", "(", ")", ";", "StateStream", "stateStream", "=", "getStateStream", "(", ")", ";", "// Initial range in stream is always completed Range", "stateStream", ".", "setCursor", "(", "0", ")", ";", "// skip this and move to next range", "stateStream", ".", "getNext", "(", ")", ";", "// Get the first TickRange after completed range and move cursor to the next one", "TickRange", "tr", "=", "stateStream", ".", "getNext", "(", ")", ";", "// Iterate until we reach final Unknown range", "while", "(", "tr", ".", "endstamp", "<", "RangeList", ".", "INFINITY", ")", "{", "if", "(", "!", "(", "tr", ".", "type", "==", "TickRange", ".", "Completed", ")", ")", "{", "msgs", ".", "add", "(", "new", "Long", "(", "tr", ".", "startstamp", ")", ")", ";", "}", "tr", "=", "stateStream", ".", "getNext", "(", ")", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"getTicksOnStream\"", ",", "msgs", ")", ";", "return", "msgs", ";", "}" ]
Gets a list of all tick values on the state stream @param stream @return
[ "Gets", "a", "list", "of", "all", "tick", "values", "on", "the", "state", "stream" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/ControllableStream.java#L38-L68
train