repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
sequence
docstring
stringlengths
3
16k
docstring_tokens
sequence
sha
stringlengths
40
40
url
stringlengths
105
339
partition
stringclasses
1 value
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/BlockVector.java
BlockVector.insertNullElementsAt
public final void insertNullElementsAt(int index, int count) { if (tc.isEntryEnabled()) SibTr.entry( tc, "insertNullElementsAt", new Object[] { new Integer(index), new Integer(count)}); for (int i = index; i < index + count; i++) add(i, null); if (tc.isEntryEnabled()) SibTr.exit(tc, "insertNullElementsAt"); }
java
public final void insertNullElementsAt(int index, int count) { if (tc.isEntryEnabled()) SibTr.entry( tc, "insertNullElementsAt", new Object[] { new Integer(index), new Integer(count)}); for (int i = index; i < index + count; i++) add(i, null); if (tc.isEntryEnabled()) SibTr.exit(tc, "insertNullElementsAt"); }
[ "public", "final", "void", "insertNullElementsAt", "(", "int", "index", ",", "int", "count", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"insertNullElementsAt\"", ",", "new", "Object", "[", "]", "{", "new", "Integer", "(", "index", ")", ",", "new", "Integer", "(", "count", ")", "}", ")", ";", "for", "(", "int", "i", "=", "index", ";", "i", "<", "index", "+", "count", ";", "i", "++", ")", "add", "(", "i", ",", "null", ")", ";", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"insertNullElementsAt\"", ")", ";", "}" ]
Inserts count null values at index, moving up all the components at index and greater. index cannot be greater than the size of the Vector. @exception ArrayIndexOutOfBoundsException if the index was invalid.
[ "Inserts", "count", "null", "values", "at", "index", "moving", "up", "all", "the", "components", "at", "index", "and", "greater", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/BlockVector.java#L64-L77
train
OpenLiberty/open-liberty
dev/com.ibm.ws.opentracing/src/com/ibm/ws/opentracing/filters/SpanFilterBase.java
SpanFilterBase.validatePattern
protected void validatePattern() { if (pattern.length() == 0) { throw new IllegalArgumentException(Tr.formatMessage(tc, "OPENTRACING_FILTER_PATTERN_BLANK")); } if (!regex) { try { URI.create(pattern); } catch (IllegalArgumentException e) { throw new IllegalArgumentException(Tr.formatMessage(tc, "OPENTRACING_FILTER_PATTERN_INVALID", pattern), e); } } }
java
protected void validatePattern() { if (pattern.length() == 0) { throw new IllegalArgumentException(Tr.formatMessage(tc, "OPENTRACING_FILTER_PATTERN_BLANK")); } if (!regex) { try { URI.create(pattern); } catch (IllegalArgumentException e) { throw new IllegalArgumentException(Tr.formatMessage(tc, "OPENTRACING_FILTER_PATTERN_INVALID", pattern), e); } } }
[ "protected", "void", "validatePattern", "(", ")", "{", "if", "(", "pattern", ".", "length", "(", ")", "==", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "Tr", ".", "formatMessage", "(", "tc", ",", "\"OPENTRACING_FILTER_PATTERN_BLANK\"", ")", ")", ";", "}", "if", "(", "!", "regex", ")", "{", "try", "{", "URI", ".", "create", "(", "pattern", ")", ";", "}", "catch", "(", "IllegalArgumentException", "e", ")", "{", "throw", "new", "IllegalArgumentException", "(", "Tr", ".", "formatMessage", "(", "tc", ",", "\"OPENTRACING_FILTER_PATTERN_INVALID\"", ",", "pattern", ")", ",", "e", ")", ";", "}", "}", "}" ]
Throw exceptions if the pattern is invalid. @throws IllegalArgumentException Pattern is blank or non-conformant to RFC 2396.
[ "Throw", "exceptions", "if", "the", "pattern", "is", "invalid", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.opentracing/src/com/ibm/ws/opentracing/filters/SpanFilterBase.java#L103-L115
train
OpenLiberty/open-liberty
dev/com.ibm.ws.opentracing/src/com/ibm/ws/opentracing/filters/SpanFilterBase.java
SpanFilterBase.prepareUri
protected final String prepareUri(final URI uri) { if (compareRelative) { final String path = uri.getRawPath(); final String query = uri.getRawQuery(); final String fragment = uri.getRawFragment(); if (query != null && fragment != null) { return path + "?" + query + "#" + fragment; } else if (query != null) { return path + "?" + query; } else if (fragment != null) { return path + "#" + fragment; } else { return path; } } else { return uri.toString(); } }
java
protected final String prepareUri(final URI uri) { if (compareRelative) { final String path = uri.getRawPath(); final String query = uri.getRawQuery(); final String fragment = uri.getRawFragment(); if (query != null && fragment != null) { return path + "?" + query + "#" + fragment; } else if (query != null) { return path + "?" + query; } else if (fragment != null) { return path + "#" + fragment; } else { return path; } } else { return uri.toString(); } }
[ "protected", "final", "String", "prepareUri", "(", "final", "URI", "uri", ")", "{", "if", "(", "compareRelative", ")", "{", "final", "String", "path", "=", "uri", ".", "getRawPath", "(", ")", ";", "final", "String", "query", "=", "uri", ".", "getRawQuery", "(", ")", ";", "final", "String", "fragment", "=", "uri", ".", "getRawFragment", "(", ")", ";", "if", "(", "query", "!=", "null", "&&", "fragment", "!=", "null", ")", "{", "return", "path", "+", "\"?\"", "+", "query", "+", "\"#\"", "+", "fragment", ";", "}", "else", "if", "(", "query", "!=", "null", ")", "{", "return", "path", "+", "\"?\"", "+", "query", ";", "}", "else", "if", "(", "fragment", "!=", "null", ")", "{", "return", "path", "+", "\"#\"", "+", "fragment", ";", "}", "else", "{", "return", "path", ";", "}", "}", "else", "{", "return", "uri", ".", "toString", "(", ")", ";", "}", "}" ]
Prepare the URI for matching. @param uri The URI. @return A String version of the URI to compare to the pattern.
[ "Prepare", "the", "URI", "for", "matching", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.opentracing/src/com/ibm/ws/opentracing/filters/SpanFilterBase.java#L161-L178
train
OpenLiberty/open-liberty
dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/ConsoleWrapper.java
ConsoleWrapper.readText
public String readText(String prompt) { if (!isInputStreamAvailable()) { return null; } try { return console.readLine(prompt); } catch (IOError e) { stderr.println("Exception while reading stdin: " + e.getMessage()); e.printStackTrace(stderr); } return null; }
java
public String readText(String prompt) { if (!isInputStreamAvailable()) { return null; } try { return console.readLine(prompt); } catch (IOError e) { stderr.println("Exception while reading stdin: " + e.getMessage()); e.printStackTrace(stderr); } return null; }
[ "public", "String", "readText", "(", "String", "prompt", ")", "{", "if", "(", "!", "isInputStreamAvailable", "(", ")", ")", "{", "return", "null", ";", "}", "try", "{", "return", "console", ".", "readLine", "(", "prompt", ")", ";", "}", "catch", "(", "IOError", "e", ")", "{", "stderr", ".", "println", "(", "\"Exception while reading stdin: \"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "e", ".", "printStackTrace", "(", "stderr", ")", ";", "}", "return", "null", ";", "}" ]
Reads text from the input String, prompting with the given String. @param prompt @return String read from input.
[ "Reads", "text", "from", "the", "input", "String", "prompting", "with", "the", "given", "String", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/ConsoleWrapper.java#L46-L57
train
OpenLiberty/open-liberty
dev/com.ibm.ws.request.probes/src/com/ibm/wsspi/probeExtension/FastList.java
FastList.add
public synchronized int add(E object) { if (object == null) throw new NullPointerException("FastList add called with null"); if ((count + 1) >= maxCount) resize(capacity * 2); int initialAddIndex = addIndex; // find right spot to add to - start with addIndex and look // for first open spot. give up if we get back to initialAddIndex while (listElements[addIndex] != null) { addIndex++; if (addIndex == capacity) addIndex = 0; if (addIndex == initialAddIndex) { // should not happen - we should have resized if we needed more // capacity throw new RuntimeException("FastList out of space"); } } count++; listElements[addIndex] = object; return addIndex; }
java
public synchronized int add(E object) { if (object == null) throw new NullPointerException("FastList add called with null"); if ((count + 1) >= maxCount) resize(capacity * 2); int initialAddIndex = addIndex; // find right spot to add to - start with addIndex and look // for first open spot. give up if we get back to initialAddIndex while (listElements[addIndex] != null) { addIndex++; if (addIndex == capacity) addIndex = 0; if (addIndex == initialAddIndex) { // should not happen - we should have resized if we needed more // capacity throw new RuntimeException("FastList out of space"); } } count++; listElements[addIndex] = object; return addIndex; }
[ "public", "synchronized", "int", "add", "(", "E", "object", ")", "{", "if", "(", "object", "==", "null", ")", "throw", "new", "NullPointerException", "(", "\"FastList add called with null\"", ")", ";", "if", "(", "(", "count", "+", "1", ")", ">=", "maxCount", ")", "resize", "(", "capacity", "*", "2", ")", ";", "int", "initialAddIndex", "=", "addIndex", ";", "// find right spot to add to - start with addIndex and look", "// for first open spot. give up if we get back to initialAddIndex", "while", "(", "listElements", "[", "addIndex", "]", "!=", "null", ")", "{", "addIndex", "++", ";", "if", "(", "addIndex", "==", "capacity", ")", "addIndex", "=", "0", ";", "if", "(", "addIndex", "==", "initialAddIndex", ")", "{", "// should not happen - we should have resized if we needed more", "// capacity", "throw", "new", "RuntimeException", "(", "\"FastList out of space\"", ")", ";", "}", "}", "count", "++", ";", "listElements", "[", "addIndex", "]", "=", "object", ";", "return", "addIndex", ";", "}" ]
Adds specified object to the list and increments size @param object the object to add to the list @throws NullPointerException if a null object is supplied
[ "Adds", "specified", "object", "to", "the", "list", "and", "increments", "size" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.request.probes/src/com/ibm/wsspi/probeExtension/FastList.java#L67-L94
train
OpenLiberty/open-liberty
dev/com.ibm.ws.request.probes/src/com/ibm/wsspi/probeExtension/FastList.java
FastList.getAll
public synchronized List<E> getAll() { ArrayList<E> list = new ArrayList<E>(); for (E element : listElements) { if (element != null) { list.add(element); } } return list; }
java
public synchronized List<E> getAll() { ArrayList<E> list = new ArrayList<E>(); for (E element : listElements) { if (element != null) { list.add(element); } } return list; }
[ "public", "synchronized", "List", "<", "E", ">", "getAll", "(", ")", "{", "ArrayList", "<", "E", ">", "list", "=", "new", "ArrayList", "<", "E", ">", "(", ")", ";", "for", "(", "E", "element", ":", "listElements", ")", "{", "if", "(", "element", "!=", "null", ")", "{", "list", ".", "add", "(", "element", ")", ";", "}", "}", "return", "list", ";", "}" ]
Provides a shallow copy of the list
[ "Provides", "a", "shallow", "copy", "of", "the", "list" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.request.probes/src/com/ibm/wsspi/probeExtension/FastList.java#L129-L139
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/CacheMap.java
CacheMap.addAll
public Object[] addAll(CacheMap c) { LinkedList<Object> discards = new LinkedList<Object>(); Object discard; for (int bucketIndex = c.next[c.BEFORE_LRU]; bucketIndex != c.AFTER_MRU; bucketIndex = c.next[bucketIndex]) for (int i = 0; i < c.bucketSizes[bucketIndex]; i++) if ((discard = add(c.keys[bucketIndex][i], c.values[bucketIndex][i])) != null) discards.add(discard); return discards.toArray(); }
java
public Object[] addAll(CacheMap c) { LinkedList<Object> discards = new LinkedList<Object>(); Object discard; for (int bucketIndex = c.next[c.BEFORE_LRU]; bucketIndex != c.AFTER_MRU; bucketIndex = c.next[bucketIndex]) for (int i = 0; i < c.bucketSizes[bucketIndex]; i++) if ((discard = add(c.keys[bucketIndex][i], c.values[bucketIndex][i])) != null) discards.add(discard); return discards.toArray(); }
[ "public", "Object", "[", "]", "addAll", "(", "CacheMap", "c", ")", "{", "LinkedList", "<", "Object", ">", "discards", "=", "new", "LinkedList", "<", "Object", ">", "(", ")", ";", "Object", "discard", ";", "for", "(", "int", "bucketIndex", "=", "c", ".", "next", "[", "c", ".", "BEFORE_LRU", "]", ";", "bucketIndex", "!=", "c", ".", "AFTER_MRU", ";", "bucketIndex", "=", "c", ".", "next", "[", "bucketIndex", "]", ")", "for", "(", "int", "i", "=", "0", ";", "i", "<", "c", ".", "bucketSizes", "[", "bucketIndex", "]", ";", "i", "++", ")", "if", "(", "(", "discard", "=", "add", "(", "c", ".", "keys", "[", "bucketIndex", "]", "[", "i", "]", ",", "c", ".", "values", "[", "bucketIndex", "]", "[", "i", "]", ")", ")", "!=", "null", ")", "discards", ".", "add", "(", "discard", ")", ";", "return", "discards", ".", "toArray", "(", ")", ";", "}" ]
Inserts into this CacheMap all entries from the specified CacheMap, returning a list of any values that do not fit. @param c the source CacheMap from which to copy entries. @return list of values from the source CacheMap which didn't fit.
[ "Inserts", "into", "this", "CacheMap", "all", "entries", "from", "the", "specified", "CacheMap", "returning", "a", "list", "of", "any", "values", "that", "do", "not", "fit", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/CacheMap.java#L172-L182
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/CacheMap.java
CacheMap.discardFromBucket
private Object discardFromBucket(int bucketIndex, int entryIndex) { numDiscards++; bucketSizes[bucketIndex]--; numEntries--; return values[bucketIndex][entryIndex]; }
java
private Object discardFromBucket(int bucketIndex, int entryIndex) { numDiscards++; bucketSizes[bucketIndex]--; numEntries--; return values[bucketIndex][entryIndex]; }
[ "private", "Object", "discardFromBucket", "(", "int", "bucketIndex", ",", "int", "entryIndex", ")", "{", "numDiscards", "++", ";", "bucketSizes", "[", "bucketIndex", "]", "--", ";", "numEntries", "--", ";", "return", "values", "[", "bucketIndex", "]", "[", "entryIndex", "]", ";", "}" ]
Discard an entry from the specified bucket. The actual entry is not nulled out because it will later be overwritten. @param bucketIndex the index of the bucket from which to discard an entry. @param entryIndex the index of the entry within the bucket to discard. @return the discarded value.
[ "Discard", "an", "entry", "from", "the", "specified", "bucket", ".", "The", "actual", "entry", "is", "not", "nulled", "out", "because", "it", "will", "later", "be", "overwritten", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/CacheMap.java#L194-L199
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/MESubscription.java
MESubscription.addRef
int addRef() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "addRef"); int ret = NOP; // If this is a new subscription, then the operation is to subscribe. if (_refCount++ == 0) ret = SUBSCRIBE; checkRefCount(); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "addRef", String.valueOf(ret) +":"+ String.valueOf(_refCount)); return ret; }
java
int addRef() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "addRef"); int ret = NOP; // If this is a new subscription, then the operation is to subscribe. if (_refCount++ == 0) ret = SUBSCRIBE; checkRefCount(); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "addRef", String.valueOf(ret) +":"+ String.valueOf(_refCount)); return ret; }
[ "int", "addRef", "(", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"addRef\"", ")", ";", "int", "ret", "=", "NOP", ";", "// If this is a new subscription, then the operation is to subscribe.", "if", "(", "_refCount", "++", "==", "0", ")", "ret", "=", "SUBSCRIBE", ";", "checkRefCount", "(", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"addRef\"", ",", "String", ".", "valueOf", "(", "ret", ")", "+", "\":\"", "+", "String", ".", "valueOf", "(", "_refCount", ")", ")", ";", "return", "ret", ";", "}" ]
Adds a reference to the subscription. @return The operation represented by the addition of the reference.
[ "Adds", "a", "reference", "to", "the", "subscription", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/MESubscription.java#L200-L218
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/MESubscription.java
MESubscription.removeRef
int removeRef() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "removeRef"); int ret = NOP; // If this is the last reference, then the operation is unsubscribe. if (--_refCount == 0) ret = UNSUBSCRIBE; checkRefCount(); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "removeRef", String.valueOf(ret) +":"+ String.valueOf(_refCount)); return ret; }
java
int removeRef() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "removeRef"); int ret = NOP; // If this is the last reference, then the operation is unsubscribe. if (--_refCount == 0) ret = UNSUBSCRIBE; checkRefCount(); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "removeRef", String.valueOf(ret) +":"+ String.valueOf(_refCount)); return ret; }
[ "int", "removeRef", "(", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"removeRef\"", ")", ";", "int", "ret", "=", "NOP", ";", "// If this is the last reference, then the operation is unsubscribe.", "if", "(", "--", "_refCount", "==", "0", ")", "ret", "=", "UNSUBSCRIBE", ";", "checkRefCount", "(", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"removeRef\"", ",", "String", ".", "valueOf", "(", "ret", ")", "+", "\":\"", "+", "String", ".", "valueOf", "(", "_refCount", ")", ")", ";", "return", "ret", ";", "}" ]
Removes a reference to the subscription. @return The operation represented by the removal of the reference.
[ "Removes", "a", "reference", "to", "the", "subscription", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/MESubscription.java#L226-L244
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/MESubscription.java
MESubscription.getTopic
final String getTopic() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, "getTopic"); SibTr.exit(tc, "getTopic", _topic); } return _topic; }
java
final String getTopic() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, "getTopic"); SibTr.exit(tc, "getTopic", _topic); } return _topic; }
[ "final", "String", "getTopic", "(", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "entry", "(", "tc", ",", "\"getTopic\"", ")", ";", "SibTr", ".", "exit", "(", "tc", ",", "\"getTopic\"", ",", "_topic", ")", ";", "}", "return", "_topic", ";", "}" ]
Returns the value of the topic. @return The topic.
[ "Returns", "the", "value", "of", "the", "topic", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/MESubscription.java#L251-L260
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/MESubscription.java
MESubscription.getTopicSpaceUuid
final SIBUuid12 getTopicSpaceUuid() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, "getTopicSpaceUuid"); SibTr.exit(tc, "getTopicSpaceUuid", _topicSpaceUuid); } return _topicSpaceUuid; }
java
final SIBUuid12 getTopicSpaceUuid() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, "getTopicSpaceUuid"); SibTr.exit(tc, "getTopicSpaceUuid", _topicSpaceUuid); } return _topicSpaceUuid; }
[ "final", "SIBUuid12", "getTopicSpaceUuid", "(", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "entry", "(", "tc", ",", "\"getTopicSpaceUuid\"", ")", ";", "SibTr", ".", "exit", "(", "tc", ",", "\"getTopicSpaceUuid\"", ",", "_topicSpaceUuid", ")", ";", "}", "return", "_topicSpaceUuid", ";", "}" ]
Returns the value of the topic space uuid. @return The topic space uuid
[ "Returns", "the", "value", "of", "the", "topic", "space", "uuid", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/MESubscription.java#L294-L303
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/MESubscription.java
MESubscription.getTopicSpaceName
final String getTopicSpaceName() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, "getTopicSpaceName"); SibTr.exit(tc, "getTopicSpaceName", _topicSpaceName); } return _topicSpaceName; }
java
final String getTopicSpaceName() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, "getTopicSpaceName"); SibTr.exit(tc, "getTopicSpaceName", _topicSpaceName); } return _topicSpaceName; }
[ "final", "String", "getTopicSpaceName", "(", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "entry", "(", "tc", ",", "\"getTopicSpaceName\"", ")", ";", "SibTr", ".", "exit", "(", "tc", ",", "\"getTopicSpaceName\"", ",", "_topicSpaceName", ")", ";", "}", "return", "_topicSpaceName", ";", "}" ]
Returns the value of the topic space name. @return The topic space name
[ "Returns", "the", "value", "of", "the", "topic", "space", "name", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/MESubscription.java#L310-L319
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/MESubscription.java
MESubscription.getMESubUserId
final String getMESubUserId() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, "getMESubUserId"); SibTr.exit(tc, "getMESubUserId", _meSubUserId); } return _meSubUserId; }
java
final String getMESubUserId() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, "getMESubUserId"); SibTr.exit(tc, "getMESubUserId", _meSubUserId); } return _meSubUserId; }
[ "final", "String", "getMESubUserId", "(", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "entry", "(", "tc", ",", "\"getMESubUserId\"", ")", ";", "SibTr", ".", "exit", "(", "tc", ",", "\"getMESubUserId\"", ",", "_meSubUserId", ")", ";", "}", "return", "_meSubUserId", ";", "}" ]
Returns the value of the userid associated with the subscription. @return The userid.
[ "Returns", "the", "value", "of", "the", "userid", "associated", "with", "the", "subscription", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/MESubscription.java#L326-L335
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/MESubscription.java
MESubscription.isForeignSecuredProxy
final boolean isForeignSecuredProxy() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, "isForeignSecuredProxy"); SibTr.exit(tc, "isForeignSecuredProxy", new Boolean(_foreignSecuredProxy)); } return _foreignSecuredProxy; }
java
final boolean isForeignSecuredProxy() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, "isForeignSecuredProxy"); SibTr.exit(tc, "isForeignSecuredProxy", new Boolean(_foreignSecuredProxy)); } return _foreignSecuredProxy; }
[ "final", "boolean", "isForeignSecuredProxy", "(", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "entry", "(", "tc", ",", "\"isForeignSecuredProxy\"", ")", ";", "SibTr", ".", "exit", "(", "tc", ",", "\"isForeignSecuredProxy\"", ",", "new", "Boolean", "(", "_foreignSecuredProxy", ")", ")", ";", "}", "return", "_foreignSecuredProxy", ";", "}" ]
Returns true if this proxy sub was from a foreign bus in a secured env. @return The userid.
[ "Returns", "true", "if", "this", "proxy", "sub", "was", "from", "a", "foreign", "bus", "in", "a", "secured", "env", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/MESubscription.java#L354-L363
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/MESubscription.java
MESubscription.mark
void mark() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, "mark"); SibTr.exit(tc, "mark"); } _marked = true; }
java
void mark() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, "mark"); SibTr.exit(tc, "mark"); } _marked = true; }
[ "void", "mark", "(", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "entry", "(", "tc", ",", "\"mark\"", ")", ";", "SibTr", ".", "exit", "(", "tc", ",", "\"mark\"", ")", ";", "}", "_marked", "=", "true", ";", "}" ]
Marks this object. Used for deciding if this object is to be deleted. The object is marked, the proxies are all reregistered. If there is a mark still left, then this proxy can be deleted.
[ "Marks", "this", "object", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/MESubscription.java#L386-L395
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/MESubscription.java
MESubscription.unmark
void unmark() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, "unmark"); SibTr.exit(tc, "unmark"); } _marked = false; }
java
void unmark() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, "unmark"); SibTr.exit(tc, "unmark"); } _marked = false; }
[ "void", "unmark", "(", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "entry", "(", "tc", ",", "\"unmark\"", ")", ";", "SibTr", ".", "exit", "(", "tc", ",", "\"unmark\"", ")", ";", "}", "_marked", "=", "false", ";", "}" ]
Unmarks this object. Used for deciding if this object is to be deleted. The object is marked, the proxies are all reregistered. If there is a mark still left, then this proxy can be deleted.
[ "Unmarks", "this", "object", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/MESubscription.java#L405-L414
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/MESubscription.java
MESubscription.isMarked
boolean isMarked() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, "isMarked"); SibTr.exit(tc, "isMarked", new Boolean(_marked)); } return _marked; }
java
boolean isMarked() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, "isMarked"); SibTr.exit(tc, "isMarked", new Boolean(_marked)); } return _marked; }
[ "boolean", "isMarked", "(", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "entry", "(", "tc", ",", "\"isMarked\"", ")", ";", "SibTr", ".", "exit", "(", "tc", ",", "\"isMarked\"", ",", "new", "Boolean", "(", "_marked", ")", ")", ";", "}", "return", "_marked", ";", "}" ]
Is Marked indicates if this object is still marked. If it is, then it can be removed. @return iMarked true if this Subscription is still marked.
[ "Is", "Marked", "indicates", "if", "this", "object", "is", "still", "marked", ".", "If", "it", "is", "then", "it", "can", "be", "removed", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/MESubscription.java#L422-L431
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/MESubscription.java
MESubscription.registerForPostCommit
protected void registerForPostCommit(MultiMEProxyHandler proxyHandler, DestinationHandler destination, PubSubOutputHandler handler, Neighbour neighbour) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "registerForPostCommit", new Object[] { proxyHandler, destination, handler, neighbour }); _proxyHandler = proxyHandler; _destination = destination; _handler = handler; _neighbour = neighbour; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "registerForPostCommit"); }
java
protected void registerForPostCommit(MultiMEProxyHandler proxyHandler, DestinationHandler destination, PubSubOutputHandler handler, Neighbour neighbour) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "registerForPostCommit", new Object[] { proxyHandler, destination, handler, neighbour }); _proxyHandler = proxyHandler; _destination = destination; _handler = handler; _neighbour = neighbour; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "registerForPostCommit"); }
[ "protected", "void", "registerForPostCommit", "(", "MultiMEProxyHandler", "proxyHandler", ",", "DestinationHandler", "destination", ",", "PubSubOutputHandler", "handler", ",", "Neighbour", "neighbour", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"registerForPostCommit\"", ",", "new", "Object", "[", "]", "{", "proxyHandler", ",", "destination", ",", "handler", ",", "neighbour", "}", ")", ";", "_proxyHandler", "=", "proxyHandler", ";", "_destination", "=", "destination", ";", "_handler", "=", "handler", ";", "_neighbour", "=", "neighbour", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"registerForPostCommit\"", ")", ";", "}" ]
Sets the information in the subscription so that when a commit is called it can resolve the correct objects to add items to the MatchSpace. @param proxyHandler @param handler
[ "Sets", "the", "information", "in", "the", "subscription", "so", "that", "when", "a", "commit", "is", "called", "it", "can", "resolve", "the", "correct", "objects", "to", "add", "items", "to", "the", "MatchSpace", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/MESubscription.java#L458-L474
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/MESubscription.java
MESubscription.registerForPostCommit
protected void registerForPostCommit(Neighbour neighbour, Neighbours neighbours) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "registerForPostCommit", new Object[] { neighbour, neighbours }); _proxyHandler = null; _destination = null; _handler = null; _neighbour = neighbour; _neighbours = neighbours; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "registerForPostCommit"); }
java
protected void registerForPostCommit(Neighbour neighbour, Neighbours neighbours) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "registerForPostCommit", new Object[] { neighbour, neighbours }); _proxyHandler = null; _destination = null; _handler = null; _neighbour = neighbour; _neighbours = neighbours; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "registerForPostCommit"); }
[ "protected", "void", "registerForPostCommit", "(", "Neighbour", "neighbour", ",", "Neighbours", "neighbours", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"registerForPostCommit\"", ",", "new", "Object", "[", "]", "{", "neighbour", ",", "neighbours", "}", ")", ";", "_proxyHandler", "=", "null", ";", "_destination", "=", "null", ";", "_handler", "=", "null", ";", "_neighbour", "=", "neighbour", ";", "_neighbours", "=", "neighbours", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"registerForPostCommit\"", ")", ";", "}" ]
Used only for rollback - if the transaction is rolled back and there is a neighbour set, then rmeove the proxy reference. @param neighbour the neighbour object for rollback
[ "Used", "only", "for", "rollback", "-", "if", "the", "transaction", "is", "rolled", "back", "and", "there", "is", "a", "neighbour", "set", "then", "rmeove", "the", "proxy", "reference", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/MESubscription.java#L482-L497
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/MESubscription.java
MESubscription.eventPostRollbackAdd
public void eventPostRollbackAdd(Transaction transaction) throws SevereMessageStoreException { super.eventPostRollbackAdd(transaction); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "eventPostRollbackAdd", transaction); if (_handler != null) { _handler.removeTopic(_topic); // If this was the last topic reference, then delete the PubSub output // handler. if (_handler.getTopics()== null || _handler.getTopics().length == 0) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Deleting PubSubOutputHandler " + _handler); _destination.deletePubSubOutputHandler(_neighbour.getUUID()); } } else if (_neighbours!=null) _neighbours.removeTopicSpaceReference(_neighbour.getUUID(), this, _topicSpaceUuid, _topic); // Remove the subscription from the list. _neighbour.removeSubscription(_topicSpaceUuid, _topic); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "eventPostRollbackAdd"); }
java
public void eventPostRollbackAdd(Transaction transaction) throws SevereMessageStoreException { super.eventPostRollbackAdd(transaction); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "eventPostRollbackAdd", transaction); if (_handler != null) { _handler.removeTopic(_topic); // If this was the last topic reference, then delete the PubSub output // handler. if (_handler.getTopics()== null || _handler.getTopics().length == 0) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Deleting PubSubOutputHandler " + _handler); _destination.deletePubSubOutputHandler(_neighbour.getUUID()); } } else if (_neighbours!=null) _neighbours.removeTopicSpaceReference(_neighbour.getUUID(), this, _topicSpaceUuid, _topic); // Remove the subscription from the list. _neighbour.removeSubscription(_topicSpaceUuid, _topic); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "eventPostRollbackAdd"); }
[ "public", "void", "eventPostRollbackAdd", "(", "Transaction", "transaction", ")", "throws", "SevereMessageStoreException", "{", "super", ".", "eventPostRollbackAdd", "(", "transaction", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"eventPostRollbackAdd\"", ",", "transaction", ")", ";", "if", "(", "_handler", "!=", "null", ")", "{", "_handler", ".", "removeTopic", "(", "_topic", ")", ";", "// If this was the last topic reference, then delete the PubSub output ", "// handler.", "if", "(", "_handler", ".", "getTopics", "(", ")", "==", "null", "||", "_handler", ".", "getTopics", "(", ")", ".", "length", "==", "0", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "SibTr", ".", "debug", "(", "tc", ",", "\"Deleting PubSubOutputHandler \"", "+", "_handler", ")", ";", "_destination", ".", "deletePubSubOutputHandler", "(", "_neighbour", ".", "getUUID", "(", ")", ")", ";", "}", "}", "else", "if", "(", "_neighbours", "!=", "null", ")", "_neighbours", ".", "removeTopicSpaceReference", "(", "_neighbour", ".", "getUUID", "(", ")", ",", "this", ",", "_topicSpaceUuid", ",", "_topic", ")", ";", "// Remove the subscription from the list.", "_neighbour", ".", "removeSubscription", "(", "_topicSpaceUuid", ",", "_topic", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"eventPostRollbackAdd\"", ")", ";", "}" ]
When the add rollback is made, need to remove the topic. Or the topicSpace reference needs to be removed. @param transaction the {@link Transaction} under which the event has occurred
[ "When", "the", "add", "rollback", "is", "made", "need", "to", "remove", "the", "topic", ".", "Or", "the", "topicSpace", "reference", "needs", "to", "be", "removed", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/MESubscription.java#L606-L639
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/MESubscription.java
MESubscription.eventPostCommitUpdate
public void eventPostCommitUpdate(Transaction transaction) throws SevereMessageStoreException { super.eventPostCommitAdd(transaction); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "eventPostCommitUpdate", transaction); // Remove the current CPS from the MatchSpace if (_proxyHandler != null) { _destination.getSubscriptionIndex().remove(_controllableProxySubscription); _proxyHandler .getMessageProcessor() .getMessageProcessorMatching() .removePubSubOutputHandlerMatchTarget(_controllableProxySubscription); } // Add the CPS to the MatchSpace. try { if (_proxyHandler != null) { _controllableProxySubscription = _proxyHandler .getMessageProcessor() .getMessageProcessorMatching() .addPubSubOutputHandlerMatchTarget( _handler, _topicSpaceUuid, _topic, _foreignSecuredProxy, _meSubUserId); } } catch (SIException e) { // FFDC FFDCFilter.processException( e, "com.ibm.ws.sib.processor.proxyhandler.MESubscription.eventPostCommitUpdate", "1:738:1.55", this); SibTr.exception(tc, e); SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002", new Object[] { "com.ibm.ws.sib.processor.proxyhandler.MESubscription", "1:745:1.55", e }); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "eventPostCommitUpdate", "SIErrorException"); // An error at this point is very bad ! throw new SIErrorException(nls.getFormattedMessage( "INTERNAL_MESSAGING_ERROR_CWSIP0002", new Object[] { "com.ibm.ws.sib.processor.proxyhandler.MESubscription", "1:755:1.55", e }, null), e); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "eventPostCommitUpdate"); }
java
public void eventPostCommitUpdate(Transaction transaction) throws SevereMessageStoreException { super.eventPostCommitAdd(transaction); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "eventPostCommitUpdate", transaction); // Remove the current CPS from the MatchSpace if (_proxyHandler != null) { _destination.getSubscriptionIndex().remove(_controllableProxySubscription); _proxyHandler .getMessageProcessor() .getMessageProcessorMatching() .removePubSubOutputHandlerMatchTarget(_controllableProxySubscription); } // Add the CPS to the MatchSpace. try { if (_proxyHandler != null) { _controllableProxySubscription = _proxyHandler .getMessageProcessor() .getMessageProcessorMatching() .addPubSubOutputHandlerMatchTarget( _handler, _topicSpaceUuid, _topic, _foreignSecuredProxy, _meSubUserId); } } catch (SIException e) { // FFDC FFDCFilter.processException( e, "com.ibm.ws.sib.processor.proxyhandler.MESubscription.eventPostCommitUpdate", "1:738:1.55", this); SibTr.exception(tc, e); SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002", new Object[] { "com.ibm.ws.sib.processor.proxyhandler.MESubscription", "1:745:1.55", e }); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "eventPostCommitUpdate", "SIErrorException"); // An error at this point is very bad ! throw new SIErrorException(nls.getFormattedMessage( "INTERNAL_MESSAGING_ERROR_CWSIP0002", new Object[] { "com.ibm.ws.sib.processor.proxyhandler.MESubscription", "1:755:1.55", e }, null), e); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "eventPostCommitUpdate"); }
[ "public", "void", "eventPostCommitUpdate", "(", "Transaction", "transaction", ")", "throws", "SevereMessageStoreException", "{", "super", ".", "eventPostCommitAdd", "(", "transaction", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"eventPostCommitUpdate\"", ",", "transaction", ")", ";", "// Remove the current CPS from the MatchSpace ", "if", "(", "_proxyHandler", "!=", "null", ")", "{", "_destination", ".", "getSubscriptionIndex", "(", ")", ".", "remove", "(", "_controllableProxySubscription", ")", ";", "_proxyHandler", ".", "getMessageProcessor", "(", ")", ".", "getMessageProcessorMatching", "(", ")", ".", "removePubSubOutputHandlerMatchTarget", "(", "_controllableProxySubscription", ")", ";", "}", "// Add the CPS to the MatchSpace.", "try", "{", "if", "(", "_proxyHandler", "!=", "null", ")", "{", "_controllableProxySubscription", "=", "_proxyHandler", ".", "getMessageProcessor", "(", ")", ".", "getMessageProcessorMatching", "(", ")", ".", "addPubSubOutputHandlerMatchTarget", "(", "_handler", ",", "_topicSpaceUuid", ",", "_topic", ",", "_foreignSecuredProxy", ",", "_meSubUserId", ")", ";", "}", "}", "catch", "(", "SIException", "e", ")", "{", "// FFDC", "FFDCFilter", ".", "processException", "(", "e", ",", "\"com.ibm.ws.sib.processor.proxyhandler.MESubscription.eventPostCommitUpdate\"", ",", "\"1:738:1.55\"", ",", "this", ")", ";", "SibTr", ".", "exception", "(", "tc", ",", "e", ")", ";", "SibTr", ".", "error", "(", "tc", ",", "\"INTERNAL_MESSAGING_ERROR_CWSIP0002\"", ",", "new", "Object", "[", "]", "{", "\"com.ibm.ws.sib.processor.proxyhandler.MESubscription\"", ",", "\"1:745:1.55\"", ",", "e", "}", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"eventPostCommitUpdate\"", ",", "\"SIErrorException\"", ")", ";", "// An error at this point is very bad !", "throw", "new", "SIErrorException", "(", "nls", ".", "getFormattedMessage", "(", "\"INTERNAL_MESSAGING_ERROR_CWSIP0002\"", ",", "new", "Object", "[", "]", "{", "\"com.ibm.ws.sib.processor.proxyhandler.MESubscription\"", ",", "\"1:755:1.55\"", ",", "e", "}", ",", "null", ")", ",", "e", ")", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"eventPostCommitUpdate\"", ")", ";", "}" ]
Updates the ControllableProxySubscription. We go through a full blown MatchSpace add and remove operation to ensure that MatchSpace caches get re-synched. @param transaction the {@link Transaction} under which the event has occurred
[ "Updates", "the", "ControllableProxySubscription", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/MESubscription.java#L677-L740
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/MESubscription.java
MESubscription.setMatchspaceSub
public void setMatchspaceSub(ControllableProxySubscription sub) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "setMatchspaceSub", sub); _controllableProxySubscription = sub; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "setMatchspaceSub"); }
java
public void setMatchspaceSub(ControllableProxySubscription sub) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "setMatchspaceSub", sub); _controllableProxySubscription = sub; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "setMatchspaceSub"); }
[ "public", "void", "setMatchspaceSub", "(", "ControllableProxySubscription", "sub", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"setMatchspaceSub\"", ",", "sub", ")", ";", "_controllableProxySubscription", "=", "sub", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"setMatchspaceSub\"", ")", ";", "}" ]
This sets the field in the MESubscription for the object that was stored in the Matchspace @param sub
[ "This", "sets", "the", "field", "in", "the", "MESubscription", "for", "the", "object", "that", "was", "stored", "in", "the", "Matchspace" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/MESubscription.java#L887-L896
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/MESubscription.java
MESubscription.getMatchspaceSub
public ControllableProxySubscription getMatchspaceSub() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, "getMatchspaceSub"); SibTr.exit(tc, "getMatchspaceSub", _controllableProxySubscription); } return _controllableProxySubscription; }
java
public ControllableProxySubscription getMatchspaceSub() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, "getMatchspaceSub"); SibTr.exit(tc, "getMatchspaceSub", _controllableProxySubscription); } return _controllableProxySubscription; }
[ "public", "ControllableProxySubscription", "getMatchspaceSub", "(", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "entry", "(", "tc", ",", "\"getMatchspaceSub\"", ")", ";", "SibTr", ".", "exit", "(", "tc", ",", "\"getMatchspaceSub\"", ",", "_controllableProxySubscription", ")", ";", "}", "return", "_controllableProxySubscription", ";", "}" ]
Gets the object that was stored in the Matchspace @return
[ "Gets", "the", "object", "that", "was", "stored", "in", "the", "Matchspace" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/MESubscription.java#L902-L910
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/ReferenceStream.java
ReferenceStream.findById
public final AbstractItem findById(long itemId) throws SevereMessageStoreException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "findById", Long.valueOf(itemId)); AbstractItem item = null; ReferenceCollection ic = ((ReferenceCollection) _getMembership()); if (null == ic) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "findById"); throw new NotInMessageStore(); // Defect 489210 } item = ic.findById(itemId); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "findById", item); return item; }
java
public final AbstractItem findById(long itemId) throws SevereMessageStoreException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "findById", Long.valueOf(itemId)); AbstractItem item = null; ReferenceCollection ic = ((ReferenceCollection) _getMembership()); if (null == ic) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "findById"); throw new NotInMessageStore(); // Defect 489210 } item = ic.findById(itemId); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "findById", item); return item; }
[ "public", "final", "AbstractItem", "findById", "(", "long", "itemId", ")", "throws", "SevereMessageStoreException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "this", ",", "tc", ",", "\"findById\"", ",", "Long", ".", "valueOf", "(", "itemId", ")", ")", ";", "AbstractItem", "item", "=", "null", ";", "ReferenceCollection", "ic", "=", "(", "(", "ReferenceCollection", ")", "_getMembership", "(", ")", ")", ";", "if", "(", "null", "==", "ic", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "this", ",", "tc", ",", "\"findById\"", ")", ";", "throw", "new", "NotInMessageStore", "(", ")", ";", "// Defect 489210", "}", "item", "=", "ic", ".", "findById", "(", "itemId", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "this", ",", "tc", ",", "\"findById\"", ",", "item", ")", ";", "return", "item", ";", "}" ]
Reply the item in the receiver with a matching ID. The item returned stream is neither removed from the message store nor locked for exclusive use of the caller. @param itemId @return item found or null if none. @throws SevereMessageStoreException @throws MessageStoreException
[ "Reply", "the", "item", "in", "the", "receiver", "with", "a", "matching", "ID", ".", "The", "item", "returned", "stream", "is", "neither", "removed", "from", "the", "message", "store", "nor", "locked", "for", "exclusive", "use", "of", "the", "caller", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/ReferenceStream.java#L191-L209
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/ReferenceStream.java
ReferenceStream.findOldestReference
public final ItemReference findOldestReference() throws MessageStoreException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "findOldestReference"); ReferenceCollection ic = ((ReferenceCollection) _getMembership()); if (null == ic) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "findOldestReference"); throw new NotInMessageStore(); } ItemReference item = null; if (ic != null) { item = (ItemReference) ic.findOldestItem(); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "findOldestReference", item); return item; }
java
public final ItemReference findOldestReference() throws MessageStoreException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "findOldestReference"); ReferenceCollection ic = ((ReferenceCollection) _getMembership()); if (null == ic) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "findOldestReference"); throw new NotInMessageStore(); } ItemReference item = null; if (ic != null) { item = (ItemReference) ic.findOldestItem(); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "findOldestReference", item); return item; }
[ "public", "final", "ItemReference", "findOldestReference", "(", ")", "throws", "MessageStoreException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "this", ",", "tc", ",", "\"findOldestReference\"", ")", ";", "ReferenceCollection", "ic", "=", "(", "(", "ReferenceCollection", ")", "_getMembership", "(", ")", ")", ";", "if", "(", "null", "==", "ic", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "this", ",", "tc", ",", "\"findOldestReference\"", ")", ";", "throw", "new", "NotInMessageStore", "(", ")", ";", "}", "ItemReference", "item", "=", "null", ";", "if", "(", "ic", "!=", "null", ")", "{", "item", "=", "(", "ItemReference", ")", "ic", ".", "findOldestItem", "(", ")", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "this", ",", "tc", ",", "\"findOldestReference\"", ",", "item", ")", ";", "return", "item", ";", "}" ]
Find the reference that has been known to the stream for longest. The reference returned may be in any of the states defined in the state model. The caller should not assume that the reference can be used for any particular purpose. @return Item, may be null. @throws {@link MessageStoreException} if the item was spilled and could not be unspilled. Or if item not found in backing store.
[ "Find", "the", "reference", "that", "has", "been", "known", "to", "the", "stream", "for", "longest", ".", "The", "reference", "returned", "may", "be", "in", "any", "of", "the", "states", "defined", "in", "the", "state", "model", ".", "The", "caller", "should", "not", "assume", "that", "the", "reference", "can", "be", "used", "for", "any", "particular", "purpose", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/ReferenceStream.java#L255-L276
train
OpenLiberty/open-liberty
dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/api/impl/JobOperatorImpl.java
JobOperatorImpl.publishEvent
private void publishEvent(WSJobExecution jobEx, String topicToPublish, String correlationId) { if (eventsPublisher != null) { eventsPublisher.publishJobExecutionEvent(jobEx, topicToPublish, correlationId); } }
java
private void publishEvent(WSJobExecution jobEx, String topicToPublish, String correlationId) { if (eventsPublisher != null) { eventsPublisher.publishJobExecutionEvent(jobEx, topicToPublish, correlationId); } }
[ "private", "void", "publishEvent", "(", "WSJobExecution", "jobEx", ",", "String", "topicToPublish", ",", "String", "correlationId", ")", "{", "if", "(", "eventsPublisher", "!=", "null", ")", "{", "eventsPublisher", ".", "publishJobExecutionEvent", "(", "jobEx", ",", "topicToPublish", ",", "correlationId", ")", ";", "}", "}" ]
Helper method to publish event @param jobEx @param topicToPublish @param correlationId
[ "Helper", "method", "to", "publish", "event" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/api/impl/JobOperatorImpl.java#L369-L373
train
OpenLiberty/open-liberty
dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/api/impl/JobOperatorImpl.java
JobOperatorImpl.publishEvent
private void publishEvent(WSJobInstance jobInst, String topicToPublish, String correlationId) { if (eventsPublisher != null) { eventsPublisher.publishJobInstanceEvent(jobInst, topicToPublish, correlationId); } }
java
private void publishEvent(WSJobInstance jobInst, String topicToPublish, String correlationId) { if (eventsPublisher != null) { eventsPublisher.publishJobInstanceEvent(jobInst, topicToPublish, correlationId); } }
[ "private", "void", "publishEvent", "(", "WSJobInstance", "jobInst", ",", "String", "topicToPublish", ",", "String", "correlationId", ")", "{", "if", "(", "eventsPublisher", "!=", "null", ")", "{", "eventsPublisher", ".", "publishJobInstanceEvent", "(", "jobInst", ",", "topicToPublish", ",", "correlationId", ")", ";", "}", "}" ]
Helper method to publish event with correlationId @param jobInstance @param topicToPublish @param correlationId
[ "Helper", "method", "to", "publish", "event", "with", "correlationId" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/api/impl/JobOperatorImpl.java#L382-L386
train
OpenLiberty/open-liberty
dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/api/impl/JobOperatorImpl.java
JobOperatorImpl.restartInternal
private long restartInternal(long oldExecutionId, Properties restartParameters) throws JobExecutionAlreadyCompleteException, NoSuchJobExecutionException, JobExecutionNotMostRecentException, JobRestartException, JobSecurityException { if (authService != null) { authService.authorizedJobRestartByExecution(oldExecutionId); } if (logger.isLoggable(Level.FINE)) { logger.fine("JobOperator restart, with old executionId = " + oldExecutionId + "\n" + traceJobParameters(restartParameters)); } //Check if there are no job executions and step executions running. BatchStatusValidator.validateStatusAtExecutionRestart(oldExecutionId, restartParameters); //Set instance state to submitted to be consistent with start long instanceId = getPersistenceManagerService().getJobInstanceIdFromExecutionId(oldExecutionId); getPersistenceManagerService().updateJobInstanceOnRestart(instanceId, new Date()); WSJobExecution jobExecution = getPersistenceManagerService().createJobExecution(instanceId, restartParameters, new Date()); long newExecutionId = getBatchKernelService().restartJob(jobExecution.getExecutionId(), restartParameters).getKey(); if (logger.isLoggable(Level.FINE)) { logger.fine("Restarted job with new executionId: " + newExecutionId + ", and old executionID: " + oldExecutionId); } return newExecutionId; }
java
private long restartInternal(long oldExecutionId, Properties restartParameters) throws JobExecutionAlreadyCompleteException, NoSuchJobExecutionException, JobExecutionNotMostRecentException, JobRestartException, JobSecurityException { if (authService != null) { authService.authorizedJobRestartByExecution(oldExecutionId); } if (logger.isLoggable(Level.FINE)) { logger.fine("JobOperator restart, with old executionId = " + oldExecutionId + "\n" + traceJobParameters(restartParameters)); } //Check if there are no job executions and step executions running. BatchStatusValidator.validateStatusAtExecutionRestart(oldExecutionId, restartParameters); //Set instance state to submitted to be consistent with start long instanceId = getPersistenceManagerService().getJobInstanceIdFromExecutionId(oldExecutionId); getPersistenceManagerService().updateJobInstanceOnRestart(instanceId, new Date()); WSJobExecution jobExecution = getPersistenceManagerService().createJobExecution(instanceId, restartParameters, new Date()); long newExecutionId = getBatchKernelService().restartJob(jobExecution.getExecutionId(), restartParameters).getKey(); if (logger.isLoggable(Level.FINE)) { logger.fine("Restarted job with new executionId: " + newExecutionId + ", and old executionID: " + oldExecutionId); } return newExecutionId; }
[ "private", "long", "restartInternal", "(", "long", "oldExecutionId", ",", "Properties", "restartParameters", ")", "throws", "JobExecutionAlreadyCompleteException", ",", "NoSuchJobExecutionException", ",", "JobExecutionNotMostRecentException", ",", "JobRestartException", ",", "JobSecurityException", "{", "if", "(", "authService", "!=", "null", ")", "{", "authService", ".", "authorizedJobRestartByExecution", "(", "oldExecutionId", ")", ";", "}", "if", "(", "logger", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "{", "logger", ".", "fine", "(", "\"JobOperator restart, with old executionId = \"", "+", "oldExecutionId", "+", "\"\\n\"", "+", "traceJobParameters", "(", "restartParameters", ")", ")", ";", "}", "//Check if there are no job executions and step executions running.", "BatchStatusValidator", ".", "validateStatusAtExecutionRestart", "(", "oldExecutionId", ",", "restartParameters", ")", ";", "//Set instance state to submitted to be consistent with start", "long", "instanceId", "=", "getPersistenceManagerService", "(", ")", ".", "getJobInstanceIdFromExecutionId", "(", "oldExecutionId", ")", ";", "getPersistenceManagerService", "(", ")", ".", "updateJobInstanceOnRestart", "(", "instanceId", ",", "new", "Date", "(", ")", ")", ";", "WSJobExecution", "jobExecution", "=", "getPersistenceManagerService", "(", ")", ".", "createJobExecution", "(", "instanceId", ",", "restartParameters", ",", "new", "Date", "(", ")", ")", ";", "long", "newExecutionId", "=", "getBatchKernelService", "(", ")", ".", "restartJob", "(", "jobExecution", ".", "getExecutionId", "(", ")", ",", "restartParameters", ")", ".", "getKey", "(", ")", ";", "if", "(", "logger", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "{", "logger", ".", "fine", "(", "\"Restarted job with new executionId: \"", "+", "newExecutionId", "+", "\", and old executionID: \"", "+", "oldExecutionId", ")", ";", "}", "return", "newExecutionId", ";", "}" ]
Restart the given execution using the given jobparams. @return execId of restarted job.
[ "Restart", "the", "given", "execution", "using", "the", "given", "jobparams", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/api/impl/JobOperatorImpl.java#L651-L676
train
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/MBeans.java
MBeans.getMessageDigestMD5
private void getMessageDigestMD5() throws AttributeNotFoundException { if (MBeans.messageDigestMD5 == null) { try { MBeans.messageDigestMD5 = MessageDigestUtility.createMessageDigest("MD5"); } catch (NoSuchAlgorithmException e) { Tr.error(tc, "DYNA1044E", new Object[] { e.getMessage() }); throw new AttributeNotFoundException("Message digest for MD5 is not available. " + e.getMessage()); } } }
java
private void getMessageDigestMD5() throws AttributeNotFoundException { if (MBeans.messageDigestMD5 == null) { try { MBeans.messageDigestMD5 = MessageDigestUtility.createMessageDigest("MD5"); } catch (NoSuchAlgorithmException e) { Tr.error(tc, "DYNA1044E", new Object[] { e.getMessage() }); throw new AttributeNotFoundException("Message digest for MD5 is not available. " + e.getMessage()); } } }
[ "private", "void", "getMessageDigestMD5", "(", ")", "throws", "AttributeNotFoundException", "{", "if", "(", "MBeans", ".", "messageDigestMD5", "==", "null", ")", "{", "try", "{", "MBeans", ".", "messageDigestMD5", "=", "MessageDigestUtility", ".", "createMessageDigest", "(", "\"MD5\"", ")", ";", "}", "catch", "(", "NoSuchAlgorithmException", "e", ")", "{", "Tr", ".", "error", "(", "tc", ",", "\"DYNA1044E\"", ",", "new", "Object", "[", "]", "{", "e", ".", "getMessage", "(", ")", "}", ")", ";", "throw", "new", "AttributeNotFoundException", "(", "\"Message digest for MD5 is not available. \"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}", "}" ]
create messageDigest for MD5 algoritm if it is not created.
[ "create", "messageDigest", "for", "MD5", "algoritm", "if", "it", "is", "not", "created", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/MBeans.java#L651-L660
train
OpenLiberty/open-liberty
dev/com.ibm.ws.config/src/com/ibm/ws/config/xml/internal/metatype/ExtendedObjectClassDefinitionImpl.java
ExtendedObjectClassDefinitionImpl.getAttributeMap
@Override @Trivial public Map<String, ExtendedAttributeDefinition> getAttributeMap() { Map<String, ExtendedAttributeDefinition> map = null; AttributeDefinition[] attrDefs = getAttributeDefinitions(ObjectClassDefinition.ALL); if (attrDefs != null) { map = new HashMap<String, ExtendedAttributeDefinition>(); for (AttributeDefinition attrDef : attrDefs) { map.put(attrDef.getID(), new ExtendedAttributeDefinitionImpl(attrDef)); } } else { map = Collections.emptyMap(); } return map; }
java
@Override @Trivial public Map<String, ExtendedAttributeDefinition> getAttributeMap() { Map<String, ExtendedAttributeDefinition> map = null; AttributeDefinition[] attrDefs = getAttributeDefinitions(ObjectClassDefinition.ALL); if (attrDefs != null) { map = new HashMap<String, ExtendedAttributeDefinition>(); for (AttributeDefinition attrDef : attrDefs) { map.put(attrDef.getID(), new ExtendedAttributeDefinitionImpl(attrDef)); } } else { map = Collections.emptyMap(); } return map; }
[ "@", "Override", "@", "Trivial", "public", "Map", "<", "String", ",", "ExtendedAttributeDefinition", ">", "getAttributeMap", "(", ")", "{", "Map", "<", "String", ",", "ExtendedAttributeDefinition", ">", "map", "=", "null", ";", "AttributeDefinition", "[", "]", "attrDefs", "=", "getAttributeDefinitions", "(", "ObjectClassDefinition", ".", "ALL", ")", ";", "if", "(", "attrDefs", "!=", "null", ")", "{", "map", "=", "new", "HashMap", "<", "String", ",", "ExtendedAttributeDefinition", ">", "(", ")", ";", "for", "(", "AttributeDefinition", "attrDef", ":", "attrDefs", ")", "{", "map", ".", "put", "(", "attrDef", ".", "getID", "(", ")", ",", "new", "ExtendedAttributeDefinitionImpl", "(", "attrDef", ")", ")", ";", "}", "}", "else", "{", "map", "=", "Collections", ".", "emptyMap", "(", ")", ";", "}", "return", "map", ";", "}" ]
ONLY USED BY SCHEMA WRITER
[ "ONLY", "USED", "BY", "SCHEMA", "WRITER" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.config/src/com/ibm/ws/config/xml/internal/metatype/ExtendedObjectClassDefinitionImpl.java#L270-L284
train
OpenLiberty/open-liberty
dev/com.ibm.ws.config/src/com/ibm/ws/config/xml/internal/metatype/ExtendedObjectClassDefinitionImpl.java
ExtendedObjectClassDefinitionImpl.getAliasName
private static String getAliasName(String alias, String bundleLocation) { String newAlias = alias; if (alias != null && !alias.isEmpty()) { try { if (bundleLocation != null && !bundleLocation.isEmpty()) { if (bundleLocation.startsWith(XMLConfigConstants.BUNDLE_LOC_KERNEL_TAG)) { // nothing to do. The alias is returned. } else if (bundleLocation.startsWith(XMLConfigConstants.BUNDLE_LOC_FEATURE_TAG)) { // Check for the presence of a product extension location. int index = bundleLocation.indexOf(XMLConfigConstants.BUNDLE_LOC_PROD_EXT_TAG); if (index != -1) { index += XMLConfigConstants.BUNDLE_LOC_PROD_EXT_TAG.length(); int endIndex = bundleLocation.indexOf(":", index); String productName = bundleLocation.substring(index, endIndex); newAlias = productName + "_" + alias; } } else if (bundleLocation.startsWith(XMLConfigConstants.BUNDLE_LOC_CONNECTOR_TAG)) { // nothing to do. The alias is returned. } else { // Unknown location. Ignore the alias. If bundles are installed through fileInstall, // bundle resolution should happen through the pid or factoryPid. newAlias = null; } } } catch (Throwable t) { // An exception here would be bad. Need an ffdc. } } return newAlias; }
java
private static String getAliasName(String alias, String bundleLocation) { String newAlias = alias; if (alias != null && !alias.isEmpty()) { try { if (bundleLocation != null && !bundleLocation.isEmpty()) { if (bundleLocation.startsWith(XMLConfigConstants.BUNDLE_LOC_KERNEL_TAG)) { // nothing to do. The alias is returned. } else if (bundleLocation.startsWith(XMLConfigConstants.BUNDLE_LOC_FEATURE_TAG)) { // Check for the presence of a product extension location. int index = bundleLocation.indexOf(XMLConfigConstants.BUNDLE_LOC_PROD_EXT_TAG); if (index != -1) { index += XMLConfigConstants.BUNDLE_LOC_PROD_EXT_TAG.length(); int endIndex = bundleLocation.indexOf(":", index); String productName = bundleLocation.substring(index, endIndex); newAlias = productName + "_" + alias; } } else if (bundleLocation.startsWith(XMLConfigConstants.BUNDLE_LOC_CONNECTOR_TAG)) { // nothing to do. The alias is returned. } else { // Unknown location. Ignore the alias. If bundles are installed through fileInstall, // bundle resolution should happen through the pid or factoryPid. newAlias = null; } } } catch (Throwable t) { // An exception here would be bad. Need an ffdc. } } return newAlias; }
[ "private", "static", "String", "getAliasName", "(", "String", "alias", ",", "String", "bundleLocation", ")", "{", "String", "newAlias", "=", "alias", ";", "if", "(", "alias", "!=", "null", "&&", "!", "alias", ".", "isEmpty", "(", ")", ")", "{", "try", "{", "if", "(", "bundleLocation", "!=", "null", "&&", "!", "bundleLocation", ".", "isEmpty", "(", ")", ")", "{", "if", "(", "bundleLocation", ".", "startsWith", "(", "XMLConfigConstants", ".", "BUNDLE_LOC_KERNEL_TAG", ")", ")", "{", "// nothing to do. The alias is returned.", "}", "else", "if", "(", "bundleLocation", ".", "startsWith", "(", "XMLConfigConstants", ".", "BUNDLE_LOC_FEATURE_TAG", ")", ")", "{", "// Check for the presence of a product extension location.", "int", "index", "=", "bundleLocation", ".", "indexOf", "(", "XMLConfigConstants", ".", "BUNDLE_LOC_PROD_EXT_TAG", ")", ";", "if", "(", "index", "!=", "-", "1", ")", "{", "index", "+=", "XMLConfigConstants", ".", "BUNDLE_LOC_PROD_EXT_TAG", ".", "length", "(", ")", ";", "int", "endIndex", "=", "bundleLocation", ".", "indexOf", "(", "\":\"", ",", "index", ")", ";", "String", "productName", "=", "bundleLocation", ".", "substring", "(", "index", ",", "endIndex", ")", ";", "newAlias", "=", "productName", "+", "\"_\"", "+", "alias", ";", "}", "}", "else", "if", "(", "bundleLocation", ".", "startsWith", "(", "XMLConfigConstants", ".", "BUNDLE_LOC_CONNECTOR_TAG", ")", ")", "{", "// nothing to do. The alias is returned.", "}", "else", "{", "// Unknown location. Ignore the alias. If bundles are installed through fileInstall,", "// bundle resolution should happen through the pid or factoryPid.", "newAlias", "=", "null", ";", "}", "}", "}", "catch", "(", "Throwable", "t", ")", "{", "// An exception here would be bad. Need an ffdc.", "}", "}", "return", "newAlias", ";", "}" ]
Prefixes the alias with the product extension name if there is a product extension associated to this OCD. @param alias The alias name to process. @param bundleLocation bundle location to analyze to provide prefix for the alias @return The new alias possibly including a prefix based on the bundle location.
[ "Prefixes", "the", "alias", "with", "the", "product", "extension", "name", "if", "there", "is", "a", "product", "extension", "associated", "to", "this", "OCD", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.config/src/com/ibm/ws/config/xml/internal/metatype/ExtendedObjectClassDefinitionImpl.java#L383-L414
train
OpenLiberty/open-liberty
dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/ContainerClassLoader.java
ContainerClassLoader.getBytes
@Trivial private static byte[] getBytes(InputStream stream, int knownSize) throws IOException { try { if (knownSize == -1) { ByteArrayOutputStream byteOut = new ByteArrayOutputStream(); try { byte[] bytes = new byte[1024]; int read; while (0 <= (read = stream.read(bytes))) byteOut.write(bytes, 0, read); return byteOut.toByteArray(); } finally { Util.tryToClose(byteOut); } } else { byte[] bytes = new byte[knownSize]; int read; int offset = 0; while (knownSize > 0 && (read = stream.read(bytes, offset, knownSize)) > 0) { offset += read; knownSize -= read; } return bytes; } } finally { Util.tryToClose(stream); } }
java
@Trivial private static byte[] getBytes(InputStream stream, int knownSize) throws IOException { try { if (knownSize == -1) { ByteArrayOutputStream byteOut = new ByteArrayOutputStream(); try { byte[] bytes = new byte[1024]; int read; while (0 <= (read = stream.read(bytes))) byteOut.write(bytes, 0, read); return byteOut.toByteArray(); } finally { Util.tryToClose(byteOut); } } else { byte[] bytes = new byte[knownSize]; int read; int offset = 0; while (knownSize > 0 && (read = stream.read(bytes, offset, knownSize)) > 0) { offset += read; knownSize -= read; } return bytes; } } finally { Util.tryToClose(stream); } }
[ "@", "Trivial", "private", "static", "byte", "[", "]", "getBytes", "(", "InputStream", "stream", ",", "int", "knownSize", ")", "throws", "IOException", "{", "try", "{", "if", "(", "knownSize", "==", "-", "1", ")", "{", "ByteArrayOutputStream", "byteOut", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "try", "{", "byte", "[", "]", "bytes", "=", "new", "byte", "[", "1024", "]", ";", "int", "read", ";", "while", "(", "0", "<=", "(", "read", "=", "stream", ".", "read", "(", "bytes", ")", ")", ")", "byteOut", ".", "write", "(", "bytes", ",", "0", ",", "read", ")", ";", "return", "byteOut", ".", "toByteArray", "(", ")", ";", "}", "finally", "{", "Util", ".", "tryToClose", "(", "byteOut", ")", ";", "}", "}", "else", "{", "byte", "[", "]", "bytes", "=", "new", "byte", "[", "knownSize", "]", ";", "int", "read", ";", "int", "offset", "=", "0", ";", "while", "(", "knownSize", ">", "0", "&&", "(", "read", "=", "stream", ".", "read", "(", "bytes", ",", "offset", ",", "knownSize", ")", ")", ">", "0", ")", "{", "offset", "+=", "read", ";", "knownSize", "-=", "read", ";", "}", "return", "bytes", ";", "}", "}", "finally", "{", "Util", ".", "tryToClose", "(", "stream", ")", ";", "}", "}" ]
Util method to totally read an input stream into a byte array. Used for class definition. @param stream the stream to read. @return byte array of data from stream. @throws IOException if an error occurs.
[ "Util", "method", "to", "totally", "read", "an", "input", "stream", "into", "a", "byte", "array", ".", "Used", "for", "class", "definition", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/ContainerClassLoader.java#L124-L153
train
OpenLiberty/open-liberty
dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/ContainerClassLoader.java
ContainerClassLoader.getSharedClassCacheURL
static URL getSharedClassCacheURL(URL resourceURL, String resourceName) { URL sharedClassCacheURL; if (resourceURL == null) { sharedClassCacheURL = null; } else { String protocol = resourceURL.getProtocol(); if ("jar".equals(protocol)) { sharedClassCacheURL = resourceURL; } else if ("wsjar".equals(protocol)) { try { sharedClassCacheURL = new URL(resourceURL.toExternalForm().substring(2)); } catch (MalformedURLException e) { sharedClassCacheURL = null; } } else if (!"file".equals(protocol)) { sharedClassCacheURL = null; } else { String externalForm = resourceURL.toExternalForm(); if (externalForm.endsWith(resourceName)) { try { sharedClassCacheURL = new URL(externalForm.substring(0, externalForm.length() - resourceName.length())); } catch (MalformedURLException e) { sharedClassCacheURL = null; } } else { sharedClassCacheURL = null; } } } return sharedClassCacheURL; }
java
static URL getSharedClassCacheURL(URL resourceURL, String resourceName) { URL sharedClassCacheURL; if (resourceURL == null) { sharedClassCacheURL = null; } else { String protocol = resourceURL.getProtocol(); if ("jar".equals(protocol)) { sharedClassCacheURL = resourceURL; } else if ("wsjar".equals(protocol)) { try { sharedClassCacheURL = new URL(resourceURL.toExternalForm().substring(2)); } catch (MalformedURLException e) { sharedClassCacheURL = null; } } else if (!"file".equals(protocol)) { sharedClassCacheURL = null; } else { String externalForm = resourceURL.toExternalForm(); if (externalForm.endsWith(resourceName)) { try { sharedClassCacheURL = new URL(externalForm.substring(0, externalForm.length() - resourceName.length())); } catch (MalformedURLException e) { sharedClassCacheURL = null; } } else { sharedClassCacheURL = null; } } } return sharedClassCacheURL; }
[ "static", "URL", "getSharedClassCacheURL", "(", "URL", "resourceURL", ",", "String", "resourceName", ")", "{", "URL", "sharedClassCacheURL", ";", "if", "(", "resourceURL", "==", "null", ")", "{", "sharedClassCacheURL", "=", "null", ";", "}", "else", "{", "String", "protocol", "=", "resourceURL", ".", "getProtocol", "(", ")", ";", "if", "(", "\"jar\"", ".", "equals", "(", "protocol", ")", ")", "{", "sharedClassCacheURL", "=", "resourceURL", ";", "}", "else", "if", "(", "\"wsjar\"", ".", "equals", "(", "protocol", ")", ")", "{", "try", "{", "sharedClassCacheURL", "=", "new", "URL", "(", "resourceURL", ".", "toExternalForm", "(", ")", ".", "substring", "(", "2", ")", ")", ";", "}", "catch", "(", "MalformedURLException", "e", ")", "{", "sharedClassCacheURL", "=", "null", ";", "}", "}", "else", "if", "(", "!", "\"file\"", ".", "equals", "(", "protocol", ")", ")", "{", "sharedClassCacheURL", "=", "null", ";", "}", "else", "{", "String", "externalForm", "=", "resourceURL", ".", "toExternalForm", "(", ")", ";", "if", "(", "externalForm", ".", "endsWith", "(", "resourceName", ")", ")", "{", "try", "{", "sharedClassCacheURL", "=", "new", "URL", "(", "externalForm", ".", "substring", "(", "0", ",", "externalForm", ".", "length", "(", ")", "-", "resourceName", ".", "length", "(", ")", ")", ")", ";", "}", "catch", "(", "MalformedURLException", "e", ")", "{", "sharedClassCacheURL", "=", "null", ";", "}", "}", "else", "{", "sharedClassCacheURL", "=", "null", ";", "}", "}", "}", "return", "sharedClassCacheURL", ";", "}" ]
Computes the shared class cache URL from the resource URL. If the URL is a jar protocol URL, then use it as is. If it is a wsjar protocol URL, then change it to a jar protocol URL. If it is a file protocol URL, confirm that the URL ends with the class file name, and return the directory before the package qualified class file name. @param resourceURL The URL of the location of the class file. @param resourceName The resource path of the class file. i.e. package/sub/MyClass.class @return the URL to pass to the shared class cache, or null if protocol is wrong, or path doesn't include resourceName.
[ "Computes", "the", "shared", "class", "cache", "URL", "from", "the", "resource", "URL", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/ContainerClassLoader.java#L217-L247
train
OpenLiberty/open-liberty
dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/ContainerClassLoader.java
ContainerClassLoader.definePackage
public Package definePackage(String name, Manifest manifest, URL sealBase) throws IllegalArgumentException { Attributes mA = manifest.getMainAttributes(); String specTitle = mA.getValue(Name.SPECIFICATION_TITLE); String specVersion = mA.getValue(Name.SPECIFICATION_VERSION); String specVendor = mA.getValue(Name.SPECIFICATION_VENDOR); String implTitle = mA.getValue(Name.IMPLEMENTATION_TITLE); String implVersion = mA.getValue(Name.IMPLEMENTATION_VERSION); String implVendor = mA.getValue(Name.IMPLEMENTATION_VENDOR); String sealedString = mA.getValue(Name.SEALED); Boolean sealed = (sealedString == null ? Boolean.FALSE : sealedString.equalsIgnoreCase("true")); //now overwrite global attributes with the specific attributes String unixName = name.replaceAll("\\.", "/") + "/"; //replace all dots with slash and add trailing slash mA = manifest.getAttributes(unixName); if (mA != null) { String s = mA.getValue(Name.SPECIFICATION_TITLE); if (s != null) specTitle = s; s = mA.getValue(Name.SPECIFICATION_VERSION); if (s != null) specVersion = s; s = mA.getValue(Name.SPECIFICATION_VENDOR); if (s != null) specVendor = s; s = mA.getValue(Name.IMPLEMENTATION_TITLE); if (s != null) implTitle = s; s = mA.getValue(Name.IMPLEMENTATION_VERSION); if (s != null) implVersion = s; s = mA.getValue(Name.IMPLEMENTATION_VENDOR); if (s != null) implVendor = s; s = mA.getValue(Name.SEALED); if (s != null) sealed = s.equalsIgnoreCase("true"); } if (!sealed) sealBase = null; return definePackage(name, specTitle, specVersion, specVendor, implTitle, implVersion, implVendor, sealBase); }
java
public Package definePackage(String name, Manifest manifest, URL sealBase) throws IllegalArgumentException { Attributes mA = manifest.getMainAttributes(); String specTitle = mA.getValue(Name.SPECIFICATION_TITLE); String specVersion = mA.getValue(Name.SPECIFICATION_VERSION); String specVendor = mA.getValue(Name.SPECIFICATION_VENDOR); String implTitle = mA.getValue(Name.IMPLEMENTATION_TITLE); String implVersion = mA.getValue(Name.IMPLEMENTATION_VERSION); String implVendor = mA.getValue(Name.IMPLEMENTATION_VENDOR); String sealedString = mA.getValue(Name.SEALED); Boolean sealed = (sealedString == null ? Boolean.FALSE : sealedString.equalsIgnoreCase("true")); //now overwrite global attributes with the specific attributes String unixName = name.replaceAll("\\.", "/") + "/"; //replace all dots with slash and add trailing slash mA = manifest.getAttributes(unixName); if (mA != null) { String s = mA.getValue(Name.SPECIFICATION_TITLE); if (s != null) specTitle = s; s = mA.getValue(Name.SPECIFICATION_VERSION); if (s != null) specVersion = s; s = mA.getValue(Name.SPECIFICATION_VENDOR); if (s != null) specVendor = s; s = mA.getValue(Name.IMPLEMENTATION_TITLE); if (s != null) implTitle = s; s = mA.getValue(Name.IMPLEMENTATION_VERSION); if (s != null) implVersion = s; s = mA.getValue(Name.IMPLEMENTATION_VENDOR); if (s != null) implVendor = s; s = mA.getValue(Name.SEALED); if (s != null) sealed = s.equalsIgnoreCase("true"); } if (!sealed) sealBase = null; return definePackage(name, specTitle, specVersion, specVendor, implTitle, implVersion, implVendor, sealBase); }
[ "public", "Package", "definePackage", "(", "String", "name", ",", "Manifest", "manifest", ",", "URL", "sealBase", ")", "throws", "IllegalArgumentException", "{", "Attributes", "mA", "=", "manifest", ".", "getMainAttributes", "(", ")", ";", "String", "specTitle", "=", "mA", ".", "getValue", "(", "Name", ".", "SPECIFICATION_TITLE", ")", ";", "String", "specVersion", "=", "mA", ".", "getValue", "(", "Name", ".", "SPECIFICATION_VERSION", ")", ";", "String", "specVendor", "=", "mA", ".", "getValue", "(", "Name", ".", "SPECIFICATION_VENDOR", ")", ";", "String", "implTitle", "=", "mA", ".", "getValue", "(", "Name", ".", "IMPLEMENTATION_TITLE", ")", ";", "String", "implVersion", "=", "mA", ".", "getValue", "(", "Name", ".", "IMPLEMENTATION_VERSION", ")", ";", "String", "implVendor", "=", "mA", ".", "getValue", "(", "Name", ".", "IMPLEMENTATION_VENDOR", ")", ";", "String", "sealedString", "=", "mA", ".", "getValue", "(", "Name", ".", "SEALED", ")", ";", "Boolean", "sealed", "=", "(", "sealedString", "==", "null", "?", "Boolean", ".", "FALSE", ":", "sealedString", ".", "equalsIgnoreCase", "(", "\"true\"", ")", ")", ";", "//now overwrite global attributes with the specific attributes", "String", "unixName", "=", "name", ".", "replaceAll", "(", "\"\\\\.\"", ",", "\"/\"", ")", "+", "\"/\"", ";", "//replace all dots with slash and add trailing slash", "mA", "=", "manifest", ".", "getAttributes", "(", "unixName", ")", ";", "if", "(", "mA", "!=", "null", ")", "{", "String", "s", "=", "mA", ".", "getValue", "(", "Name", ".", "SPECIFICATION_TITLE", ")", ";", "if", "(", "s", "!=", "null", ")", "specTitle", "=", "s", ";", "s", "=", "mA", ".", "getValue", "(", "Name", ".", "SPECIFICATION_VERSION", ")", ";", "if", "(", "s", "!=", "null", ")", "specVersion", "=", "s", ";", "s", "=", "mA", ".", "getValue", "(", "Name", ".", "SPECIFICATION_VENDOR", ")", ";", "if", "(", "s", "!=", "null", ")", "specVendor", "=", "s", ";", "s", "=", "mA", ".", "getValue", "(", "Name", ".", "IMPLEMENTATION_TITLE", ")", ";", "if", "(", "s", "!=", "null", ")", "implTitle", "=", "s", ";", "s", "=", "mA", ".", "getValue", "(", "Name", ".", "IMPLEMENTATION_VERSION", ")", ";", "if", "(", "s", "!=", "null", ")", "implVersion", "=", "s", ";", "s", "=", "mA", ".", "getValue", "(", "Name", ".", "IMPLEMENTATION_VENDOR", ")", ";", "if", "(", "s", "!=", "null", ")", "implVendor", "=", "s", ";", "s", "=", "mA", ".", "getValue", "(", "Name", ".", "SEALED", ")", ";", "if", "(", "s", "!=", "null", ")", "sealed", "=", "s", ".", "equalsIgnoreCase", "(", "\"true\"", ")", ";", "}", "if", "(", "!", "sealed", ")", "sealBase", "=", "null", ";", "return", "definePackage", "(", "name", ",", "specTitle", ",", "specVersion", ",", "specVendor", ",", "implTitle", ",", "implVersion", ",", "implVendor", ",", "sealBase", ")", ";", "}" ]
to set vars passed up to ClassLoader.definePackage.
[ "to", "set", "vars", "passed", "up", "to", "ClassLoader", ".", "definePackage", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/ContainerClassLoader.java#L1496-L1537
train
OpenLiberty/open-liberty
dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/ContainerClassLoader.java
ContainerClassLoader.addToClassPath
protected void addToClassPath(Iterable<ArtifactContainer> artifacts) { for (ArtifactContainer art : artifacts) { smartClassPath.addArtifactContainer(art); } }
java
protected void addToClassPath(Iterable<ArtifactContainer> artifacts) { for (ArtifactContainer art : artifacts) { smartClassPath.addArtifactContainer(art); } }
[ "protected", "void", "addToClassPath", "(", "Iterable", "<", "ArtifactContainer", ">", "artifacts", ")", "{", "for", "(", "ArtifactContainer", "art", ":", "artifacts", ")", "{", "smartClassPath", ".", "addArtifactContainer", "(", "art", ")", ";", "}", "}" ]
Add all the artifact containers to the class path
[ "Add", "all", "the", "artifact", "containers", "to", "the", "class", "path" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/ContainerClassLoader.java#L1542-L1547
train
OpenLiberty/open-liberty
dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/ContainerClassLoader.java
ContainerClassLoader.addLibraryFile
@FFDCIgnore(NullPointerException.class) protected void addLibraryFile(File f) { if (!!!f.exists()) { if (tc.isWarningEnabled()) { Tr.warning(tc, "cls.library.archive", f, new FileNotFoundException(f.getName())); } return; } // Skip files that are not archives of some sort. if (!f.isDirectory() && !isArchive(f)) return; //this area subject to refactor following shared lib rework.. //ideally the shared lib code will start passing us ArtifactContainers, and it //will own the management of the ACF via DS. //NASTY.. need to use DS to get the ACF, not OSGi backdoor ;p BundleContext bc = FrameworkUtil.getBundle(ContainerClassLoader.class).getBundleContext(); ServiceReference<ArtifactContainerFactory> acfsr = bc.getServiceReference(ArtifactContainerFactory.class); if (acfsr != null) { ArtifactContainerFactory acf = bc.getService(acfsr); if (acf != null) { //NASTY.. using this bundle as the cache dir location for the data file.. try { ArtifactContainer ac = acf.getContainer(bc.getBundle().getDataFile(""), f); smartClassPath.addArtifactContainer(ac); } catch (NullPointerException e) { // TODO completed under task 74097 if (tc.isDebugEnabled()) { Tr.debug(tc, "Exception while adding files to classpath", e); } if (tc.isInfoEnabled()) { Tr.info(tc, "cls.library.file.forbidden", f); } } } } }
java
@FFDCIgnore(NullPointerException.class) protected void addLibraryFile(File f) { if (!!!f.exists()) { if (tc.isWarningEnabled()) { Tr.warning(tc, "cls.library.archive", f, new FileNotFoundException(f.getName())); } return; } // Skip files that are not archives of some sort. if (!f.isDirectory() && !isArchive(f)) return; //this area subject to refactor following shared lib rework.. //ideally the shared lib code will start passing us ArtifactContainers, and it //will own the management of the ACF via DS. //NASTY.. need to use DS to get the ACF, not OSGi backdoor ;p BundleContext bc = FrameworkUtil.getBundle(ContainerClassLoader.class).getBundleContext(); ServiceReference<ArtifactContainerFactory> acfsr = bc.getServiceReference(ArtifactContainerFactory.class); if (acfsr != null) { ArtifactContainerFactory acf = bc.getService(acfsr); if (acf != null) { //NASTY.. using this bundle as the cache dir location for the data file.. try { ArtifactContainer ac = acf.getContainer(bc.getBundle().getDataFile(""), f); smartClassPath.addArtifactContainer(ac); } catch (NullPointerException e) { // TODO completed under task 74097 if (tc.isDebugEnabled()) { Tr.debug(tc, "Exception while adding files to classpath", e); } if (tc.isInfoEnabled()) { Tr.info(tc, "cls.library.file.forbidden", f); } } } } }
[ "@", "FFDCIgnore", "(", "NullPointerException", ".", "class", ")", "protected", "void", "addLibraryFile", "(", "File", "f", ")", "{", "if", "(", "!", "!", "!", "f", ".", "exists", "(", ")", ")", "{", "if", "(", "tc", ".", "isWarningEnabled", "(", ")", ")", "{", "Tr", ".", "warning", "(", "tc", ",", "\"cls.library.archive\"", ",", "f", ",", "new", "FileNotFoundException", "(", "f", ".", "getName", "(", ")", ")", ")", ";", "}", "return", ";", "}", "// Skip files that are not archives of some sort.", "if", "(", "!", "f", ".", "isDirectory", "(", ")", "&&", "!", "isArchive", "(", "f", ")", ")", "return", ";", "//this area subject to refactor following shared lib rework..", "//ideally the shared lib code will start passing us ArtifactContainers, and it", "//will own the management of the ACF via DS.", "//NASTY.. need to use DS to get the ACF, not OSGi backdoor ;p", "BundleContext", "bc", "=", "FrameworkUtil", ".", "getBundle", "(", "ContainerClassLoader", ".", "class", ")", ".", "getBundleContext", "(", ")", ";", "ServiceReference", "<", "ArtifactContainerFactory", ">", "acfsr", "=", "bc", ".", "getServiceReference", "(", "ArtifactContainerFactory", ".", "class", ")", ";", "if", "(", "acfsr", "!=", "null", ")", "{", "ArtifactContainerFactory", "acf", "=", "bc", ".", "getService", "(", "acfsr", ")", ";", "if", "(", "acf", "!=", "null", ")", "{", "//NASTY.. using this bundle as the cache dir location for the data file..", "try", "{", "ArtifactContainer", "ac", "=", "acf", ".", "getContainer", "(", "bc", ".", "getBundle", "(", ")", ".", "getDataFile", "(", "\"\"", ")", ",", "f", ")", ";", "smartClassPath", ".", "addArtifactContainer", "(", "ac", ")", ";", "}", "catch", "(", "NullPointerException", "e", ")", "{", "// TODO completed under task 74097", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Exception while adding files to classpath\"", ",", "e", ")", ";", "}", "if", "(", "tc", ".", "isInfoEnabled", "(", ")", ")", "{", "Tr", ".", "info", "(", "tc", ",", "\"cls.library.file.forbidden\"", ",", "f", ")", ";", "}", "}", "}", "}", "}" ]
Method to allow adding shared libraries to this classloader, currently using File. @param f the File to add as a shared lib.. can be a dir or a jar (or a loose xml ;p)
[ "Method", "to", "allow", "adding", "shared", "libraries", "to", "this", "classloader", "currently", "using", "File", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/ContainerClassLoader.java#L1554-L1593
train
OpenLiberty/open-liberty
dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/ContainerClassLoader.java
ContainerClassLoader.isArchive
@FFDCIgnore(PrivilegedActionException.class) private boolean isArchive(File f) { final File target = f; try { AccessController.doPrivileged(new PrivilegedExceptionAction<Void>() { @Override public Void run() throws IOException { new ZipFile(target).close(); return null; } }); } catch (PrivilegedActionException e) { Exception innerException = e.getException(); if (tc.isDebugEnabled()) { Tr.debug(tc, "The following file can not be added to the classpath " + f + " due to error ", innerException); } return false; } return true; }
java
@FFDCIgnore(PrivilegedActionException.class) private boolean isArchive(File f) { final File target = f; try { AccessController.doPrivileged(new PrivilegedExceptionAction<Void>() { @Override public Void run() throws IOException { new ZipFile(target).close(); return null; } }); } catch (PrivilegedActionException e) { Exception innerException = e.getException(); if (tc.isDebugEnabled()) { Tr.debug(tc, "The following file can not be added to the classpath " + f + " due to error ", innerException); } return false; } return true; }
[ "@", "FFDCIgnore", "(", "PrivilegedActionException", ".", "class", ")", "private", "boolean", "isArchive", "(", "File", "f", ")", "{", "final", "File", "target", "=", "f", ";", "try", "{", "AccessController", ".", "doPrivileged", "(", "new", "PrivilegedExceptionAction", "<", "Void", ">", "(", ")", "{", "@", "Override", "public", "Void", "run", "(", ")", "throws", "IOException", "{", "new", "ZipFile", "(", "target", ")", ".", "close", "(", ")", ";", "return", "null", ";", "}", "}", ")", ";", "}", "catch", "(", "PrivilegedActionException", "e", ")", "{", "Exception", "innerException", "=", "e", ".", "getException", "(", ")", ";", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"The following file can not be added to the classpath \"", "+", "f", "+", "\" due to error \"", ",", "innerException", ")", ";", "}", "return", "false", ";", "}", "return", "true", ";", "}" ]
Check that a file is an archive @param f
[ "Check", "that", "a", "file", "is", "an", "archive" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/ContainerClassLoader.java#L1604-L1623
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jndi.url.contexts/src/com/ibm/ws/jndi/url/contexts/javacolon/JavaJNDIComponentMetaDataAccessor.java
JavaJNDIComponentMetaDataAccessor.getComponentMetaData
public static ComponentMetaData getComponentMetaData(JavaColonNamespace namespace, String name) throws NamingException { ComponentMetaData cmd = ComponentMetaDataAccessorImpl.getComponentMetaDataAccessor().getComponentMetaData(); if (cmd == null) { String fullName = name.isEmpty() ? namespace.toString() : namespace + "/" + name; String msg = Tr.formatMessage(tc, "JNDI_NON_JEE_THREAD_CWWKN0100E", fullName); NamingException nex = new NamingException(msg); throw nex; } return cmd; }
java
public static ComponentMetaData getComponentMetaData(JavaColonNamespace namespace, String name) throws NamingException { ComponentMetaData cmd = ComponentMetaDataAccessorImpl.getComponentMetaDataAccessor().getComponentMetaData(); if (cmd == null) { String fullName = name.isEmpty() ? namespace.toString() : namespace + "/" + name; String msg = Tr.formatMessage(tc, "JNDI_NON_JEE_THREAD_CWWKN0100E", fullName); NamingException nex = new NamingException(msg); throw nex; } return cmd; }
[ "public", "static", "ComponentMetaData", "getComponentMetaData", "(", "JavaColonNamespace", "namespace", ",", "String", "name", ")", "throws", "NamingException", "{", "ComponentMetaData", "cmd", "=", "ComponentMetaDataAccessorImpl", ".", "getComponentMetaDataAccessor", "(", ")", ".", "getComponentMetaData", "(", ")", ";", "if", "(", "cmd", "==", "null", ")", "{", "String", "fullName", "=", "name", ".", "isEmpty", "(", ")", "?", "namespace", ".", "toString", "(", ")", ":", "namespace", "+", "\"/\"", "+", "name", ";", "String", "msg", "=", "Tr", ".", "formatMessage", "(", "tc", ",", "\"JNDI_NON_JEE_THREAD_CWWKN0100E\"", ",", "fullName", ")", ";", "NamingException", "nex", "=", "new", "NamingException", "(", "msg", ")", ";", "throw", "nex", ";", "}", "return", "cmd", ";", "}" ]
Helper method to get the component metadata from the thread context. @return the component metadata data for the thread. @throws NamingException Throws NamingException if running on a non-Java EE thread.
[ "Helper", "method", "to", "get", "the", "component", "metadata", "from", "the", "thread", "context", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jndi.url.contexts/src/com/ibm/ws/jndi/url/contexts/javacolon/JavaJNDIComponentMetaDataAccessor.java#L36-L45
train
OpenLiberty/open-liberty
dev/com.ibm.ws.security/src/com/ibm/ws/security/internal/SecurityServiceImpl.java
SecurityServiceImpl.setConfiguration
@Reference(policy = ReferencePolicy.DYNAMIC, cardinality = ReferenceCardinality.MULTIPLE) protected Map<String, Object> setConfiguration(ServiceReference<SecurityConfiguration> ref) { String id = (String) ref.getProperty(KEY_ID); if (id != null) { configs.putReference(id, ref); } else { Tr.error(tc, "SECURITY_SERVICE_REQUIRED_SERVICE_WITHOUT_ID", "securityConfiguration"); } return getServiceProperties(); }
java
@Reference(policy = ReferencePolicy.DYNAMIC, cardinality = ReferenceCardinality.MULTIPLE) protected Map<String, Object> setConfiguration(ServiceReference<SecurityConfiguration> ref) { String id = (String) ref.getProperty(KEY_ID); if (id != null) { configs.putReference(id, ref); } else { Tr.error(tc, "SECURITY_SERVICE_REQUIRED_SERVICE_WITHOUT_ID", "securityConfiguration"); } return getServiceProperties(); }
[ "@", "Reference", "(", "policy", "=", "ReferencePolicy", ".", "DYNAMIC", ",", "cardinality", "=", "ReferenceCardinality", ".", "MULTIPLE", ")", "protected", "Map", "<", "String", ",", "Object", ">", "setConfiguration", "(", "ServiceReference", "<", "SecurityConfiguration", ">", "ref", ")", "{", "String", "id", "=", "(", "String", ")", "ref", ".", "getProperty", "(", "KEY_ID", ")", ";", "if", "(", "id", "!=", "null", ")", "{", "configs", ".", "putReference", "(", "id", ",", "ref", ")", ";", "}", "else", "{", "Tr", ".", "error", "(", "tc", ",", "\"SECURITY_SERVICE_REQUIRED_SERVICE_WITHOUT_ID\"", ",", "\"securityConfiguration\"", ")", ";", "}", "return", "getServiceProperties", "(", ")", ";", "}" ]
Method will be called for each SecurityConfiguration that is registered in the OSGi service registry. We maintain an internal map of these for easy access. If the ID is not defined for the configuration, it is incomplete and can not be used. @param ref Reference to a registered SecurityConfiguration
[ "Method", "will", "be", "called", "for", "each", "SecurityConfiguration", "that", "is", "registered", "in", "the", "OSGi", "service", "registry", ".", "We", "maintain", "an", "internal", "map", "of", "these", "for", "easy", "access", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security/src/com/ibm/ws/security/internal/SecurityServiceImpl.java#L92-L101
train
OpenLiberty/open-liberty
dev/com.ibm.ws.security/src/com/ibm/ws/security/internal/SecurityServiceImpl.java
SecurityServiceImpl.unsetConfiguration
protected Map<String, Object> unsetConfiguration(ServiceReference<SecurityConfiguration> ref) { configs.removeReference((String) ref.getProperty(KEY_ID), ref); return getServiceProperties(); }
java
protected Map<String, Object> unsetConfiguration(ServiceReference<SecurityConfiguration> ref) { configs.removeReference((String) ref.getProperty(KEY_ID), ref); return getServiceProperties(); }
[ "protected", "Map", "<", "String", ",", "Object", ">", "unsetConfiguration", "(", "ServiceReference", "<", "SecurityConfiguration", ">", "ref", ")", "{", "configs", ".", "removeReference", "(", "(", "String", ")", "ref", ".", "getProperty", "(", "KEY_ID", ")", ",", "ref", ")", ";", "return", "getServiceProperties", "(", ")", ";", "}" ]
Method will be called for each SecurityConfiguration that is unregistered in the OSGi service registry. We must remove this instance from our internal map. @param ref Reference to an unregistered SecurityConfiguration
[ "Method", "will", "be", "called", "for", "each", "SecurityConfiguration", "that", "is", "unregistered", "in", "the", "OSGi", "service", "registry", ".", "We", "must", "remove", "this", "instance", "from", "our", "internal", "map", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security/src/com/ibm/ws/security/internal/SecurityServiceImpl.java#L110-L113
train
OpenLiberty/open-liberty
dev/com.ibm.ws.security/src/com/ibm/ws/security/internal/SecurityServiceImpl.java
SecurityServiceImpl.setAuthentication
@Reference(policy = ReferencePolicy.DYNAMIC, cardinality = ReferenceCardinality.MULTIPLE) protected Map<String, Object> setAuthentication(ServiceReference<AuthenticationService> ref) { if (hasPropertiesFromFile(ref)) { String id = (String) ref.getProperty(KEY_ID); if (id != null) { authentication.putReference(id, ref); } else { Tr.error(tc, "SECURITY_SERVICE_REQUIRED_SERVICE_WITHOUT_ID", KEY_AUTHENTICATION); } } else { authentication.putReference(String.valueOf(ref.getProperty(KEY_SERVICE_ID)), ref); } // determine a new authentication service authnService.set(null); return getServiceProperties(); }
java
@Reference(policy = ReferencePolicy.DYNAMIC, cardinality = ReferenceCardinality.MULTIPLE) protected Map<String, Object> setAuthentication(ServiceReference<AuthenticationService> ref) { if (hasPropertiesFromFile(ref)) { String id = (String) ref.getProperty(KEY_ID); if (id != null) { authentication.putReference(id, ref); } else { Tr.error(tc, "SECURITY_SERVICE_REQUIRED_SERVICE_WITHOUT_ID", KEY_AUTHENTICATION); } } else { authentication.putReference(String.valueOf(ref.getProperty(KEY_SERVICE_ID)), ref); } // determine a new authentication service authnService.set(null); return getServiceProperties(); }
[ "@", "Reference", "(", "policy", "=", "ReferencePolicy", ".", "DYNAMIC", ",", "cardinality", "=", "ReferenceCardinality", ".", "MULTIPLE", ")", "protected", "Map", "<", "String", ",", "Object", ">", "setAuthentication", "(", "ServiceReference", "<", "AuthenticationService", ">", "ref", ")", "{", "if", "(", "hasPropertiesFromFile", "(", "ref", ")", ")", "{", "String", "id", "=", "(", "String", ")", "ref", ".", "getProperty", "(", "KEY_ID", ")", ";", "if", "(", "id", "!=", "null", ")", "{", "authentication", ".", "putReference", "(", "id", ",", "ref", ")", ";", "}", "else", "{", "Tr", ".", "error", "(", "tc", ",", "\"SECURITY_SERVICE_REQUIRED_SERVICE_WITHOUT_ID\"", ",", "KEY_AUTHENTICATION", ")", ";", "}", "}", "else", "{", "authentication", ".", "putReference", "(", "String", ".", "valueOf", "(", "ref", ".", "getProperty", "(", "KEY_SERVICE_ID", ")", ")", ",", "ref", ")", ";", "}", "// determine a new authentication service", "authnService", ".", "set", "(", "null", ")", ";", "return", "getServiceProperties", "(", ")", ";", "}" ]
Method will be called for each AuthenticationService that is registered in the OSGi service registry. We maintain an internal map of these for easy access. @param ref Reference to a registered AuthenticationService
[ "Method", "will", "be", "called", "for", "each", "AuthenticationService", "that", "is", "registered", "in", "the", "OSGi", "service", "registry", ".", "We", "maintain", "an", "internal", "map", "of", "these", "for", "easy", "access", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security/src/com/ibm/ws/security/internal/SecurityServiceImpl.java#L132-L148
train
OpenLiberty/open-liberty
dev/com.ibm.ws.security/src/com/ibm/ws/security/internal/SecurityServiceImpl.java
SecurityServiceImpl.unsetAuthentication
protected Map<String, Object> unsetAuthentication(ServiceReference<AuthenticationService> ref) { authentication.removeReference((String) ref.getProperty(KEY_ID), ref); authentication.removeReference(String.valueOf(ref.getProperty(KEY_SERVICE_ID)), ref); // determine a new authentication service authnService.set(null); return getServiceProperties(); }
java
protected Map<String, Object> unsetAuthentication(ServiceReference<AuthenticationService> ref) { authentication.removeReference((String) ref.getProperty(KEY_ID), ref); authentication.removeReference(String.valueOf(ref.getProperty(KEY_SERVICE_ID)), ref); // determine a new authentication service authnService.set(null); return getServiceProperties(); }
[ "protected", "Map", "<", "String", ",", "Object", ">", "unsetAuthentication", "(", "ServiceReference", "<", "AuthenticationService", ">", "ref", ")", "{", "authentication", ".", "removeReference", "(", "(", "String", ")", "ref", ".", "getProperty", "(", "KEY_ID", ")", ",", "ref", ")", ";", "authentication", ".", "removeReference", "(", "String", ".", "valueOf", "(", "ref", ".", "getProperty", "(", "KEY_SERVICE_ID", ")", ")", ",", "ref", ")", ";", "// determine a new authentication service", "authnService", ".", "set", "(", "null", ")", ";", "return", "getServiceProperties", "(", ")", ";", "}" ]
Method will be called for each AuthenticationService that is unregistered in the OSGi service registry. We must remove this instance from our internal map. @param ref Reference to an unregistered AuthenticationService
[ "Method", "will", "be", "called", "for", "each", "AuthenticationService", "that", "is", "unregistered", "in", "the", "OSGi", "service", "registry", ".", "We", "must", "remove", "this", "instance", "from", "our", "internal", "map", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security/src/com/ibm/ws/security/internal/SecurityServiceImpl.java#L157-L164
train
OpenLiberty/open-liberty
dev/com.ibm.ws.security/src/com/ibm/ws/security/internal/SecurityServiceImpl.java
SecurityServiceImpl.setAuthorization
@Reference(policy = ReferencePolicy.DYNAMIC, cardinality = ReferenceCardinality.MULTIPLE) protected Map<String, Object> setAuthorization(ServiceReference<AuthorizationService> ref) { if (hasPropertiesFromFile(ref)) { String id = (String) ref.getProperty(KEY_ID); if (id != null) { authorization.putReference(id, ref); } else { Tr.error(tc, "SECURITY_SERVICE_REQUIRED_SERVICE_WITHOUT_ID", KEY_AUTHORIZATION); } } else { authorization.putReference(String.valueOf(ref.getProperty(KEY_SERVICE_ID)), ref); } // determine a new authorization service authzService.set(null); return getServiceProperties(); }
java
@Reference(policy = ReferencePolicy.DYNAMIC, cardinality = ReferenceCardinality.MULTIPLE) protected Map<String, Object> setAuthorization(ServiceReference<AuthorizationService> ref) { if (hasPropertiesFromFile(ref)) { String id = (String) ref.getProperty(KEY_ID); if (id != null) { authorization.putReference(id, ref); } else { Tr.error(tc, "SECURITY_SERVICE_REQUIRED_SERVICE_WITHOUT_ID", KEY_AUTHORIZATION); } } else { authorization.putReference(String.valueOf(ref.getProperty(KEY_SERVICE_ID)), ref); } // determine a new authorization service authzService.set(null); return getServiceProperties(); }
[ "@", "Reference", "(", "policy", "=", "ReferencePolicy", ".", "DYNAMIC", ",", "cardinality", "=", "ReferenceCardinality", ".", "MULTIPLE", ")", "protected", "Map", "<", "String", ",", "Object", ">", "setAuthorization", "(", "ServiceReference", "<", "AuthorizationService", ">", "ref", ")", "{", "if", "(", "hasPropertiesFromFile", "(", "ref", ")", ")", "{", "String", "id", "=", "(", "String", ")", "ref", ".", "getProperty", "(", "KEY_ID", ")", ";", "if", "(", "id", "!=", "null", ")", "{", "authorization", ".", "putReference", "(", "id", ",", "ref", ")", ";", "}", "else", "{", "Tr", ".", "error", "(", "tc", ",", "\"SECURITY_SERVICE_REQUIRED_SERVICE_WITHOUT_ID\"", ",", "KEY_AUTHORIZATION", ")", ";", "}", "}", "else", "{", "authorization", ".", "putReference", "(", "String", ".", "valueOf", "(", "ref", ".", "getProperty", "(", "KEY_SERVICE_ID", ")", ")", ",", "ref", ")", ";", "}", "// determine a new authorization service", "authzService", ".", "set", "(", "null", ")", ";", "return", "getServiceProperties", "(", ")", ";", "}" ]
Method will be called for each AuthorizationService that is registered in the OSGi service registry. We maintain an internal map of these for easy access. @param ref Reference to a registered AuthorizationService
[ "Method", "will", "be", "called", "for", "each", "AuthorizationService", "that", "is", "registered", "in", "the", "OSGi", "service", "registry", ".", "We", "maintain", "an", "internal", "map", "of", "these", "for", "easy", "access", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security/src/com/ibm/ws/security/internal/SecurityServiceImpl.java#L173-L189
train
OpenLiberty/open-liberty
dev/com.ibm.ws.security/src/com/ibm/ws/security/internal/SecurityServiceImpl.java
SecurityServiceImpl.unsetAuthorization
protected Map<String, Object> unsetAuthorization(ServiceReference<AuthorizationService> ref) { authorization.removeReference((String) ref.getProperty(KEY_ID), ref); authorization.removeReference(String.valueOf(ref.getProperty(KEY_SERVICE_ID)), ref); // determine a new authorization service authzService.set(null); return getServiceProperties(); }
java
protected Map<String, Object> unsetAuthorization(ServiceReference<AuthorizationService> ref) { authorization.removeReference((String) ref.getProperty(KEY_ID), ref); authorization.removeReference(String.valueOf(ref.getProperty(KEY_SERVICE_ID)), ref); // determine a new authorization service authzService.set(null); return getServiceProperties(); }
[ "protected", "Map", "<", "String", ",", "Object", ">", "unsetAuthorization", "(", "ServiceReference", "<", "AuthorizationService", ">", "ref", ")", "{", "authorization", ".", "removeReference", "(", "(", "String", ")", "ref", ".", "getProperty", "(", "KEY_ID", ")", ",", "ref", ")", ";", "authorization", ".", "removeReference", "(", "String", ".", "valueOf", "(", "ref", ".", "getProperty", "(", "KEY_SERVICE_ID", ")", ")", ",", "ref", ")", ";", "// determine a new authorization service", "authzService", ".", "set", "(", "null", ")", ";", "return", "getServiceProperties", "(", ")", ";", "}" ]
Method will be called for each AuthorizationService that is unregistered in the OSGi service registry. We must remove this instance from our internal map. @param ref Reference to an unregistered AuthorizationService
[ "Method", "will", "be", "called", "for", "each", "AuthorizationService", "that", "is", "unregistered", "in", "the", "OSGi", "service", "registry", ".", "We", "must", "remove", "this", "instance", "from", "our", "internal", "map", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security/src/com/ibm/ws/security/internal/SecurityServiceImpl.java#L198-L205
train
OpenLiberty/open-liberty
dev/com.ibm.ws.security/src/com/ibm/ws/security/internal/SecurityServiceImpl.java
SecurityServiceImpl.setUserRegistry
@Reference(policy = ReferencePolicy.DYNAMIC, cardinality = ReferenceCardinality.MULTIPLE, target = "(config.displayId=*)") protected Map<String, Object> setUserRegistry(ServiceReference<UserRegistryService> ref) { adjustUserRegistryServiceRef(ref); // determine a new user registry service userRegistryService.set(null); return getServiceProperties(); }
java
@Reference(policy = ReferencePolicy.DYNAMIC, cardinality = ReferenceCardinality.MULTIPLE, target = "(config.displayId=*)") protected Map<String, Object> setUserRegistry(ServiceReference<UserRegistryService> ref) { adjustUserRegistryServiceRef(ref); // determine a new user registry service userRegistryService.set(null); return getServiceProperties(); }
[ "@", "Reference", "(", "policy", "=", "ReferencePolicy", ".", "DYNAMIC", ",", "cardinality", "=", "ReferenceCardinality", ".", "MULTIPLE", ",", "target", "=", "\"(config.displayId=*)\"", ")", "protected", "Map", "<", "String", ",", "Object", ">", "setUserRegistry", "(", "ServiceReference", "<", "UserRegistryService", ">", "ref", ")", "{", "adjustUserRegistryServiceRef", "(", "ref", ")", ";", "// determine a new user registry service", "userRegistryService", ".", "set", "(", "null", ")", ";", "return", "getServiceProperties", "(", ")", ";", "}" ]
Method will be called for each UserRegistryService that is registered in the OSGi service registry. We maintain an internal map of these for easy access. @param ref Reference to a registered UserRegistryService
[ "Method", "will", "be", "called", "for", "each", "UserRegistryService", "that", "is", "registered", "in", "the", "OSGi", "service", "registry", ".", "We", "maintain", "an", "internal", "map", "of", "these", "for", "easy", "access", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security/src/com/ibm/ws/security/internal/SecurityServiceImpl.java#L214-L221
train
OpenLiberty/open-liberty
dev/com.ibm.ws.security/src/com/ibm/ws/security/internal/SecurityServiceImpl.java
SecurityServiceImpl.unsetUserRegistry
protected Map<String, Object> unsetUserRegistry(ServiceReference<UserRegistryService> ref) { userRegistry.removeReference((String) ref.getProperty(KEY_ID), ref); userRegistry.removeReference(String.valueOf(ref.getProperty(KEY_SERVICE_ID)), ref); // determine a new user registry service userRegistryService.set(null); return getServiceProperties(); }
java
protected Map<String, Object> unsetUserRegistry(ServiceReference<UserRegistryService> ref) { userRegistry.removeReference((String) ref.getProperty(KEY_ID), ref); userRegistry.removeReference(String.valueOf(ref.getProperty(KEY_SERVICE_ID)), ref); // determine a new user registry service userRegistryService.set(null); return getServiceProperties(); }
[ "protected", "Map", "<", "String", ",", "Object", ">", "unsetUserRegistry", "(", "ServiceReference", "<", "UserRegistryService", ">", "ref", ")", "{", "userRegistry", ".", "removeReference", "(", "(", "String", ")", "ref", ".", "getProperty", "(", "KEY_ID", ")", ",", "ref", ")", ";", "userRegistry", ".", "removeReference", "(", "String", ".", "valueOf", "(", "ref", ".", "getProperty", "(", "KEY_SERVICE_ID", ")", ")", ",", "ref", ")", ";", "// determine a new user registry service", "userRegistryService", ".", "set", "(", "null", ")", ";", "return", "getServiceProperties", "(", ")", ";", "}" ]
Method will be called for each UserRegistryService that is unregistered in the OSGi service registry. We must remove this instance from our internal map. @param ref Reference to an unregistered UserRegistryService
[ "Method", "will", "be", "called", "for", "each", "UserRegistryService", "that", "is", "unregistered", "in", "the", "OSGi", "service", "registry", ".", "We", "must", "remove", "this", "instance", "from", "our", "internal", "map", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security/src/com/ibm/ws/security/internal/SecurityServiceImpl.java#L251-L258
train
OpenLiberty/open-liberty
dev/com.ibm.ws.security/src/com/ibm/ws/security/internal/SecurityServiceImpl.java
SecurityServiceImpl.getEffectiveSecurityConfiguration
private SecurityConfiguration getEffectiveSecurityConfiguration() { SecurityConfiguration effectiveConfig = configs.getService(cfgSystemDomain); if (effectiveConfig == null) { Tr.error(tc, "SECURITY_SERVICE_ERROR_BAD_DOMAIN", cfgSystemDomain, CFG_KEY_SYSTEM_DOMAIN); throw new IllegalArgumentException(Tr.formatMessage(tc, "SECURITY_SERVICE_ERROR_BAD_DOMAIN", cfgSystemDomain, CFG_KEY_SYSTEM_DOMAIN)); } return effectiveConfig; }
java
private SecurityConfiguration getEffectiveSecurityConfiguration() { SecurityConfiguration effectiveConfig = configs.getService(cfgSystemDomain); if (effectiveConfig == null) { Tr.error(tc, "SECURITY_SERVICE_ERROR_BAD_DOMAIN", cfgSystemDomain, CFG_KEY_SYSTEM_DOMAIN); throw new IllegalArgumentException(Tr.formatMessage(tc, "SECURITY_SERVICE_ERROR_BAD_DOMAIN", cfgSystemDomain, CFG_KEY_SYSTEM_DOMAIN)); } return effectiveConfig; }
[ "private", "SecurityConfiguration", "getEffectiveSecurityConfiguration", "(", ")", "{", "SecurityConfiguration", "effectiveConfig", "=", "configs", ".", "getService", "(", "cfgSystemDomain", ")", ";", "if", "(", "effectiveConfig", "==", "null", ")", "{", "Tr", ".", "error", "(", "tc", ",", "\"SECURITY_SERVICE_ERROR_BAD_DOMAIN\"", ",", "cfgSystemDomain", ",", "CFG_KEY_SYSTEM_DOMAIN", ")", ";", "throw", "new", "IllegalArgumentException", "(", "Tr", ".", "formatMessage", "(", "tc", ",", "\"SECURITY_SERVICE_ERROR_BAD_DOMAIN\"", ",", "cfgSystemDomain", ",", "CFG_KEY_SYSTEM_DOMAIN", ")", ")", ";", "}", "return", "effectiveConfig", ";", "}" ]
Eventually this will be execution context aware and pick the right domain. Till then, we're only accessing the system domain configuration. @return SecurityConfiguration representing the "effective" configuration for the execution context.
[ "Eventually", "this", "will", "be", "execution", "context", "aware", "and", "pick", "the", "right", "domain", ".", "Till", "then", "we", "re", "only", "accessing", "the", "system", "domain", "configuration", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security/src/com/ibm/ws/security/internal/SecurityServiceImpl.java#L374-L381
train
OpenLiberty/open-liberty
dev/com.ibm.ws.security/src/com/ibm/ws/security/internal/SecurityServiceImpl.java
SecurityServiceImpl.autoDetectService
private <V> V autoDetectService(String serviceName, ConcurrentServiceReferenceMap<String, V> map) { Iterator<V> services = map.getServices(); if (services.hasNext() == false) { Tr.error(tc, "SECURITY_SERVICE_NO_SERVICE_AVAILABLE", serviceName); throw new IllegalStateException(Tr.formatMessage(tc, "SECURITY_SERVICE_NO_SERVICE_AVAILABLE", serviceName)); } V service = services.next(); if (services.hasNext()) { Tr.error(tc, "SECURITY_SERVICE_MULTIPLE_SERVICE_AVAILABLE", serviceName); throw new IllegalStateException(Tr.formatMessage(tc, "SECURITY_SERVICE_MULTIPLE_SERVICE_AVAILABLE", serviceName)); } return service; }
java
private <V> V autoDetectService(String serviceName, ConcurrentServiceReferenceMap<String, V> map) { Iterator<V> services = map.getServices(); if (services.hasNext() == false) { Tr.error(tc, "SECURITY_SERVICE_NO_SERVICE_AVAILABLE", serviceName); throw new IllegalStateException(Tr.formatMessage(tc, "SECURITY_SERVICE_NO_SERVICE_AVAILABLE", serviceName)); } V service = services.next(); if (services.hasNext()) { Tr.error(tc, "SECURITY_SERVICE_MULTIPLE_SERVICE_AVAILABLE", serviceName); throw new IllegalStateException(Tr.formatMessage(tc, "SECURITY_SERVICE_MULTIPLE_SERVICE_AVAILABLE", serviceName)); } return service; }
[ "private", "<", "V", ">", "V", "autoDetectService", "(", "String", "serviceName", ",", "ConcurrentServiceReferenceMap", "<", "String", ",", "V", ">", "map", ")", "{", "Iterator", "<", "V", ">", "services", "=", "map", ".", "getServices", "(", ")", ";", "if", "(", "services", ".", "hasNext", "(", ")", "==", "false", ")", "{", "Tr", ".", "error", "(", "tc", ",", "\"SECURITY_SERVICE_NO_SERVICE_AVAILABLE\"", ",", "serviceName", ")", ";", "throw", "new", "IllegalStateException", "(", "Tr", ".", "formatMessage", "(", "tc", ",", "\"SECURITY_SERVICE_NO_SERVICE_AVAILABLE\"", ",", "serviceName", ")", ")", ";", "}", "V", "service", "=", "services", ".", "next", "(", ")", ";", "if", "(", "services", ".", "hasNext", "(", ")", ")", "{", "Tr", ".", "error", "(", "tc", ",", "\"SECURITY_SERVICE_MULTIPLE_SERVICE_AVAILABLE\"", ",", "serviceName", ")", ";", "throw", "new", "IllegalStateException", "(", "Tr", ".", "formatMessage", "(", "tc", ",", "\"SECURITY_SERVICE_MULTIPLE_SERVICE_AVAILABLE\"", ",", "serviceName", ")", ")", ";", "}", "return", "service", ";", "}" ]
When the configuration element is not defined, use some "auto-detect" logic to try and return the single Service of a specified field. If there is no service, or multiple services, that is considered an error case which "auto-detect" can not resolve. @param serviceName name of the service @param map ConcurrentServiceReferenceMap of registered services @return id of the single service registered in map. Will not return null.
[ "When", "the", "configuration", "element", "is", "not", "defined", "use", "some", "auto", "-", "detect", "logic", "to", "try", "and", "return", "the", "single", "Service", "of", "a", "specified", "field", ".", "If", "there", "is", "no", "service", "or", "multiple", "services", "that", "is", "considered", "an", "error", "case", "which", "auto", "-", "detect", "can", "not", "resolve", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security/src/com/ibm/ws/security/internal/SecurityServiceImpl.java#L401-L414
train
OpenLiberty/open-liberty
dev/com.ibm.ws.security/src/com/ibm/ws/security/internal/SecurityServiceImpl.java
SecurityServiceImpl.getAuthenticationService
private AuthenticationService getAuthenticationService(String id) { AuthenticationService service = authentication.getService(id); if (service == null) { throwIllegalArgumentExceptionInvalidAttributeValue(SecurityConfiguration.CFG_KEY_AUTHENTICATION_REF, id); } return service; }
java
private AuthenticationService getAuthenticationService(String id) { AuthenticationService service = authentication.getService(id); if (service == null) { throwIllegalArgumentExceptionInvalidAttributeValue(SecurityConfiguration.CFG_KEY_AUTHENTICATION_REF, id); } return service; }
[ "private", "AuthenticationService", "getAuthenticationService", "(", "String", "id", ")", "{", "AuthenticationService", "service", "=", "authentication", ".", "getService", "(", "id", ")", ";", "if", "(", "service", "==", "null", ")", "{", "throwIllegalArgumentExceptionInvalidAttributeValue", "(", "SecurityConfiguration", ".", "CFG_KEY_AUTHENTICATION_REF", ",", "id", ")", ";", "}", "return", "service", ";", "}" ]
Retrieve the AuthenticationService for the specified id. @param id AuthenticationService id to retrieve @return A non-null AuthenticationService instance.
[ "Retrieve", "the", "AuthenticationService", "for", "the", "specified", "id", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security/src/com/ibm/ws/security/internal/SecurityServiceImpl.java#L444-L450
train
OpenLiberty/open-liberty
dev/com.ibm.ws.security/src/com/ibm/ws/security/internal/SecurityServiceImpl.java
SecurityServiceImpl.getAuthorizationService
private AuthorizationService getAuthorizationService(String id) { AuthorizationService service = authorization.getService(id); if (service == null) { throwIllegalArgumentExceptionInvalidAttributeValue(SecurityConfiguration.CFG_KEY_AUTHORIZATION_REF, id); } return service; }
java
private AuthorizationService getAuthorizationService(String id) { AuthorizationService service = authorization.getService(id); if (service == null) { throwIllegalArgumentExceptionInvalidAttributeValue(SecurityConfiguration.CFG_KEY_AUTHORIZATION_REF, id); } return service; }
[ "private", "AuthorizationService", "getAuthorizationService", "(", "String", "id", ")", "{", "AuthorizationService", "service", "=", "authorization", ".", "getService", "(", "id", ")", ";", "if", "(", "service", "==", "null", ")", "{", "throwIllegalArgumentExceptionInvalidAttributeValue", "(", "SecurityConfiguration", ".", "CFG_KEY_AUTHORIZATION_REF", ",", "id", ")", ";", "}", "return", "service", ";", "}" ]
Retrieve the AuthorizationService for the specified id. @param id AuthorizationService id to retrieve @return A non-null AuthorizationService instance.
[ "Retrieve", "the", "AuthorizationService", "for", "the", "specified", "id", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security/src/com/ibm/ws/security/internal/SecurityServiceImpl.java#L527-L533
train
OpenLiberty/open-liberty
dev/com.ibm.ws.security/src/com/ibm/ws/security/internal/SecurityServiceImpl.java
SecurityServiceImpl.getUserRegistryService
private UserRegistryService getUserRegistryService(String id) { UserRegistryService service = userRegistry.getService(id); if (service == null) { throwIllegalArgumentExceptionInvalidAttributeValue(SecurityConfiguration.CFG_KEY_USERREGISTRY_REF, id); } return service; }
java
private UserRegistryService getUserRegistryService(String id) { UserRegistryService service = userRegistry.getService(id); if (service == null) { throwIllegalArgumentExceptionInvalidAttributeValue(SecurityConfiguration.CFG_KEY_USERREGISTRY_REF, id); } return service; }
[ "private", "UserRegistryService", "getUserRegistryService", "(", "String", "id", ")", "{", "UserRegistryService", "service", "=", "userRegistry", ".", "getService", "(", "id", ")", ";", "if", "(", "service", "==", "null", ")", "{", "throwIllegalArgumentExceptionInvalidAttributeValue", "(", "SecurityConfiguration", ".", "CFG_KEY_USERREGISTRY_REF", ",", "id", ")", ";", "}", "return", "service", ";", "}" ]
Retrieve the UserRegistryService for the specified id. @param id UserRegistryService id to retrieve @return A non-null UserRegistryService instance.
[ "Retrieve", "the", "UserRegistryService", "for", "the", "specified", "id", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security/src/com/ibm/ws/security/internal/SecurityServiceImpl.java#L558-L564
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/jsf/ComponentHandler.java
ComponentHandler.getFacetName
protected final String getFacetName(FaceletContext ctx, UIComponent parent) { // TODO: REFACTOR - "facelets.FACET_NAME" should be a constant somewhere, used to be in FacetHandler // from real Facelets return (String) parent.getAttributes().get("facelets.FACET_NAME"); }
java
protected final String getFacetName(FaceletContext ctx, UIComponent parent) { // TODO: REFACTOR - "facelets.FACET_NAME" should be a constant somewhere, used to be in FacetHandler // from real Facelets return (String) parent.getAttributes().get("facelets.FACET_NAME"); }
[ "protected", "final", "String", "getFacetName", "(", "FaceletContext", "ctx", ",", "UIComponent", "parent", ")", "{", "// TODO: REFACTOR - \"facelets.FACET_NAME\" should be a constant somewhere, used to be in FacetHandler", "// from real Facelets", "return", "(", "String", ")", "parent", ".", "getAttributes", "(", ")", ".", "get", "(", "\"facelets.FACET_NAME\"", ")", ";", "}" ]
Return the Facet name we are scoped in, otherwise null @param ctx @return
[ "Return", "the", "Facet", "name", "we", "are", "scoped", "in", "otherwise", "null" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/jsf/ComponentHandler.java#L198-L203
train
OpenLiberty/open-liberty
dev/com.ibm.ws.tx.embeddable/src/com/ibm/tx/jta/embeddable/impl/EmbeddableTranManagerImpl.java
EmbeddableTranManagerImpl.completeTxTimeout
public void completeTxTimeout() throws TransactionRolledbackException { final boolean traceOn = TraceComponent.isAnyTracingEnabled(); if (traceOn && tc.isEntryEnabled()) Tr.entry(tc, "completeTxTimeout"); if (tx != null && tx.isTimedOut()) { if (traceOn && tc.isEventEnabled()) Tr.event(tc, "Transaction has timed out. The transaction will be rolled back now"); Tr.info(tc, "WTRN0041_TXN_ROLLED_BACK", tx.getTranName()); ((EmbeddableTransactionImpl) tx).rollbackResources(); final TransactionRolledbackException rbe = new TransactionRolledbackException("Transaction is ended due to timeout"); FFDCFilter.processException(rbe, "com.ibm.tx.jta.embeddable.impl.EmbeddableTranManagerImpl.completeTxTimeout", "100", this); if (traceOn && tc.isEntryEnabled()) Tr.exit(tc, "completeTxTimeout", rbe); throw rbe; } if (traceOn && tc.isEntryEnabled()) Tr.exit(tc, "completeTxTimeout"); }
java
public void completeTxTimeout() throws TransactionRolledbackException { final boolean traceOn = TraceComponent.isAnyTracingEnabled(); if (traceOn && tc.isEntryEnabled()) Tr.entry(tc, "completeTxTimeout"); if (tx != null && tx.isTimedOut()) { if (traceOn && tc.isEventEnabled()) Tr.event(tc, "Transaction has timed out. The transaction will be rolled back now"); Tr.info(tc, "WTRN0041_TXN_ROLLED_BACK", tx.getTranName()); ((EmbeddableTransactionImpl) tx).rollbackResources(); final TransactionRolledbackException rbe = new TransactionRolledbackException("Transaction is ended due to timeout"); FFDCFilter.processException(rbe, "com.ibm.tx.jta.embeddable.impl.EmbeddableTranManagerImpl.completeTxTimeout", "100", this); if (traceOn && tc.isEntryEnabled()) Tr.exit(tc, "completeTxTimeout", rbe); throw rbe; } if (traceOn && tc.isEntryEnabled()) Tr.exit(tc, "completeTxTimeout"); }
[ "public", "void", "completeTxTimeout", "(", ")", "throws", "TransactionRolledbackException", "{", "final", "boolean", "traceOn", "=", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", ";", "if", "(", "traceOn", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "tc", ",", "\"completeTxTimeout\"", ")", ";", "if", "(", "tx", "!=", "null", "&&", "tx", ".", "isTimedOut", "(", ")", ")", "{", "if", "(", "traceOn", "&&", "tc", ".", "isEventEnabled", "(", ")", ")", "Tr", ".", "event", "(", "tc", ",", "\"Transaction has timed out. The transaction will be rolled back now\"", ")", ";", "Tr", ".", "info", "(", "tc", ",", "\"WTRN0041_TXN_ROLLED_BACK\"", ",", "tx", ".", "getTranName", "(", ")", ")", ";", "(", "(", "EmbeddableTransactionImpl", ")", "tx", ")", ".", "rollbackResources", "(", ")", ";", "final", "TransactionRolledbackException", "rbe", "=", "new", "TransactionRolledbackException", "(", "\"Transaction is ended due to timeout\"", ")", ";", "FFDCFilter", ".", "processException", "(", "rbe", ",", "\"com.ibm.tx.jta.embeddable.impl.EmbeddableTranManagerImpl.completeTxTimeout\"", ",", "\"100\"", ",", "this", ")", ";", "if", "(", "traceOn", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"completeTxTimeout\"", ",", "rbe", ")", ";", "throw", "rbe", ";", "}", "if", "(", "traceOn", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"completeTxTimeout\"", ")", ";", "}" ]
Complete processing of passive transaction timeout.
[ "Complete", "processing", "of", "passive", "transaction", "timeout", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.tx.embeddable/src/com/ibm/tx/jta/embeddable/impl/EmbeddableTranManagerImpl.java#L91-L115
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSConsumerSet.java
JSConsumerSet.addConsumer
public void addConsumer(DispatchableConsumerPoint lcp) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "addConsumer", lcp); // WARNING: We mustn't hold the LCP lock of the consumer at this point synchronized(consumerList) { consumerList.add(lcp); } if(TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "addConsumer"); }
java
public void addConsumer(DispatchableConsumerPoint lcp) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "addConsumer", lcp); // WARNING: We mustn't hold the LCP lock of the consumer at this point synchronized(consumerList) { consumerList.add(lcp); } if(TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "addConsumer"); }
[ "public", "void", "addConsumer", "(", "DispatchableConsumerPoint", "lcp", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"addConsumer\"", ",", "lcp", ")", ";", "// WARNING: We mustn't hold the LCP lock of the consumer at this point", "synchronized", "(", "consumerList", ")", "{", "consumerList", ".", "add", "(", "lcp", ")", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"addConsumer\"", ")", ";", "}" ]
Add a new consumer to this set. @param lcp
[ "Add", "a", "new", "consumer", "to", "this", "set", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSConsumerSet.java#L158-L172
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSConsumerSet.java
JSConsumerSet.removeConsumer
public void removeConsumer(DispatchableConsumerPoint lcp) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "removeConsumer", lcp); // WARNING: We mustn't hold the LCP lock of the consumer at this point synchronized(consumerList) { consumerList.remove(lcp); } if(TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "removeConsumer"); }
java
public void removeConsumer(DispatchableConsumerPoint lcp) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "removeConsumer", lcp); // WARNING: We mustn't hold the LCP lock of the consumer at this point synchronized(consumerList) { consumerList.remove(lcp); } if(TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "removeConsumer"); }
[ "public", "void", "removeConsumer", "(", "DispatchableConsumerPoint", "lcp", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"removeConsumer\"", ",", "lcp", ")", ";", "// WARNING: We mustn't hold the LCP lock of the consumer at this point", "synchronized", "(", "consumerList", ")", "{", "consumerList", ".", "remove", "(", "lcp", ")", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"removeConsumer\"", ")", ";", "}" ]
Remove a consumer from the set. @param lcp
[ "Remove", "a", "consumer", "from", "the", "set", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSConsumerSet.java#L178-L192
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSConsumerSet.java
JSConsumerSet.getGetCursorIndex
public int getGetCursorIndex(SIMPMessage msg) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getGetCursorIndex"); // The zeroth index is reserved for non-classified messages int classPos = 0; synchronized(classifications) { if(classifications.getNumberOfClasses()>0) { // Need to get the classification out of the message String keyClassification = msg.getMessageControlClassification(true); // In the special case where the weighting for the classification in the // message was zero, we use the Default cursor if(keyClassification != null && classifications.getWeight(keyClassification) > 0) // Get the position of the classification classPos = classifications.getPosition(keyClassification); } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getGetCursorIndex", classPos); return classPos; }
java
public int getGetCursorIndex(SIMPMessage msg) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getGetCursorIndex"); // The zeroth index is reserved for non-classified messages int classPos = 0; synchronized(classifications) { if(classifications.getNumberOfClasses()>0) { // Need to get the classification out of the message String keyClassification = msg.getMessageControlClassification(true); // In the special case where the weighting for the classification in the // message was zero, we use the Default cursor if(keyClassification != null && classifications.getWeight(keyClassification) > 0) // Get the position of the classification classPos = classifications.getPosition(keyClassification); } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getGetCursorIndex", classPos); return classPos; }
[ "public", "int", "getGetCursorIndex", "(", "SIMPMessage", "msg", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"getGetCursorIndex\"", ")", ";", "// The zeroth index is reserved for non-classified messages", "int", "classPos", "=", "0", ";", "synchronized", "(", "classifications", ")", "{", "if", "(", "classifications", ".", "getNumberOfClasses", "(", ")", ">", "0", ")", "{", "// Need to get the classification out of the message", "String", "keyClassification", "=", "msg", ".", "getMessageControlClassification", "(", "true", ")", ";", "// In the special case where the weighting for the classification in the", "// message was zero, we use the Default cursor", "if", "(", "keyClassification", "!=", "null", "&&", "classifications", ".", "getWeight", "(", "keyClassification", ")", ">", "0", ")", "// Get the position of the classification", "classPos", "=", "classifications", ".", "getPosition", "(", "keyClassification", ")", ";", "}", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"getGetCursorIndex\"", ",", "classPos", ")", ";", "return", "classPos", ";", "}" ]
Determine the index of the getCursor to use based on the classification of a message. @param msg @return
[ "Determine", "the", "index", "of", "the", "getCursor", "to", "use", "based", "on", "the", "classification", "of", "a", "message", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSConsumerSet.java#L201-L227
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSConsumerSet.java
JSConsumerSet.chooseGetCursorIndex
public synchronized int chooseGetCursorIndex(int previous) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "chooseGetCursorIndex", new Object[] {Integer.valueOf(previous)}); // The zeroth index represents the default cursor for non-classified messages. int classPos = 0; if(classifications.getNumberOfClasses()>0) { // Need to determine the class of message to process if(previous == -1) { // First time through, get the initial weightings table weightMap = classifications.getWeightings(); } else { // Need to remove previous entries from the weightMap weightMap.remove(Integer.valueOf(previous)); } if(!weightMap.isEmpty()) { classPos = classifications.findClassIndex(weightMap); } // eof non-empty weightmap else if(unitTestOperation) { // In a production environment we'd return zero in this case so that the // default cursor would be used. In a Unit test environment, where we are // classifying messages and where we have configured the test so that a // cursor associated with a specific classification should be used then // we'll alert the test to an error by throwing this exception. if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "chooseGetCursorIndex", "SIErrorException"); throw new SIErrorException(); } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "chooseGetCursorIndex", classPos); return classPos; }
java
public synchronized int chooseGetCursorIndex(int previous) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "chooseGetCursorIndex", new Object[] {Integer.valueOf(previous)}); // The zeroth index represents the default cursor for non-classified messages. int classPos = 0; if(classifications.getNumberOfClasses()>0) { // Need to determine the class of message to process if(previous == -1) { // First time through, get the initial weightings table weightMap = classifications.getWeightings(); } else { // Need to remove previous entries from the weightMap weightMap.remove(Integer.valueOf(previous)); } if(!weightMap.isEmpty()) { classPos = classifications.findClassIndex(weightMap); } // eof non-empty weightmap else if(unitTestOperation) { // In a production environment we'd return zero in this case so that the // default cursor would be used. In a Unit test environment, where we are // classifying messages and where we have configured the test so that a // cursor associated with a specific classification should be used then // we'll alert the test to an error by throwing this exception. if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "chooseGetCursorIndex", "SIErrorException"); throw new SIErrorException(); } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "chooseGetCursorIndex", classPos); return classPos; }
[ "public", "synchronized", "int", "chooseGetCursorIndex", "(", "int", "previous", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"chooseGetCursorIndex\"", ",", "new", "Object", "[", "]", "{", "Integer", ".", "valueOf", "(", "previous", ")", "}", ")", ";", "// The zeroth index represents the default cursor for non-classified messages.", "int", "classPos", "=", "0", ";", "if", "(", "classifications", ".", "getNumberOfClasses", "(", ")", ">", "0", ")", "{", "// Need to determine the class of message to process", "if", "(", "previous", "==", "-", "1", ")", "{", "// First time through, get the initial weightings table", "weightMap", "=", "classifications", ".", "getWeightings", "(", ")", ";", "}", "else", "{", "// Need to remove previous entries from the weightMap", "weightMap", ".", "remove", "(", "Integer", ".", "valueOf", "(", "previous", ")", ")", ";", "}", "if", "(", "!", "weightMap", ".", "isEmpty", "(", ")", ")", "{", "classPos", "=", "classifications", ".", "findClassIndex", "(", "weightMap", ")", ";", "}", "// eof non-empty weightmap", "else", "if", "(", "unitTestOperation", ")", "{", "// In a production environment we'd return zero in this case so that the", "// default cursor would be used. In a Unit test environment, where we are", "// classifying messages and where we have configured the test so that a", "// cursor associated with a specific classification should be used then", "// we'll alert the test to an error by throwing this exception.", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"chooseGetCursorIndex\"", ",", "\"SIErrorException\"", ")", ";", "throw", "new", "SIErrorException", "(", ")", ";", "}", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"chooseGetCursorIndex\"", ",", "classPos", ")", ";", "return", "classPos", ";", "}" ]
Determine the index of the getCursor to use based on the classifications defined for the ConsumerSet that this consumer belongs to. @param msg @return
[ "Determine", "the", "index", "of", "the", "getCursor", "to", "use", "based", "on", "the", "classifications", "defined", "for", "the", "ConsumerSet", "that", "this", "consumer", "belongs", "to", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSConsumerSet.java#L236-L278
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSConsumerSet.java
JSConsumerSet.getClassifications
public JSConsumerClassifications getClassifications() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getClassifications"); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getClassifications", classifications); // TODO No synchronization? return classifications; }
java
public JSConsumerClassifications getClassifications() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getClassifications"); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getClassifications", classifications); // TODO No synchronization? return classifications; }
[ "public", "JSConsumerClassifications", "getClassifications", "(", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"getClassifications\"", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"getClassifications\"", ",", "classifications", ")", ";", "// TODO No synchronization?", "return", "classifications", ";", "}" ]
Returns a reference to the Classifications object that wraps the classifications specified by XD. @return
[ "Returns", "a", "reference", "to", "the", "Classifications", "object", "that", "wraps", "the", "classifications", "specified", "by", "XD", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSConsumerSet.java#L286-L296
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSConsumerSet.java
JSConsumerSet.prepareAddActiveMessage
public boolean prepareAddActiveMessage() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this,tc, "prepareAddActiveMessage"); boolean messageAccepted = false; boolean limitReached = false; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "maxActiveMessagePrepareReadLock.lock(): " + maxActiveMessagePrepareLock); // Add us as a reader - this will block if a writer currently holds the lock. maxActiveMessagePrepareReadLock.lock(); // Lock the actual message counters - to prevent other 'readers' concurrently making // changes. synchronized(maxActiveMessageLock) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Active Messages: current: " + currentActiveMessages + ", prepared: " + preparedActiveMessages + ", maximum: " + maxActiveMessages + " (suspended: " + consumerSetSuspended + ")"); // If we're already suspended we'll simply unlock the prepare and reject the message, // causing the consumer to suspend itself. // Otherwise, we need to check the current number of active messages... if(!consumerSetSuspended) { // If adding this message would cause us to reach the limit then we need to // drop out of this synchronize and re-take the prepare lock as a write lock. if((currentActiveMessages + preparedActiveMessages) == (maxActiveMessages - 1)) { limitReached = true; } // Otherwise, we're safe to accept the message and add this message to the // prepare counter else { preparedActiveMessages++; messageAccepted = true; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Prepare added"); } } // If the message hasn't been accepted yet (because we're suspended or we // have to take the write lock) then release the read lock if(!messageAccepted) { maxActiveMessagePrepareReadLock.unlock(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "maxActiveMessagePrepareReadLock.unlock(): " + maxActiveMessagePrepareLock); } } // synchronize // If this message would cause us to reach the limit then we must take the write // lock to prevent others preparing messages while we're in the middle of this // threashold-case. We also need to block until any existing prepares complete to // ensure that we really are on the brink of suspending the set if(limitReached) { boolean releaseWriteLock = true; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "maxActiveMessagePrepareWriteLock.lock(): " + maxActiveMessagePrepareLock); // Take the write lock and hold it until the commit/rollback maxActiveMessagePrepareWriteLock.lock(); // Re-take the active message counter lock synchronized(maxActiveMessageLock) { // We could have been suspended between us releasing the locks above // and re-taking them here, if that's the case we simply release the // write lock and reject the message add. if(!consumerSetSuspended) { // We're not suspended yet so accept this message and add the prepared // message messageAccepted = true; preparedActiveMessages++; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Prepare added"); // If we're still in the position where committing this add would make // us hit the limit then we need to hold onto the write lock until the // commit/rollback. if((currentActiveMessages + preparedActiveMessages) == maxActiveMessages) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Write lock held until commit/rollback"); releaseWriteLock = false; } // Otherwise, someone must have got in while we'd released the locks and // removed one or more of the active messages. In which case this add won't // make us hit the limit so we downgrade the prepare lock to a read and release // the write lock once we've done it. else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "maxActiveMessagePrepareReadLock.lock(): " + maxActiveMessagePrepareLock); maxActiveMessagePrepareReadLock.lock(); } } // If we were told to release the write lock do it now. if(releaseWriteLock) { maxActiveMessagePrepareWriteLock.unlock(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "maxActiveMessagePrepareWriteLock.unlock(): " + maxActiveMessagePrepareLock); } } } if(TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "prepareAddActiveMessage", Boolean.valueOf(messageAccepted)); return messageAccepted; }
java
public boolean prepareAddActiveMessage() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this,tc, "prepareAddActiveMessage"); boolean messageAccepted = false; boolean limitReached = false; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "maxActiveMessagePrepareReadLock.lock(): " + maxActiveMessagePrepareLock); // Add us as a reader - this will block if a writer currently holds the lock. maxActiveMessagePrepareReadLock.lock(); // Lock the actual message counters - to prevent other 'readers' concurrently making // changes. synchronized(maxActiveMessageLock) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Active Messages: current: " + currentActiveMessages + ", prepared: " + preparedActiveMessages + ", maximum: " + maxActiveMessages + " (suspended: " + consumerSetSuspended + ")"); // If we're already suspended we'll simply unlock the prepare and reject the message, // causing the consumer to suspend itself. // Otherwise, we need to check the current number of active messages... if(!consumerSetSuspended) { // If adding this message would cause us to reach the limit then we need to // drop out of this synchronize and re-take the prepare lock as a write lock. if((currentActiveMessages + preparedActiveMessages) == (maxActiveMessages - 1)) { limitReached = true; } // Otherwise, we're safe to accept the message and add this message to the // prepare counter else { preparedActiveMessages++; messageAccepted = true; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Prepare added"); } } // If the message hasn't been accepted yet (because we're suspended or we // have to take the write lock) then release the read lock if(!messageAccepted) { maxActiveMessagePrepareReadLock.unlock(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "maxActiveMessagePrepareReadLock.unlock(): " + maxActiveMessagePrepareLock); } } // synchronize // If this message would cause us to reach the limit then we must take the write // lock to prevent others preparing messages while we're in the middle of this // threashold-case. We also need to block until any existing prepares complete to // ensure that we really are on the brink of suspending the set if(limitReached) { boolean releaseWriteLock = true; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "maxActiveMessagePrepareWriteLock.lock(): " + maxActiveMessagePrepareLock); // Take the write lock and hold it until the commit/rollback maxActiveMessagePrepareWriteLock.lock(); // Re-take the active message counter lock synchronized(maxActiveMessageLock) { // We could have been suspended between us releasing the locks above // and re-taking them here, if that's the case we simply release the // write lock and reject the message add. if(!consumerSetSuspended) { // We're not suspended yet so accept this message and add the prepared // message messageAccepted = true; preparedActiveMessages++; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Prepare added"); // If we're still in the position where committing this add would make // us hit the limit then we need to hold onto the write lock until the // commit/rollback. if((currentActiveMessages + preparedActiveMessages) == maxActiveMessages) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Write lock held until commit/rollback"); releaseWriteLock = false; } // Otherwise, someone must have got in while we'd released the locks and // removed one or more of the active messages. In which case this add won't // make us hit the limit so we downgrade the prepare lock to a read and release // the write lock once we've done it. else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "maxActiveMessagePrepareReadLock.lock(): " + maxActiveMessagePrepareLock); maxActiveMessagePrepareReadLock.lock(); } } // If we were told to release the write lock do it now. if(releaseWriteLock) { maxActiveMessagePrepareWriteLock.unlock(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "maxActiveMessagePrepareWriteLock.unlock(): " + maxActiveMessagePrepareLock); } } } if(TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "prepareAddActiveMessage", Boolean.valueOf(messageAccepted)); return messageAccepted; }
[ "public", "boolean", "prepareAddActiveMessage", "(", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "this", ",", "tc", ",", "\"prepareAddActiveMessage\"", ")", ";", "boolean", "messageAccepted", "=", "false", ";", "boolean", "limitReached", "=", "false", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "SibTr", ".", "debug", "(", "tc", ",", "\"maxActiveMessagePrepareReadLock.lock(): \"", "+", "maxActiveMessagePrepareLock", ")", ";", "// Add us as a reader - this will block if a writer currently holds the lock.", "maxActiveMessagePrepareReadLock", ".", "lock", "(", ")", ";", "// Lock the actual message counters - to prevent other 'readers' concurrently making", "// changes.", "synchronized", "(", "maxActiveMessageLock", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "SibTr", ".", "debug", "(", "tc", ",", "\"Active Messages: current: \"", "+", "currentActiveMessages", "+", "\", prepared: \"", "+", "preparedActiveMessages", "+", "\", maximum: \"", "+", "maxActiveMessages", "+", "\" (suspended: \"", "+", "consumerSetSuspended", "+", "\")\"", ")", ";", "// If we're already suspended we'll simply unlock the prepare and reject the message,", "// causing the consumer to suspend itself.", "// Otherwise, we need to check the current number of active messages...", "if", "(", "!", "consumerSetSuspended", ")", "{", "// If adding this message would cause us to reach the limit then we need to", "// drop out of this synchronize and re-take the prepare lock as a write lock.", "if", "(", "(", "currentActiveMessages", "+", "preparedActiveMessages", ")", "==", "(", "maxActiveMessages", "-", "1", ")", ")", "{", "limitReached", "=", "true", ";", "}", "// Otherwise, we're safe to accept the message and add this message to the", "// prepare counter", "else", "{", "preparedActiveMessages", "++", ";", "messageAccepted", "=", "true", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "SibTr", ".", "debug", "(", "tc", ",", "\"Prepare added\"", ")", ";", "}", "}", "// If the message hasn't been accepted yet (because we're suspended or we", "// have to take the write lock) then release the read lock", "if", "(", "!", "messageAccepted", ")", "{", "maxActiveMessagePrepareReadLock", ".", "unlock", "(", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "SibTr", ".", "debug", "(", "tc", ",", "\"maxActiveMessagePrepareReadLock.unlock(): \"", "+", "maxActiveMessagePrepareLock", ")", ";", "}", "}", "// synchronize", "// If this message would cause us to reach the limit then we must take the write", "// lock to prevent others preparing messages while we're in the middle of this", "// threashold-case. We also need to block until any existing prepares complete to", "// ensure that we really are on the brink of suspending the set", "if", "(", "limitReached", ")", "{", "boolean", "releaseWriteLock", "=", "true", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "SibTr", ".", "debug", "(", "tc", ",", "\"maxActiveMessagePrepareWriteLock.lock(): \"", "+", "maxActiveMessagePrepareLock", ")", ";", "// Take the write lock and hold it until the commit/rollback", "maxActiveMessagePrepareWriteLock", ".", "lock", "(", ")", ";", "// Re-take the active message counter lock", "synchronized", "(", "maxActiveMessageLock", ")", "{", "// We could have been suspended between us releasing the locks above", "// and re-taking them here, if that's the case we simply release the", "// write lock and reject the message add.", "if", "(", "!", "consumerSetSuspended", ")", "{", "// We're not suspended yet so accept this message and add the prepared", "// message", "messageAccepted", "=", "true", ";", "preparedActiveMessages", "++", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "SibTr", ".", "debug", "(", "tc", ",", "\"Prepare added\"", ")", ";", "// If we're still in the position where committing this add would make", "// us hit the limit then we need to hold onto the write lock until the", "// commit/rollback.", "if", "(", "(", "currentActiveMessages", "+", "preparedActiveMessages", ")", "==", "maxActiveMessages", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "SibTr", ".", "debug", "(", "tc", ",", "\"Write lock held until commit/rollback\"", ")", ";", "releaseWriteLock", "=", "false", ";", "}", "// Otherwise, someone must have got in while we'd released the locks and", "// removed one or more of the active messages. In which case this add won't", "// make us hit the limit so we downgrade the prepare lock to a read and release", "// the write lock once we've done it.", "else", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "SibTr", ".", "debug", "(", "tc", ",", "\"maxActiveMessagePrepareReadLock.lock(): \"", "+", "maxActiveMessagePrepareLock", ")", ";", "maxActiveMessagePrepareReadLock", ".", "lock", "(", ")", ";", "}", "}", "// If we were told to release the write lock do it now.", "if", "(", "releaseWriteLock", ")", "{", "maxActiveMessagePrepareWriteLock", ".", "unlock", "(", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "SibTr", ".", "debug", "(", "tc", ",", "\"maxActiveMessagePrepareWriteLock.unlock(): \"", "+", "maxActiveMessagePrepareLock", ")", ";", "}", "}", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "this", ",", "tc", ",", "\"prepareAddActiveMessage\"", ",", "Boolean", ".", "valueOf", "(", "messageAccepted", ")", ")", ";", "return", "messageAccepted", ";", "}" ]
Because there may be multiple members or the ConsumerSet, if we're managing the active mesage count we must 'reserve' a space for any message that a consumer may lock, rather than lock it first then realise that the ConsumerSet has reached its maximum active message limit and have to unlock it. Preparing the add of a message will result in the maxActiveMessagePrepareLock being held until the add succeeds (committed) or fails (rolled back). Normally the lock is held as a read lock unless this add would make the active message count hit the maximum, in which case a write lock is taken to ensure any inflight prepares complete first and no new ones can occur until the outcome of this add is know. This prevents the suspend/resume state of the ConsumerSet changing while any of the members are halfway through an add.
[ "Because", "there", "may", "be", "multiple", "members", "or", "the", "ConsumerSet", "if", "we", "re", "managing", "the", "active", "mesage", "count", "we", "must", "reserve", "a", "space", "for", "any", "message", "that", "a", "consumer", "may", "lock", "rather", "than", "lock", "it", "first", "then", "realise", "that", "the", "ConsumerSet", "has", "reached", "its", "maximum", "active", "message", "limit", "and", "have", "to", "unlock", "it", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSConsumerSet.java#L312-L437
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSConsumerSet.java
JSConsumerSet.takeClassificationReadLock
public void takeClassificationReadLock() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "takeClassificationReadLock"); classificationReadLock.lock(); if(TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "takeClassificationReadLock"); }
java
public void takeClassificationReadLock() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "takeClassificationReadLock"); classificationReadLock.lock(); if(TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "takeClassificationReadLock"); }
[ "public", "void", "takeClassificationReadLock", "(", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"takeClassificationReadLock\"", ")", ";", "classificationReadLock", ".", "lock", "(", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"takeClassificationReadLock\"", ")", ";", "}" ]
Take a classification readlock
[ "Take", "a", "classification", "readlock" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSConsumerSet.java#L997-L1006
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSConsumerSet.java
JSConsumerSet.freeClassificationReadLock
public void freeClassificationReadLock() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "freeClassificationReadLock"); classificationReadLock.unlock(); if(TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "freeClassificationReadLock"); }
java
public void freeClassificationReadLock() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "freeClassificationReadLock"); classificationReadLock.unlock(); if(TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "freeClassificationReadLock"); }
[ "public", "void", "freeClassificationReadLock", "(", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"freeClassificationReadLock\"", ")", ";", "classificationReadLock", ".", "unlock", "(", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"freeClassificationReadLock\"", ")", ";", "}" ]
Free a classification readlock TODO Put all calls to this in a finally
[ "Free", "a", "classification", "readlock" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSConsumerSet.java#L1013-L1022
train
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/ContainerAS.java
ContainerAS.registerSynchronization
public void registerSynchronization(Synchronization s) throws CPIException { try { ivContainer.uowCtrl.enlistWithSession(s); // enlistSession(s) } catch (CSIException e) { throw new CPIException(e.toString()); } }
java
public void registerSynchronization(Synchronization s) throws CPIException { try { ivContainer.uowCtrl.enlistWithSession(s); // enlistSession(s) } catch (CSIException e) { throw new CPIException(e.toString()); } }
[ "public", "void", "registerSynchronization", "(", "Synchronization", "s", ")", "throws", "CPIException", "{", "try", "{", "ivContainer", ".", "uowCtrl", ".", "enlistWithSession", "(", "s", ")", ";", "// enlistSession(s)", "}", "catch", "(", "CSIException", "e", ")", "{", "throw", "new", "CPIException", "(", "e", ".", "toString", "(", ")", ")", ";", "}", "}" ]
Register the synchronization object with this activity session
[ "Register", "the", "synchronization", "object", "with", "this", "activity", "session" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/ContainerAS.java#L308-L316
train
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/ContainerAS.java
ContainerAS.getEJBKeys
private EJBKey[] getEJBKeys(BeanO[] beans) { EJBKey result[] = null; if (beans != null) { result = new EJBKey[beans.length]; for (int i = 0; i < beans.length; ++i) { result[i] = beans[i].getId(); } } return result; }
java
private EJBKey[] getEJBKeys(BeanO[] beans) { EJBKey result[] = null; if (beans != null) { result = new EJBKey[beans.length]; for (int i = 0; i < beans.length; ++i) { result[i] = beans[i].getId(); } } return result; }
[ "private", "EJBKey", "[", "]", "getEJBKeys", "(", "BeanO", "[", "]", "beans", ")", "{", "EJBKey", "result", "[", "]", "=", "null", ";", "if", "(", "beans", "!=", "null", ")", "{", "result", "=", "new", "EJBKey", "[", "beans", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "beans", ".", "length", ";", "++", "i", ")", "{", "result", "[", "i", "]", "=", "beans", "[", "i", "]", ".", "getId", "(", ")", ";", "}", "}", "return", "result", ";", "}" ]
Get snapshot of all EJBKeys associated with the beans involved in current activity session
[ "Get", "snapshot", "of", "all", "EJBKeys", "associated", "with", "the", "beans", "involved", "in", "current", "activity", "session" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/ContainerAS.java#L322-L332
train
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/ContainerAS.java
ContainerAS.getBeanOs
private BeanO[] getBeanOs() { BeanO result[]; result = new BeanO[ivBeanOs.size()]; Iterator<BeanO> iter = ivBeanOs.values().iterator(); int i = 0; while (iter.hasNext()) { result[i++] = iter.next(); } return result; }
java
private BeanO[] getBeanOs() { BeanO result[]; result = new BeanO[ivBeanOs.size()]; Iterator<BeanO> iter = ivBeanOs.values().iterator(); int i = 0; while (iter.hasNext()) { result[i++] = iter.next(); } return result; }
[ "private", "BeanO", "[", "]", "getBeanOs", "(", ")", "{", "BeanO", "result", "[", "]", ";", "result", "=", "new", "BeanO", "[", "ivBeanOs", ".", "size", "(", ")", "]", ";", "Iterator", "<", "BeanO", ">", "iter", "=", "ivBeanOs", ".", "values", "(", ")", ".", "iterator", "(", ")", ";", "int", "i", "=", "0", ";", "while", "(", "iter", ".", "hasNext", "(", ")", ")", "{", "result", "[", "i", "++", "]", "=", "iter", ".", "next", "(", ")", ";", "}", "return", "result", ";", "}" ]
Get snapshot of all beans involved in current activity session
[ "Get", "snapshot", "of", "all", "beans", "involved", "in", "current", "activity", "session" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/ContainerAS.java#L337-L347
train
OpenLiberty/open-liberty
dev/com.ibm.ws.anno/src/com/ibm/ws/anno/classsource/internal/ClassSourceImpl_ClassLoader.java
ClassSourceImpl_ClassLoader.scanClasses
@Override public void scanClasses( ClassSource_Streamer streamer, Set<String> i_seedClassNamesSet, ScanPolicy scanPolicy) { throw new UnsupportedOperationException(); }
java
@Override public void scanClasses( ClassSource_Streamer streamer, Set<String> i_seedClassNamesSet, ScanPolicy scanPolicy) { throw new UnsupportedOperationException(); }
[ "@", "Override", "public", "void", "scanClasses", "(", "ClassSource_Streamer", "streamer", ",", "Set", "<", "String", ">", "i_seedClassNamesSet", ",", "ScanPolicy", "scanPolicy", ")", "{", "throw", "new", "UnsupportedOperationException", "(", ")", ";", "}" ]
scan policy, and external regions are never scanned iteratively.
[ "scan", "policy", "and", "external", "regions", "are", "never", "scanned", "iteratively", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.anno/src/com/ibm/ws/anno/classsource/internal/ClassSourceImpl_ClassLoader.java#L95-L102
train
OpenLiberty/open-liberty
dev/com.ibm.websphere.security.wim.base/src/com/ibm/wsspi/security/wim/model/RolePlayer.java
RolePlayer.getPartyRoles
public List<com.ibm.wsspi.security.wim.model.PartyRole> getPartyRoles() { if (partyRoles == null) { partyRoles = new ArrayList<com.ibm.wsspi.security.wim.model.PartyRole>(); } return this.partyRoles; }
java
public List<com.ibm.wsspi.security.wim.model.PartyRole> getPartyRoles() { if (partyRoles == null) { partyRoles = new ArrayList<com.ibm.wsspi.security.wim.model.PartyRole>(); } return this.partyRoles; }
[ "public", "List", "<", "com", ".", "ibm", ".", "wsspi", ".", "security", ".", "wim", ".", "model", ".", "PartyRole", ">", "getPartyRoles", "(", ")", "{", "if", "(", "partyRoles", "==", "null", ")", "{", "partyRoles", "=", "new", "ArrayList", "<", "com", ".", "ibm", ".", "wsspi", ".", "security", ".", "wim", ".", "model", ".", "PartyRole", ">", "(", ")", ";", "}", "return", "this", ".", "partyRoles", ";", "}" ]
Gets the value of the partyRoles 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 partyRoles property. <p> For example, to add a new item, do as follows: <pre> getPartyRoles().add(newItem); </pre> <p> Objects of the following type(s) are allowed in the list {@link com.ibm.wsspi.security.wim.model.PartyRole }
[ "Gets", "the", "value", "of", "the", "partyRoles", "property", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.security.wim.base/src/com/ibm/wsspi/security/wim/model/RolePlayer.java#L107-L112
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSDynamic.java
JSDynamic.getExpectedSchema
public JSchema getExpectedSchema(Map context) { if (expectedSchema != null) return expectedSchema; if (expectedType == null) return null; expectedSchema = (JSchema)context.get(expectedType); if (expectedSchema != null) return expectedSchema; expectedSchema = new JSchema(expectedType, context); return expectedSchema; }
java
public JSchema getExpectedSchema(Map context) { if (expectedSchema != null) return expectedSchema; if (expectedType == null) return null; expectedSchema = (JSchema)context.get(expectedType); if (expectedSchema != null) return expectedSchema; expectedSchema = new JSchema(expectedType, context); return expectedSchema; }
[ "public", "JSchema", "getExpectedSchema", "(", "Map", "context", ")", "{", "if", "(", "expectedSchema", "!=", "null", ")", "return", "expectedSchema", ";", "if", "(", "expectedType", "==", "null", ")", "return", "null", ";", "expectedSchema", "=", "(", "JSchema", ")", "context", ".", "get", "(", "expectedType", ")", ";", "if", "(", "expectedSchema", "!=", "null", ")", "return", "expectedSchema", ";", "expectedSchema", "=", "new", "JSchema", "(", "expectedType", ",", "context", ")", ";", "return", "expectedSchema", ";", "}" ]
Retrieve the subschema corresponding to the expected type (will be null iff expected type is null. Constructs the subschema if it doesn't already exist. The context argument guards against duplicate construction of schemas in the event that the definition is recursive.
[ "Retrieve", "the", "subschema", "corresponding", "to", "the", "expected", "type", "(", "will", "be", "null", "iff", "expected", "type", "is", "null", ".", "Constructs", "the", "subschema", "if", "it", "doesn", "t", "already", "exist", ".", "The", "context", "argument", "guards", "against", "duplicate", "construction", "of", "schemas", "in", "the", "event", "that", "the", "definition", "is", "recursive", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSDynamic.java#L67-L77
train
OpenLiberty/open-liberty
dev/com.ibm.ws.security.context/src/com/ibm/ws/security/context/internal/SecurityContextImpl.java
SecurityContextImpl.taskStarting
@Override public void taskStarting() { final boolean trace = TraceComponent.isAnyTracingEnabled(); prevInvocationSubject = subjectManager.getInvocationSubject(); prevCallerSubject = subjectManager.getCallerSubject(); if (trace && tc.isEntryEnabled()) Tr.entry(this, tc, "taskStarting", "previous caller/invocation subjects", prevCallerSubject, prevInvocationSubject); subjectManager.setInvocationSubject(invocationSubject); subjectManager.setCallerSubject(callerSubject); if (trace && tc.isEntryEnabled()) Tr.exit(this, tc, "taskStarting", new Object[] { "new caller/invocation subjects", callerSubject, invocationSubject }); }
java
@Override public void taskStarting() { final boolean trace = TraceComponent.isAnyTracingEnabled(); prevInvocationSubject = subjectManager.getInvocationSubject(); prevCallerSubject = subjectManager.getCallerSubject(); if (trace && tc.isEntryEnabled()) Tr.entry(this, tc, "taskStarting", "previous caller/invocation subjects", prevCallerSubject, prevInvocationSubject); subjectManager.setInvocationSubject(invocationSubject); subjectManager.setCallerSubject(callerSubject); if (trace && tc.isEntryEnabled()) Tr.exit(this, tc, "taskStarting", new Object[] { "new caller/invocation subjects", callerSubject, invocationSubject }); }
[ "@", "Override", "public", "void", "taskStarting", "(", ")", "{", "final", "boolean", "trace", "=", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", ";", "prevInvocationSubject", "=", "subjectManager", ".", "getInvocationSubject", "(", ")", ";", "prevCallerSubject", "=", "subjectManager", ".", "getCallerSubject", "(", ")", ";", "if", "(", "trace", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "this", ",", "tc", ",", "\"taskStarting\"", ",", "\"previous caller/invocation subjects\"", ",", "prevCallerSubject", ",", "prevInvocationSubject", ")", ";", "subjectManager", ".", "setInvocationSubject", "(", "invocationSubject", ")", ";", "subjectManager", ".", "setCallerSubject", "(", "callerSubject", ")", ";", "if", "(", "trace", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "this", ",", "tc", ",", "\"taskStarting\"", ",", "new", "Object", "[", "]", "{", "\"new caller/invocation subjects\"", ",", "callerSubject", ",", "invocationSubject", "}", ")", ";", "}" ]
Push the subjects associated with this security context onto the thread.
[ "Push", "the", "subjects", "associated", "with", "this", "security", "context", "onto", "the", "thread", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.context/src/com/ibm/ws/security/context/internal/SecurityContextImpl.java#L211-L226
train
OpenLiberty/open-liberty
dev/com.ibm.ws.security.context/src/com/ibm/ws/security/context/internal/SecurityContextImpl.java
SecurityContextImpl.taskStopping
@Override public void taskStopping() { final boolean trace = TraceComponent.isAnyTracingEnabled(); if (trace && tc.isEntryEnabled()) Tr.entry(this, tc, "taskStopping", "restore caller/invocation subjects", prevCallerSubject, prevInvocationSubject); subjectManager.setCallerSubject(prevCallerSubject); subjectManager.setInvocationSubject(prevInvocationSubject); if (trace && tc.isEntryEnabled()) Tr.exit(this, tc, "taskStopping"); }
java
@Override public void taskStopping() { final boolean trace = TraceComponent.isAnyTracingEnabled(); if (trace && tc.isEntryEnabled()) Tr.entry(this, tc, "taskStopping", "restore caller/invocation subjects", prevCallerSubject, prevInvocationSubject); subjectManager.setCallerSubject(prevCallerSubject); subjectManager.setInvocationSubject(prevInvocationSubject); if (trace && tc.isEntryEnabled()) Tr.exit(this, tc, "taskStopping"); }
[ "@", "Override", "public", "void", "taskStopping", "(", ")", "{", "final", "boolean", "trace", "=", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", ";", "if", "(", "trace", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "this", ",", "tc", ",", "\"taskStopping\"", ",", "\"restore caller/invocation subjects\"", ",", "prevCallerSubject", ",", "prevInvocationSubject", ")", ";", "subjectManager", ".", "setCallerSubject", "(", "prevCallerSubject", ")", ";", "subjectManager", ".", "setInvocationSubject", "(", "prevInvocationSubject", ")", ";", "if", "(", "trace", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "this", ",", "tc", ",", "\"taskStopping\"", ")", ";", "}" ]
Restore the subjects that were previously on the thread prior to applying this security context.
[ "Restore", "the", "subjects", "that", "were", "previously", "on", "the", "thread", "prior", "to", "applying", "this", "security", "context", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.context/src/com/ibm/ws/security/context/internal/SecurityContextImpl.java#L232-L243
train
OpenLiberty/open-liberty
dev/com.ibm.ws.security.context/src/com/ibm/ws/security/context/internal/SecurityContextImpl.java
SecurityContextImpl.readState
private void readState(GetField fields) throws IOException { //get caller principal callerPrincipal = (WSPrincipal) fields.get(CALLER_PRINCIPAL, null); //get boolean marking if subjects are equal subjectsAreEqual = fields.get(SUBJECTS_ARE_EQUAL, false); //only deserialize invocation principal if it's different from the caller if (!subjectsAreEqual) { //get invocation principal invocationPrincipal = (WSPrincipal) fields.get(INVOCATION_PRINCIPAL, null); } else { invocationPrincipal = callerPrincipal; } jaasLoginContextEntry = (String) fields.get(JAAS_LOGIN_CONTEXT, null); callerSubjectCacheKey = (String) fields.get(CALLER_SUBJECT_CACHE_KEY, null); invocationSubjectCacheKey = (String) fields.get(INVOCATION_SUBJECT_CACHE_KEY, null); }
java
private void readState(GetField fields) throws IOException { //get caller principal callerPrincipal = (WSPrincipal) fields.get(CALLER_PRINCIPAL, null); //get boolean marking if subjects are equal subjectsAreEqual = fields.get(SUBJECTS_ARE_EQUAL, false); //only deserialize invocation principal if it's different from the caller if (!subjectsAreEqual) { //get invocation principal invocationPrincipal = (WSPrincipal) fields.get(INVOCATION_PRINCIPAL, null); } else { invocationPrincipal = callerPrincipal; } jaasLoginContextEntry = (String) fields.get(JAAS_LOGIN_CONTEXT, null); callerSubjectCacheKey = (String) fields.get(CALLER_SUBJECT_CACHE_KEY, null); invocationSubjectCacheKey = (String) fields.get(INVOCATION_SUBJECT_CACHE_KEY, null); }
[ "private", "void", "readState", "(", "GetField", "fields", ")", "throws", "IOException", "{", "//get caller principal", "callerPrincipal", "=", "(", "WSPrincipal", ")", "fields", ".", "get", "(", "CALLER_PRINCIPAL", ",", "null", ")", ";", "//get boolean marking if subjects are equal", "subjectsAreEqual", "=", "fields", ".", "get", "(", "SUBJECTS_ARE_EQUAL", ",", "false", ")", ";", "//only deserialize invocation principal if it's different from the caller", "if", "(", "!", "subjectsAreEqual", ")", "{", "//get invocation principal", "invocationPrincipal", "=", "(", "WSPrincipal", ")", "fields", ".", "get", "(", "INVOCATION_PRINCIPAL", ",", "null", ")", ";", "}", "else", "{", "invocationPrincipal", "=", "callerPrincipal", ";", "}", "jaasLoginContextEntry", "=", "(", "String", ")", "fields", ".", "get", "(", "JAAS_LOGIN_CONTEXT", ",", "null", ")", ";", "callerSubjectCacheKey", "=", "(", "String", ")", "fields", ".", "get", "(", "CALLER_SUBJECT_CACHE_KEY", ",", "null", ")", ";", "invocationSubjectCacheKey", "=", "(", "String", ")", "fields", ".", "get", "(", "INVOCATION_SUBJECT_CACHE_KEY", ",", "null", ")", ";", "}" ]
Read the security context @param fields @throws IOException if there are I/O errors while reading from the underlying InputStream
[ "Read", "the", "security", "context" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.context/src/com/ibm/ws/security/context/internal/SecurityContextImpl.java#L333-L351
train
OpenLiberty/open-liberty
dev/com.ibm.ws.security.context/src/com/ibm/ws/security/context/internal/SecurityContextImpl.java
SecurityContextImpl.recreateFullSubject
@FFDCIgnore(AuthenticationException.class) protected Subject recreateFullSubject(WSPrincipal wsPrincipal, SecurityService securityService, AtomicServiceReference<UnauthenticatedSubjectService> unauthenticatedSubjectServiceRef, String customCacheKey) { Subject subject = null; if (wsPrincipal != null) { String userName = wsPrincipal.getName(); AuthenticateUserHelper authHelper = new AuthenticateUserHelper(); if (jaasLoginContextEntry == null) { jaasLoginContextEntry = DESERIALIZE_LOGINCONTEXT_DEFAULT; } try { subject = authHelper.authenticateUser(securityService.getAuthenticationService(), userName, jaasLoginContextEntry, customCacheKey); } catch (AuthenticationException e) { Tr.error(tc, "SEC_CONTEXT_DESERIALIZE_AUTHN_ERROR", new Object[] { e.getLocalizedMessage() }); } } if (subject == null) { subject = unauthenticatedSubjectServiceRef.getService().getUnauthenticatedSubject(); } return subject; }
java
@FFDCIgnore(AuthenticationException.class) protected Subject recreateFullSubject(WSPrincipal wsPrincipal, SecurityService securityService, AtomicServiceReference<UnauthenticatedSubjectService> unauthenticatedSubjectServiceRef, String customCacheKey) { Subject subject = null; if (wsPrincipal != null) { String userName = wsPrincipal.getName(); AuthenticateUserHelper authHelper = new AuthenticateUserHelper(); if (jaasLoginContextEntry == null) { jaasLoginContextEntry = DESERIALIZE_LOGINCONTEXT_DEFAULT; } try { subject = authHelper.authenticateUser(securityService.getAuthenticationService(), userName, jaasLoginContextEntry, customCacheKey); } catch (AuthenticationException e) { Tr.error(tc, "SEC_CONTEXT_DESERIALIZE_AUTHN_ERROR", new Object[] { e.getLocalizedMessage() }); } } if (subject == null) { subject = unauthenticatedSubjectServiceRef.getService().getUnauthenticatedSubject(); } return subject; }
[ "@", "FFDCIgnore", "(", "AuthenticationException", ".", "class", ")", "protected", "Subject", "recreateFullSubject", "(", "WSPrincipal", "wsPrincipal", ",", "SecurityService", "securityService", ",", "AtomicServiceReference", "<", "UnauthenticatedSubjectService", ">", "unauthenticatedSubjectServiceRef", ",", "String", "customCacheKey", ")", "{", "Subject", "subject", "=", "null", ";", "if", "(", "wsPrincipal", "!=", "null", ")", "{", "String", "userName", "=", "wsPrincipal", ".", "getName", "(", ")", ";", "AuthenticateUserHelper", "authHelper", "=", "new", "AuthenticateUserHelper", "(", ")", ";", "if", "(", "jaasLoginContextEntry", "==", "null", ")", "{", "jaasLoginContextEntry", "=", "DESERIALIZE_LOGINCONTEXT_DEFAULT", ";", "}", "try", "{", "subject", "=", "authHelper", ".", "authenticateUser", "(", "securityService", ".", "getAuthenticationService", "(", ")", ",", "userName", ",", "jaasLoginContextEntry", ",", "customCacheKey", ")", ";", "}", "catch", "(", "AuthenticationException", "e", ")", "{", "Tr", ".", "error", "(", "tc", ",", "\"SEC_CONTEXT_DESERIALIZE_AUTHN_ERROR\"", ",", "new", "Object", "[", "]", "{", "e", ".", "getLocalizedMessage", "(", ")", "}", ")", ";", "}", "}", "if", "(", "subject", "==", "null", ")", "{", "subject", "=", "unauthenticatedSubjectServiceRef", ".", "getService", "(", ")", ".", "getUnauthenticatedSubject", "(", ")", ";", "}", "return", "subject", ";", "}" ]
Perform a login to recreate the full subject, given a WSPrincipal @param wsPrincipal the deserialized WSPrincipal that will be used for creating the new subject @param securityService the security service to use for authenticating the user @param AtomicServiceReference<UnauthenticatedSubjectService> reference to the unauthenticated subject service for creating the unauthenticated subject @param customCacheKey The custom cache key to look up the subject @return the authenticated subject, or unauthenticated if there was an error during authentication or wsPrincipal was null
[ "Perform", "a", "login", "to", "recreate", "the", "full", "subject", "given", "a", "WSPrincipal" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.context/src/com/ibm/ws/security/context/internal/SecurityContextImpl.java#L362-L382
train
OpenLiberty/open-liberty
dev/com.ibm.ws.security.context/src/com/ibm/ws/security/context/internal/SecurityContextImpl.java
SecurityContextImpl.getWSPrincipal
protected WSPrincipal getWSPrincipal(Subject subject) throws IOException { WSPrincipal wsPrincipal = null; Set<WSPrincipal> principals = (subject != null) ? subject.getPrincipals(WSPrincipal.class) : null; if (principals != null && !principals.isEmpty()) { if (principals.size() > 1) { // Error - too many principals String principalNames = null; for (WSPrincipal principal : principals) { if (principalNames == null) principalNames = principal.getName(); else principalNames = principalNames + ", " + principal.getName(); } throw new IOException(Tr.formatMessage(tc, "SEC_CONTEXT_DESERIALIZE_TOO_MANY_PRINCIPALS", principalNames)); } else { wsPrincipal = principals.iterator().next(); } } return wsPrincipal; }
java
protected WSPrincipal getWSPrincipal(Subject subject) throws IOException { WSPrincipal wsPrincipal = null; Set<WSPrincipal> principals = (subject != null) ? subject.getPrincipals(WSPrincipal.class) : null; if (principals != null && !principals.isEmpty()) { if (principals.size() > 1) { // Error - too many principals String principalNames = null; for (WSPrincipal principal : principals) { if (principalNames == null) principalNames = principal.getName(); else principalNames = principalNames + ", " + principal.getName(); } throw new IOException(Tr.formatMessage(tc, "SEC_CONTEXT_DESERIALIZE_TOO_MANY_PRINCIPALS", principalNames)); } else { wsPrincipal = principals.iterator().next(); } } return wsPrincipal; }
[ "protected", "WSPrincipal", "getWSPrincipal", "(", "Subject", "subject", ")", "throws", "IOException", "{", "WSPrincipal", "wsPrincipal", "=", "null", ";", "Set", "<", "WSPrincipal", ">", "principals", "=", "(", "subject", "!=", "null", ")", "?", "subject", ".", "getPrincipals", "(", "WSPrincipal", ".", "class", ")", ":", "null", ";", "if", "(", "principals", "!=", "null", "&&", "!", "principals", ".", "isEmpty", "(", ")", ")", "{", "if", "(", "principals", ".", "size", "(", ")", ">", "1", ")", "{", "// Error - too many principals", "String", "principalNames", "=", "null", ";", "for", "(", "WSPrincipal", "principal", ":", "principals", ")", "{", "if", "(", "principalNames", "==", "null", ")", "principalNames", "=", "principal", ".", "getName", "(", ")", ";", "else", "principalNames", "=", "principalNames", "+", "\", \"", "+", "principal", ".", "getName", "(", ")", ";", "}", "throw", "new", "IOException", "(", "Tr", ".", "formatMessage", "(", "tc", ",", "\"SEC_CONTEXT_DESERIALIZE_TOO_MANY_PRINCIPALS\"", ",", "principalNames", ")", ")", ";", "}", "else", "{", "wsPrincipal", "=", "principals", ".", "iterator", "(", ")", ".", "next", "(", ")", ";", "}", "}", "return", "wsPrincipal", ";", "}" ]
Get the WSPrincipal from the subject @param subject @return the WSPrincipal of the subject @throws IOException if there is more than one WSPrincipal in the subject
[ "Get", "the", "WSPrincipal", "from", "the", "subject" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.context/src/com/ibm/ws/security/context/internal/SecurityContextImpl.java#L391-L410
train
OpenLiberty/open-liberty
dev/com.ibm.ws.security.context/src/com/ibm/ws/security/context/internal/SecurityContextImpl.java
SecurityContextImpl.serializeSubjectCacheKey
private void serializeSubjectCacheKey(PutField fields) throws Exception { if (callerSubject != null) { Hashtable<String, ?> hashtable = subjectHelper.getHashtableFromSubject(callerSubject, new String[] { AttributeNameConstants.WSCREDENTIAL_CACHE_KEY }); if (hashtable != null) { callerSubjectCacheKey = (String) hashtable.get(AttributeNameConstants.WSCREDENTIAL_CACHE_KEY); /* * 12/08/14 RZ: Removed after discussions with Ajay and Ut. This is an unwanted functionality. * * if (callerSubjectCacheKey != null && authCache != null) { * Subject lookedUpSubject = authCache.getSubject(callerSubjectCacheKey); * * // If we looked up the wrong subject, then create a BasicAuthCacheKey * if (!lookedUpSubject.equals(callerSubject)) { * hashtable = subjectHelper.getHashtableFromSubject(callerSubject, new String[] { AttributeNameConstants.WSCREDENTIAL_USERID, * AttributeNameConstants.WSCREDENTIAL_PASSWORD }); * * if (hashtable != null) { * String userid = (String) hashtable.get(AttributeNameConstants.WSCREDENTIAL_USERID); * String password = (String) hashtable.get(AttributeNameConstants.WSCREDENTIAL_PASSWORD); * * if (password != null) { * callerSubjectCacheKey = BasicAuthCacheKeyProvider.createLookupKey(subjectHelper.getRealm(callerSubject), userid, password); * } else { * callerSubjectCacheKey = BasicAuthCacheKeyProvider.createLookupKey(subjectHelper.getRealm(callerSubject), userid); * } * } * } * } */ } } if (callerSubjectCacheKey != null) fields.put(CALLER_SUBJECT_CACHE_KEY, callerSubjectCacheKey); //only serialize invocation subject if it's different from the caller if (!subjectsAreEqual) { if (invocationSubject != null) { Hashtable<String, ?> hashtable = subjectHelper.getHashtableFromSubject(invocationSubject, new String[] { AttributeNameConstants.WSCREDENTIAL_CACHE_KEY }); if (hashtable != null) { invocationSubjectCacheKey = (String) hashtable.get(AttributeNameConstants.WSCREDENTIAL_CACHE_KEY); /* * 12/08/14 RZ: Removed after discussions with Ajay and Ut. This is an unwanted functionality. * * if (invocationSubjectCacheKey != null && authCache != null) { * Subject lookedUpSubject = authCache.getSubject(invocationSubjectCacheKey); * * // If we looked up the wrong subject, then create a BasicAuthCacheKey * if (!lookedUpSubject.equals(invocationSubject)) { * hashtable = subjectHelper.getHashtableFromSubject(invocationSubject, new String[] { AttributeNameConstants.WSCREDENTIAL_USERID, * AttributeNameConstants.WSCREDENTIAL_PASSWORD }); * * if (hashtable != null) { * String userid = (String) hashtable.get(AttributeNameConstants.WSCREDENTIAL_USERID); * String password = (String) hashtable.get(AttributeNameConstants.WSCREDENTIAL_PASSWORD); * * if (password != null) { * invocationSubjectCacheKey = BasicAuthCacheKeyProvider.createLookupKey(subjectHelper.getRealm(invocationSubject), userid, password); * } else { * invocationSubjectCacheKey = BasicAuthCacheKeyProvider.createLookupKey(subjectHelper.getRealm(invocationSubject), userid); * } * } * } * } */ } } } if (invocationSubjectCacheKey != null) fields.put(INVOCATION_SUBJECT_CACHE_KEY, invocationSubjectCacheKey); }
java
private void serializeSubjectCacheKey(PutField fields) throws Exception { if (callerSubject != null) { Hashtable<String, ?> hashtable = subjectHelper.getHashtableFromSubject(callerSubject, new String[] { AttributeNameConstants.WSCREDENTIAL_CACHE_KEY }); if (hashtable != null) { callerSubjectCacheKey = (String) hashtable.get(AttributeNameConstants.WSCREDENTIAL_CACHE_KEY); /* * 12/08/14 RZ: Removed after discussions with Ajay and Ut. This is an unwanted functionality. * * if (callerSubjectCacheKey != null && authCache != null) { * Subject lookedUpSubject = authCache.getSubject(callerSubjectCacheKey); * * // If we looked up the wrong subject, then create a BasicAuthCacheKey * if (!lookedUpSubject.equals(callerSubject)) { * hashtable = subjectHelper.getHashtableFromSubject(callerSubject, new String[] { AttributeNameConstants.WSCREDENTIAL_USERID, * AttributeNameConstants.WSCREDENTIAL_PASSWORD }); * * if (hashtable != null) { * String userid = (String) hashtable.get(AttributeNameConstants.WSCREDENTIAL_USERID); * String password = (String) hashtable.get(AttributeNameConstants.WSCREDENTIAL_PASSWORD); * * if (password != null) { * callerSubjectCacheKey = BasicAuthCacheKeyProvider.createLookupKey(subjectHelper.getRealm(callerSubject), userid, password); * } else { * callerSubjectCacheKey = BasicAuthCacheKeyProvider.createLookupKey(subjectHelper.getRealm(callerSubject), userid); * } * } * } * } */ } } if (callerSubjectCacheKey != null) fields.put(CALLER_SUBJECT_CACHE_KEY, callerSubjectCacheKey); //only serialize invocation subject if it's different from the caller if (!subjectsAreEqual) { if (invocationSubject != null) { Hashtable<String, ?> hashtable = subjectHelper.getHashtableFromSubject(invocationSubject, new String[] { AttributeNameConstants.WSCREDENTIAL_CACHE_KEY }); if (hashtable != null) { invocationSubjectCacheKey = (String) hashtable.get(AttributeNameConstants.WSCREDENTIAL_CACHE_KEY); /* * 12/08/14 RZ: Removed after discussions with Ajay and Ut. This is an unwanted functionality. * * if (invocationSubjectCacheKey != null && authCache != null) { * Subject lookedUpSubject = authCache.getSubject(invocationSubjectCacheKey); * * // If we looked up the wrong subject, then create a BasicAuthCacheKey * if (!lookedUpSubject.equals(invocationSubject)) { * hashtable = subjectHelper.getHashtableFromSubject(invocationSubject, new String[] { AttributeNameConstants.WSCREDENTIAL_USERID, * AttributeNameConstants.WSCREDENTIAL_PASSWORD }); * * if (hashtable != null) { * String userid = (String) hashtable.get(AttributeNameConstants.WSCREDENTIAL_USERID); * String password = (String) hashtable.get(AttributeNameConstants.WSCREDENTIAL_PASSWORD); * * if (password != null) { * invocationSubjectCacheKey = BasicAuthCacheKeyProvider.createLookupKey(subjectHelper.getRealm(invocationSubject), userid, password); * } else { * invocationSubjectCacheKey = BasicAuthCacheKeyProvider.createLookupKey(subjectHelper.getRealm(invocationSubject), userid); * } * } * } * } */ } } } if (invocationSubjectCacheKey != null) fields.put(INVOCATION_SUBJECT_CACHE_KEY, invocationSubjectCacheKey); }
[ "private", "void", "serializeSubjectCacheKey", "(", "PutField", "fields", ")", "throws", "Exception", "{", "if", "(", "callerSubject", "!=", "null", ")", "{", "Hashtable", "<", "String", ",", "?", ">", "hashtable", "=", "subjectHelper", ".", "getHashtableFromSubject", "(", "callerSubject", ",", "new", "String", "[", "]", "{", "AttributeNameConstants", ".", "WSCREDENTIAL_CACHE_KEY", "}", ")", ";", "if", "(", "hashtable", "!=", "null", ")", "{", "callerSubjectCacheKey", "=", "(", "String", ")", "hashtable", ".", "get", "(", "AttributeNameConstants", ".", "WSCREDENTIAL_CACHE_KEY", ")", ";", "/*\n * 12/08/14 RZ: Removed after discussions with Ajay and Ut. This is an unwanted functionality.\n * \n * if (callerSubjectCacheKey != null && authCache != null) {\n * Subject lookedUpSubject = authCache.getSubject(callerSubjectCacheKey);\n * \n * // If we looked up the wrong subject, then create a BasicAuthCacheKey\n * if (!lookedUpSubject.equals(callerSubject)) {\n * hashtable = subjectHelper.getHashtableFromSubject(callerSubject, new String[] { AttributeNameConstants.WSCREDENTIAL_USERID,\n * AttributeNameConstants.WSCREDENTIAL_PASSWORD });\n * \n * if (hashtable != null) {\n * String userid = (String) hashtable.get(AttributeNameConstants.WSCREDENTIAL_USERID);\n * String password = (String) hashtable.get(AttributeNameConstants.WSCREDENTIAL_PASSWORD);\n * \n * if (password != null) {\n * callerSubjectCacheKey = BasicAuthCacheKeyProvider.createLookupKey(subjectHelper.getRealm(callerSubject), userid, password);\n * } else {\n * callerSubjectCacheKey = BasicAuthCacheKeyProvider.createLookupKey(subjectHelper.getRealm(callerSubject), userid);\n * }\n * }\n * }\n * }\n */", "}", "}", "if", "(", "callerSubjectCacheKey", "!=", "null", ")", "fields", ".", "put", "(", "CALLER_SUBJECT_CACHE_KEY", ",", "callerSubjectCacheKey", ")", ";", "//only serialize invocation subject if it's different from the caller", "if", "(", "!", "subjectsAreEqual", ")", "{", "if", "(", "invocationSubject", "!=", "null", ")", "{", "Hashtable", "<", "String", ",", "?", ">", "hashtable", "=", "subjectHelper", ".", "getHashtableFromSubject", "(", "invocationSubject", ",", "new", "String", "[", "]", "{", "AttributeNameConstants", ".", "WSCREDENTIAL_CACHE_KEY", "}", ")", ";", "if", "(", "hashtable", "!=", "null", ")", "{", "invocationSubjectCacheKey", "=", "(", "String", ")", "hashtable", ".", "get", "(", "AttributeNameConstants", ".", "WSCREDENTIAL_CACHE_KEY", ")", ";", "/*\n * 12/08/14 RZ: Removed after discussions with Ajay and Ut. This is an unwanted functionality.\n * \n * if (invocationSubjectCacheKey != null && authCache != null) {\n * Subject lookedUpSubject = authCache.getSubject(invocationSubjectCacheKey);\n * \n * // If we looked up the wrong subject, then create a BasicAuthCacheKey\n * if (!lookedUpSubject.equals(invocationSubject)) {\n * hashtable = subjectHelper.getHashtableFromSubject(invocationSubject, new String[] { AttributeNameConstants.WSCREDENTIAL_USERID,\n * AttributeNameConstants.WSCREDENTIAL_PASSWORD });\n * \n * if (hashtable != null) {\n * String userid = (String) hashtable.get(AttributeNameConstants.WSCREDENTIAL_USERID);\n * String password = (String) hashtable.get(AttributeNameConstants.WSCREDENTIAL_PASSWORD);\n * \n * if (password != null) {\n * invocationSubjectCacheKey = BasicAuthCacheKeyProvider.createLookupKey(subjectHelper.getRealm(invocationSubject), userid, password);\n * } else {\n * invocationSubjectCacheKey = BasicAuthCacheKeyProvider.createLookupKey(subjectHelper.getRealm(invocationSubject), userid);\n * }\n * }\n * }\n * }\n */", "}", "}", "}", "if", "(", "invocationSubjectCacheKey", "!=", "null", ")", "fields", ".", "put", "(", "INVOCATION_SUBJECT_CACHE_KEY", ",", "invocationSubjectCacheKey", ")", ";", "}" ]
Serialize the cache lookup keys for the caller and invocation subjects
[ "Serialize", "the", "cache", "lookup", "keys", "for", "the", "caller", "and", "invocation", "subjects" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.context/src/com/ibm/ws/security/context/internal/SecurityContextImpl.java#L430-L506
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jsp.2.3/src/org/apache/jasper/runtime/BodyContentImpl.java
BodyContentImpl.clear
public void clear() throws IOException { if (writer != null) { throw new IOException(); } else { nextChar = 0; if (limitBuffer && (strBuffer.length() > this.bodyContentBuffSize)){ //PK95332 - starts if(com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable(Level.FINE)){ logger.logp(Level.FINE, CLASS_NAME, "BodyContentImpl", "clear buffer, create new one with buffer size ["+ this.bodyContentBuffSize +"]"); } strBuffer = new StringBuffer(this.bodyContentBuffSize); } else if (strBuffer != null) { // PI24001 //PK95332 - ends strBuffer.setLength(0); // PK33136 } //PK95332 } }
java
public void clear() throws IOException { if (writer != null) { throw new IOException(); } else { nextChar = 0; if (limitBuffer && (strBuffer.length() > this.bodyContentBuffSize)){ //PK95332 - starts if(com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable(Level.FINE)){ logger.logp(Level.FINE, CLASS_NAME, "BodyContentImpl", "clear buffer, create new one with buffer size ["+ this.bodyContentBuffSize +"]"); } strBuffer = new StringBuffer(this.bodyContentBuffSize); } else if (strBuffer != null) { // PI24001 //PK95332 - ends strBuffer.setLength(0); // PK33136 } //PK95332 } }
[ "public", "void", "clear", "(", ")", "throws", "IOException", "{", "if", "(", "writer", "!=", "null", ")", "{", "throw", "new", "IOException", "(", ")", ";", "}", "else", "{", "nextChar", "=", "0", ";", "if", "(", "limitBuffer", "&&", "(", "strBuffer", ".", "length", "(", ")", ">", "this", ".", "bodyContentBuffSize", ")", ")", "{", "//PK95332 - starts", "if", "(", "com", ".", "ibm", ".", "ejs", ".", "ras", ".", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "logger", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "{", "logger", ".", "logp", "(", "Level", ".", "FINE", ",", "CLASS_NAME", ",", "\"BodyContentImpl\"", ",", "\"clear buffer, create new one with buffer size [\"", "+", "this", ".", "bodyContentBuffSize", "+", "\"]\"", ")", ";", "}", "strBuffer", "=", "new", "StringBuffer", "(", "this", ".", "bodyContentBuffSize", ")", ";", "}", "else", "if", "(", "strBuffer", "!=", "null", ")", "{", "// PI24001\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//PK95332 - ends", "strBuffer", ".", "setLength", "(", "0", ")", ";", "// PK33136", "}", "//PK95332", "}", "}" ]
Clear the contents of the buffer. If the buffer has been already been flushed then the clear operation shall throw an IOException to signal the fact that some data has already been irrevocably written to the client response stream. @throws IOException If an I/O error occurs
[ "Clear", "the", "contents", "of", "the", "buffer", ".", "If", "the", "buffer", "has", "been", "already", "been", "flushed", "then", "the", "clear", "operation", "shall", "throw", "an", "IOException", "to", "signal", "the", "fact", "that", "some", "data", "has", "already", "been", "irrevocably", "written", "to", "the", "client", "response", "stream", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsp.2.3/src/org/apache/jasper/runtime/BodyContentImpl.java#L537-L551
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jsp.2.3/src/org/apache/jasper/runtime/BodyContentImpl.java
BodyContentImpl.writeOut
public void writeOut(Writer out) throws IOException { if (writer == null) { out.write(strBuffer.toString()); // PK33136 // Flush not called as the writer passed could be a BodyContent and // it doesn't allow to flush. } }
java
public void writeOut(Writer out) throws IOException { if (writer == null) { out.write(strBuffer.toString()); // PK33136 // Flush not called as the writer passed could be a BodyContent and // it doesn't allow to flush. } }
[ "public", "void", "writeOut", "(", "Writer", "out", ")", "throws", "IOException", "{", "if", "(", "writer", "==", "null", ")", "{", "out", ".", "write", "(", "strBuffer", ".", "toString", "(", ")", ")", ";", "// PK33136", "// Flush not called as the writer passed could be a BodyContent and", "// it doesn't allow to flush.", "}", "}" ]
Write the contents of this BodyJspWriter into a Writer. Subclasses are likely to do interesting things with the implementation so some things are extra efficient. @param out The writer into which to place the contents of this body evaluation
[ "Write", "the", "contents", "of", "this", "BodyJspWriter", "into", "a", "Writer", ".", "Subclasses", "are", "likely", "to", "do", "interesting", "things", "with", "the", "implementation", "so", "some", "things", "are", "extra", "efficient", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsp.2.3/src/org/apache/jasper/runtime/BodyContentImpl.java#L630-L636
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jsp.2.3/src/org/apache/jasper/runtime/BodyContentImpl.java
BodyContentImpl.setWriter
void setWriter(Writer writer) { // PM12137 - starts if (closed) { if(com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable(Level.FINE)){ logger.logp(Level.FINE, CLASS_NAME, "setWriter", "resetting closed to false for this=["+this+"]"); } closed = false; strBuffer = new StringBuffer(this.bodyContentBuffSize); } // PM12137 - ends this.writer = writer; if (writer != null) { // According to the spec, the JspWriter returned by // JspContext.pushBody(java.io.Writer writer) must behave as // though it were unbuffered. This means that its getBufferSize() // must always return 0. The implementation of // JspWriter.getBufferSize() returns the value of JspWriter's // 'bufferSize' field, which is inherited by this class. // Therefore, we simply save the current 'bufferSize' (so we can // later restore it should this BodyContentImpl ever be reused by // a call to PageContext.pushBody()) before setting it to 0. if (bufferSize != 0) { if(com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable(Level.FINE)){ logger.logp(Level.FINE, CLASS_NAME, "setWriter", "BodyContentImpl setWriter A. bufferSize=["+bufferSize+"] this=["+this+"]"); } bufferSizeSave = bufferSize; bufferSize = 0; } } else { bufferSize = bufferSizeSave; if(com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable(Level.FINE)){ logger.logp(Level.FINE, CLASS_NAME, "setWriter", "BodyContentImpl setWriter B. bufferSize=["+bufferSize+"] this=["+this+"]"); } clearBody(); } }
java
void setWriter(Writer writer) { // PM12137 - starts if (closed) { if(com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable(Level.FINE)){ logger.logp(Level.FINE, CLASS_NAME, "setWriter", "resetting closed to false for this=["+this+"]"); } closed = false; strBuffer = new StringBuffer(this.bodyContentBuffSize); } // PM12137 - ends this.writer = writer; if (writer != null) { // According to the spec, the JspWriter returned by // JspContext.pushBody(java.io.Writer writer) must behave as // though it were unbuffered. This means that its getBufferSize() // must always return 0. The implementation of // JspWriter.getBufferSize() returns the value of JspWriter's // 'bufferSize' field, which is inherited by this class. // Therefore, we simply save the current 'bufferSize' (so we can // later restore it should this BodyContentImpl ever be reused by // a call to PageContext.pushBody()) before setting it to 0. if (bufferSize != 0) { if(com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable(Level.FINE)){ logger.logp(Level.FINE, CLASS_NAME, "setWriter", "BodyContentImpl setWriter A. bufferSize=["+bufferSize+"] this=["+this+"]"); } bufferSizeSave = bufferSize; bufferSize = 0; } } else { bufferSize = bufferSizeSave; if(com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable(Level.FINE)){ logger.logp(Level.FINE, CLASS_NAME, "setWriter", "BodyContentImpl setWriter B. bufferSize=["+bufferSize+"] this=["+this+"]"); } clearBody(); } }
[ "void", "setWriter", "(", "Writer", "writer", ")", "{", "// PM12137 - starts", "if", "(", "closed", ")", "{", "if", "(", "com", ".", "ibm", ".", "ejs", ".", "ras", ".", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "logger", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "{", "logger", ".", "logp", "(", "Level", ".", "FINE", ",", "CLASS_NAME", ",", "\"setWriter\"", ",", "\"resetting closed to false for this=[\"", "+", "this", "+", "\"]\"", ")", ";", "}", "closed", "=", "false", ";", "strBuffer", "=", "new", "StringBuffer", "(", "this", ".", "bodyContentBuffSize", ")", ";", "}", "// PM12137 - ends", "this", ".", "writer", "=", "writer", ";", "if", "(", "writer", "!=", "null", ")", "{", "// According to the spec, the JspWriter returned by", "// JspContext.pushBody(java.io.Writer writer) must behave as", "// though it were unbuffered. This means that its getBufferSize()", "// must always return 0. The implementation of", "// JspWriter.getBufferSize() returns the value of JspWriter's", "// 'bufferSize' field, which is inherited by this class.", "// Therefore, we simply save the current 'bufferSize' (so we can", "// later restore it should this BodyContentImpl ever be reused by", "// a call to PageContext.pushBody()) before setting it to 0.", "if", "(", "bufferSize", "!=", "0", ")", "{", "if", "(", "com", ".", "ibm", ".", "ejs", ".", "ras", ".", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "logger", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "{", "logger", ".", "logp", "(", "Level", ".", "FINE", ",", "CLASS_NAME", ",", "\"setWriter\"", ",", "\"BodyContentImpl setWriter A. bufferSize=[\"", "+", "bufferSize", "+", "\"] this=[\"", "+", "this", "+", "\"]\"", ")", ";", "}", "bufferSizeSave", "=", "bufferSize", ";", "bufferSize", "=", "0", ";", "}", "}", "else", "{", "bufferSize", "=", "bufferSizeSave", ";", "if", "(", "com", ".", "ibm", ".", "ejs", ".", "ras", ".", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "logger", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "{", "logger", ".", "logp", "(", "Level", ".", "FINE", ",", "CLASS_NAME", ",", "\"setWriter\"", ",", "\"BodyContentImpl setWriter B. bufferSize=[\"", "+", "bufferSize", "+", "\"] this=[\"", "+", "this", "+", "\"]\"", ")", ";", "}", "clearBody", "(", ")", ";", "}", "}" ]
Sets the writer to which all output is written.
[ "Sets", "the", "writer", "to", "which", "all", "output", "is", "written", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsp.2.3/src/org/apache/jasper/runtime/BodyContentImpl.java#L650-L685
train
OpenLiberty/open-liberty
dev/com.ibm.ws.context/src/com/ibm/ws/context/service/serializable/ContextualObject.java
ContextualObject.getExecutionProperties
@Trivial public final Map<String, String> getExecutionProperties() { TreeMap<String, String> copy = null; if (internalPropNames != null) { copy = new TreeMap<String, String>(threadContextDescriptor.getExecutionProperties()); for (String name : internalPropNames) copy.remove(name); } return copy; }
java
@Trivial public final Map<String, String> getExecutionProperties() { TreeMap<String, String> copy = null; if (internalPropNames != null) { copy = new TreeMap<String, String>(threadContextDescriptor.getExecutionProperties()); for (String name : internalPropNames) copy.remove(name); } return copy; }
[ "@", "Trivial", "public", "final", "Map", "<", "String", ",", "String", ">", "getExecutionProperties", "(", ")", "{", "TreeMap", "<", "String", ",", "String", ">", "copy", "=", "null", ";", "if", "(", "internalPropNames", "!=", "null", ")", "{", "copy", "=", "new", "TreeMap", "<", "String", ",", "String", ">", "(", "threadContextDescriptor", ".", "getExecutionProperties", "(", ")", ")", ";", "for", "(", "String", "name", ":", "internalPropNames", ")", "copy", ".", "remove", "(", "name", ")", ";", "}", "return", "copy", ";", "}" ]
Returns a copy of execution properties. @return a copy of execution properties. Null if execution properties were not specified.
[ "Returns", "a", "copy", "of", "execution", "properties", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.context/src/com/ibm/ws/context/service/serializable/ContextualObject.java#L112-L121
train
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/io/async/Timer.java
Timer.createTimeoutRequest
public TimerWorkItem createTimeoutRequest(long timeoutTime, TimerCallback _callback, IAbstractAsyncFuture _future) { TimerWorkItem wi = new TimerWorkItem(timeoutTime, _callback, _future, _future.getReuseCount()); _future.setTimeoutWorkItem(wi); // put this to the Timer's work queue. Use the queue that the Timer // thread is not using. if ((this.queueToUse == 1) || (numQueues == 1)) { synchronized (this.requestQueue1) { // add the request to the Timer work queue this.requestQueue1.add(wi); } } else { synchronized (this.requestQueue2) { // add the request to the Timer work queue this.requestQueue2.add(wi); } } return wi; }
java
public TimerWorkItem createTimeoutRequest(long timeoutTime, TimerCallback _callback, IAbstractAsyncFuture _future) { TimerWorkItem wi = new TimerWorkItem(timeoutTime, _callback, _future, _future.getReuseCount()); _future.setTimeoutWorkItem(wi); // put this to the Timer's work queue. Use the queue that the Timer // thread is not using. if ((this.queueToUse == 1) || (numQueues == 1)) { synchronized (this.requestQueue1) { // add the request to the Timer work queue this.requestQueue1.add(wi); } } else { synchronized (this.requestQueue2) { // add the request to the Timer work queue this.requestQueue2.add(wi); } } return wi; }
[ "public", "TimerWorkItem", "createTimeoutRequest", "(", "long", "timeoutTime", ",", "TimerCallback", "_callback", ",", "IAbstractAsyncFuture", "_future", ")", "{", "TimerWorkItem", "wi", "=", "new", "TimerWorkItem", "(", "timeoutTime", ",", "_callback", ",", "_future", ",", "_future", ".", "getReuseCount", "(", ")", ")", ";", "_future", ".", "setTimeoutWorkItem", "(", "wi", ")", ";", "// put this to the Timer's work queue. Use the queue that the Timer", "// thread is not using.", "if", "(", "(", "this", ".", "queueToUse", "==", "1", ")", "||", "(", "numQueues", "==", "1", ")", ")", "{", "synchronized", "(", "this", ".", "requestQueue1", ")", "{", "// add the request to the Timer work queue", "this", ".", "requestQueue1", ".", "add", "(", "wi", ")", ";", "}", "}", "else", "{", "synchronized", "(", "this", ".", "requestQueue2", ")", "{", "// add the request to the Timer work queue", "this", ".", "requestQueue2", ".", "add", "(", "wi", ")", ";", "}", "}", "return", "wi", ";", "}" ]
Creates a work item and puts it on the work queue for requesting a timeout to be started. @param timeoutTime how long this timeout is for in milliseconds. @param _callback the routine to be called when/if the timeout triggers @param _future attachment to be passed to the callback routine @return the work item that was queue'd to the timer task. This item will be needed if it is to be cancelled later.
[ "Creates", "a", "work", "item", "and", "puts", "it", "on", "the", "work", "queue", "for", "requesting", "a", "timeout", "to", "be", "started", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/io/async/Timer.java#L108-L129
train
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/io/async/Timer.java
Timer.timeSlotPruning
public void timeSlotPruning(long curTime) { // if a bucket has not been accessed in a while, and it only has // dead entries then get rid of it TimeSlot slotEntry = this.firstSlot; TimeSlot nextSlot = null; int endIndex = 0; int i; while (slotEntry != null) { nextSlot = slotEntry.nextEntry; if (curTime - slotEntry.mostRecentlyAccessedTime > TIMESLOT_PRUNING_THRESHOLD) { endIndex = slotEntry.lastEntryIndex; // entries added last are more likely to be active, so // go from last to first for (i = endIndex; i >= 0; i--) { if (slotEntry.entries[i].state == TimerWorkItem.ENTRY_ACTIVE) { break; } } if (i < 0) { // no entries are active removeSlot(slotEntry); } } slotEntry = nextSlot; } }
java
public void timeSlotPruning(long curTime) { // if a bucket has not been accessed in a while, and it only has // dead entries then get rid of it TimeSlot slotEntry = this.firstSlot; TimeSlot nextSlot = null; int endIndex = 0; int i; while (slotEntry != null) { nextSlot = slotEntry.nextEntry; if (curTime - slotEntry.mostRecentlyAccessedTime > TIMESLOT_PRUNING_THRESHOLD) { endIndex = slotEntry.lastEntryIndex; // entries added last are more likely to be active, so // go from last to first for (i = endIndex; i >= 0; i--) { if (slotEntry.entries[i].state == TimerWorkItem.ENTRY_ACTIVE) { break; } } if (i < 0) { // no entries are active removeSlot(slotEntry); } } slotEntry = nextSlot; } }
[ "public", "void", "timeSlotPruning", "(", "long", "curTime", ")", "{", "// if a bucket has not been accessed in a while, and it only has", "// dead entries then get rid of it", "TimeSlot", "slotEntry", "=", "this", ".", "firstSlot", ";", "TimeSlot", "nextSlot", "=", "null", ";", "int", "endIndex", "=", "0", ";", "int", "i", ";", "while", "(", "slotEntry", "!=", "null", ")", "{", "nextSlot", "=", "slotEntry", ".", "nextEntry", ";", "if", "(", "curTime", "-", "slotEntry", ".", "mostRecentlyAccessedTime", ">", "TIMESLOT_PRUNING_THRESHOLD", ")", "{", "endIndex", "=", "slotEntry", ".", "lastEntryIndex", ";", "// entries added last are more likely to be active, so", "// go from last to first", "for", "(", "i", "=", "endIndex", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "if", "(", "slotEntry", ".", "entries", "[", "i", "]", ".", "state", "==", "TimerWorkItem", ".", "ENTRY_ACTIVE", ")", "{", "break", ";", "}", "}", "if", "(", "i", "<", "0", ")", "{", "// no entries are active", "removeSlot", "(", "slotEntry", ")", ";", "}", "}", "slotEntry", "=", "nextSlot", ";", "}", "}" ]
Remove slots which have no active requests, and no new requests have been added in a set amount of time. @param curTime the current time in msec.
[ "Remove", "slots", "which", "have", "no", "active", "requests", "and", "no", "new", "requests", "have", "been", "added", "in", "a", "set", "amount", "of", "time", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/io/async/Timer.java#L241-L271
train
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/io/async/Timer.java
Timer.insertWorkItem
public void insertWorkItem(TimerWorkItem work, long curTime) { // find the time slot, or create a new one long insertTime = work.timeoutTime; TimeSlot nextSlot = this.firstSlot; while (nextSlot != null) { if ((insertTime == nextSlot.timeoutTime) && (nextSlot.lastEntryIndex != TimeSlot.TIMESLOT_LAST_ENTRY)) { nextSlot.addEntry(work, curTime); break; } else if (insertTime < nextSlot.timeoutTime) { nextSlot = insertSlot(insertTime, nextSlot); nextSlot.addEntry(work, curTime); break; } else { nextSlot = nextSlot.nextEntry; } } if (nextSlot == null) { nextSlot = insertSlotAtEnd(insertTime); nextSlot.addEntry(work, curTime); } }
java
public void insertWorkItem(TimerWorkItem work, long curTime) { // find the time slot, or create a new one long insertTime = work.timeoutTime; TimeSlot nextSlot = this.firstSlot; while (nextSlot != null) { if ((insertTime == nextSlot.timeoutTime) && (nextSlot.lastEntryIndex != TimeSlot.TIMESLOT_LAST_ENTRY)) { nextSlot.addEntry(work, curTime); break; } else if (insertTime < nextSlot.timeoutTime) { nextSlot = insertSlot(insertTime, nextSlot); nextSlot.addEntry(work, curTime); break; } else { nextSlot = nextSlot.nextEntry; } } if (nextSlot == null) { nextSlot = insertSlotAtEnd(insertTime); nextSlot.addEntry(work, curTime); } }
[ "public", "void", "insertWorkItem", "(", "TimerWorkItem", "work", ",", "long", "curTime", ")", "{", "// find the time slot, or create a new one", "long", "insertTime", "=", "work", ".", "timeoutTime", ";", "TimeSlot", "nextSlot", "=", "this", ".", "firstSlot", ";", "while", "(", "nextSlot", "!=", "null", ")", "{", "if", "(", "(", "insertTime", "==", "nextSlot", ".", "timeoutTime", ")", "&&", "(", "nextSlot", ".", "lastEntryIndex", "!=", "TimeSlot", ".", "TIMESLOT_LAST_ENTRY", ")", ")", "{", "nextSlot", ".", "addEntry", "(", "work", ",", "curTime", ")", ";", "break", ";", "}", "else", "if", "(", "insertTime", "<", "nextSlot", ".", "timeoutTime", ")", "{", "nextSlot", "=", "insertSlot", "(", "insertTime", ",", "nextSlot", ")", ";", "nextSlot", ".", "addEntry", "(", "work", ",", "curTime", ")", ";", "break", ";", "}", "else", "{", "nextSlot", "=", "nextSlot", ".", "nextEntry", ";", "}", "}", "if", "(", "nextSlot", "==", "null", ")", "{", "nextSlot", "=", "insertSlotAtEnd", "(", "insertTime", ")", ";", "nextSlot", ".", "addEntry", "(", "work", ",", "curTime", ")", ";", "}", "}" ]
Put a work item into an existing time slot, or create a new time slot and put the work item into that time slot. @param work @param curTime
[ "Put", "a", "work", "item", "into", "an", "existing", "time", "slot", "or", "create", "a", "new", "time", "slot", "and", "put", "the", "work", "item", "into", "that", "time", "slot", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/io/async/Timer.java#L280-L302
train
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/io/async/Timer.java
Timer.insertSlot
public TimeSlot insertSlot(long newSlotTimeout, TimeSlot slot) { // this routine assumes the list is not empty TimeSlot retSlot = new TimeSlot(newSlotTimeout); retSlot.nextEntry = slot; retSlot.prevEntry = slot.prevEntry; if (retSlot.prevEntry != null) { retSlot.prevEntry.nextEntry = retSlot; } else { // no prev, so this is now the first slot this.firstSlot = retSlot; } slot.prevEntry = retSlot; return retSlot; }
java
public TimeSlot insertSlot(long newSlotTimeout, TimeSlot slot) { // this routine assumes the list is not empty TimeSlot retSlot = new TimeSlot(newSlotTimeout); retSlot.nextEntry = slot; retSlot.prevEntry = slot.prevEntry; if (retSlot.prevEntry != null) { retSlot.prevEntry.nextEntry = retSlot; } else { // no prev, so this is now the first slot this.firstSlot = retSlot; } slot.prevEntry = retSlot; return retSlot; }
[ "public", "TimeSlot", "insertSlot", "(", "long", "newSlotTimeout", ",", "TimeSlot", "slot", ")", "{", "// this routine assumes the list is not empty", "TimeSlot", "retSlot", "=", "new", "TimeSlot", "(", "newSlotTimeout", ")", ";", "retSlot", ".", "nextEntry", "=", "slot", ";", "retSlot", ".", "prevEntry", "=", "slot", ".", "prevEntry", ";", "if", "(", "retSlot", ".", "prevEntry", "!=", "null", ")", "{", "retSlot", ".", "prevEntry", ".", "nextEntry", "=", "retSlot", ";", "}", "else", "{", "// no prev, so this is now the first slot", "this", ".", "firstSlot", "=", "retSlot", ";", "}", "slot", ".", "prevEntry", "=", "retSlot", ";", "return", "retSlot", ";", "}" ]
Create a new time slot with a given timeout time, and add this new time slot in front of an existing time slot in the list. @param newSlotTimeout - timeout time for the new time slot @param slot - existing time slot @return TimeSlot - time slot that was created and added
[ "Create", "a", "new", "time", "slot", "with", "a", "given", "timeout", "time", "and", "add", "this", "new", "time", "slot", "in", "front", "of", "an", "existing", "time", "slot", "in", "the", "list", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/io/async/Timer.java#L314-L330
train
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/io/async/Timer.java
Timer.insertSlotAtEnd
public TimeSlot insertSlotAtEnd(long newSlotTimeout) { // this routine assumes that list could be empty TimeSlot retSlot = new TimeSlot(newSlotTimeout); if (this.lastSlot == null) { // list was empty this.lastSlot = retSlot; this.firstSlot = retSlot; } else { retSlot.prevEntry = this.lastSlot; this.lastSlot.nextEntry = retSlot; this.lastSlot = retSlot; } return retSlot; }
java
public TimeSlot insertSlotAtEnd(long newSlotTimeout) { // this routine assumes that list could be empty TimeSlot retSlot = new TimeSlot(newSlotTimeout); if (this.lastSlot == null) { // list was empty this.lastSlot = retSlot; this.firstSlot = retSlot; } else { retSlot.prevEntry = this.lastSlot; this.lastSlot.nextEntry = retSlot; this.lastSlot = retSlot; } return retSlot; }
[ "public", "TimeSlot", "insertSlotAtEnd", "(", "long", "newSlotTimeout", ")", "{", "// this routine assumes that list could be empty", "TimeSlot", "retSlot", "=", "new", "TimeSlot", "(", "newSlotTimeout", ")", ";", "if", "(", "this", ".", "lastSlot", "==", "null", ")", "{", "// list was empty", "this", ".", "lastSlot", "=", "retSlot", ";", "this", ".", "firstSlot", "=", "retSlot", ";", "}", "else", "{", "retSlot", ".", "prevEntry", "=", "this", ".", "lastSlot", ";", "this", ".", "lastSlot", ".", "nextEntry", "=", "retSlot", ";", "this", ".", "lastSlot", "=", "retSlot", ";", "}", "return", "retSlot", ";", "}" ]
Create a new time slot with a given timeout time, and add this new time slot at the end of the time slot list. @param newSlotTimeout - timeout time for the new slot @return time slot that was created and added
[ "Create", "a", "new", "time", "slot", "with", "a", "given", "timeout", "time", "and", "add", "this", "new", "time", "slot", "at", "the", "end", "of", "the", "time", "slot", "list", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/io/async/Timer.java#L340-L353
train
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/io/async/Timer.java
Timer.removeSlot
public void removeSlot(TimeSlot oldSlot) { if (oldSlot.nextEntry != null) { oldSlot.nextEntry.prevEntry = oldSlot.prevEntry; } else { // old slot was tail. this.lastSlot = oldSlot.prevEntry; } if (oldSlot.prevEntry != null) { oldSlot.prevEntry.nextEntry = oldSlot.nextEntry; } else { // oldSlot was head. this.firstSlot = oldSlot.nextEntry; } }
java
public void removeSlot(TimeSlot oldSlot) { if (oldSlot.nextEntry != null) { oldSlot.nextEntry.prevEntry = oldSlot.prevEntry; } else { // old slot was tail. this.lastSlot = oldSlot.prevEntry; } if (oldSlot.prevEntry != null) { oldSlot.prevEntry.nextEntry = oldSlot.nextEntry; } else { // oldSlot was head. this.firstSlot = oldSlot.nextEntry; } }
[ "public", "void", "removeSlot", "(", "TimeSlot", "oldSlot", ")", "{", "if", "(", "oldSlot", ".", "nextEntry", "!=", "null", ")", "{", "oldSlot", ".", "nextEntry", ".", "prevEntry", "=", "oldSlot", ".", "prevEntry", ";", "}", "else", "{", "// old slot was tail.", "this", ".", "lastSlot", "=", "oldSlot", ".", "prevEntry", ";", "}", "if", "(", "oldSlot", ".", "prevEntry", "!=", "null", ")", "{", "oldSlot", ".", "prevEntry", ".", "nextEntry", "=", "oldSlot", ".", "nextEntry", ";", "}", "else", "{", "// oldSlot was head.", "this", ".", "firstSlot", "=", "oldSlot", ".", "nextEntry", ";", "}", "}" ]
Remove a time slot from the list. @param oldSlot
[ "Remove", "a", "time", "slot", "from", "the", "list", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/io/async/Timer.java#L360-L376
train
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/io/async/Timer.java
Timer.checkForTimeouts
public void checkForTimeouts(long checkTime) { TimeSlot nextSlot = this.firstSlot; TimerWorkItem entry = null; TimeSlot oldSlot = null; while (nextSlot != null && checkTime >= nextSlot.timeoutTime) { // Timeout all entries here int endIndex = nextSlot.lastEntryIndex; for (int i = 0; i <= endIndex; i++) { // invoke callback if not already cancelled entry = nextSlot.entries[i]; if (entry.state == TimerWorkItem.ENTRY_ACTIVE) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Found a timeout, calling timerTriggered"); } entry.state = TimerWorkItem.ENTRY_CANCELLED; entry.callback.timerTriggered(entry); } } // since we timed out all slot entries, remove it oldSlot = nextSlot; removeSlot(oldSlot); nextSlot = nextSlot.nextEntry; } }
java
public void checkForTimeouts(long checkTime) { TimeSlot nextSlot = this.firstSlot; TimerWorkItem entry = null; TimeSlot oldSlot = null; while (nextSlot != null && checkTime >= nextSlot.timeoutTime) { // Timeout all entries here int endIndex = nextSlot.lastEntryIndex; for (int i = 0; i <= endIndex; i++) { // invoke callback if not already cancelled entry = nextSlot.entries[i]; if (entry.state == TimerWorkItem.ENTRY_ACTIVE) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Found a timeout, calling timerTriggered"); } entry.state = TimerWorkItem.ENTRY_CANCELLED; entry.callback.timerTriggered(entry); } } // since we timed out all slot entries, remove it oldSlot = nextSlot; removeSlot(oldSlot); nextSlot = nextSlot.nextEntry; } }
[ "public", "void", "checkForTimeouts", "(", "long", "checkTime", ")", "{", "TimeSlot", "nextSlot", "=", "this", ".", "firstSlot", ";", "TimerWorkItem", "entry", "=", "null", ";", "TimeSlot", "oldSlot", "=", "null", ";", "while", "(", "nextSlot", "!=", "null", "&&", "checkTime", ">=", "nextSlot", ".", "timeoutTime", ")", "{", "// Timeout all entries here", "int", "endIndex", "=", "nextSlot", ".", "lastEntryIndex", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<=", "endIndex", ";", "i", "++", ")", "{", "// invoke callback if not already cancelled", "entry", "=", "nextSlot", ".", "entries", "[", "i", "]", ";", "if", "(", "entry", ".", "state", "==", "TimerWorkItem", ".", "ENTRY_ACTIVE", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Found a timeout, calling timerTriggered\"", ")", ";", "}", "entry", ".", "state", "=", "TimerWorkItem", ".", "ENTRY_CANCELLED", ";", "entry", ".", "callback", ".", "timerTriggered", "(", "entry", ")", ";", "}", "}", "// since we timed out all slot entries, remove it", "oldSlot", "=", "nextSlot", ";", "removeSlot", "(", "oldSlot", ")", ";", "nextSlot", "=", "nextSlot", ".", "nextEntry", ";", "}", "}" ]
Check for timeouts in the time slot list. @param checkTime to use for calculation if time outs have occurred.
[ "Check", "for", "timeouts", "in", "the", "time", "slot", "list", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/io/async/Timer.java#L384-L410
train
OpenLiberty/open-liberty
dev/com.ibm.ws.kernel.service.location/src/com/ibm/ws/kernel/service/location/internal/FileLocator.java
FileLocator.getMatchingFileNames
public static List<String> getMatchingFileNames(String root, String filterExpr, boolean fullPath) { List<File> fileList = getMatchingFiles(root, filterExpr); List<String> list = new ArrayList<String>(fileList.size()); for (File f : fileList) { if (fullPath) list.add(f.getAbsolutePath()); else list.add(f.getName()); } return list; }
java
public static List<String> getMatchingFileNames(String root, String filterExpr, boolean fullPath) { List<File> fileList = getMatchingFiles(root, filterExpr); List<String> list = new ArrayList<String>(fileList.size()); for (File f : fileList) { if (fullPath) list.add(f.getAbsolutePath()); else list.add(f.getName()); } return list; }
[ "public", "static", "List", "<", "String", ">", "getMatchingFileNames", "(", "String", "root", ",", "String", "filterExpr", ",", "boolean", "fullPath", ")", "{", "List", "<", "File", ">", "fileList", "=", "getMatchingFiles", "(", "root", ",", "filterExpr", ")", ";", "List", "<", "String", ">", "list", "=", "new", "ArrayList", "<", "String", ">", "(", "fileList", ".", "size", "(", ")", ")", ";", "for", "(", "File", "f", ":", "fileList", ")", "{", "if", "(", "fullPath", ")", "list", ".", "add", "(", "f", ".", "getAbsolutePath", "(", ")", ")", ";", "else", "list", ".", "add", "(", "f", ".", "getName", "(", ")", ")", ";", "}", "return", "list", ";", "}" ]
Get a list of file names from the given path that match the provided filter; not recursive. @param root base directory to look for files @param filterExpr the regular expression to match, may be null @return List of File objects; List will be empty if root is null
[ "Get", "a", "list", "of", "file", "names", "from", "the", "given", "path", "that", "match", "the", "provided", "filter", ";", "not", "recursive", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.service.location/src/com/ibm/ws/kernel/service/location/internal/FileLocator.java#L275-L287
train
OpenLiberty/open-liberty
dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/PartnerLogTable.java
PartnerLogTable.getEntry
public PartnerLogData getEntry(int index) { if (tc.isEntryEnabled()) Tr.entry(tc, "getEntry", index); _pltReadLock.lock(); try { final PartnerLogData entry = _partnerLogTable.get(index - 1); if (tc.isEntryEnabled()) Tr.exit(tc, "getEntry", entry); return entry; } catch (IndexOutOfBoundsException ioobe) { // The index was invalid; return null. FFDCFilter.processException(ioobe, "com.ibm.ws.Transaction.JTA.PartnerLogTable.getEntry", "122", this); } finally { _pltReadLock.unlock(); } if (tc.isEntryEnabled()) Tr.exit(tc, "getEntry", null); return null; }
java
public PartnerLogData getEntry(int index) { if (tc.isEntryEnabled()) Tr.entry(tc, "getEntry", index); _pltReadLock.lock(); try { final PartnerLogData entry = _partnerLogTable.get(index - 1); if (tc.isEntryEnabled()) Tr.exit(tc, "getEntry", entry); return entry; } catch (IndexOutOfBoundsException ioobe) { // The index was invalid; return null. FFDCFilter.processException(ioobe, "com.ibm.ws.Transaction.JTA.PartnerLogTable.getEntry", "122", this); } finally { _pltReadLock.unlock(); } if (tc.isEntryEnabled()) Tr.exit(tc, "getEntry", null); return null; }
[ "public", "PartnerLogData", "getEntry", "(", "int", "index", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "tc", ",", "\"getEntry\"", ",", "index", ")", ";", "_pltReadLock", ".", "lock", "(", ")", ";", "try", "{", "final", "PartnerLogData", "entry", "=", "_partnerLogTable", ".", "get", "(", "index", "-", "1", ")", ";", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"getEntry\"", ",", "entry", ")", ";", "return", "entry", ";", "}", "catch", "(", "IndexOutOfBoundsException", "ioobe", ")", "{", "// The index was invalid; return null.", "FFDCFilter", ".", "processException", "(", "ioobe", ",", "\"com.ibm.ws.Transaction.JTA.PartnerLogTable.getEntry\"", ",", "\"122\"", ",", "this", ")", ";", "}", "finally", "{", "_pltReadLock", ".", "unlock", "(", ")", ";", "}", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"getEntry\"", ",", "null", ")", ";", "return", "null", ";", "}" ]
Return the entry in the recovery table at the given index, or null if the index is out of the table's bounds The supplied index is actually one greater than the index into the table. @param index the index in the table of the PartnerLogData object @return the entry in the recovery table at the given index, or null if the index is out of the table's bounds
[ "Return", "the", "entry", "in", "the", "recovery", "table", "at", "the", "given", "index", "or", "null", "if", "the", "index", "is", "out", "of", "the", "table", "s", "bounds" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/PartnerLogTable.java#L91-L112
train
OpenLiberty/open-liberty
dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/PartnerLogTable.java
PartnerLogTable.addEntry
public void addEntry(PartnerLogData logData) { if (tc.isEntryEnabled()) Tr.entry(tc, "addEntry", logData); _pltWriteLock.lock(); try { addPartnerEntry(logData); } finally { _pltWriteLock.unlock(); } if (tc.isEntryEnabled()) Tr.exit(tc, "addEntry"); }
java
public void addEntry(PartnerLogData logData) { if (tc.isEntryEnabled()) Tr.entry(tc, "addEntry", logData); _pltWriteLock.lock(); try { addPartnerEntry(logData); } finally { _pltWriteLock.unlock(); } if (tc.isEntryEnabled()) Tr.exit(tc, "addEntry"); }
[ "public", "void", "addEntry", "(", "PartnerLogData", "logData", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "tc", ",", "\"addEntry\"", ",", "logData", ")", ";", "_pltWriteLock", ".", "lock", "(", ")", ";", "try", "{", "addPartnerEntry", "(", "logData", ")", ";", "}", "finally", "{", "_pltWriteLock", ".", "unlock", "(", ")", ";", "}", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"addEntry\"", ")", ";", "}" ]
Add an entry at the end of the recovery table. @param logData the PartnerLogData object to add to the table @return result the entry index into the table
[ "Add", "an", "entry", "at", "the", "end", "of", "the", "recovery", "table", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/PartnerLogTable.java#L121-L135
train
OpenLiberty/open-liberty
dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/PartnerLogTable.java
PartnerLogTable.findEntry
public PartnerLogData findEntry(RecoveryWrapper rw) { if (tc.isEntryEnabled()) Tr.entry(tc, "findEntry", rw); PartnerLogData entry; _pltWriteLock.lock(); try { // Search the partner log table... for (PartnerLogData pld : _partnerLogTable) { final RecoveryWrapper nextWrapper = pld.getLogData(); if (rw.isSameAs(nextWrapper)) { if (tc.isDebugEnabled()) Tr.debug(tc, "Found entry in table"); if (tc.isEntryEnabled()) Tr.exit(tc, "findEntry", pld.getIndex()); return pld; } } // // We have never seen this wrapper before, // so we need to add it to the recoveryTable // entry = rw.container(_failureScopeController); addPartnerEntry(entry); } finally { _pltWriteLock.unlock(); } if (tc.isEntryEnabled()) Tr.exit(tc, "findEntry", entry); return entry; }
java
public PartnerLogData findEntry(RecoveryWrapper rw) { if (tc.isEntryEnabled()) Tr.entry(tc, "findEntry", rw); PartnerLogData entry; _pltWriteLock.lock(); try { // Search the partner log table... for (PartnerLogData pld : _partnerLogTable) { final RecoveryWrapper nextWrapper = pld.getLogData(); if (rw.isSameAs(nextWrapper)) { if (tc.isDebugEnabled()) Tr.debug(tc, "Found entry in table"); if (tc.isEntryEnabled()) Tr.exit(tc, "findEntry", pld.getIndex()); return pld; } } // // We have never seen this wrapper before, // so we need to add it to the recoveryTable // entry = rw.container(_failureScopeController); addPartnerEntry(entry); } finally { _pltWriteLock.unlock(); } if (tc.isEntryEnabled()) Tr.exit(tc, "findEntry", entry); return entry; }
[ "public", "PartnerLogData", "findEntry", "(", "RecoveryWrapper", "rw", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "tc", ",", "\"findEntry\"", ",", "rw", ")", ";", "PartnerLogData", "entry", ";", "_pltWriteLock", ".", "lock", "(", ")", ";", "try", "{", "// Search the partner log table...", "for", "(", "PartnerLogData", "pld", ":", "_partnerLogTable", ")", "{", "final", "RecoveryWrapper", "nextWrapper", "=", "pld", ".", "getLogData", "(", ")", ";", "if", "(", "rw", ".", "isSameAs", "(", "nextWrapper", ")", ")", "{", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "tc", ",", "\"Found entry in table\"", ")", ";", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"findEntry\"", ",", "pld", ".", "getIndex", "(", ")", ")", ";", "return", "pld", ";", "}", "}", "//", "// We have never seen this wrapper before,", "// so we need to add it to the recoveryTable", "//", "entry", "=", "rw", ".", "container", "(", "_failureScopeController", ")", ";", "addPartnerEntry", "(", "entry", ")", ";", "}", "finally", "{", "_pltWriteLock", ".", "unlock", "(", ")", ";", "}", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"findEntry\"", ",", "entry", ")", ";", "return", "entry", ";", "}" ]
This method searches the partner log table for an entry with matching wrapper. If an entry does not exist, one is created and added to the table. It should only be accessing the "runtime" table. Called from: TranManagerSet.registerResourceInfo TranManagerSet.registerJCAProvider TransactionState.setState when logging a superior coord on a subordinate at prepare time WSCoordinatorWrapper.log when logging a subordinate coord on a superior at prepare time RecoveryManager.shutdown when checking for a subordinate or superior coord at shutdown @param rw @return
[ "This", "method", "searches", "the", "partner", "log", "table", "for", "an", "entry", "with", "matching", "wrapper", ".", "If", "an", "entry", "does", "not", "exist", "one", "is", "created", "and", "added", "to", "the", "table", ".", "It", "should", "only", "be", "accessing", "the", "runtime", "table", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/PartnerLogTable.java#L197-L231
train
OpenLiberty/open-liberty
dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/PartnerLogTable.java
PartnerLogTable.clearUnused
public void clearUnused() { if (tc.isEntryEnabled()) Tr.entry(tc, "clearUnused"); final RecoveryLog partnerLog = _failureScopeController.getPartnerLog(); _pltWriteLock.lock(); try { boolean cleared = false; for (PartnerLogData pld : _partnerLogTable) { cleared |= pld.clearIfNotInUse(); } try { if (cleared) { ((DistributedRecoveryLog) partnerLog).keypoint(); } } catch (Exception exc) { // The keypoint operation has failed. There is very little we can do // other than continue with the close logic. This should be the the // that access to the log. There is nothing helpfull we can do at // this point. } } finally { _pltWriteLock.unlock(); } if (tc.isEntryEnabled()) Tr.exit(tc, "clearUnused"); }
java
public void clearUnused() { if (tc.isEntryEnabled()) Tr.entry(tc, "clearUnused"); final RecoveryLog partnerLog = _failureScopeController.getPartnerLog(); _pltWriteLock.lock(); try { boolean cleared = false; for (PartnerLogData pld : _partnerLogTable) { cleared |= pld.clearIfNotInUse(); } try { if (cleared) { ((DistributedRecoveryLog) partnerLog).keypoint(); } } catch (Exception exc) { // The keypoint operation has failed. There is very little we can do // other than continue with the close logic. This should be the the // that access to the log. There is nothing helpfull we can do at // this point. } } finally { _pltWriteLock.unlock(); } if (tc.isEntryEnabled()) Tr.exit(tc, "clearUnused"); }
[ "public", "void", "clearUnused", "(", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "tc", ",", "\"clearUnused\"", ")", ";", "final", "RecoveryLog", "partnerLog", "=", "_failureScopeController", ".", "getPartnerLog", "(", ")", ";", "_pltWriteLock", ".", "lock", "(", ")", ";", "try", "{", "boolean", "cleared", "=", "false", ";", "for", "(", "PartnerLogData", "pld", ":", "_partnerLogTable", ")", "{", "cleared", "|=", "pld", ".", "clearIfNotInUse", "(", ")", ";", "}", "try", "{", "if", "(", "cleared", ")", "{", "(", "(", "DistributedRecoveryLog", ")", "partnerLog", ")", ".", "keypoint", "(", ")", ";", "}", "}", "catch", "(", "Exception", "exc", ")", "{", "// The keypoint operation has failed. There is very little we can do", "// other than continue with the close logic. This should be the the", "// that access to the log. There is nothing helpfull we can do at", "// this point.", "}", "}", "finally", "{", "_pltWriteLock", ".", "unlock", "(", ")", ";", "}", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"clearUnused\"", ")", ";", "}" ]
Scans through the partners listed in this table and instructs each of them to clear themselves from the recovery log if they are not associated with current transactions. Entries remain in the table an can be re-logged during if they are used again.
[ "Scans", "through", "the", "partners", "listed", "in", "this", "table", "and", "instructs", "each", "of", "them", "to", "clear", "themselves", "from", "the", "recovery", "log", "if", "they", "are", "not", "associated", "with", "current", "transactions", ".", "Entries", "remain", "in", "the", "table", "an", "can", "be", "re", "-", "logged", "during", "if", "they", "are", "used", "again", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/PartnerLogTable.java#L306-L337
train
OpenLiberty/open-liberty
dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/PartnerLogTable.java
PartnerLogTable.recover
public boolean recover(RecoveryManager recoveryManager, ClassLoader cl, Xid[] xids) { boolean success = true; // flag to indicate that we recovered all RMs if (tc.isEntryEnabled()) Tr.entry(tc, "recover", new Object[] { this, _failureScopeController.serverName() }); final int restartEpoch = recoveryManager.getCurrentEpoch(); final byte[] cruuid = recoveryManager.getApplId(); for (PartnerLogData pld : _partnerLogTable) { if (!pld.recover(cl, xids, null, cruuid, restartEpoch)) { success = false; } // Determine if shutdown processing started on another thread. // If it has, no further action can be taken. if (recoveryManager.shutdownInProgress()) { success = false; break; } } if (tc.isEntryEnabled()) Tr.exit(tc, "recover", success); return success; }
java
public boolean recover(RecoveryManager recoveryManager, ClassLoader cl, Xid[] xids) { boolean success = true; // flag to indicate that we recovered all RMs if (tc.isEntryEnabled()) Tr.entry(tc, "recover", new Object[] { this, _failureScopeController.serverName() }); final int restartEpoch = recoveryManager.getCurrentEpoch(); final byte[] cruuid = recoveryManager.getApplId(); for (PartnerLogData pld : _partnerLogTable) { if (!pld.recover(cl, xids, null, cruuid, restartEpoch)) { success = false; } // Determine if shutdown processing started on another thread. // If it has, no further action can be taken. if (recoveryManager.shutdownInProgress()) { success = false; break; } } if (tc.isEntryEnabled()) Tr.exit(tc, "recover", success); return success; }
[ "public", "boolean", "recover", "(", "RecoveryManager", "recoveryManager", ",", "ClassLoader", "cl", ",", "Xid", "[", "]", "xids", ")", "{", "boolean", "success", "=", "true", ";", "// flag to indicate that we recovered all RMs", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "tc", ",", "\"recover\"", ",", "new", "Object", "[", "]", "{", "this", ",", "_failureScopeController", ".", "serverName", "(", ")", "}", ")", ";", "final", "int", "restartEpoch", "=", "recoveryManager", ".", "getCurrentEpoch", "(", ")", ";", "final", "byte", "[", "]", "cruuid", "=", "recoveryManager", ".", "getApplId", "(", ")", ";", "for", "(", "PartnerLogData", "pld", ":", "_partnerLogTable", ")", "{", "if", "(", "!", "pld", ".", "recover", "(", "cl", ",", "xids", ",", "null", ",", "cruuid", ",", "restartEpoch", ")", ")", "{", "success", "=", "false", ";", "}", "// Determine if shutdown processing started on another thread. ", "// If it has, no further action can be taken.", "if", "(", "recoveryManager", ".", "shutdownInProgress", "(", ")", ")", "{", "success", "=", "false", ";", "break", ";", "}", "}", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"recover\"", ",", "success", ")", ";", "return", "success", ";", "}" ]
Determine XA RMs needing recovery. <p> For each resource manager known to the transaction service all indoubt transactions are located. @param cl A class loader for contacting XA RMs
[ "Determine", "XA", "RMs", "needing", "recovery", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/PartnerLogTable.java#L348-L373
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jndi.management.j2ee/src/com/ibm/ws/jndi/management/j2ee/internal/JNDIMBeanRuntime.java
JNDIMBeanRuntime.registerMBean
private <T> ServiceRegistration<T> registerMBean(ObjectName on, Class<T> type, T o) { Dictionary<String, Object> props = new Hashtable<String, Object>(); props.put("jmx.objectname", on.toString()); return context.registerService(type, o, props); }
java
private <T> ServiceRegistration<T> registerMBean(ObjectName on, Class<T> type, T o) { Dictionary<String, Object> props = new Hashtable<String, Object>(); props.put("jmx.objectname", on.toString()); return context.registerService(type, o, props); }
[ "private", "<", "T", ">", "ServiceRegistration", "<", "T", ">", "registerMBean", "(", "ObjectName", "on", ",", "Class", "<", "T", ">", "type", ",", "T", "o", ")", "{", "Dictionary", "<", "String", ",", "Object", ">", "props", "=", "new", "Hashtable", "<", "String", ",", "Object", ">", "(", ")", ";", "props", ".", "put", "(", "\"jmx.objectname\"", ",", "on", ".", "toString", "(", ")", ")", ";", "return", "context", ".", "registerService", "(", "type", ",", "o", ",", "props", ")", ";", "}" ]
Used to Register an MBean @param on : The ObjectName registration for the MBean @param type : The class type of the MBean being register @param o: The MBean @return : A service registration that provides access to manage the MBean
[ "Used", "to", "Register", "an", "MBean" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jndi.management.j2ee/src/com/ibm/ws/jndi/management/j2ee/internal/JNDIMBeanRuntime.java#L104-L108
train
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer.servlet.3.1/src/com/ibm/ws/webcontainer31/async/AsyncContext31Impl.java
AsyncContext31Impl.startReadListener
public void startReadListener(ThreadContextManager tcm, SRTInputStream31 inputStream) throws Exception{ try { ReadListenerRunnable rlRunnable = new ReadListenerRunnable(tcm, inputStream, this); this.setReadListenerRunning(true); com.ibm.ws.webcontainer.osgi.WebContainer.getExecutorService().execute(rlRunnable); // The read listener will now be invoked on another thread. Call pre-join to // notify interested components that this will be happening. It's possible that // the read listener may run before the pre-join is complete, and callers need to // be able to cope with that. notifyITransferContextPreProcessWorkState(); } catch (Exception e) { this.setReadListenerRunning(false); throw e; } }
java
public void startReadListener(ThreadContextManager tcm, SRTInputStream31 inputStream) throws Exception{ try { ReadListenerRunnable rlRunnable = new ReadListenerRunnable(tcm, inputStream, this); this.setReadListenerRunning(true); com.ibm.ws.webcontainer.osgi.WebContainer.getExecutorService().execute(rlRunnable); // The read listener will now be invoked on another thread. Call pre-join to // notify interested components that this will be happening. It's possible that // the read listener may run before the pre-join is complete, and callers need to // be able to cope with that. notifyITransferContextPreProcessWorkState(); } catch (Exception e) { this.setReadListenerRunning(false); throw e; } }
[ "public", "void", "startReadListener", "(", "ThreadContextManager", "tcm", ",", "SRTInputStream31", "inputStream", ")", "throws", "Exception", "{", "try", "{", "ReadListenerRunnable", "rlRunnable", "=", "new", "ReadListenerRunnable", "(", "tcm", ",", "inputStream", ",", "this", ")", ";", "this", ".", "setReadListenerRunning", "(", "true", ")", ";", "com", ".", "ibm", ".", "ws", ".", "webcontainer", ".", "osgi", ".", "WebContainer", ".", "getExecutorService", "(", ")", ".", "execute", "(", "rlRunnable", ")", ";", "// The read listener will now be invoked on another thread. Call pre-join to", "// notify interested components that this will be happening. It's possible that", "// the read listener may run before the pre-join is complete, and callers need to", "// be able to cope with that.", "notifyITransferContextPreProcessWorkState", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "this", ".", "setReadListenerRunning", "(", "false", ")", ";", "throw", "e", ";", "}", "}" ]
A read listener has been set on the SRTInputStream and we will set it up to do its first read on another thread.
[ "A", "read", "listener", "has", "been", "set", "on", "the", "SRTInputStream", "and", "we", "will", "set", "it", "up", "to", "do", "its", "first", "read", "on", "another", "thread", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.servlet.3.1/src/com/ibm/ws/webcontainer31/async/AsyncContext31Impl.java#L193-L208
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/framework/Framework.java
Framework.getThreadPool
public ThreadPool getThreadPool(String threadPoolName, int minSize, int maxSize) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getThreadPool", new Object[]{threadPoolName, minSize, maxSize}); ThreadPool threadPool = null; if (RuntimeInfo.isThinClient()) { try { Class clazz = Class.forName(JFapChannelConstants.THIN_CLIENT_THREADPOOL_CLASS); threadPool = (ThreadPool) clazz.newInstance(); } catch (Exception e) { FFDCFilter.processException(e, CLASS_NAME + ".getInstance", JFapChannelConstants.FRAMEWORK_GETTHREADPOOL_01, JFapChannelConstants.THIN_CLIENT_THREADPOOL_CLASS); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Unable to instantiate thin client thread pool", e); // Nothin we can do throw this on... throw new SIErrorException(e); } } else { try { Class clazz = Class.forName(JFapChannelConstants.RICH_CLIENT_THREADPOOL_CLASS); threadPool = (ThreadPool) clazz.newInstance(); } catch (Exception e) { FFDCFilter.processException(e, CLASS_NAME + ".getInstance", JFapChannelConstants.FRAMEWORK_GETTHREADPOOL_02, JFapChannelConstants.RICH_CLIENT_THREADPOOL_CLASS); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Unable to instantiate rich client thread pool", e); // Nothin we can do throw this on... throw new SIErrorException(e); } } threadPool.initialise(threadPoolName, minSize, maxSize); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getThreadPool", threadPool); return threadPool; }
java
public ThreadPool getThreadPool(String threadPoolName, int minSize, int maxSize) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getThreadPool", new Object[]{threadPoolName, minSize, maxSize}); ThreadPool threadPool = null; if (RuntimeInfo.isThinClient()) { try { Class clazz = Class.forName(JFapChannelConstants.THIN_CLIENT_THREADPOOL_CLASS); threadPool = (ThreadPool) clazz.newInstance(); } catch (Exception e) { FFDCFilter.processException(e, CLASS_NAME + ".getInstance", JFapChannelConstants.FRAMEWORK_GETTHREADPOOL_01, JFapChannelConstants.THIN_CLIENT_THREADPOOL_CLASS); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Unable to instantiate thin client thread pool", e); // Nothin we can do throw this on... throw new SIErrorException(e); } } else { try { Class clazz = Class.forName(JFapChannelConstants.RICH_CLIENT_THREADPOOL_CLASS); threadPool = (ThreadPool) clazz.newInstance(); } catch (Exception e) { FFDCFilter.processException(e, CLASS_NAME + ".getInstance", JFapChannelConstants.FRAMEWORK_GETTHREADPOOL_02, JFapChannelConstants.RICH_CLIENT_THREADPOOL_CLASS); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Unable to instantiate rich client thread pool", e); // Nothin we can do throw this on... throw new SIErrorException(e); } } threadPool.initialise(threadPoolName, minSize, maxSize); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getThreadPool", threadPool); return threadPool; }
[ "public", "ThreadPool", "getThreadPool", "(", "String", "threadPoolName", ",", "int", "minSize", ",", "int", "maxSize", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "this", ",", "tc", ",", "\"getThreadPool\"", ",", "new", "Object", "[", "]", "{", "threadPoolName", ",", "minSize", ",", "maxSize", "}", ")", ";", "ThreadPool", "threadPool", "=", "null", ";", "if", "(", "RuntimeInfo", ".", "isThinClient", "(", ")", ")", "{", "try", "{", "Class", "clazz", "=", "Class", ".", "forName", "(", "JFapChannelConstants", ".", "THIN_CLIENT_THREADPOOL_CLASS", ")", ";", "threadPool", "=", "(", "ThreadPool", ")", "clazz", ".", "newInstance", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "FFDCFilter", ".", "processException", "(", "e", ",", "CLASS_NAME", "+", "\".getInstance\"", ",", "JFapChannelConstants", ".", "FRAMEWORK_GETTHREADPOOL_01", ",", "JFapChannelConstants", ".", "THIN_CLIENT_THREADPOOL_CLASS", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "SibTr", ".", "debug", "(", "tc", ",", "\"Unable to instantiate thin client thread pool\"", ",", "e", ")", ";", "// Nothin we can do throw this on...", "throw", "new", "SIErrorException", "(", "e", ")", ";", "}", "}", "else", "{", "try", "{", "Class", "clazz", "=", "Class", ".", "forName", "(", "JFapChannelConstants", ".", "RICH_CLIENT_THREADPOOL_CLASS", ")", ";", "threadPool", "=", "(", "ThreadPool", ")", "clazz", ".", "newInstance", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "FFDCFilter", ".", "processException", "(", "e", ",", "CLASS_NAME", "+", "\".getInstance\"", ",", "JFapChannelConstants", ".", "FRAMEWORK_GETTHREADPOOL_02", ",", "JFapChannelConstants", ".", "RICH_CLIENT_THREADPOOL_CLASS", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "SibTr", ".", "debug", "(", "tc", ",", "\"Unable to instantiate rich client thread pool\"", ",", "e", ")", ";", "// Nothin we can do throw this on...", "throw", "new", "SIErrorException", "(", "e", ")", ";", "}", "}", "threadPool", ".", "initialise", "(", "threadPoolName", ",", "minSize", ",", "maxSize", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "this", ",", "tc", ",", "\"getThreadPool\"", ",", "threadPool", ")", ";", "return", "threadPool", ";", "}" ]
Retrieves a thread pool that is backed by the appropriate framework implementation. @param threadPoolName The name for the new thread pool. @param minSize The minimum size for the new pool. @param maxSize The maximum size for the new pool. @return Returns a thread pool of the correct type (this is different depending on whether we are a thin client or a rich client).
[ "Retrieves", "a", "thread", "pool", "that", "is", "backed", "by", "the", "appropriate", "framework", "implementation", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/framework/Framework.java#L182-L232
train
OpenLiberty/open-liberty
dev/com.ibm.ws.monitor/src/com/ibm/websphere/monitor/meters/StatisticsMeter.java
StatisticsMeter.cleanup
private void cleanup() { StatsDataReference ref = null; while ((ref = (StatsDataReference) statisticsReferenceQueue.poll()) != null) { StatsData oldStats = null; StatsData updatedStats = null; do { oldStats = terminatedThreadStats.get(); updatedStats = aggregateStats(oldStats, ref.statsData); } while (!terminatedThreadStats.compareAndSet(oldStats, updatedStats)); allReferences.remove(ref); } }
java
private void cleanup() { StatsDataReference ref = null; while ((ref = (StatsDataReference) statisticsReferenceQueue.poll()) != null) { StatsData oldStats = null; StatsData updatedStats = null; do { oldStats = terminatedThreadStats.get(); updatedStats = aggregateStats(oldStats, ref.statsData); } while (!terminatedThreadStats.compareAndSet(oldStats, updatedStats)); allReferences.remove(ref); } }
[ "private", "void", "cleanup", "(", ")", "{", "StatsDataReference", "ref", "=", "null", ";", "while", "(", "(", "ref", "=", "(", "StatsDataReference", ")", "statisticsReferenceQueue", ".", "poll", "(", ")", ")", "!=", "null", ")", "{", "StatsData", "oldStats", "=", "null", ";", "StatsData", "updatedStats", "=", "null", ";", "do", "{", "oldStats", "=", "terminatedThreadStats", ".", "get", "(", ")", ";", "updatedStats", "=", "aggregateStats", "(", "oldStats", ",", "ref", ".", "statsData", ")", ";", "}", "while", "(", "!", "terminatedThreadStats", ".", "compareAndSet", "(", "oldStats", ",", "updatedStats", ")", ")", ";", "allReferences", ".", "remove", "(", "ref", ")", ";", "}", "}" ]
Poll the reference queue looking for statistics data associated with a thread that is no longer reachable. If one is found, update the terminated thread statistics.
[ "Poll", "the", "reference", "queue", "looking", "for", "statistics", "data", "associated", "with", "a", "thread", "that", "is", "no", "longer", "reachable", ".", "If", "one", "is", "found", "update", "the", "terminated", "thread", "statistics", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/websphere/monitor/meters/StatisticsMeter.java#L329-L340
train
OpenLiberty/open-liberty
dev/com.ibm.ws.security.mp.jwt_fat/fat/src/com/ibm/ws/security/mp/jwt/fat/CommonMpJwtFat.java
CommonMpJwtFat.goodAppExpectations
public Expectations goodAppExpectations(String theUrl, String appClass) throws Exception { Expectations expectations = new Expectations(); expectations.addExpectations(CommonExpectations.successfullyReachedUrl(theUrl)); expectations.addExpectation(new ResponseFullExpectation(MpJwtFatConstants.STRING_CONTAINS, appClass, "Did not invoke the app " + appClass + ".")); return expectations; }
java
public Expectations goodAppExpectations(String theUrl, String appClass) throws Exception { Expectations expectations = new Expectations(); expectations.addExpectations(CommonExpectations.successfullyReachedUrl(theUrl)); expectations.addExpectation(new ResponseFullExpectation(MpJwtFatConstants.STRING_CONTAINS, appClass, "Did not invoke the app " + appClass + ".")); return expectations; }
[ "public", "Expectations", "goodAppExpectations", "(", "String", "theUrl", ",", "String", "appClass", ")", "throws", "Exception", "{", "Expectations", "expectations", "=", "new", "Expectations", "(", ")", ";", "expectations", ".", "addExpectations", "(", "CommonExpectations", ".", "successfullyReachedUrl", "(", "theUrl", ")", ")", ";", "expectations", ".", "addExpectation", "(", "new", "ResponseFullExpectation", "(", "MpJwtFatConstants", ".", "STRING_CONTAINS", ",", "appClass", ",", "\"Did not invoke the app \"", "+", "appClass", "+", "\".\"", ")", ")", ";", "return", "expectations", ";", "}" ]
Set good app check expectations - sets checks for good status code and for a message indicating what if any app class was invoked successfully @param theUrl - the url that the test invoked @param appClass - the app class that should have been invoked @return - newly created Expectations @throws Exception
[ "Set", "good", "app", "check", "expectations", "-", "sets", "checks", "for", "good", "status", "code", "and", "for", "a", "message", "indicating", "what", "if", "any", "app", "class", "was", "invoked", "successfully" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.mp.jwt_fat/fat/src/com/ibm/ws/security/mp/jwt/fat/CommonMpJwtFat.java#L95-L102
train
OpenLiberty/open-liberty
dev/com.ibm.ws.security.mp.jwt_fat/fat/src/com/ibm/ws/security/mp/jwt/fat/CommonMpJwtFat.java
CommonMpJwtFat.badAppExpectations
public Expectations badAppExpectations(String errorMessage) throws Exception { Expectations expectations = new Expectations(); expectations.addExpectation(new ResponseStatusExpectation(HttpServletResponse.SC_UNAUTHORIZED)); expectations.addExpectation(new ResponseMessageExpectation(MpJwtFatConstants.STRING_CONTAINS, errorMessage, "Did not find the error message: " + errorMessage)); return expectations; }
java
public Expectations badAppExpectations(String errorMessage) throws Exception { Expectations expectations = new Expectations(); expectations.addExpectation(new ResponseStatusExpectation(HttpServletResponse.SC_UNAUTHORIZED)); expectations.addExpectation(new ResponseMessageExpectation(MpJwtFatConstants.STRING_CONTAINS, errorMessage, "Did not find the error message: " + errorMessage)); return expectations; }
[ "public", "Expectations", "badAppExpectations", "(", "String", "errorMessage", ")", "throws", "Exception", "{", "Expectations", "expectations", "=", "new", "Expectations", "(", ")", ";", "expectations", ".", "addExpectation", "(", "new", "ResponseStatusExpectation", "(", "HttpServletResponse", ".", "SC_UNAUTHORIZED", ")", ")", ";", "expectations", ".", "addExpectation", "(", "new", "ResponseMessageExpectation", "(", "MpJwtFatConstants", ".", "STRING_CONTAINS", ",", "errorMessage", ",", "\"Did not find the error message: \"", "+", "errorMessage", ")", ")", ";", "return", "expectations", ";", "}" ]
Set bad app check expectations - sets checks for a 401 status code and the expected error message in the server's messages.log @param errorMessage - the error message to search for in the server's messages.log file @return - newly created Expectations @throws Exception
[ "Set", "bad", "app", "check", "expectations", "-", "sets", "checks", "for", "a", "401", "status", "code", "and", "the", "expected", "error", "message", "in", "the", "server", "s", "messages", ".", "log" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.mp.jwt_fat/fat/src/com/ibm/ws/security/mp/jwt/fat/CommonMpJwtFat.java#L111-L118
train
OpenLiberty/open-liberty
dev/com.ibm.ws.security.mp.jwt_fat/fat/src/com/ibm/ws/security/mp/jwt/fat/CommonMpJwtFat.java
CommonMpJwtFat.buildAppUrl
public String buildAppUrl(LibertyServer theServer, String root, String app) throws Exception { return SecurityFatHttpUtils.getServerUrlBase(theServer) + root + "/rest/" + app + "/" + MpJwtFatConstants.MPJWT_GENERIC_APP_NAME; }
java
public String buildAppUrl(LibertyServer theServer, String root, String app) throws Exception { return SecurityFatHttpUtils.getServerUrlBase(theServer) + root + "/rest/" + app + "/" + MpJwtFatConstants.MPJWT_GENERIC_APP_NAME; }
[ "public", "String", "buildAppUrl", "(", "LibertyServer", "theServer", ",", "String", "root", ",", "String", "app", ")", "throws", "Exception", "{", "return", "SecurityFatHttpUtils", ".", "getServerUrlBase", "(", "theServer", ")", "+", "root", "+", "\"/rest/\"", "+", "app", "+", "\"/\"", "+", "MpJwtFatConstants", ".", "MPJWT_GENERIC_APP_NAME", ";", "}" ]
Build the http app url @param theServer - The server where the app is running (used to get the port) @param root - the root context of the app @param app - the specific app to run @return - returns the full url to invoke @throws Exception
[ "Build", "the", "http", "app", "url" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.mp.jwt_fat/fat/src/com/ibm/ws/security/mp/jwt/fat/CommonMpJwtFat.java#L129-L133
train
OpenLiberty/open-liberty
dev/com.ibm.ws.security.mp.jwt_fat/fat/src/com/ibm/ws/security/mp/jwt/fat/CommonMpJwtFat.java
CommonMpJwtFat.buildAppSecureUrl
public String buildAppSecureUrl(LibertyServer theServer, String root, String app) throws Exception { return SecurityFatHttpUtils.getServerSecureUrlBase(theServer) + root + "/rest/" + app + "/" + MpJwtFatConstants.MPJWT_GENERIC_APP_NAME; }
java
public String buildAppSecureUrl(LibertyServer theServer, String root, String app) throws Exception { return SecurityFatHttpUtils.getServerSecureUrlBase(theServer) + root + "/rest/" + app + "/" + MpJwtFatConstants.MPJWT_GENERIC_APP_NAME; }
[ "public", "String", "buildAppSecureUrl", "(", "LibertyServer", "theServer", ",", "String", "root", ",", "String", "app", ")", "throws", "Exception", "{", "return", "SecurityFatHttpUtils", ".", "getServerSecureUrlBase", "(", "theServer", ")", "+", "root", "+", "\"/rest/\"", "+", "app", "+", "\"/\"", "+", "MpJwtFatConstants", ".", "MPJWT_GENERIC_APP_NAME", ";", "}" ]
Build the https app url @param theServer - The server where the app is running (used to get the port) @param root - the root context of the app @param app - the specific app to run @return - returns the full url to invoke @throws Exception
[ "Build", "the", "https", "app", "url" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.mp.jwt_fat/fat/src/com/ibm/ws/security/mp/jwt/fat/CommonMpJwtFat.java#L144-L148
train
OpenLiberty/open-liberty
dev/com.ibm.ws.security.mp.jwt_fat/fat/src/com/ibm/ws/security/mp/jwt/fat/CommonMpJwtFat.java
CommonMpJwtFat.setBadIssuerExpectations
public Expectations setBadIssuerExpectations(LibertyServer server) throws Exception { Expectations expectations = new Expectations(); expectations.addExpectation(new ResponseStatusExpectation(HttpServletResponse.SC_UNAUTHORIZED)); expectations.addExpectation(new ServerMessageExpectation(server, MpJwtMessageConstants.CWWKS5523E_ERROR_CREATING_JWT_USING_TOKEN_IN_REQ, "Messagelog did not contain an error indicating a problem authenticating the request with the provided token.")); expectations.addExpectation(new ServerMessageExpectation(server, MpJwtMessageConstants.CWWKS6022E_ISSUER_NOT_TRUSTED, "Messagelog did not contain an exception indicating that the issuer is NOT valid.")); return expectations; }
java
public Expectations setBadIssuerExpectations(LibertyServer server) throws Exception { Expectations expectations = new Expectations(); expectations.addExpectation(new ResponseStatusExpectation(HttpServletResponse.SC_UNAUTHORIZED)); expectations.addExpectation(new ServerMessageExpectation(server, MpJwtMessageConstants.CWWKS5523E_ERROR_CREATING_JWT_USING_TOKEN_IN_REQ, "Messagelog did not contain an error indicating a problem authenticating the request with the provided token.")); expectations.addExpectation(new ServerMessageExpectation(server, MpJwtMessageConstants.CWWKS6022E_ISSUER_NOT_TRUSTED, "Messagelog did not contain an exception indicating that the issuer is NOT valid.")); return expectations; }
[ "public", "Expectations", "setBadIssuerExpectations", "(", "LibertyServer", "server", ")", "throws", "Exception", "{", "Expectations", "expectations", "=", "new", "Expectations", "(", ")", ";", "expectations", ".", "addExpectation", "(", "new", "ResponseStatusExpectation", "(", "HttpServletResponse", ".", "SC_UNAUTHORIZED", ")", ")", ";", "expectations", ".", "addExpectation", "(", "new", "ServerMessageExpectation", "(", "server", ",", "MpJwtMessageConstants", ".", "CWWKS5523E_ERROR_CREATING_JWT_USING_TOKEN_IN_REQ", ",", "\"Messagelog did not contain an error indicating a problem authenticating the request with the provided token.\"", ")", ")", ";", "expectations", ".", "addExpectation", "(", "new", "ServerMessageExpectation", "(", "server", ",", "MpJwtMessageConstants", ".", "CWWKS6022E_ISSUER_NOT_TRUSTED", ",", "\"Messagelog did not contain an exception indicating that the issuer is NOT valid.\"", ")", ")", ";", "return", "expectations", ";", "}" ]
Set expectations for tests that have bad issuers @return Expectations @throws Exception
[ "Set", "expectations", "for", "tests", "that", "have", "bad", "issuers" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.mp.jwt_fat/fat/src/com/ibm/ws/security/mp/jwt/fat/CommonMpJwtFat.java#L300-L310
train