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.dynacache/src/com/ibm/ws/cache/HTODInvalidationBuffer.java
HTODInvalidationBuffer.isBackgroundInvalidationInProgress
protected synchronized boolean isBackgroundInvalidationInProgress() { boolean cleanupThreadRunning = false; if (this.cod.diskCleanupThread != null) { synchronized (cod.diskCleanupThread.dcMonitor) { cleanupThreadRunning = this.cod.diskCleanupThread.currentThread != null; } } boolean garbageCollectorThreadRunning = false; if (this.cod.garbageCollectionThread != null) { synchronized (cod.garbageCollectionThread.gcMonitor) { garbageCollectorThreadRunning = this.cod.garbageCollectionThread.currentThread != null; } } return (cleanupThreadRunning || garbageCollectorThreadRunning) ? true : false; }
java
protected synchronized boolean isBackgroundInvalidationInProgress() { boolean cleanupThreadRunning = false; if (this.cod.diskCleanupThread != null) { synchronized (cod.diskCleanupThread.dcMonitor) { cleanupThreadRunning = this.cod.diskCleanupThread.currentThread != null; } } boolean garbageCollectorThreadRunning = false; if (this.cod.garbageCollectionThread != null) { synchronized (cod.garbageCollectionThread.gcMonitor) { garbageCollectorThreadRunning = this.cod.garbageCollectionThread.currentThread != null; } } return (cleanupThreadRunning || garbageCollectorThreadRunning) ? true : false; }
[ "protected", "synchronized", "boolean", "isBackgroundInvalidationInProgress", "(", ")", "{", "boolean", "cleanupThreadRunning", "=", "false", ";", "if", "(", "this", ".", "cod", ".", "diskCleanupThread", "!=", "null", ")", "{", "synchronized", "(", "cod", ".", "diskCleanupThread", ".", "dcMonitor", ")", "{", "cleanupThreadRunning", "=", "this", ".", "cod", ".", "diskCleanupThread", ".", "currentThread", "!=", "null", ";", "}", "}", "boolean", "garbageCollectorThreadRunning", "=", "false", ";", "if", "(", "this", ".", "cod", ".", "garbageCollectionThread", "!=", "null", ")", "{", "synchronized", "(", "cod", ".", "garbageCollectionThread", ".", "gcMonitor", ")", "{", "garbageCollectorThreadRunning", "=", "this", ".", "cod", ".", "garbageCollectionThread", ".", "currentThread", "!=", "null", ";", "}", "}", "return", "(", "cleanupThreadRunning", "||", "garbageCollectorThreadRunning", ")", "?", "true", ":", "false", ";", "}" ]
Call this method to check the state of "LPBT in Progress". @return boolean - the state.
[ "Call", "this", "method", "to", "check", "the", "state", "of", "LPBT", "in", "Progress", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/HTODInvalidationBuffer.java#L604-L619
train
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/HTODInvalidationBuffer.java
HTODInvalidationBuffer.isLoopOnce
protected synchronized boolean isLoopOnce() { final String methodName = "isLoopOnce()"; if (loopOnce) { traceDebug(methodName, "cacheName=" + this.cod.cacheName + " isLoopOnce=" + loopOnce + " explicitBuffer=" + explicitBuffer.size() + " scanBuffer=" + this.scanBuffer.size()); } return this.loopOnce; }
java
protected synchronized boolean isLoopOnce() { final String methodName = "isLoopOnce()"; if (loopOnce) { traceDebug(methodName, "cacheName=" + this.cod.cacheName + " isLoopOnce=" + loopOnce + " explicitBuffer=" + explicitBuffer.size() + " scanBuffer=" + this.scanBuffer.size()); } return this.loopOnce; }
[ "protected", "synchronized", "boolean", "isLoopOnce", "(", ")", "{", "final", "String", "methodName", "=", "\"isLoopOnce()\"", ";", "if", "(", "loopOnce", ")", "{", "traceDebug", "(", "methodName", ",", "\"cacheName=\"", "+", "this", ".", "cod", ".", "cacheName", "+", "\" isLoopOnce=\"", "+", "loopOnce", "+", "\" explicitBuffer=\"", "+", "explicitBuffer", ".", "size", "(", ")", "+", "\" scanBuffer=\"", "+", "this", ".", "scanBuffer", ".", "size", "(", ")", ")", ";", "}", "return", "this", ".", "loopOnce", ";", "}" ]
Call this method to check the state of "Loop Once". @return boolean - the state.
[ "Call", "this", "method", "to", "check", "the", "state", "of", "Loop", "Once", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/HTODInvalidationBuffer.java#L626-L633
train
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/HTODInvalidationBuffer.java
HTODInvalidationBuffer.setStopping
protected synchronized void setStopping(boolean stopping) { final String methodName = "setStopping()"; this.stopping = stopping; traceDebug(methodName, "cacheName=" + this.cod.cacheName + " stopping=" + this.stopping); }
java
protected synchronized void setStopping(boolean stopping) { final String methodName = "setStopping()"; this.stopping = stopping; traceDebug(methodName, "cacheName=" + this.cod.cacheName + " stopping=" + this.stopping); }
[ "protected", "synchronized", "void", "setStopping", "(", "boolean", "stopping", ")", "{", "final", "String", "methodName", "=", "\"setStopping()\"", ";", "this", ".", "stopping", "=", "stopping", ";", "traceDebug", "(", "methodName", ",", "\"cacheName=\"", "+", "this", ".", "cod", ".", "cacheName", "+", "\" stopping=\"", "+", "this", ".", "stopping", ")", ";", "}" ]
Call this method to set the state of "Stopping". No more invoking the LPBT. @param stopping - boolean to set true or false.
[ "Call", "this", "method", "to", "set", "the", "state", "of", "Stopping", ".", "No", "more", "invoking", "the", "LPBT", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/HTODInvalidationBuffer.java#L662-L666
train
OpenLiberty/open-liberty
dev/com.ibm.ws.config/src/com/ibm/ws/config/admin/internal/ExtendedConfigurationImpl.java
ExtendedConfigurationImpl.updateProperties
@Override public void updateProperties(Dictionary<String, Object> properties) throws IOException { lock.lock(); try { doUpdateProperties(properties); } finally { lock.unlock(); } }
java
@Override public void updateProperties(Dictionary<String, Object> properties) throws IOException { lock.lock(); try { doUpdateProperties(properties); } finally { lock.unlock(); } }
[ "@", "Override", "public", "void", "updateProperties", "(", "Dictionary", "<", "String", ",", "Object", ">", "properties", ")", "throws", "IOException", "{", "lock", ".", "lock", "(", ")", ";", "try", "{", "doUpdateProperties", "(", "properties", ")", ";", "}", "finally", "{", "lock", ".", "unlock", "(", ")", ";", "}", "}" ]
without other guards, separating updating the properties and sending configuration events can result in missing and duplicate update events even if every update is eventually associated with an event.
[ "without", "other", "guards", "separating", "updating", "the", "properties", "and", "sending", "configuration", "events", "can", "result", "in", "missing", "and", "duplicate", "update", "events", "even", "if", "every", "update", "is", "eventually", "associated", "with", "an", "event", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.config/src/com/ibm/ws/config/admin/internal/ExtendedConfigurationImpl.java#L433-L441
train
OpenLiberty/open-liberty
dev/com.ibm.ws.config/src/com/ibm/ws/config/admin/internal/ExtendedConfigurationImpl.java
ExtendedConfigurationImpl.updateCache
@Override public void updateCache(Dictionary<String, Object> properties, Set<ConfigID> references, Set<String> newUniques) throws IOException { lock.lock(); try { removeReferences(); setProperties(properties); this.references = references; this.uniqueVariables = newUniques; caFactory.getConfigurationStore().saveConfiguration(pid, this); changeCount.incrementAndGet(); addReferences(); sendEvents = true; } finally { lock.unlock(); } }
java
@Override public void updateCache(Dictionary<String, Object> properties, Set<ConfigID> references, Set<String> newUniques) throws IOException { lock.lock(); try { removeReferences(); setProperties(properties); this.references = references; this.uniqueVariables = newUniques; caFactory.getConfigurationStore().saveConfiguration(pid, this); changeCount.incrementAndGet(); addReferences(); sendEvents = true; } finally { lock.unlock(); } }
[ "@", "Override", "public", "void", "updateCache", "(", "Dictionary", "<", "String", ",", "Object", ">", "properties", ",", "Set", "<", "ConfigID", ">", "references", ",", "Set", "<", "String", ">", "newUniques", ")", "throws", "IOException", "{", "lock", ".", "lock", "(", ")", ";", "try", "{", "removeReferences", "(", ")", ";", "setProperties", "(", "properties", ")", ";", "this", ".", "references", "=", "references", ";", "this", ".", "uniqueVariables", "=", "newUniques", ";", "caFactory", ".", "getConfigurationStore", "(", ")", ".", "saveConfiguration", "(", "pid", ",", "this", ")", ";", "changeCount", ".", "incrementAndGet", "(", ")", ";", "addReferences", "(", ")", ";", "sendEvents", "=", "true", ";", "}", "finally", "{", "lock", ".", "unlock", "(", ")", ";", "}", "}" ]
Updates ConfigurationAdmin's cache with current config properties. If replaceProp is set to true, current config properties is replace with the given properties before caching and the internal pid-to-config table is updated to reflect the new config properties. @param properties @param replaceProp @param isMetaTypeProperties true if properties is MetaType converted properties @param newUniques @throws IOException
[ "Updates", "ConfigurationAdmin", "s", "cache", "with", "current", "config", "properties", ".", "If", "replaceProp", "is", "set", "to", "true", "current", "config", "properties", "is", "replace", "with", "the", "given", "properties", "before", "caching", "and", "the", "internal", "pid", "-", "to", "-", "config", "table", "is", "updated", "to", "reflect", "the", "new", "config", "properties", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.config/src/com/ibm/ws/config/admin/internal/ExtendedConfigurationImpl.java#L474-L492
train
OpenLiberty/open-liberty
dev/com.ibm.ws.config/src/com/ibm/ws/config/admin/internal/ExtendedConfigurationImpl.java
ExtendedConfigurationImpl.setProperties
private void setProperties(Dictionary<String, ?> d) { if (d == null) { this.properties = null; return; } ConfigurationDictionary newDictionary = new ConfigurationDictionary(); Enumeration<String> keys = d.keys(); while (keys.hasMoreElements()) { String key = keys.nextElement(); if (newDictionary.get(key) == null) { Object value = d.get(key); if (value.getClass().isArray()) { int arrayLength = Array.getLength(value); Object copyOfArray = Array.newInstance(value.getClass().getComponentType(), arrayLength); System.arraycopy(value, 0, copyOfArray, 0, arrayLength); newDictionary.put(key, copyOfArray); } else if (value instanceof Collection) { newDictionary.put(key, new Vector<Object>((Collection<?>) value)); } else { newDictionary.put(key, value); } } else throw new IllegalArgumentException(key + " is already present or is a case variant."); //$NON-NLS-1$ } // fill in necessary properties if (this.factoryPid != null) { newDictionary.put(ConfigurationAdmin.SERVICE_FACTORYPID, this.factoryPid); } newDictionary.put(Constants.SERVICE_PID, this.pid); if (this.inOverridesFile) { newDictionary.put("config.overrides", "true"); } this.properties = newDictionary; //we got new props so we should redo the mappings in case they changed addPidMapping(); }
java
private void setProperties(Dictionary<String, ?> d) { if (d == null) { this.properties = null; return; } ConfigurationDictionary newDictionary = new ConfigurationDictionary(); Enumeration<String> keys = d.keys(); while (keys.hasMoreElements()) { String key = keys.nextElement(); if (newDictionary.get(key) == null) { Object value = d.get(key); if (value.getClass().isArray()) { int arrayLength = Array.getLength(value); Object copyOfArray = Array.newInstance(value.getClass().getComponentType(), arrayLength); System.arraycopy(value, 0, copyOfArray, 0, arrayLength); newDictionary.put(key, copyOfArray); } else if (value instanceof Collection) { newDictionary.put(key, new Vector<Object>((Collection<?>) value)); } else { newDictionary.put(key, value); } } else throw new IllegalArgumentException(key + " is already present or is a case variant."); //$NON-NLS-1$ } // fill in necessary properties if (this.factoryPid != null) { newDictionary.put(ConfigurationAdmin.SERVICE_FACTORYPID, this.factoryPid); } newDictionary.put(Constants.SERVICE_PID, this.pid); if (this.inOverridesFile) { newDictionary.put("config.overrides", "true"); } this.properties = newDictionary; //we got new props so we should redo the mappings in case they changed addPidMapping(); }
[ "private", "void", "setProperties", "(", "Dictionary", "<", "String", ",", "?", ">", "d", ")", "{", "if", "(", "d", "==", "null", ")", "{", "this", ".", "properties", "=", "null", ";", "return", ";", "}", "ConfigurationDictionary", "newDictionary", "=", "new", "ConfigurationDictionary", "(", ")", ";", "Enumeration", "<", "String", ">", "keys", "=", "d", ".", "keys", "(", ")", ";", "while", "(", "keys", ".", "hasMoreElements", "(", ")", ")", "{", "String", "key", "=", "keys", ".", "nextElement", "(", ")", ";", "if", "(", "newDictionary", ".", "get", "(", "key", ")", "==", "null", ")", "{", "Object", "value", "=", "d", ".", "get", "(", "key", ")", ";", "if", "(", "value", ".", "getClass", "(", ")", ".", "isArray", "(", ")", ")", "{", "int", "arrayLength", "=", "Array", ".", "getLength", "(", "value", ")", ";", "Object", "copyOfArray", "=", "Array", ".", "newInstance", "(", "value", ".", "getClass", "(", ")", ".", "getComponentType", "(", ")", ",", "arrayLength", ")", ";", "System", ".", "arraycopy", "(", "value", ",", "0", ",", "copyOfArray", ",", "0", ",", "arrayLength", ")", ";", "newDictionary", ".", "put", "(", "key", ",", "copyOfArray", ")", ";", "}", "else", "if", "(", "value", "instanceof", "Collection", ")", "{", "newDictionary", ".", "put", "(", "key", ",", "new", "Vector", "<", "Object", ">", "(", "(", "Collection", "<", "?", ">", ")", "value", ")", ")", ";", "}", "else", "{", "newDictionary", ".", "put", "(", "key", ",", "value", ")", ";", "}", "}", "else", "throw", "new", "IllegalArgumentException", "(", "key", "+", "\" is already present or is a case variant.\"", ")", ";", "//$NON-NLS-1$", "}", "// fill in necessary properties", "if", "(", "this", ".", "factoryPid", "!=", "null", ")", "{", "newDictionary", ".", "put", "(", "ConfigurationAdmin", ".", "SERVICE_FACTORYPID", ",", "this", ".", "factoryPid", ")", ";", "}", "newDictionary", ".", "put", "(", "Constants", ".", "SERVICE_PID", ",", "this", ".", "pid", ")", ";", "if", "(", "this", ".", "inOverridesFile", ")", "{", "newDictionary", ".", "put", "(", "\"config.overrides\"", ",", "\"true\"", ")", ";", "}", "this", ".", "properties", "=", "newDictionary", ";", "//we got new props so we should redo the mappings in case they changed", "addPidMapping", "(", ")", ";", "}" ]
This is not part of Configuration interface. It sets configuration dictionary with specified dictionary and updates configuration attributes if they are not set and found in given dictionary. @param d
[ "This", "is", "not", "part", "of", "Configuration", "interface", ".", "It", "sets", "configuration", "dictionary", "with", "specified", "dictionary", "and", "updates", "configuration", "attributes", "if", "they", "are", "not", "set", "and", "found", "in", "given", "dictionary", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.config/src/com/ibm/ws/config/admin/internal/ExtendedConfigurationImpl.java#L588-L627
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jsp/src/org/apache/jasper/runtime/PageContextImpl.java
PageContextImpl.proprietaryEvaluate
@SuppressWarnings("unchecked") public static Object proprietaryEvaluate(final String expression, final Class expectedType, final PageContext pageContext, final ProtectedFunctionMapper functionMap, final boolean escape) throws ELException { Object retValue; ExpressionFactory exprFactorySetInPageContext = (ExpressionFactory)pageContext.getAttribute(Constants.JSP_EXPRESSION_FACTORY_OBJECT); if (exprFactorySetInPageContext==null) { exprFactorySetInPageContext = JspFactory.getDefaultFactory().getJspApplicationContext(pageContext.getServletContext()).getExpressionFactory(); } final ExpressionFactory exprFactory = exprFactorySetInPageContext; //if (SecurityUtil.isPackageProtectionEnabled()) { ELContextImpl ctx = (ELContextImpl) pageContext.getELContext(); ctx.setFunctionMapper(new FunctionMapperImpl(functionMap)); ValueExpression ve = exprFactory.createValueExpression(ctx, expression, expectedType); retValue = ve.getValue(ctx); if (escape && retValue != null) { retValue = XmlEscape(retValue.toString()); } return retValue; }
java
@SuppressWarnings("unchecked") public static Object proprietaryEvaluate(final String expression, final Class expectedType, final PageContext pageContext, final ProtectedFunctionMapper functionMap, final boolean escape) throws ELException { Object retValue; ExpressionFactory exprFactorySetInPageContext = (ExpressionFactory)pageContext.getAttribute(Constants.JSP_EXPRESSION_FACTORY_OBJECT); if (exprFactorySetInPageContext==null) { exprFactorySetInPageContext = JspFactory.getDefaultFactory().getJspApplicationContext(pageContext.getServletContext()).getExpressionFactory(); } final ExpressionFactory exprFactory = exprFactorySetInPageContext; //if (SecurityUtil.isPackageProtectionEnabled()) { ELContextImpl ctx = (ELContextImpl) pageContext.getELContext(); ctx.setFunctionMapper(new FunctionMapperImpl(functionMap)); ValueExpression ve = exprFactory.createValueExpression(ctx, expression, expectedType); retValue = ve.getValue(ctx); if (escape && retValue != null) { retValue = XmlEscape(retValue.toString()); } return retValue; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "Object", "proprietaryEvaluate", "(", "final", "String", "expression", ",", "final", "Class", "expectedType", ",", "final", "PageContext", "pageContext", ",", "final", "ProtectedFunctionMapper", "functionMap", ",", "final", "boolean", "escape", ")", "throws", "ELException", "{", "Object", "retValue", ";", "ExpressionFactory", "exprFactorySetInPageContext", "=", "(", "ExpressionFactory", ")", "pageContext", ".", "getAttribute", "(", "Constants", ".", "JSP_EXPRESSION_FACTORY_OBJECT", ")", ";", "if", "(", "exprFactorySetInPageContext", "==", "null", ")", "{", "exprFactorySetInPageContext", "=", "JspFactory", ".", "getDefaultFactory", "(", ")", ".", "getJspApplicationContext", "(", "pageContext", ".", "getServletContext", "(", ")", ")", ".", "getExpressionFactory", "(", ")", ";", "}", "final", "ExpressionFactory", "exprFactory", "=", "exprFactorySetInPageContext", ";", "//if (SecurityUtil.isPackageProtectionEnabled()) {", "ELContextImpl", "ctx", "=", "(", "ELContextImpl", ")", "pageContext", ".", "getELContext", "(", ")", ";", "ctx", ".", "setFunctionMapper", "(", "new", "FunctionMapperImpl", "(", "functionMap", ")", ")", ";", "ValueExpression", "ve", "=", "exprFactory", ".", "createValueExpression", "(", "ctx", ",", "expression", ",", "expectedType", ")", ";", "retValue", "=", "ve", ".", "getValue", "(", "ctx", ")", ";", "if", "(", "escape", "&&", "retValue", "!=", "null", ")", "{", "retValue", "=", "XmlEscape", "(", "retValue", ".", "toString", "(", ")", ")", ";", "}", "return", "retValue", ";", "}" ]
Proprietary method to evaluate EL expressions. XXX - This method should go away once the EL interpreter moves out of JSTL and into its own project. For now, this is necessary because the standard machinery is too slow. @param expression The expression to be evaluated @param expectedType The expected resulting type @param pageContext The page context @param functionMap Maps prefix and name to Method @return The result of the evaluation
[ "Proprietary", "method", "to", "evaluate", "EL", "expressions", ".", "XXX", "-", "This", "method", "should", "go", "away", "once", "the", "EL", "interpreter", "moves", "out", "of", "JSTL", "and", "into", "its", "own", "project", ".", "For", "now", "this", "is", "necessary", "because", "the", "standard", "machinery", "is", "too", "slow", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsp/src/org/apache/jasper/runtime/PageContextImpl.java#L779-L800
train
OpenLiberty/open-liberty
dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/EventManager.java
EventManager.addListener
public void addListener(InstallEventListener listener, String notificationType) { if (listener == null || notificationType == null) return; if (notificationType.isEmpty()) return; if (listenersMap == null) { listenersMap = new HashMap<String, Collection<InstallEventListener>>(); } Collection<InstallEventListener> listeners = listenersMap.get(notificationType); if (listeners == null) { listeners = new ArrayList<InstallEventListener>(1); listenersMap.put(notificationType, listeners); } listeners.add(listener); }
java
public void addListener(InstallEventListener listener, String notificationType) { if (listener == null || notificationType == null) return; if (notificationType.isEmpty()) return; if (listenersMap == null) { listenersMap = new HashMap<String, Collection<InstallEventListener>>(); } Collection<InstallEventListener> listeners = listenersMap.get(notificationType); if (listeners == null) { listeners = new ArrayList<InstallEventListener>(1); listenersMap.put(notificationType, listeners); } listeners.add(listener); }
[ "public", "void", "addListener", "(", "InstallEventListener", "listener", ",", "String", "notificationType", ")", "{", "if", "(", "listener", "==", "null", "||", "notificationType", "==", "null", ")", "return", ";", "if", "(", "notificationType", ".", "isEmpty", "(", ")", ")", "return", ";", "if", "(", "listenersMap", "==", "null", ")", "{", "listenersMap", "=", "new", "HashMap", "<", "String", ",", "Collection", "<", "InstallEventListener", ">", ">", "(", ")", ";", "}", "Collection", "<", "InstallEventListener", ">", "listeners", "=", "listenersMap", ".", "get", "(", "notificationType", ")", ";", "if", "(", "listeners", "==", "null", ")", "{", "listeners", "=", "new", "ArrayList", "<", "InstallEventListener", ">", "(", "1", ")", ";", "listenersMap", ".", "put", "(", "notificationType", ",", "listeners", ")", ";", "}", "listeners", ".", "add", "(", "listener", ")", ";", "}" ]
Adds an install event listener to the listenersMap with a specified notification type @param listener InstallEventListener to add @param notificationType Notification type of listener
[ "Adds", "an", "install", "event", "listener", "to", "the", "listenersMap", "with", "a", "specified", "notification", "type" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/EventManager.java#L35-L49
train
OpenLiberty/open-liberty
dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/EventManager.java
EventManager.removeListener
public void removeListener(InstallEventListener listener) { if (listenersMap != null) { for (Collection<InstallEventListener> listeners : listenersMap.values()) { listeners.remove(listener); } } }
java
public void removeListener(InstallEventListener listener) { if (listenersMap != null) { for (Collection<InstallEventListener> listeners : listenersMap.values()) { listeners.remove(listener); } } }
[ "public", "void", "removeListener", "(", "InstallEventListener", "listener", ")", "{", "if", "(", "listenersMap", "!=", "null", ")", "{", "for", "(", "Collection", "<", "InstallEventListener", ">", "listeners", ":", "listenersMap", ".", "values", "(", ")", ")", "{", "listeners", ".", "remove", "(", "listener", ")", ";", "}", "}", "}" ]
Removes a listener from listenersMap @param listener Listener to remove
[ "Removes", "a", "listener", "from", "listenersMap" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/EventManager.java#L56-L62
train
OpenLiberty/open-liberty
dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/EventManager.java
EventManager.fireProgressEvent
public void fireProgressEvent(int state, int progress, String message) throws Exception { if (listenersMap != null) { Collection<InstallEventListener> listeners = listenersMap.get(InstallConstants.EVENT_TYPE_PROGRESS); if (listeners != null) { for (InstallEventListener listener : listeners) { listener.handleInstallEvent(new InstallProgressEvent(state, progress, message)); } } } }
java
public void fireProgressEvent(int state, int progress, String message) throws Exception { if (listenersMap != null) { Collection<InstallEventListener> listeners = listenersMap.get(InstallConstants.EVENT_TYPE_PROGRESS); if (listeners != null) { for (InstallEventListener listener : listeners) { listener.handleInstallEvent(new InstallProgressEvent(state, progress, message)); } } } }
[ "public", "void", "fireProgressEvent", "(", "int", "state", ",", "int", "progress", ",", "String", "message", ")", "throws", "Exception", "{", "if", "(", "listenersMap", "!=", "null", ")", "{", "Collection", "<", "InstallEventListener", ">", "listeners", "=", "listenersMap", ".", "get", "(", "InstallConstants", ".", "EVENT_TYPE_PROGRESS", ")", ";", "if", "(", "listeners", "!=", "null", ")", "{", "for", "(", "InstallEventListener", "listener", ":", "listeners", ")", "{", "listener", ".", "handleInstallEvent", "(", "new", "InstallProgressEvent", "(", "state", ",", "progress", ",", "message", ")", ")", ";", "}", "}", "}", "}" ]
Fires progress event messages @param state The state integer @param progress The progress integer @param message The message to be displayed @throws Exception
[ "Fires", "progress", "event", "messages" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/EventManager.java#L72-L81
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/queue/ReadAheadQueue.java
ReadAheadQueue.putToFront
public void putToFront(QueueData queueData, short msgBatch) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "putToFront", new Object[]{queueData, msgBatch}); _put(queueData, msgBatch, false); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "putToFront"); }
java
public void putToFront(QueueData queueData, short msgBatch) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "putToFront", new Object[]{queueData, msgBatch}); _put(queueData, msgBatch, false); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "putToFront"); }
[ "public", "void", "putToFront", "(", "QueueData", "queueData", ",", "short", "msgBatch", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "this", ",", "tc", ",", "\"putToFront\"", ",", "new", "Object", "[", "]", "{", "queueData", ",", "msgBatch", "}", ")", ";", "_put", "(", "queueData", ",", "msgBatch", ",", "false", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "this", ",", "tc", ",", "\"putToFront\"", ")", ";", "}" ]
Places a message on to the front of the proxy queue so that the next get operation will consume it. @param queueData @param msgBatch
[ "Places", "a", "message", "on", "to", "the", "front", "of", "the", "proxy", "queue", "so", "that", "the", "next", "get", "operation", "will", "consume", "it", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/queue/ReadAheadQueue.java#L267-L275
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/queue/ReadAheadQueue.java
ReadAheadQueue.getBatch
public synchronized JsMessage[] getBatch(int batchSize, short id) throws SIResourceException, SIConnectionDroppedException, SIConnectionLostException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getBatch", ""+batchSize); int size; synchronized(queue) { size = queue.size(); } if (size > batchSize) size = batchSize; JsMessage[] retArray = new JsMessage[size]; for (int i=0; i < retArray.length; ++i) retArray[i] = get(id); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getBatch", retArray); return retArray; }
java
public synchronized JsMessage[] getBatch(int batchSize, short id) throws SIResourceException, SIConnectionDroppedException, SIConnectionLostException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getBatch", ""+batchSize); int size; synchronized(queue) { size = queue.size(); } if (size > batchSize) size = batchSize; JsMessage[] retArray = new JsMessage[size]; for (int i=0; i < retArray.length; ++i) retArray[i] = get(id); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getBatch", retArray); return retArray; }
[ "public", "synchronized", "JsMessage", "[", "]", "getBatch", "(", "int", "batchSize", ",", "short", "id", ")", "throws", "SIResourceException", ",", "SIConnectionDroppedException", ",", "SIConnectionLostException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "this", ",", "tc", ",", "\"getBatch\"", ",", "\"\"", "+", "batchSize", ")", ";", "int", "size", ";", "synchronized", "(", "queue", ")", "{", "size", "=", "queue", ".", "size", "(", ")", ";", "}", "if", "(", "size", ">", "batchSize", ")", "size", "=", "batchSize", ";", "JsMessage", "[", "]", "retArray", "=", "new", "JsMessage", "[", "size", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "retArray", ".", "length", ";", "++", "i", ")", "retArray", "[", "i", "]", "=", "get", "(", "id", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "this", ",", "tc", ",", "\"getBatch\"", ",", "retArray", ")", ";", "return", "retArray", ";", "}" ]
Gets a batch of several messages from the queue. @param batchSize @param id @return JsMessage[] The batch of messages (or null if the queue is empty) @throws SIResourceException @throws SIConnectionDroppedException @throws SIConnectionLostException
[ "Gets", "a", "batch", "of", "several", "messages", "from", "the", "queue", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/queue/ReadAheadQueue.java#L596-L614
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/queue/ReadAheadQueue.java
ReadAheadQueue.setTrackBytes
public synchronized void setTrackBytes(boolean trackBytes) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setTrackBytes", trackBytes); this.trackBytes = trackBytes; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setTrackBytes"); }
java
public synchronized void setTrackBytes(boolean trackBytes) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setTrackBytes", trackBytes); this.trackBytes = trackBytes; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setTrackBytes"); }
[ "public", "synchronized", "void", "setTrackBytes", "(", "boolean", "trackBytes", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "this", ",", "tc", ",", "\"setTrackBytes\"", ",", "trackBytes", ")", ";", "this", ".", "trackBytes", "=", "trackBytes", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "this", ",", "tc", ",", "\"setTrackBytes\"", ")", ";", "}" ]
Sets the trackBytes parameter. This flag is used to indicate whether this queue should keep track of the bytes on the queue and request more from the server when it is running low. @param trackBytes
[ "Sets", "the", "trackBytes", "parameter", ".", "This", "flag", "is", "used", "to", "indicate", "whether", "this", "queue", "should", "keep", "track", "of", "the", "bytes", "on", "the", "queue", "and", "request", "more", "from", "the", "server", "when", "it", "is", "running", "low", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/queue/ReadAheadQueue.java#L876-L881
train
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer/src/com/ibm/wsspi/webcontainer/util/ByteBufferOutputStream.java
ByteBufferOutputStream.reset
public void reset() { current = null; _hasWritten = false; byteBuffersRetrieved = false; limit = -1; total = 0; if (!byteBuffersRetrieved) { ListIterator<WsByteBuffer> it = bbList.listIterator(); while (it.hasNext()) { WsByteBuffer next = it.next(); next.release(); it.remove(); } } }
java
public void reset() { current = null; _hasWritten = false; byteBuffersRetrieved = false; limit = -1; total = 0; if (!byteBuffersRetrieved) { ListIterator<WsByteBuffer> it = bbList.listIterator(); while (it.hasNext()) { WsByteBuffer next = it.next(); next.release(); it.remove(); } } }
[ "public", "void", "reset", "(", ")", "{", "current", "=", "null", ";", "_hasWritten", "=", "false", ";", "byteBuffersRetrieved", "=", "false", ";", "limit", "=", "-", "1", ";", "total", "=", "0", ";", "if", "(", "!", "byteBuffersRetrieved", ")", "{", "ListIterator", "<", "WsByteBuffer", ">", "it", "=", "bbList", ".", "listIterator", "(", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "WsByteBuffer", "next", "=", "it", ".", "next", "(", ")", ";", "next", ".", "release", "(", ")", ";", "it", ".", "remove", "(", ")", ";", "}", "}", "}" ]
clean up...
[ "clean", "up", "..." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/wsspi/webcontainer/util/ByteBufferOutputStream.java#L77-L94
train
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer/src/com/ibm/wsspi/webcontainer/util/ByteBufferOutputStream.java
ByteBufferOutputStream.write
public void write(byte[] buf, int offset, int len) throws IOException { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { // 306998.15 Tr.debug(tc, "write len --> " + len + ", limit->" + limit); } if (len < 0) { if (tc.isErrorEnabled()) Tr.error(tc, "Illegal.Argument.Trying.to.write.chars"); throw new IllegalArgumentException(); } if (!_hasWritten && obs != null) { _hasWritten = true; obs.alertFirstWrite(); } if (limit > -1) { if (total + len > limit) { len = limit - total; except = new WriteBeyondContentLengthException(); } } int toWrite = 0, amountWritten = 0, remaining = 0; while (amountWritten != len) { checkList(); toWrite = len - amountWritten; remaining = current.remaining(); if (toWrite <= remaining) { /* * We can write it all in the current buffer */ current.put(buf, offset + amountWritten, toWrite); amountWritten += toWrite; } else { /* * Write what we can to the current position */ current.put(buf, offset + amountWritten, remaining); amountWritten += remaining; } } count += len; total += len; check(); }
java
public void write(byte[] buf, int offset, int len) throws IOException { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { // 306998.15 Tr.debug(tc, "write len --> " + len + ", limit->" + limit); } if (len < 0) { if (tc.isErrorEnabled()) Tr.error(tc, "Illegal.Argument.Trying.to.write.chars"); throw new IllegalArgumentException(); } if (!_hasWritten && obs != null) { _hasWritten = true; obs.alertFirstWrite(); } if (limit > -1) { if (total + len > limit) { len = limit - total; except = new WriteBeyondContentLengthException(); } } int toWrite = 0, amountWritten = 0, remaining = 0; while (amountWritten != len) { checkList(); toWrite = len - amountWritten; remaining = current.remaining(); if (toWrite <= remaining) { /* * We can write it all in the current buffer */ current.put(buf, offset + amountWritten, toWrite); amountWritten += toWrite; } else { /* * Write what we can to the current position */ current.put(buf, offset + amountWritten, remaining); amountWritten += remaining; } } count += len; total += len; check(); }
[ "public", "void", "write", "(", "byte", "[", "]", "buf", ",", "int", "offset", ",", "int", "len", ")", "throws", "IOException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "// 306998.15", "Tr", ".", "debug", "(", "tc", ",", "\"write len --> \"", "+", "len", "+", "\", limit->\"", "+", "limit", ")", ";", "}", "if", "(", "len", "<", "0", ")", "{", "if", "(", "tc", ".", "isErrorEnabled", "(", ")", ")", "Tr", ".", "error", "(", "tc", ",", "\"Illegal.Argument.Trying.to.write.chars\"", ")", ";", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "if", "(", "!", "_hasWritten", "&&", "obs", "!=", "null", ")", "{", "_hasWritten", "=", "true", ";", "obs", ".", "alertFirstWrite", "(", ")", ";", "}", "if", "(", "limit", ">", "-", "1", ")", "{", "if", "(", "total", "+", "len", ">", "limit", ")", "{", "len", "=", "limit", "-", "total", ";", "except", "=", "new", "WriteBeyondContentLengthException", "(", ")", ";", "}", "}", "int", "toWrite", "=", "0", ",", "amountWritten", "=", "0", ",", "remaining", "=", "0", ";", "while", "(", "amountWritten", "!=", "len", ")", "{", "checkList", "(", ")", ";", "toWrite", "=", "len", "-", "amountWritten", ";", "remaining", "=", "current", ".", "remaining", "(", ")", ";", "if", "(", "toWrite", "<=", "remaining", ")", "{", "/*\n * We can write it all in the current buffer\n */", "current", ".", "put", "(", "buf", ",", "offset", "+", "amountWritten", ",", "toWrite", ")", ";", "amountWritten", "+=", "toWrite", ";", "}", "else", "{", "/*\n * Write what we can to the current position\n */", "current", ".", "put", "(", "buf", ",", "offset", "+", "amountWritten", ",", "remaining", ")", ";", "amountWritten", "+=", "remaining", ";", "}", "}", "count", "+=", "len", ";", "total", "+=", "len", ";", "check", "(", ")", ";", "}" ]
Writes a byte array
[ "Writes", "a", "byte", "array" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/wsspi/webcontainer/util/ByteBufferOutputStream.java#L127-L186
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jca/src/com/ibm/ws/jca/internal/WorkManagerImpl.java
WorkManagerImpl.doWork
@Override public void doWork( Work work, long startTimeout, ExecutionContext execContext, WorkListener workListener) throws WorkException { try { beforeRunCheck(work, workListener, startTimeout); new WorkProxy(work, startTimeout, execContext, workListener, bootstrapContext, runningWork, false).call(); } catch (WorkException ex) { throw ex; } catch (Throwable t) { WorkRejectedException wrex = new WorkRejectedException(t); wrex.setErrorCode(WorkException.INTERNAL); if (workListener != null) workListener.workRejected(new WorkEvent(work, WorkEvent.WORK_REJECTED, work, wrex)); throw wrex; } }
java
@Override public void doWork( Work work, long startTimeout, ExecutionContext execContext, WorkListener workListener) throws WorkException { try { beforeRunCheck(work, workListener, startTimeout); new WorkProxy(work, startTimeout, execContext, workListener, bootstrapContext, runningWork, false).call(); } catch (WorkException ex) { throw ex; } catch (Throwable t) { WorkRejectedException wrex = new WorkRejectedException(t); wrex.setErrorCode(WorkException.INTERNAL); if (workListener != null) workListener.workRejected(new WorkEvent(work, WorkEvent.WORK_REJECTED, work, wrex)); throw wrex; } }
[ "@", "Override", "public", "void", "doWork", "(", "Work", "work", ",", "long", "startTimeout", ",", "ExecutionContext", "execContext", ",", "WorkListener", "workListener", ")", "throws", "WorkException", "{", "try", "{", "beforeRunCheck", "(", "work", ",", "workListener", ",", "startTimeout", ")", ";", "new", "WorkProxy", "(", "work", ",", "startTimeout", ",", "execContext", ",", "workListener", ",", "bootstrapContext", ",", "runningWork", ",", "false", ")", ".", "call", "(", ")", ";", "}", "catch", "(", "WorkException", "ex", ")", "{", "throw", "ex", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "WorkRejectedException", "wrex", "=", "new", "WorkRejectedException", "(", "t", ")", ";", "wrex", ".", "setErrorCode", "(", "WorkException", ".", "INTERNAL", ")", ";", "if", "(", "workListener", "!=", "null", ")", "workListener", ".", "workRejected", "(", "new", "WorkEvent", "(", "work", ",", "WorkEvent", ".", "WORK_REJECTED", ",", "work", ",", "wrex", ")", ")", ";", "throw", "wrex", ";", "}", "}" ]
This method does not return until the work is completed as the caller expects to wait until the work is completed before getting control back. This method accomplishes this by NOT spinning a thread. @pre providerId != null @param work @param startTimeout @param execContext @param workListener @throws WorkException @see <a href="http://java.sun.com/j2ee/1.4/docs/api/javax/resource/spi/work/WorkManager.html#doWork(com.ibm.javarx.spi.work.Work, long, com.ibm.javarx.spi.work.ExecutionContext, com.ibm.javarx.spi.work.WorkListener)"> com.ibm.javarx.spi.work.WorkManager.doWork(Work, long, ExecutionContext, WorkListener)</a>
[ "This", "method", "does", "not", "return", "until", "the", "work", "is", "completed", "as", "the", "caller", "expects", "to", "wait", "until", "the", "work", "is", "completed", "before", "getting", "control", "back", ".", "This", "method", "accomplishes", "this", "by", "NOT", "spinning", "a", "thread", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca/src/com/ibm/ws/jca/internal/WorkManagerImpl.java#L102-L122
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jca/src/com/ibm/ws/jca/internal/WorkManagerImpl.java
WorkManagerImpl.scheduleWork
@Override public void scheduleWork( Work work, long startTimeout, ExecutionContext execContext, WorkListener workListener) throws WorkException { try { beforeRunCheck(work, workListener, startTimeout); WorkProxy workProxy = new WorkProxy(work, startTimeout, execContext, workListener, bootstrapContext, runningWork, true); FutureTask<Void> futureTask = new FutureTask<Void>(workProxy); bootstrapContext.execSvc.executeGlobal(futureTask); if (futures.add(futureTask) && futures.size() % FUTURE_PURGE_INTERVAL == 0) purgeFutures(); } catch (WorkException ex) { throw ex; } catch (Throwable t) { WorkRejectedException wrex = new WorkRejectedException(t); wrex.setErrorCode(WorkException.INTERNAL); if (workListener != null) workListener.workRejected(new WorkEvent(work, WorkEvent.WORK_REJECTED, work, wrex)); throw wrex; } }
java
@Override public void scheduleWork( Work work, long startTimeout, ExecutionContext execContext, WorkListener workListener) throws WorkException { try { beforeRunCheck(work, workListener, startTimeout); WorkProxy workProxy = new WorkProxy(work, startTimeout, execContext, workListener, bootstrapContext, runningWork, true); FutureTask<Void> futureTask = new FutureTask<Void>(workProxy); bootstrapContext.execSvc.executeGlobal(futureTask); if (futures.add(futureTask) && futures.size() % FUTURE_PURGE_INTERVAL == 0) purgeFutures(); } catch (WorkException ex) { throw ex; } catch (Throwable t) { WorkRejectedException wrex = new WorkRejectedException(t); wrex.setErrorCode(WorkException.INTERNAL); if (workListener != null) workListener.workRejected(new WorkEvent(work, WorkEvent.WORK_REJECTED, work, wrex)); throw wrex; } }
[ "@", "Override", "public", "void", "scheduleWork", "(", "Work", "work", ",", "long", "startTimeout", ",", "ExecutionContext", "execContext", ",", "WorkListener", "workListener", ")", "throws", "WorkException", "{", "try", "{", "beforeRunCheck", "(", "work", ",", "workListener", ",", "startTimeout", ")", ";", "WorkProxy", "workProxy", "=", "new", "WorkProxy", "(", "work", ",", "startTimeout", ",", "execContext", ",", "workListener", ",", "bootstrapContext", ",", "runningWork", ",", "true", ")", ";", "FutureTask", "<", "Void", ">", "futureTask", "=", "new", "FutureTask", "<", "Void", ">", "(", "workProxy", ")", ";", "bootstrapContext", ".", "execSvc", ".", "executeGlobal", "(", "futureTask", ")", ";", "if", "(", "futures", ".", "add", "(", "futureTask", ")", "&&", "futures", ".", "size", "(", ")", "%", "FUTURE_PURGE_INTERVAL", "==", "0", ")", "purgeFutures", "(", ")", ";", "}", "catch", "(", "WorkException", "ex", ")", "{", "throw", "ex", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "WorkRejectedException", "wrex", "=", "new", "WorkRejectedException", "(", "t", ")", ";", "wrex", ".", "setErrorCode", "(", "WorkException", ".", "INTERNAL", ")", ";", "if", "(", "workListener", "!=", "null", ")", "workListener", ".", "workRejected", "(", "new", "WorkEvent", "(", "work", ",", "WorkEvent", ".", "WORK_REJECTED", ",", "work", ",", "wrex", ")", ")", ";", "throw", "wrex", ";", "}", "}" ]
This method puts the work on a queue that is later processed by the "scheduler" thread. This allows the method to return to the caller without having to wait for the thread to start. @pre providerId != null @param work @param startTimeout @param execContext @param workListener @throws WorkException @exception NullPointerException this method relies on the RALifeCycleManager to call setThreadPoolName() to set theScheduler @see <a href="http://java.sun.com/j2ee/1.4/docs/api/javax/resource/spi/work/WorkManager.html#scheduleWork(com.ibm.javarx.spi.work.Work, long, com.ibm.javarx.spi.work.ExecutionContext, com.ibm.javarx.spi.work.WorkListener)"> com.ibm.javarx.spi.work.WorkManager.scheduleWork(Work, long, ExecutionContext, WorkListener)</a>
[ "This", "method", "puts", "the", "work", "on", "a", "queue", "that", "is", "later", "processed", "by", "the", "scheduler", "thread", ".", "This", "allows", "the", "method", "to", "return", "to", "the", "caller", "without", "having", "to", "wait", "for", "the", "thread", "to", "start", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca/src/com/ibm/ws/jca/internal/WorkManagerImpl.java#L236-L262
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jca/src/com/ibm/ws/jca/internal/WorkManagerImpl.java
WorkManagerImpl.beforeRunCheck
@Trivial private void beforeRunCheck( Work work, WorkListener workListener, long startTimeout) throws WorkRejectedException { WorkRejectedException wrex = null; if (work == null) { wrex = new WorkRejectedException(new NullPointerException("work")); wrex.setErrorCode(WorkException.UNDEFINED); } else if (startTimeout < WorkManager.IMMEDIATE) wrex = new WorkRejectedException("startTimeout=" + startTimeout, WorkException.START_TIMED_OUT); else if (stopped) wrex = new WorkRejectedException(new UnavailableException(bootstrapContext.resourceAdapterID)); if (wrex != null) { if (workListener != null) { WorkEvent event = new WorkEvent(work == null ? this : work, WorkEvent.WORK_REJECTED, work, wrex); workListener.workRejected(event); } throw wrex; } }
java
@Trivial private void beforeRunCheck( Work work, WorkListener workListener, long startTimeout) throws WorkRejectedException { WorkRejectedException wrex = null; if (work == null) { wrex = new WorkRejectedException(new NullPointerException("work")); wrex.setErrorCode(WorkException.UNDEFINED); } else if (startTimeout < WorkManager.IMMEDIATE) wrex = new WorkRejectedException("startTimeout=" + startTimeout, WorkException.START_TIMED_OUT); else if (stopped) wrex = new WorkRejectedException(new UnavailableException(bootstrapContext.resourceAdapterID)); if (wrex != null) { if (workListener != null) { WorkEvent event = new WorkEvent(work == null ? this : work, WorkEvent.WORK_REJECTED, work, wrex); workListener.workRejected(event); } throw wrex; } }
[ "@", "Trivial", "private", "void", "beforeRunCheck", "(", "Work", "work", ",", "WorkListener", "workListener", ",", "long", "startTimeout", ")", "throws", "WorkRejectedException", "{", "WorkRejectedException", "wrex", "=", "null", ";", "if", "(", "work", "==", "null", ")", "{", "wrex", "=", "new", "WorkRejectedException", "(", "new", "NullPointerException", "(", "\"work\"", ")", ")", ";", "wrex", ".", "setErrorCode", "(", "WorkException", ".", "UNDEFINED", ")", ";", "}", "else", "if", "(", "startTimeout", "<", "WorkManager", ".", "IMMEDIATE", ")", "wrex", "=", "new", "WorkRejectedException", "(", "\"startTimeout=\"", "+", "startTimeout", ",", "WorkException", ".", "START_TIMED_OUT", ")", ";", "else", "if", "(", "stopped", ")", "wrex", "=", "new", "WorkRejectedException", "(", "new", "UnavailableException", "(", "bootstrapContext", ".", "resourceAdapterID", ")", ")", ";", "if", "(", "wrex", "!=", "null", ")", "{", "if", "(", "workListener", "!=", "null", ")", "{", "WorkEvent", "event", "=", "new", "WorkEvent", "(", "work", "==", "null", "?", "this", ":", "work", ",", "WorkEvent", ".", "WORK_REJECTED", ",", "work", ",", "wrex", ")", ";", "workListener", ".", "workRejected", "(", "event", ")", ";", "}", "throw", "wrex", ";", "}", "}" ]
Input parameter checks that can be done before calling run. @param work @param workListener @param startTimeout @throws WorkRejectedException
[ "Input", "parameter", "checks", "that", "can", "be", "done", "before", "calling", "run", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca/src/com/ibm/ws/jca/internal/WorkManagerImpl.java#L273-L295
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jca/src/com/ibm/ws/jca/internal/WorkManagerImpl.java
WorkManagerImpl.stop
public void stop() { final boolean trace = TraceComponent.isAnyTracingEnabled(); // Stop accepting work stopped = true; // Cancel futures for submitted work for (Future<Void> future = futures.poll(); future != null; future = futures.poll()) if (!future.isDone() && future.cancel(true)) if (trace && tc.isDebugEnabled()) Tr.debug(this, tc, "canceled", future); // Release running work for (Work work = runningWork.poll(); work != null; work = runningWork.poll()) { if (trace && tc.isDebugEnabled()) Tr.debug(this, tc, "release", work); work.release(); } }
java
public void stop() { final boolean trace = TraceComponent.isAnyTracingEnabled(); // Stop accepting work stopped = true; // Cancel futures for submitted work for (Future<Void> future = futures.poll(); future != null; future = futures.poll()) if (!future.isDone() && future.cancel(true)) if (trace && tc.isDebugEnabled()) Tr.debug(this, tc, "canceled", future); // Release running work for (Work work = runningWork.poll(); work != null; work = runningWork.poll()) { if (trace && tc.isDebugEnabled()) Tr.debug(this, tc, "release", work); work.release(); } }
[ "public", "void", "stop", "(", ")", "{", "final", "boolean", "trace", "=", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", ";", "// Stop accepting work", "stopped", "=", "true", ";", "// Cancel futures for submitted work", "for", "(", "Future", "<", "Void", ">", "future", "=", "futures", ".", "poll", "(", ")", ";", "future", "!=", "null", ";", "future", "=", "futures", ".", "poll", "(", ")", ")", "if", "(", "!", "future", ".", "isDone", "(", ")", "&&", "future", ".", "cancel", "(", "true", ")", ")", "if", "(", "trace", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "this", ",", "tc", ",", "\"canceled\"", ",", "future", ")", ";", "// Release running work", "for", "(", "Work", "work", "=", "runningWork", ".", "poll", "(", ")", ";", "work", "!=", "null", ";", "work", "=", "runningWork", ".", "poll", "(", ")", ")", "{", "if", "(", "trace", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "this", ",", "tc", ",", "\"release\"", ",", "work", ")", ";", "work", ".", "release", "(", ")", ";", "}", "}" ]
Provides a way to stop the WorkManager.
[ "Provides", "a", "way", "to", "stop", "the", "WorkManager", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca/src/com/ibm/ws/jca/internal/WorkManagerImpl.java#L311-L329
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/jfapchannel/server/impl/ListenerPortImpl.java
ListenerPortImpl.close
public void close() { if (tc.isEntryEnabled()) SibTr.entry(this, tc, "close"); // begin F177053 ChannelFramework framework = ChannelFrameworkFactory.getChannelFramework(); // F196678.10 try { framework.stopChain(chainInbound, CHAIN_STOP_TIME); } catch (ChainException e) { FFDCFilter.processException(e, "com.ibm.ws.sib.jfapchannel.impl.ListenerPortImpl.close", JFapChannelConstants.LISTENERPORTIMPL_CLOSE_01, new Object[] { framework, chainInbound }); // D232185 if (tc.isEventEnabled()) SibTr.exception(this, tc, e); } catch (ChannelException e) { FFDCFilter.processException(e, "com.ibm.ws.sib.jfapchannel.impl.ListenerPortImpl.close", JFapChannelConstants.LISTENERPORTIMPL_CLOSE_02, new Object[] { framework, chainInbound }); // D232185 if (tc.isEventEnabled()) SibTr.exception(this, tc, e); } // end F177053 if (tc.isEntryEnabled()) SibTr.exit(this, tc, "close"); }
java
public void close() { if (tc.isEntryEnabled()) SibTr.entry(this, tc, "close"); // begin F177053 ChannelFramework framework = ChannelFrameworkFactory.getChannelFramework(); // F196678.10 try { framework.stopChain(chainInbound, CHAIN_STOP_TIME); } catch (ChainException e) { FFDCFilter.processException(e, "com.ibm.ws.sib.jfapchannel.impl.ListenerPortImpl.close", JFapChannelConstants.LISTENERPORTIMPL_CLOSE_01, new Object[] { framework, chainInbound }); // D232185 if (tc.isEventEnabled()) SibTr.exception(this, tc, e); } catch (ChannelException e) { FFDCFilter.processException(e, "com.ibm.ws.sib.jfapchannel.impl.ListenerPortImpl.close", JFapChannelConstants.LISTENERPORTIMPL_CLOSE_02, new Object[] { framework, chainInbound }); // D232185 if (tc.isEventEnabled()) SibTr.exception(this, tc, e); } // end F177053 if (tc.isEntryEnabled()) SibTr.exit(this, tc, "close"); }
[ "public", "void", "close", "(", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "this", ",", "tc", ",", "\"close\"", ")", ";", "// begin F177053", "ChannelFramework", "framework", "=", "ChannelFrameworkFactory", ".", "getChannelFramework", "(", ")", ";", "// F196678.10", "try", "{", "framework", ".", "stopChain", "(", "chainInbound", ",", "CHAIN_STOP_TIME", ")", ";", "}", "catch", "(", "ChainException", "e", ")", "{", "FFDCFilter", ".", "processException", "(", "e", ",", "\"com.ibm.ws.sib.jfapchannel.impl.ListenerPortImpl.close\"", ",", "JFapChannelConstants", ".", "LISTENERPORTIMPL_CLOSE_01", ",", "new", "Object", "[", "]", "{", "framework", ",", "chainInbound", "}", ")", ";", "// D232185", "if", "(", "tc", ".", "isEventEnabled", "(", ")", ")", "SibTr", ".", "exception", "(", "this", ",", "tc", ",", "e", ")", ";", "}", "catch", "(", "ChannelException", "e", ")", "{", "FFDCFilter", ".", "processException", "(", "e", ",", "\"com.ibm.ws.sib.jfapchannel.impl.ListenerPortImpl.close\"", ",", "JFapChannelConstants", ".", "LISTENERPORTIMPL_CLOSE_02", ",", "new", "Object", "[", "]", "{", "framework", ",", "chainInbound", "}", ")", ";", "// D232185", "if", "(", "tc", ".", "isEventEnabled", "(", ")", ")", "SibTr", ".", "exception", "(", "this", ",", "tc", ",", "e", ")", ";", "}", "// end F177053", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "this", ",", "tc", ",", "\"close\"", ")", ";", "}" ]
Stops the listener port listening. @see ListenerPort#close()
[ "Stops", "the", "listener", "port", "listening", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/jfapchannel/server/impl/ListenerPortImpl.java#L73-L98
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/jfapchannel/server/impl/ListenerPortImpl.java
ListenerPortImpl.getAcceptListener
public AcceptListener getAcceptListener() { if (tc.isEntryEnabled()) SibTr.entry(this, tc, "getAcceptListener"); if (tc.isEntryEnabled()) SibTr.exit(this, tc, "getAcceptListener", acceptListener); return acceptListener; }
java
public AcceptListener getAcceptListener() { if (tc.isEntryEnabled()) SibTr.entry(this, tc, "getAcceptListener"); if (tc.isEntryEnabled()) SibTr.exit(this, tc, "getAcceptListener", acceptListener); return acceptListener; }
[ "public", "AcceptListener", "getAcceptListener", "(", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "this", ",", "tc", ",", "\"getAcceptListener\"", ")", ";", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "this", ",", "tc", ",", "\"getAcceptListener\"", ",", "acceptListener", ")", ";", "return", "acceptListener", ";", "}" ]
Returns the accept listener associated with this listener port. @see ListenerPort#getAcceptListener()
[ "Returns", "the", "accept", "listener", "associated", "with", "this", "listener", "port", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/jfapchannel/server/impl/ListenerPortImpl.java#L105-L111
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/jfapchannel/server/impl/ListenerPortImpl.java
ListenerPortImpl.getPortNumber
public int getPortNumber() { if (tc.isEntryEnabled()) SibTr.entry(this, tc, "getPortNumber"); if (tc.isEntryEnabled()) SibTr.exit(this, tc, "getPortNumber", "" + portNumber); return portNumber; }
java
public int getPortNumber() { if (tc.isEntryEnabled()) SibTr.entry(this, tc, "getPortNumber"); if (tc.isEntryEnabled()) SibTr.exit(this, tc, "getPortNumber", "" + portNumber); return portNumber; }
[ "public", "int", "getPortNumber", "(", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "this", ",", "tc", ",", "\"getPortNumber\"", ")", ";", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "this", ",", "tc", ",", "\"getPortNumber\"", ",", "\"\"", "+", "portNumber", ")", ";", "return", "portNumber", ";", "}" ]
Returns the port number associated with this listener port. @see ListenerPort#getPortNumber()
[ "Returns", "the", "port", "number", "associated", "with", "this", "listener", "port", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/jfapchannel/server/impl/ListenerPortImpl.java#L118-L124
train
OpenLiberty/open-liberty
dev/com.ibm.ws.rest.handler/src/com/ibm/wsspi/rest/handler/helper/DefaultRoutingHelper.java
DefaultRoutingHelper.containsRoutingContext
public static boolean containsRoutingContext(RESTRequest request) { if (request.getHeader(RESTHandlerContainer.COLLECTIVE_HOST_NAMES) != null) { return true; } //No routing header found, so check query strings return getQueryParameterValue(request, RESTHandlerContainer.COLLECTIVE_HOST_NAMES) != null; }
java
public static boolean containsRoutingContext(RESTRequest request) { if (request.getHeader(RESTHandlerContainer.COLLECTIVE_HOST_NAMES) != null) { return true; } //No routing header found, so check query strings return getQueryParameterValue(request, RESTHandlerContainer.COLLECTIVE_HOST_NAMES) != null; }
[ "public", "static", "boolean", "containsRoutingContext", "(", "RESTRequest", "request", ")", "{", "if", "(", "request", ".", "getHeader", "(", "RESTHandlerContainer", ".", "COLLECTIVE_HOST_NAMES", ")", "!=", "null", ")", "{", "return", "true", ";", "}", "//No routing header found, so check query strings", "return", "getQueryParameterValue", "(", "request", ",", "RESTHandlerContainer", ".", "COLLECTIVE_HOST_NAMES", ")", "!=", "null", ";", "}" ]
Quick check for multiple routing context, without actually fetching all pieces
[ "Quick", "check", "for", "multiple", "routing", "context", "without", "actually", "fetching", "all", "pieces" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.rest.handler/src/com/ibm/wsspi/rest/handler/helper/DefaultRoutingHelper.java#L106-L113
train
OpenLiberty/open-liberty
dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/services/impl/JPAPersistenceManagerImpl.java
JPAPersistenceManagerImpl.createPsu
private PersistenceServiceUnit createPsu(int jobInstanceVersion, int jobExecutionVersion) throws Exception { return databaseStore.createPersistenceServiceUnit(getJobInstanceEntityClass(jobInstanceVersion).getClassLoader(), getJobExecutionEntityClass(jobExecutionVersion).getName(), getJobInstanceEntityClass(jobInstanceVersion).getName(), StepThreadExecutionEntity.class.getName(), StepThreadInstanceEntity.class.getName(), TopLevelStepExecutionEntity.class.getName(), TopLevelStepInstanceEntity.class.getName()); }
java
private PersistenceServiceUnit createPsu(int jobInstanceVersion, int jobExecutionVersion) throws Exception { return databaseStore.createPersistenceServiceUnit(getJobInstanceEntityClass(jobInstanceVersion).getClassLoader(), getJobExecutionEntityClass(jobExecutionVersion).getName(), getJobInstanceEntityClass(jobInstanceVersion).getName(), StepThreadExecutionEntity.class.getName(), StepThreadInstanceEntity.class.getName(), TopLevelStepExecutionEntity.class.getName(), TopLevelStepInstanceEntity.class.getName()); }
[ "private", "PersistenceServiceUnit", "createPsu", "(", "int", "jobInstanceVersion", ",", "int", "jobExecutionVersion", ")", "throws", "Exception", "{", "return", "databaseStore", ".", "createPersistenceServiceUnit", "(", "getJobInstanceEntityClass", "(", "jobInstanceVersion", ")", ".", "getClassLoader", "(", ")", ",", "getJobExecutionEntityClass", "(", "jobExecutionVersion", ")", ".", "getName", "(", ")", ",", "getJobInstanceEntityClass", "(", "jobInstanceVersion", ")", ".", "getName", "(", ")", ",", "StepThreadExecutionEntity", ".", "class", ".", "getName", "(", ")", ",", "StepThreadInstanceEntity", ".", "class", ".", "getName", "(", ")", ",", "TopLevelStepExecutionEntity", ".", "class", ".", "getName", "(", ")", ",", "TopLevelStepInstanceEntity", ".", "class", ".", "getName", "(", ")", ")", ";", "}" ]
Creates a PersistenceServiceUnit using the specified entity versions.
[ "Creates", "a", "PersistenceServiceUnit", "using", "the", "specified", "entity", "versions", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/services/impl/JPAPersistenceManagerImpl.java#L270-L278
train
OpenLiberty/open-liberty
dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/services/impl/JPAPersistenceManagerImpl.java
JPAPersistenceManagerImpl.updateJobExecutionAndInstanceFinalStatus
public JobExecution updateJobExecutionAndInstanceFinalStatus(PersistenceServiceUnit psu, final long jobExecutionId, final BatchStatus finalBatchStatus, final String finalExitStatus, final Date endTime) throws NoSuchJobExecutionException { EntityManager em = psu.createEntityManager(); try { return new TranRequest<JobExecution>(em) { @Override public JobExecution call() { JobExecutionEntity exec = entityMgr.find(JobExecutionEntity.class, jobExecutionId); if (exec == null) { throw new NoSuchJobExecutionException("No job execution found for id = " + jobExecutionId); } try { verifyStatusTransitionIsValid(exec, finalBatchStatus); exec.setBatchStatus(finalBatchStatus); exec.getJobInstance().setBatchStatus(finalBatchStatus); exec.setExitStatus(finalExitStatus); exec.getJobInstance().setExitStatus(finalExitStatus); exec.getJobInstance().setLastUpdatedTime(endTime); // set the state to be the same value as the batchstatus // Note: we only want to do this is if the batchStatus is one of the "done" statuses. if (isFinalBatchStatus(finalBatchStatus)) { InstanceState newInstanceState = InstanceState.valueOf(finalBatchStatus.toString()); verifyStateTransitionIsValid(exec.getJobInstance(), newInstanceState); exec.getJobInstance().setInstanceState(newInstanceState); } exec.setLastUpdatedTime(endTime); exec.setEndTime(endTime); return exec; } catch (BatchIllegalJobStatusTransitionException e) { throw new PersistenceException(e); } } }.runInNewOrExistingGlobalTran(); } finally { em.close(); } }
java
public JobExecution updateJobExecutionAndInstanceFinalStatus(PersistenceServiceUnit psu, final long jobExecutionId, final BatchStatus finalBatchStatus, final String finalExitStatus, final Date endTime) throws NoSuchJobExecutionException { EntityManager em = psu.createEntityManager(); try { return new TranRequest<JobExecution>(em) { @Override public JobExecution call() { JobExecutionEntity exec = entityMgr.find(JobExecutionEntity.class, jobExecutionId); if (exec == null) { throw new NoSuchJobExecutionException("No job execution found for id = " + jobExecutionId); } try { verifyStatusTransitionIsValid(exec, finalBatchStatus); exec.setBatchStatus(finalBatchStatus); exec.getJobInstance().setBatchStatus(finalBatchStatus); exec.setExitStatus(finalExitStatus); exec.getJobInstance().setExitStatus(finalExitStatus); exec.getJobInstance().setLastUpdatedTime(endTime); // set the state to be the same value as the batchstatus // Note: we only want to do this is if the batchStatus is one of the "done" statuses. if (isFinalBatchStatus(finalBatchStatus)) { InstanceState newInstanceState = InstanceState.valueOf(finalBatchStatus.toString()); verifyStateTransitionIsValid(exec.getJobInstance(), newInstanceState); exec.getJobInstance().setInstanceState(newInstanceState); } exec.setLastUpdatedTime(endTime); exec.setEndTime(endTime); return exec; } catch (BatchIllegalJobStatusTransitionException e) { throw new PersistenceException(e); } } }.runInNewOrExistingGlobalTran(); } finally { em.close(); } }
[ "public", "JobExecution", "updateJobExecutionAndInstanceFinalStatus", "(", "PersistenceServiceUnit", "psu", ",", "final", "long", "jobExecutionId", ",", "final", "BatchStatus", "finalBatchStatus", ",", "final", "String", "finalExitStatus", ",", "final", "Date", "endTime", ")", "throws", "NoSuchJobExecutionException", "{", "EntityManager", "em", "=", "psu", ".", "createEntityManager", "(", ")", ";", "try", "{", "return", "new", "TranRequest", "<", "JobExecution", ">", "(", "em", ")", "{", "@", "Override", "public", "JobExecution", "call", "(", ")", "{", "JobExecutionEntity", "exec", "=", "entityMgr", ".", "find", "(", "JobExecutionEntity", ".", "class", ",", "jobExecutionId", ")", ";", "if", "(", "exec", "==", "null", ")", "{", "throw", "new", "NoSuchJobExecutionException", "(", "\"No job execution found for id = \"", "+", "jobExecutionId", ")", ";", "}", "try", "{", "verifyStatusTransitionIsValid", "(", "exec", ",", "finalBatchStatus", ")", ";", "exec", ".", "setBatchStatus", "(", "finalBatchStatus", ")", ";", "exec", ".", "getJobInstance", "(", ")", ".", "setBatchStatus", "(", "finalBatchStatus", ")", ";", "exec", ".", "setExitStatus", "(", "finalExitStatus", ")", ";", "exec", ".", "getJobInstance", "(", ")", ".", "setExitStatus", "(", "finalExitStatus", ")", ";", "exec", ".", "getJobInstance", "(", ")", ".", "setLastUpdatedTime", "(", "endTime", ")", ";", "// set the state to be the same value as the batchstatus", "// Note: we only want to do this is if the batchStatus is one of the \"done\" statuses.", "if", "(", "isFinalBatchStatus", "(", "finalBatchStatus", ")", ")", "{", "InstanceState", "newInstanceState", "=", "InstanceState", ".", "valueOf", "(", "finalBatchStatus", ".", "toString", "(", ")", ")", ";", "verifyStateTransitionIsValid", "(", "exec", ".", "getJobInstance", "(", ")", ",", "newInstanceState", ")", ";", "exec", ".", "getJobInstance", "(", ")", ".", "setInstanceState", "(", "newInstanceState", ")", ";", "}", "exec", ".", "setLastUpdatedTime", "(", "endTime", ")", ";", "exec", ".", "setEndTime", "(", "endTime", ")", ";", "return", "exec", ";", "}", "catch", "(", "BatchIllegalJobStatusTransitionException", "e", ")", "{", "throw", "new", "PersistenceException", "(", "e", ")", ";", "}", "}", "}", ".", "runInNewOrExistingGlobalTran", "(", ")", ";", "}", "finally", "{", "em", ".", "close", "(", ")", ";", "}", "}" ]
This method is called during recovery, as well as during normal operation. Note this is public but not part of the IPersistenceManagerService interface, since there's no equivalent for in-mem persistence. Set the final batchStatus, exitStatus, and endTime for the given jobExecutionId.
[ "This", "method", "is", "called", "during", "recovery", "as", "well", "as", "during", "normal", "operation", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/services/impl/JPAPersistenceManagerImpl.java#L1128-L1170
train
OpenLiberty/open-liberty
dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/services/impl/JPAPersistenceManagerImpl.java
JPAPersistenceManagerImpl.getStepExecutionsTopLevelFromJobExecutionId
@Override public List<StepExecution> getStepExecutionsTopLevelFromJobExecutionId(final long jobExecutionId) throws NoSuchJobExecutionException { final EntityManager em = getPsu().createEntityManager(); try { List<StepExecution> exec = new TranRequest<List<StepExecution>>(em) { @Override public List<StepExecution> call() throws Exception { TypedQuery<StepExecution> query = em.createNamedQuery(TopLevelStepExecutionEntity.GET_TOP_LEVEL_STEP_EXECUTIONS_BY_JOB_EXEC_SORT_BY_START_TIME_ASC, StepExecution.class); query.setParameter("jobExecId", jobExecutionId); List<StepExecution> result = query.getResultList(); if (result == null) { result = new ArrayList<StepExecution>(); } // If empty, try to get job execution to generate NoSuchJobExecutionException if unknown id if (result.isEmpty()) { getJobExecution(jobExecutionId); } return result; } }.runInNewOrExistingGlobalTran(); return exec; } finally { em.close(); } }
java
@Override public List<StepExecution> getStepExecutionsTopLevelFromJobExecutionId(final long jobExecutionId) throws NoSuchJobExecutionException { final EntityManager em = getPsu().createEntityManager(); try { List<StepExecution> exec = new TranRequest<List<StepExecution>>(em) { @Override public List<StepExecution> call() throws Exception { TypedQuery<StepExecution> query = em.createNamedQuery(TopLevelStepExecutionEntity.GET_TOP_LEVEL_STEP_EXECUTIONS_BY_JOB_EXEC_SORT_BY_START_TIME_ASC, StepExecution.class); query.setParameter("jobExecId", jobExecutionId); List<StepExecution> result = query.getResultList(); if (result == null) { result = new ArrayList<StepExecution>(); } // If empty, try to get job execution to generate NoSuchJobExecutionException if unknown id if (result.isEmpty()) { getJobExecution(jobExecutionId); } return result; } }.runInNewOrExistingGlobalTran(); return exec; } finally { em.close(); } }
[ "@", "Override", "public", "List", "<", "StepExecution", ">", "getStepExecutionsTopLevelFromJobExecutionId", "(", "final", "long", "jobExecutionId", ")", "throws", "NoSuchJobExecutionException", "{", "final", "EntityManager", "em", "=", "getPsu", "(", ")", ".", "createEntityManager", "(", ")", ";", "try", "{", "List", "<", "StepExecution", ">", "exec", "=", "new", "TranRequest", "<", "List", "<", "StepExecution", ">", ">", "(", "em", ")", "{", "@", "Override", "public", "List", "<", "StepExecution", ">", "call", "(", ")", "throws", "Exception", "{", "TypedQuery", "<", "StepExecution", ">", "query", "=", "em", ".", "createNamedQuery", "(", "TopLevelStepExecutionEntity", ".", "GET_TOP_LEVEL_STEP_EXECUTIONS_BY_JOB_EXEC_SORT_BY_START_TIME_ASC", ",", "StepExecution", ".", "class", ")", ";", "query", ".", "setParameter", "(", "\"jobExecId\"", ",", "jobExecutionId", ")", ";", "List", "<", "StepExecution", ">", "result", "=", "query", ".", "getResultList", "(", ")", ";", "if", "(", "result", "==", "null", ")", "{", "result", "=", "new", "ArrayList", "<", "StepExecution", ">", "(", ")", ";", "}", "// If empty, try to get job execution to generate NoSuchJobExecutionException if unknown id", "if", "(", "result", ".", "isEmpty", "(", ")", ")", "{", "getJobExecution", "(", "jobExecutionId", ")", ";", "}", "return", "result", ";", "}", "}", ".", "runInNewOrExistingGlobalTran", "(", ")", ";", "return", "exec", ";", "}", "finally", "{", "em", ".", "close", "(", ")", ";", "}", "}" ]
order by start time, ascending
[ "order", "by", "start", "time", "ascending" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/services/impl/JPAPersistenceManagerImpl.java#L1980-L2005
train
OpenLiberty/open-liberty
dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/services/impl/JPAPersistenceManagerImpl.java
JPAPersistenceManagerImpl.updateRemotablePartitionOnRecovery
public RemotablePartitionEntity updateRemotablePartitionOnRecovery(PersistenceServiceUnit psu, final RemotablePartitionEntity partition) { // TODO Auto-generated method stub EntityManager em = psu.createEntityManager(); try { return new TranRequest<RemotablePartitionEntity>(em) { @Override public RemotablePartitionEntity call() { RemotablePartitionKey key = new RemotablePartitionKey(partition); RemotablePartitionEntity remotablePartition = entityMgr.find(RemotablePartitionEntity.class, key); remotablePartition.setLastUpdated(new Date()); return remotablePartition; } }.runInNewOrExistingGlobalTran(); } finally { em.close(); } }
java
public RemotablePartitionEntity updateRemotablePartitionOnRecovery(PersistenceServiceUnit psu, final RemotablePartitionEntity partition) { // TODO Auto-generated method stub EntityManager em = psu.createEntityManager(); try { return new TranRequest<RemotablePartitionEntity>(em) { @Override public RemotablePartitionEntity call() { RemotablePartitionKey key = new RemotablePartitionKey(partition); RemotablePartitionEntity remotablePartition = entityMgr.find(RemotablePartitionEntity.class, key); remotablePartition.setLastUpdated(new Date()); return remotablePartition; } }.runInNewOrExistingGlobalTran(); } finally { em.close(); } }
[ "public", "RemotablePartitionEntity", "updateRemotablePartitionOnRecovery", "(", "PersistenceServiceUnit", "psu", ",", "final", "RemotablePartitionEntity", "partition", ")", "{", "// TODO Auto-generated method stub", "EntityManager", "em", "=", "psu", ".", "createEntityManager", "(", ")", ";", "try", "{", "return", "new", "TranRequest", "<", "RemotablePartitionEntity", ">", "(", "em", ")", "{", "@", "Override", "public", "RemotablePartitionEntity", "call", "(", ")", "{", "RemotablePartitionKey", "key", "=", "new", "RemotablePartitionKey", "(", "partition", ")", ";", "RemotablePartitionEntity", "remotablePartition", "=", "entityMgr", ".", "find", "(", "RemotablePartitionEntity", ".", "class", ",", "key", ")", ";", "remotablePartition", ".", "setLastUpdated", "(", "new", "Date", "(", ")", ")", ";", "return", "remotablePartition", ";", "}", "}", ".", "runInNewOrExistingGlobalTran", "(", ")", ";", "}", "finally", "{", "em", ".", "close", "(", ")", ";", "}", "}" ]
This method is called during recovery Set the lastUpdated for the given RemotablePartitionEntity
[ "This", "method", "is", "called", "during", "recovery" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/services/impl/JPAPersistenceManagerImpl.java#L2110-L2127
train
OpenLiberty/open-liberty
dev/com.ibm.ws.wsoc/src/com/ibm/ws/wsoc/SessionImpl.java
SessionImpl.addMessageHandler
public <T> void addMessageHandler(Class<T> clazz, Whole<T> handler) { connLink.addMessageHandler(clazz, handler); }
java
public <T> void addMessageHandler(Class<T> clazz, Whole<T> handler) { connLink.addMessageHandler(clazz, handler); }
[ "public", "<", "T", ">", "void", "addMessageHandler", "(", "Class", "<", "T", ">", "clazz", ",", "Whole", "<", "T", ">", "handler", ")", "{", "connLink", ".", "addMessageHandler", "(", "clazz", ",", "handler", ")", ";", "}" ]
websocket 1.1 methods
[ "websocket", "1", ".", "1", "methods" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.wsoc/src/com/ibm/ws/wsoc/SessionImpl.java#L503-L505
train
OpenLiberty/open-liberty
dev/com.ibm.ws.webserver.plugin.utility/src/com/ibm/ws/webserver/plugin/utility/utils/PluginUtilityConsole.java
PluginUtilityConsole.promptForUser
public String promptForUser(String arg) { String user = console.readLine(CommandUtils.getMessage("user.enterText", arg) + " "); return user; }
java
public String promptForUser(String arg) { String user = console.readLine(CommandUtils.getMessage("user.enterText", arg) + " "); return user; }
[ "public", "String", "promptForUser", "(", "String", "arg", ")", "{", "String", "user", "=", "console", ".", "readLine", "(", "CommandUtils", ".", "getMessage", "(", "\"user.enterText\"", ",", "arg", ")", "+", "\" \"", ")", ";", "return", "user", ";", "}" ]
Prompt the user to enter text. @return Entered String
[ "Prompt", "the", "user", "to", "enter", "text", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webserver.plugin.utility/src/com/ibm/ws/webserver/plugin/utility/utils/PluginUtilityConsole.java#L46-L50
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbOnePhaseXaResourceImpl.java
WSRdbOnePhaseXaResourceImpl.end
public void end(Xid xid, int flags) throws XAException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.entry(this, tc, "end", new Object[] { ivManagedConnection, AdapterUtil.toString(xid), AdapterUtil.getXAResourceEndFlagString(flags) }); try { if (flags == XAResource.TMFAIL) { ivStateManager.setState(WSStateManager.XA_END_FAIL); } else { ivStateManager.setState(WSStateManager.XA_END); } } catch (TransactionException te) { //Exception means setState failed because it was invalid to set the state in this case FFDCFilter.processException(te, "com.ibm.ws.rsadapter.spi.WSRdbOnePhaseXaResourceImpl.end", "189", this); Tr.error(tc, "INVALID_TX_STATE", new Object[] { "OnePhaseXAResource.end()", ivManagedConnection.getTransactionStateAsString() }); XAException xae = new XAException(XAException.XA_RBPROTO); traceXAException(xae, currClass); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(this, tc, "end", "Exception"); throw xae; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(this, tc, "end"); }
java
public void end(Xid xid, int flags) throws XAException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.entry(this, tc, "end", new Object[] { ivManagedConnection, AdapterUtil.toString(xid), AdapterUtil.getXAResourceEndFlagString(flags) }); try { if (flags == XAResource.TMFAIL) { ivStateManager.setState(WSStateManager.XA_END_FAIL); } else { ivStateManager.setState(WSStateManager.XA_END); } } catch (TransactionException te) { //Exception means setState failed because it was invalid to set the state in this case FFDCFilter.processException(te, "com.ibm.ws.rsadapter.spi.WSRdbOnePhaseXaResourceImpl.end", "189", this); Tr.error(tc, "INVALID_TX_STATE", new Object[] { "OnePhaseXAResource.end()", ivManagedConnection.getTransactionStateAsString() }); XAException xae = new XAException(XAException.XA_RBPROTO); traceXAException(xae, currClass); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(this, tc, "end", "Exception"); throw xae; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(this, tc, "end"); }
[ "public", "void", "end", "(", "Xid", "xid", ",", "int", "flags", ")", "throws", "XAException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "this", ",", "tc", ",", "\"end\"", ",", "new", "Object", "[", "]", "{", "ivManagedConnection", ",", "AdapterUtil", ".", "toString", "(", "xid", ")", ",", "AdapterUtil", ".", "getXAResourceEndFlagString", "(", "flags", ")", "}", ")", ";", "try", "{", "if", "(", "flags", "==", "XAResource", ".", "TMFAIL", ")", "{", "ivStateManager", ".", "setState", "(", "WSStateManager", ".", "XA_END_FAIL", ")", ";", "}", "else", "{", "ivStateManager", ".", "setState", "(", "WSStateManager", ".", "XA_END", ")", ";", "}", "}", "catch", "(", "TransactionException", "te", ")", "{", "//Exception means setState failed because it was invalid to set the state in this case", "FFDCFilter", ".", "processException", "(", "te", ",", "\"com.ibm.ws.rsadapter.spi.WSRdbOnePhaseXaResourceImpl.end\"", ",", "\"189\"", ",", "this", ")", ";", "Tr", ".", "error", "(", "tc", ",", "\"INVALID_TX_STATE\"", ",", "new", "Object", "[", "]", "{", "\"OnePhaseXAResource.end()\"", ",", "ivManagedConnection", ".", "getTransactionStateAsString", "(", ")", "}", ")", ";", "XAException", "xae", "=", "new", "XAException", "(", "XAException", ".", "XA_RBPROTO", ")", ";", "traceXAException", "(", "xae", ",", "currClass", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "this", ",", "tc", ",", "\"end\"", ",", "\"Exception\"", ")", ";", "throw", "xae", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "this", ",", "tc", ",", "\"end\"", ")", ";", "}" ]
XAException with return code XA_RBROLLBACK
[ "XAException", "with", "return", "code", "XA_RBROLLBACK" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbOnePhaseXaResourceImpl.java#L236-L265
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbOnePhaseXaResourceImpl.java
WSRdbOnePhaseXaResourceImpl.rollback
public void rollback(Xid xid) throws XAException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.entry(this, tc, "rollback", new Object[] { ivManagedConnection, AdapterUtil.toString(xid) }); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { String cId = null; try { cId = ivManagedConnection.mcf.getCorrelator(ivManagedConnection); } catch (SQLException x) { // will just log the exception here and ignore it since its in trace Tr.debug(this, tc, "got an exception trying to get the correlator in commit, exception is: ", x); } if (cId != null) { StringBuffer stbuf = new StringBuffer(200); stbuf.append("Correlator: DB2, ID: "); stbuf.append(cId); if (xid != null) { stbuf.append("Transaction ID : "); stbuf.append(xid); } stbuf.append(" ROLLBACK"); Tr.debug(this, tc, stbuf.toString()); } } // Reset so we can deferred enlist in a future global transaction. ivManagedConnection.wasLazilyEnlistedInGlobalTran = false; try { // If no work was done during the transaction, the autoCommit value may still // be on. In this case, just no-op, since some drivers like ConnectJDBC 3.1 // don't allow commit/rollback when autoCommit is on. ivSqlConn.rollback(); ivStateManager.setState(WSStateManager.XA_ROLLBACK); } catch (SQLException sqe) { FFDCFilter.processException(sqe, "com.ibm.ws.rsadapter.spi.WSRdbOnePhaseXaResourceImpl.rollback", "342", this); Tr.error(tc, "DSA_INTERNAL_ERROR", new Object[] { "Exception caught during rollback on the OnePhaseXAResource", sqe }); XAException xae = new XAException(XAException.XAER_RMERR); traceXAException(xae, currClass); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(this, tc, "rollback", "Exception"); throw xae; } catch (TransactionException te) { //Exception means setState failed because it was invalid to set the state in this case FFDCFilter.processException(te, "com.ibm.ws.rsadapter.spi.WSRdbOnePhaseXaResourceImpl.rollback", "351", this); Tr.error(tc, "INVALID_TX_STATE", new Object[] { "OnePhaseXAResource.rollback()", ivManagedConnection.getTransactionStateAsString() }); XAException xae = new XAException(XAException.XAER_RMERR); traceXAException(xae, currClass); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(this, tc, "rollback", "Exception"); throw xae; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(this, tc, "rollback"); }
java
public void rollback(Xid xid) throws XAException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.entry(this, tc, "rollback", new Object[] { ivManagedConnection, AdapterUtil.toString(xid) }); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { String cId = null; try { cId = ivManagedConnection.mcf.getCorrelator(ivManagedConnection); } catch (SQLException x) { // will just log the exception here and ignore it since its in trace Tr.debug(this, tc, "got an exception trying to get the correlator in commit, exception is: ", x); } if (cId != null) { StringBuffer stbuf = new StringBuffer(200); stbuf.append("Correlator: DB2, ID: "); stbuf.append(cId); if (xid != null) { stbuf.append("Transaction ID : "); stbuf.append(xid); } stbuf.append(" ROLLBACK"); Tr.debug(this, tc, stbuf.toString()); } } // Reset so we can deferred enlist in a future global transaction. ivManagedConnection.wasLazilyEnlistedInGlobalTran = false; try { // If no work was done during the transaction, the autoCommit value may still // be on. In this case, just no-op, since some drivers like ConnectJDBC 3.1 // don't allow commit/rollback when autoCommit is on. ivSqlConn.rollback(); ivStateManager.setState(WSStateManager.XA_ROLLBACK); } catch (SQLException sqe) { FFDCFilter.processException(sqe, "com.ibm.ws.rsadapter.spi.WSRdbOnePhaseXaResourceImpl.rollback", "342", this); Tr.error(tc, "DSA_INTERNAL_ERROR", new Object[] { "Exception caught during rollback on the OnePhaseXAResource", sqe }); XAException xae = new XAException(XAException.XAER_RMERR); traceXAException(xae, currClass); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(this, tc, "rollback", "Exception"); throw xae; } catch (TransactionException te) { //Exception means setState failed because it was invalid to set the state in this case FFDCFilter.processException(te, "com.ibm.ws.rsadapter.spi.WSRdbOnePhaseXaResourceImpl.rollback", "351", this); Tr.error(tc, "INVALID_TX_STATE", new Object[] { "OnePhaseXAResource.rollback()", ivManagedConnection.getTransactionStateAsString() }); XAException xae = new XAException(XAException.XAER_RMERR); traceXAException(xae, currClass); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(this, tc, "rollback", "Exception"); throw xae; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(this, tc, "rollback"); }
[ "public", "void", "rollback", "(", "Xid", "xid", ")", "throws", "XAException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "this", ",", "tc", ",", "\"rollback\"", ",", "new", "Object", "[", "]", "{", "ivManagedConnection", ",", "AdapterUtil", ".", "toString", "(", "xid", ")", "}", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "String", "cId", "=", "null", ";", "try", "{", "cId", "=", "ivManagedConnection", ".", "mcf", ".", "getCorrelator", "(", "ivManagedConnection", ")", ";", "}", "catch", "(", "SQLException", "x", ")", "{", "// will just log the exception here and ignore it since its in trace", "Tr", ".", "debug", "(", "this", ",", "tc", ",", "\"got an exception trying to get the correlator in commit, exception is: \"", ",", "x", ")", ";", "}", "if", "(", "cId", "!=", "null", ")", "{", "StringBuffer", "stbuf", "=", "new", "StringBuffer", "(", "200", ")", ";", "stbuf", ".", "append", "(", "\"Correlator: DB2, ID: \"", ")", ";", "stbuf", ".", "append", "(", "cId", ")", ";", "if", "(", "xid", "!=", "null", ")", "{", "stbuf", ".", "append", "(", "\"Transaction ID : \"", ")", ";", "stbuf", ".", "append", "(", "xid", ")", ";", "}", "stbuf", ".", "append", "(", "\" ROLLBACK\"", ")", ";", "Tr", ".", "debug", "(", "this", ",", "tc", ",", "stbuf", ".", "toString", "(", ")", ")", ";", "}", "}", "// Reset so we can deferred enlist in a future global transaction. ", "ivManagedConnection", ".", "wasLazilyEnlistedInGlobalTran", "=", "false", ";", "try", "{", "// If no work was done during the transaction, the autoCommit value may still", "// be on. In this case, just no-op, since some drivers like ConnectJDBC 3.1", "// don't allow commit/rollback when autoCommit is on. ", "ivSqlConn", ".", "rollback", "(", ")", ";", "ivStateManager", ".", "setState", "(", "WSStateManager", ".", "XA_ROLLBACK", ")", ";", "}", "catch", "(", "SQLException", "sqe", ")", "{", "FFDCFilter", ".", "processException", "(", "sqe", ",", "\"com.ibm.ws.rsadapter.spi.WSRdbOnePhaseXaResourceImpl.rollback\"", ",", "\"342\"", ",", "this", ")", ";", "Tr", ".", "error", "(", "tc", ",", "\"DSA_INTERNAL_ERROR\"", ",", "new", "Object", "[", "]", "{", "\"Exception caught during rollback on the OnePhaseXAResource\"", ",", "sqe", "}", ")", ";", "XAException", "xae", "=", "new", "XAException", "(", "XAException", ".", "XAER_RMERR", ")", ";", "traceXAException", "(", "xae", ",", "currClass", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "this", ",", "tc", ",", "\"rollback\"", ",", "\"Exception\"", ")", ";", "throw", "xae", ";", "}", "catch", "(", "TransactionException", "te", ")", "{", "//Exception means setState failed because it was invalid to set the state in this case", "FFDCFilter", ".", "processException", "(", "te", ",", "\"com.ibm.ws.rsadapter.spi.WSRdbOnePhaseXaResourceImpl.rollback\"", ",", "\"351\"", ",", "this", ")", ";", "Tr", ".", "error", "(", "tc", ",", "\"INVALID_TX_STATE\"", ",", "new", "Object", "[", "]", "{", "\"OnePhaseXAResource.rollback()\"", ",", "ivManagedConnection", ".", "getTransactionStateAsString", "(", ")", "}", ")", ";", "XAException", "xae", "=", "new", "XAException", "(", "XAException", ".", "XAER_RMERR", ")", ";", "traceXAException", "(", "xae", ",", "currClass", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "this", ",", "tc", ",", "\"rollback\"", ",", "\"Exception\"", ")", ";", "throw", "xae", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "this", ",", "tc", ",", "\"rollback\"", ")", ";", "}" ]
XAER_RMERR return code in XAException
[ "XAER_RMERR", "return", "code", "in", "XAException" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbOnePhaseXaResourceImpl.java#L422-L483
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc.management.j2ee/src/com/ibm/ws/jdbc/management/j2ee/internal/JDBCMBeanRuntime.java
JDBCMBeanRuntime.getBundleContext
private static BundleContext getBundleContext(final Bundle bundle) { if (System.getSecurityManager() == null) return bundle.getBundleContext(); else return AccessController.doPrivileged(new PrivilegedAction<BundleContext>() { @Override public BundleContext run() { return bundle.getBundleContext(); } }); }
java
private static BundleContext getBundleContext(final Bundle bundle) { if (System.getSecurityManager() == null) return bundle.getBundleContext(); else return AccessController.doPrivileged(new PrivilegedAction<BundleContext>() { @Override public BundleContext run() { return bundle.getBundleContext(); } }); }
[ "private", "static", "BundleContext", "getBundleContext", "(", "final", "Bundle", "bundle", ")", "{", "if", "(", "System", ".", "getSecurityManager", "(", ")", "==", "null", ")", "return", "bundle", ".", "getBundleContext", "(", ")", ";", "else", "return", "AccessController", ".", "doPrivileged", "(", "new", "PrivilegedAction", "<", "BundleContext", ">", "(", ")", "{", "@", "Override", "public", "BundleContext", "run", "(", ")", "{", "return", "bundle", ".", "getBundleContext", "(", ")", ";", "}", "}", ")", ";", "}" ]
no need for an updatedJdbcDriver because changes will not impact the mbean
[ "no", "need", "for", "an", "updatedJdbcDriver", "because", "changes", "will", "not", "impact", "the", "mbean" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc.management.j2ee/src/com/ibm/ws/jdbc/management/j2ee/internal/JDBCMBeanRuntime.java#L350-L360
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/renderkit/ErrorPageWriter.java
ErrorPageWriter.debugHtml
public static void debugHtml(Writer writer, FacesContext faces, Throwable e) throws IOException { debugHtml(writer, faces, faces.getViewRoot(), null, e); }
java
public static void debugHtml(Writer writer, FacesContext faces, Throwable e) throws IOException { debugHtml(writer, faces, faces.getViewRoot(), null, e); }
[ "public", "static", "void", "debugHtml", "(", "Writer", "writer", ",", "FacesContext", "faces", ",", "Throwable", "e", ")", "throws", "IOException", "{", "debugHtml", "(", "writer", ",", "faces", ",", "faces", ".", "getViewRoot", "(", ")", ",", "null", ",", "e", ")", ";", "}" ]
Generates the HTML error page for the given Throwable and writes it to the given writer. @param writer @param faces @param e @throws IOException
[ "Generates", "the", "HTML", "error", "page", "for", "the", "given", "Throwable", "and", "writes", "it", "to", "the", "given", "writer", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/renderkit/ErrorPageWriter.java#L264-L267
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/renderkit/ErrorPageWriter.java
ErrorPageWriter.debugHtml
public static void debugHtml(Writer writer, FacesContext faces) throws IOException { _init(faces); Date now = new Date(); for (int i = 0; i < debugParts.length; i++) { if ("message".equals(debugParts[i])) { writer.write(faces.getViewRoot().getViewId()); } else if ("now".equals(debugParts[i])) { writer.write(DateFormat.getDateTimeInstance().format(now)); } else if ("tree".equals(debugParts[i])) { _writeComponent(faces, writer, faces.getViewRoot(), null, true); } else if ("extendedtree".equals(debugParts[i])) { _writeExtendedComponentTree(writer, faces); } else if ("vars".equals(debugParts[i])) { _writeVariables(writer, faces, faces.getViewRoot()); } else { writer.write(debugParts[i]); } } }
java
public static void debugHtml(Writer writer, FacesContext faces) throws IOException { _init(faces); Date now = new Date(); for (int i = 0; i < debugParts.length; i++) { if ("message".equals(debugParts[i])) { writer.write(faces.getViewRoot().getViewId()); } else if ("now".equals(debugParts[i])) { writer.write(DateFormat.getDateTimeInstance().format(now)); } else if ("tree".equals(debugParts[i])) { _writeComponent(faces, writer, faces.getViewRoot(), null, true); } else if ("extendedtree".equals(debugParts[i])) { _writeExtendedComponentTree(writer, faces); } else if ("vars".equals(debugParts[i])) { _writeVariables(writer, faces, faces.getViewRoot()); } else { writer.write(debugParts[i]); } } }
[ "public", "static", "void", "debugHtml", "(", "Writer", "writer", ",", "FacesContext", "faces", ")", "throws", "IOException", "{", "_init", "(", "faces", ")", ";", "Date", "now", "=", "new", "Date", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "debugParts", ".", "length", ";", "i", "++", ")", "{", "if", "(", "\"message\"", ".", "equals", "(", "debugParts", "[", "i", "]", ")", ")", "{", "writer", ".", "write", "(", "faces", ".", "getViewRoot", "(", ")", ".", "getViewId", "(", ")", ")", ";", "}", "else", "if", "(", "\"now\"", ".", "equals", "(", "debugParts", "[", "i", "]", ")", ")", "{", "writer", ".", "write", "(", "DateFormat", ".", "getDateTimeInstance", "(", ")", ".", "format", "(", "now", ")", ")", ";", "}", "else", "if", "(", "\"tree\"", ".", "equals", "(", "debugParts", "[", "i", "]", ")", ")", "{", "_writeComponent", "(", "faces", ",", "writer", ",", "faces", ".", "getViewRoot", "(", ")", ",", "null", ",", "true", ")", ";", "}", "else", "if", "(", "\"extendedtree\"", ".", "equals", "(", "debugParts", "[", "i", "]", ")", ")", "{", "_writeExtendedComponentTree", "(", "writer", ",", "faces", ")", ";", "}", "else", "if", "(", "\"vars\"", ".", "equals", "(", "debugParts", "[", "i", "]", ")", ")", "{", "_writeVariables", "(", "writer", ",", "faces", ",", "faces", ".", "getViewRoot", "(", ")", ")", ";", "}", "else", "{", "writer", ".", "write", "(", "debugParts", "[", "i", "]", ")", ";", "}", "}", "}" ]
Generates the HTML debug page for the current view and writes it to the given writer. @param writer @param faces @throws IOException
[ "Generates", "the", "HTML", "debug", "page", "for", "the", "current", "view", "and", "writes", "it", "to", "the", "given", "writer", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/renderkit/ErrorPageWriter.java#L399-L430
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/SchemaSet.java
SchemaSet.hashToTable
private int hashToTable(Long id, Entry[] table) { int posVal = id.intValue() & Integer.MAX_VALUE; return (posVal % table.length); }
java
private int hashToTable(Long id, Entry[] table) { int posVal = id.intValue() & Integer.MAX_VALUE; return (posVal % table.length); }
[ "private", "int", "hashToTable", "(", "Long", "id", ",", "Entry", "[", "]", "table", ")", "{", "int", "posVal", "=", "id", ".", "intValue", "(", ")", "&", "Integer", ".", "MAX_VALUE", ";", "return", "(", "posVal", "%", "table", ".", "length", ")", ";", "}" ]
The Long Id is already effectively a hashcode for the Schema and should be unique. All we should need to do is get a positive integer version of it & divide by the table size.
[ "The", "Long", "Id", "is", "already", "effectively", "a", "hashcode", "for", "the", "Schema", "and", "should", "be", "unique", ".", "All", "we", "should", "need", "to", "do", "is", "get", "a", "positive", "integer", "version", "of", "it", "&", "divide", "by", "the", "table", "size", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/SchemaSet.java#L289-L292
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/SchemaSet.java
SchemaSet.resize
private void resize() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "resize", table.length); Entry[] newTable = new Entry[table.length + (table.length / 2)]; /* We have to walk the entire SchemaSet, rehashing each Entry and putting */ /* it in its new home. As contains() may be running at the same time, we */ /* have to create a new Entry instance for each. */ for (int i = 0; i < table.length; i++) { Entry ent = table[i]; Entry newEntry; int j; while (ent != null) { j = hashToTable(ent.schemaId, newTable); newEntry = new Entry(ent.schemaId, newTable[j]); newTable[j] = newEntry; ent = ent.next; } } /* Now replace the old table with the new one. */ table = newTable; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "resize", table.length); }
java
private void resize() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "resize", table.length); Entry[] newTable = new Entry[table.length + (table.length / 2)]; /* We have to walk the entire SchemaSet, rehashing each Entry and putting */ /* it in its new home. As contains() may be running at the same time, we */ /* have to create a new Entry instance for each. */ for (int i = 0; i < table.length; i++) { Entry ent = table[i]; Entry newEntry; int j; while (ent != null) { j = hashToTable(ent.schemaId, newTable); newEntry = new Entry(ent.schemaId, newTable[j]); newTable[j] = newEntry; ent = ent.next; } } /* Now replace the old table with the new one. */ table = newTable; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "resize", table.length); }
[ "private", "void", "resize", "(", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "this", ",", "tc", ",", "\"resize\"", ",", "table", ".", "length", ")", ";", "Entry", "[", "]", "newTable", "=", "new", "Entry", "[", "table", ".", "length", "+", "(", "table", ".", "length", "/", "2", ")", "]", ";", "/* We have to walk the entire SchemaSet, rehashing each Entry and putting */", "/* it in its new home. As contains() may be running at the same time, we */", "/* have to create a new Entry instance for each. */", "for", "(", "int", "i", "=", "0", ";", "i", "<", "table", ".", "length", ";", "i", "++", ")", "{", "Entry", "ent", "=", "table", "[", "i", "]", ";", "Entry", "newEntry", ";", "int", "j", ";", "while", "(", "ent", "!=", "null", ")", "{", "j", "=", "hashToTable", "(", "ent", ".", "schemaId", ",", "newTable", ")", ";", "newEntry", "=", "new", "Entry", "(", "ent", ".", "schemaId", ",", "newTable", "[", "j", "]", ")", ";", "newTable", "[", "j", "]", "=", "newEntry", ";", "ent", "=", "ent", ".", "next", ";", "}", "}", "/* Now replace the old table with the new one. */", "table", "=", "newTable", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "this", ",", "tc", ",", "\"resize\"", ",", "table", ".", "length", ")", ";", "}" ]
Resize the SchemaSet, adding 50% to the size. This method must only be called from add() which is synchronized.
[ "Resize", "the", "SchemaSet", "adding", "50%", "to", "the", "size", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/SchemaSet.java#L300-L324
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/SchemaSet.java
SchemaSet.toVerboseString
public String toVerboseString() { /* Take a local reference to the table in case a resize happens. */ Entry[] tempTable = table; StringBuffer buf = new StringBuffer(); /* Include the SchemaSet hashcode just in case we need to distinguish them */ buf.append("SchemaSet "); buf.append(this.hashCode()); buf.append(" {\n"); /* For each table entry, write out all the SchemaIds */ for (int i=0; i < tempTable.length; i++) { buf.append(" ["); buf.append(i); buf.append("] "); Entry ent = tempTable[i]; buf.append(ent); while (ent != null) { ent = ent.next; buf.append(" "); buf.append(ent); } buf.append("\n"); } buf.append(" }\n"); return buf.toString(); }
java
public String toVerboseString() { /* Take a local reference to the table in case a resize happens. */ Entry[] tempTable = table; StringBuffer buf = new StringBuffer(); /* Include the SchemaSet hashcode just in case we need to distinguish them */ buf.append("SchemaSet "); buf.append(this.hashCode()); buf.append(" {\n"); /* For each table entry, write out all the SchemaIds */ for (int i=0; i < tempTable.length; i++) { buf.append(" ["); buf.append(i); buf.append("] "); Entry ent = tempTable[i]; buf.append(ent); while (ent != null) { ent = ent.next; buf.append(" "); buf.append(ent); } buf.append("\n"); } buf.append(" }\n"); return buf.toString(); }
[ "public", "String", "toVerboseString", "(", ")", "{", "/* Take a local reference to the table in case a resize happens. */", "Entry", "[", "]", "tempTable", "=", "table", ";", "StringBuffer", "buf", "=", "new", "StringBuffer", "(", ")", ";", "/* Include the SchemaSet hashcode just in case we need to distinguish them */", "buf", ".", "append", "(", "\"SchemaSet \"", ")", ";", "buf", ".", "append", "(", "this", ".", "hashCode", "(", ")", ")", ";", "buf", ".", "append", "(", "\" {\\n\"", ")", ";", "/* For each table entry, write out all the SchemaIds */", "for", "(", "int", "i", "=", "0", ";", "i", "<", "tempTable", ".", "length", ";", "i", "++", ")", "{", "buf", ".", "append", "(", "\" [\"", ")", ";", "buf", ".", "append", "(", "i", ")", ";", "buf", ".", "append", "(", "\"] \"", ")", ";", "Entry", "ent", "=", "tempTable", "[", "i", "]", ";", "buf", ".", "append", "(", "ent", ")", ";", "while", "(", "ent", "!=", "null", ")", "{", "ent", "=", "ent", ".", "next", ";", "buf", ".", "append", "(", "\" \"", ")", ";", "buf", ".", "append", "(", "ent", ")", ";", "}", "buf", ".", "append", "(", "\"\\n\"", ")", ";", "}", "buf", ".", "append", "(", "\" }\\n\"", ")", ";", "return", "buf", ".", "toString", "(", ")", ";", "}" ]
Returns a printable view of the SchemaSet and contents for use in debugging and Unit Tests. @return String Printable view of the SchemaSet and contents
[ "Returns", "a", "printable", "view", "of", "the", "SchemaSet", "and", "contents", "for", "use", "in", "debugging", "and", "Unit", "Tests", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/SchemaSet.java#L333-L363
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/SchemaSet.java
SchemaSet.debugId
private static final String debugId(Object o) { Long id = (Long)o; byte[] buf = new byte[8]; ArrayUtil.writeLong(buf, 0, id.longValue()); return HexUtil.toString(buf); }
java
private static final String debugId(Object o) { Long id = (Long)o; byte[] buf = new byte[8]; ArrayUtil.writeLong(buf, 0, id.longValue()); return HexUtil.toString(buf); }
[ "private", "static", "final", "String", "debugId", "(", "Object", "o", ")", "{", "Long", "id", "=", "(", "Long", ")", "o", ";", "byte", "[", "]", "buf", "=", "new", "byte", "[", "8", "]", ";", "ArrayUtil", ".", "writeLong", "(", "buf", ",", "0", ",", "id", ".", "longValue", "(", ")", ")", ";", "return", "HexUtil", ".", "toString", "(", "buf", ")", ";", "}" ]
Write a Schema Id out as a hex string. @param o The SchemaId @return String A hex string representaion of the SchemaId's long value.
[ "Write", "a", "Schema", "Id", "out", "as", "a", "hex", "string", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/SchemaSet.java#L373-L378
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jca.utils/src/com/ibm/ws/jca/utils/xml/ra/RaAuthenticationMechanism.java
RaAuthenticationMechanism.setAuthenticationMechanismType
@XmlElement(name = "authentication-mechanism-type", required = true) public void setAuthenticationMechanismType(String authMech) { AuthenticationMechanismType type = AuthenticationMechanismType.valueOf(authMech); authenticationMechanismType = type.name(); }
java
@XmlElement(name = "authentication-mechanism-type", required = true) public void setAuthenticationMechanismType(String authMech) { AuthenticationMechanismType type = AuthenticationMechanismType.valueOf(authMech); authenticationMechanismType = type.name(); }
[ "@", "XmlElement", "(", "name", "=", "\"authentication-mechanism-type\"", ",", "required", "=", "true", ")", "public", "void", "setAuthenticationMechanismType", "(", "String", "authMech", ")", "{", "AuthenticationMechanismType", "type", "=", "AuthenticationMechanismType", ".", "valueOf", "(", "authMech", ")", ";", "authenticationMechanismType", "=", "type", ".", "name", "(", ")", ";", "}" ]
Set the authentication mechanism type @param the authentication mechanism type
[ "Set", "the", "authentication", "mechanism", "type" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca.utils/src/com/ibm/ws/jca/utils/xml/ra/RaAuthenticationMechanism.java#L85-L89
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jndi/src/com/ibm/ws/jndi/internal/ContextNode.java
ContextNode.autoBind
@FFDCIgnore(ClassCastException.class) void autoBind(WSName subname, Object obj) throws InvalidNameException, NotContextException, NameAlreadyBoundException { ContextNode target = this, parent = this; int i = 0; try { for (/* int i = 0 */; i < subname.size() - 1; i++) { String elem = subname.get(i); target = (ContextNode) target.children.get(elem); // create an auto-deleteable subcontext if (target == null) { target = new ContextNode(parent, elem, true); Object existingEntry = parent.children.putIfAbsent(elem, target); if (existingEntry != null) { // another thread just beat me to it creating this entry // assume it is a context and continue target = (ContextNode) existingEntry; } } parent = target; } } catch (ClassCastException e) { throw new NotContextException("" + fullName.plus(subname.getPrefix(i + 1))); } // allow multiple entries during invocation by JndiServiceBinder boolean replaced = false; String lastName = subname.getLast(); AutoBindNode abNode = new AutoBindNode(obj); while (!replaced) { Object oldObj = target.children.putIfAbsent(lastName, abNode); if (oldObj != null) { if (oldObj instanceof AutoBindNode) { abNode = (AutoBindNode) oldObj; // This synch ensures that addition of entries to an // AutoBindNode does not take place during removal of // the same AutoBindNode. synchronized (abNode) { abNode.addLastEntry(obj); // This is a no-op in the normal case, but if we're racing an unbind, // we might need to modify a different AutoBindNode replaced = target.children.replace(lastName, oldObj, abNode); } } else { throw new NameAlreadyBoundException("" + fullName.plus(lastName)); } } else { replaced = true; } } }
java
@FFDCIgnore(ClassCastException.class) void autoBind(WSName subname, Object obj) throws InvalidNameException, NotContextException, NameAlreadyBoundException { ContextNode target = this, parent = this; int i = 0; try { for (/* int i = 0 */; i < subname.size() - 1; i++) { String elem = subname.get(i); target = (ContextNode) target.children.get(elem); // create an auto-deleteable subcontext if (target == null) { target = new ContextNode(parent, elem, true); Object existingEntry = parent.children.putIfAbsent(elem, target); if (existingEntry != null) { // another thread just beat me to it creating this entry // assume it is a context and continue target = (ContextNode) existingEntry; } } parent = target; } } catch (ClassCastException e) { throw new NotContextException("" + fullName.plus(subname.getPrefix(i + 1))); } // allow multiple entries during invocation by JndiServiceBinder boolean replaced = false; String lastName = subname.getLast(); AutoBindNode abNode = new AutoBindNode(obj); while (!replaced) { Object oldObj = target.children.putIfAbsent(lastName, abNode); if (oldObj != null) { if (oldObj instanceof AutoBindNode) { abNode = (AutoBindNode) oldObj; // This synch ensures that addition of entries to an // AutoBindNode does not take place during removal of // the same AutoBindNode. synchronized (abNode) { abNode.addLastEntry(obj); // This is a no-op in the normal case, but if we're racing an unbind, // we might need to modify a different AutoBindNode replaced = target.children.replace(lastName, oldObj, abNode); } } else { throw new NameAlreadyBoundException("" + fullName.plus(lastName)); } } else { replaced = true; } } }
[ "@", "FFDCIgnore", "(", "ClassCastException", ".", "class", ")", "void", "autoBind", "(", "WSName", "subname", ",", "Object", "obj", ")", "throws", "InvalidNameException", ",", "NotContextException", ",", "NameAlreadyBoundException", "{", "ContextNode", "target", "=", "this", ",", "parent", "=", "this", ";", "int", "i", "=", "0", ";", "try", "{", "for", "(", "/* int i = 0 */", ";", "i", "<", "subname", ".", "size", "(", ")", "-", "1", ";", "i", "++", ")", "{", "String", "elem", "=", "subname", ".", "get", "(", "i", ")", ";", "target", "=", "(", "ContextNode", ")", "target", ".", "children", ".", "get", "(", "elem", ")", ";", "// create an auto-deleteable subcontext", "if", "(", "target", "==", "null", ")", "{", "target", "=", "new", "ContextNode", "(", "parent", ",", "elem", ",", "true", ")", ";", "Object", "existingEntry", "=", "parent", ".", "children", ".", "putIfAbsent", "(", "elem", ",", "target", ")", ";", "if", "(", "existingEntry", "!=", "null", ")", "{", "// another thread just beat me to it creating this entry", "// assume it is a context and continue", "target", "=", "(", "ContextNode", ")", "existingEntry", ";", "}", "}", "parent", "=", "target", ";", "}", "}", "catch", "(", "ClassCastException", "e", ")", "{", "throw", "new", "NotContextException", "(", "\"\"", "+", "fullName", ".", "plus", "(", "subname", ".", "getPrefix", "(", "i", "+", "1", ")", ")", ")", ";", "}", "// allow multiple entries during invocation by JndiServiceBinder", "boolean", "replaced", "=", "false", ";", "String", "lastName", "=", "subname", ".", "getLast", "(", ")", ";", "AutoBindNode", "abNode", "=", "new", "AutoBindNode", "(", "obj", ")", ";", "while", "(", "!", "replaced", ")", "{", "Object", "oldObj", "=", "target", ".", "children", ".", "putIfAbsent", "(", "lastName", ",", "abNode", ")", ";", "if", "(", "oldObj", "!=", "null", ")", "{", "if", "(", "oldObj", "instanceof", "AutoBindNode", ")", "{", "abNode", "=", "(", "AutoBindNode", ")", "oldObj", ";", "// This synch ensures that addition of entries to an ", "// AutoBindNode does not take place during removal of ", "// the same AutoBindNode.", "synchronized", "(", "abNode", ")", "{", "abNode", ".", "addLastEntry", "(", "obj", ")", ";", "// This is a no-op in the normal case, but if we're racing an unbind, ", "// we might need to modify a different AutoBindNode", "replaced", "=", "target", ".", "children", ".", "replace", "(", "lastName", ",", "oldObj", ",", "abNode", ")", ";", "}", "}", "else", "{", "throw", "new", "NameAlreadyBoundException", "(", "\"\"", "+", "fullName", ".", "plus", "(", "lastName", ")", ")", ";", "}", "}", "else", "{", "replaced", "=", "true", ";", "}", "}", "}" ]
Works like bind but automatically creates intermediate contexts if they do not exist. Any automatically created contexts will be cleaned up automatically when their last child is unbound.
[ "Works", "like", "bind", "but", "automatically", "creates", "intermediate", "contexts", "if", "they", "do", "not", "exist", ".", "Any", "automatically", "created", "contexts", "will", "be", "cleaned", "up", "automatically", "when", "their", "last", "child", "is", "unbound", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jndi/src/com/ibm/ws/jndi/internal/ContextNode.java#L158-L206
train
OpenLiberty/open-liberty
dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/bci/ProbeAtEntryMethodAdapter.java
ProbeAtEntryMethodAdapter.onMethodEntry
@Override protected void onMethodEntry() { if (enabledListeners.isEmpty()) return; String probeKey = createKey(); ProbeImpl probe = getProbe(probeKey); long probeId = probe.getIdentifier(); setProbeInProgress(true); visitLdcInsn(Long.valueOf(probeId)); // long1 long2 if (isStatic() || isConstructor()) { visitInsn(ACONST_NULL); // long1 long2 this } else { visitVarInsn(ALOAD, 0); // long1 long2 this } visitInsn(ACONST_NULL); // long1 long2 this that createParameterArray(); // long1 long2 this that args visitFireProbeInvocation(); setProbeInProgress(false); setProbeListeners(probe, enabledListeners); }
java
@Override protected void onMethodEntry() { if (enabledListeners.isEmpty()) return; String probeKey = createKey(); ProbeImpl probe = getProbe(probeKey); long probeId = probe.getIdentifier(); setProbeInProgress(true); visitLdcInsn(Long.valueOf(probeId)); // long1 long2 if (isStatic() || isConstructor()) { visitInsn(ACONST_NULL); // long1 long2 this } else { visitVarInsn(ALOAD, 0); // long1 long2 this } visitInsn(ACONST_NULL); // long1 long2 this that createParameterArray(); // long1 long2 this that args visitFireProbeInvocation(); setProbeInProgress(false); setProbeListeners(probe, enabledListeners); }
[ "@", "Override", "protected", "void", "onMethodEntry", "(", ")", "{", "if", "(", "enabledListeners", ".", "isEmpty", "(", ")", ")", "return", ";", "String", "probeKey", "=", "createKey", "(", ")", ";", "ProbeImpl", "probe", "=", "getProbe", "(", "probeKey", ")", ";", "long", "probeId", "=", "probe", ".", "getIdentifier", "(", ")", ";", "setProbeInProgress", "(", "true", ")", ";", "visitLdcInsn", "(", "Long", ".", "valueOf", "(", "probeId", ")", ")", ";", "// long1 long2", "if", "(", "isStatic", "(", ")", "||", "isConstructor", "(", ")", ")", "{", "visitInsn", "(", "ACONST_NULL", ")", ";", "// long1 long2 this", "}", "else", "{", "visitVarInsn", "(", "ALOAD", ",", "0", ")", ";", "// long1 long2 this", "}", "visitInsn", "(", "ACONST_NULL", ")", ";", "// long1 long2 this that", "createParameterArray", "(", ")", ";", "// long1 long2 this that args", "visitFireProbeInvocation", "(", ")", ";", "setProbeInProgress", "(", "false", ")", ";", "setProbeListeners", "(", "probe", ",", "enabledListeners", ")", ";", "}" ]
Inject the byte code required to fire a method entry probe.
[ "Inject", "the", "byte", "code", "required", "to", "fire", "a", "method", "entry", "probe", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/bci/ProbeAtEntryMethodAdapter.java#L57-L79
train
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/io/async/AbstractAsyncChannel.java
AbstractAsyncChannel.getBufAddress
static long getBufAddress(ByteBuffer theBuffer) { /* * This only works for DIRECT byte buffers. Direct ByteBuffers have a field called "address" which * holds the physical address of the start of the buffer contents in native memory. * This method obtains the value of the address field through reflection. */ if (!theBuffer.isDirect()) { throw new IllegalArgumentException(AsyncProperties.aio_direct_buffers_only); } try { return addrField.getLong(theBuffer); } catch (IllegalAccessException exception) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Error getting async provider instance, exception: " + exception.getMessage()); } FFDCFilter.processException(exception, "com.ibm.io.async.AbstractAsyncChannel", "149"); throw new RuntimeException(exception.getMessage()); } }
java
static long getBufAddress(ByteBuffer theBuffer) { /* * This only works for DIRECT byte buffers. Direct ByteBuffers have a field called "address" which * holds the physical address of the start of the buffer contents in native memory. * This method obtains the value of the address field through reflection. */ if (!theBuffer.isDirect()) { throw new IllegalArgumentException(AsyncProperties.aio_direct_buffers_only); } try { return addrField.getLong(theBuffer); } catch (IllegalAccessException exception) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Error getting async provider instance, exception: " + exception.getMessage()); } FFDCFilter.processException(exception, "com.ibm.io.async.AbstractAsyncChannel", "149"); throw new RuntimeException(exception.getMessage()); } }
[ "static", "long", "getBufAddress", "(", "ByteBuffer", "theBuffer", ")", "{", "/*\n * This only works for DIRECT byte buffers. Direct ByteBuffers have a field called \"address\" which\n * holds the physical address of the start of the buffer contents in native memory.\n * This method obtains the value of the address field through reflection.\n */", "if", "(", "!", "theBuffer", ".", "isDirect", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "AsyncProperties", ".", "aio_direct_buffers_only", ")", ";", "}", "try", "{", "return", "addrField", ".", "getLong", "(", "theBuffer", ")", ";", "}", "catch", "(", "IllegalAccessException", "exception", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Error getting async provider instance, exception: \"", "+", "exception", ".", "getMessage", "(", ")", ")", ";", "}", "FFDCFilter", ".", "processException", "(", "exception", ",", "\"com.ibm.io.async.AbstractAsyncChannel\"", ",", "\"149\"", ")", ";", "throw", "new", "RuntimeException", "(", "exception", ".", "getMessage", "(", ")", ")", ";", "}", "}" ]
Returns the address of the start of the given direct byte buffer in OS memory. @param theBuffer the direct byte buffer. @return the OS address as a <code>long</code>. @throws IllegalArgumentException if the buffer is not direct.
[ "Returns", "the", "address", "of", "the", "start", "of", "the", "given", "direct", "byte", "buffer", "in", "OS", "memory", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/io/async/AbstractAsyncChannel.java#L137-L156
train
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/io/async/AbstractAsyncChannel.java
AbstractAsyncChannel.getFutureFromIndex
public AsyncFuture getFutureFromIndex(int theIndex) { if (theIndex == READ_FUTURE_INDEX || theIndex == SYNC_READ_FUTURE_INDEX) { return this.readFuture; } if (theIndex == WRITE_FUTURE_INDEX || theIndex == SYNC_WRITE_FUTURE_INDEX) { return this.writeFuture; } return null; }
java
public AsyncFuture getFutureFromIndex(int theIndex) { if (theIndex == READ_FUTURE_INDEX || theIndex == SYNC_READ_FUTURE_INDEX) { return this.readFuture; } if (theIndex == WRITE_FUTURE_INDEX || theIndex == SYNC_WRITE_FUTURE_INDEX) { return this.writeFuture; } return null; }
[ "public", "AsyncFuture", "getFutureFromIndex", "(", "int", "theIndex", ")", "{", "if", "(", "theIndex", "==", "READ_FUTURE_INDEX", "||", "theIndex", "==", "SYNC_READ_FUTURE_INDEX", ")", "{", "return", "this", ".", "readFuture", ";", "}", "if", "(", "theIndex", "==", "WRITE_FUTURE_INDEX", "||", "theIndex", "==", "SYNC_WRITE_FUTURE_INDEX", ")", "{", "return", "this", ".", "writeFuture", ";", "}", "return", "null", ";", "}" ]
Gets the Future corresponding to a supplied index value. @param theIndex the index value of the Future @return the Future corresponding to the index number. null if there is no Future which corresponds to the supplied Index
[ "Gets", "the", "Future", "corresponding", "to", "a", "supplied", "index", "value", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/io/async/AbstractAsyncChannel.java#L206-L214
train
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/io/async/AbstractAsyncChannel.java
AbstractAsyncChannel.cancel
void cancel(AsyncChannelFuture future, Exception reason) throws ClosedChannelException, IOException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "cancel"); } if (!isOpen()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Cancel request on closed connection"); } future.setCancelInProgress(0); throw new ClosedChannelException(); } // Cannot cancel a completed call. if (future.isCompleted()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Cancel request on completed future"); } future.setCancelInProgress(0); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "cancel"); } return; } long callid; if (((AsyncFuture) future).isRead()) { callid = this.readIOCB.getCallIdentifier(); } else { callid = this.writeIOCB.getCallIdentifier(); } int rc = provider.cancel2(this.channelIdentifier, callid); if (rc == 0) { // Mark the future completed with an Exception if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Cancel Successful, resetting CancelInProgress state to 0"); } future.setCancelInProgress(0); future.completed(reason); } else { // could not cancel if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Cancel could not be completed"); } future.setCancelInProgress(0); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "cancel"); } }
java
void cancel(AsyncChannelFuture future, Exception reason) throws ClosedChannelException, IOException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "cancel"); } if (!isOpen()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Cancel request on closed connection"); } future.setCancelInProgress(0); throw new ClosedChannelException(); } // Cannot cancel a completed call. if (future.isCompleted()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Cancel request on completed future"); } future.setCancelInProgress(0); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "cancel"); } return; } long callid; if (((AsyncFuture) future).isRead()) { callid = this.readIOCB.getCallIdentifier(); } else { callid = this.writeIOCB.getCallIdentifier(); } int rc = provider.cancel2(this.channelIdentifier, callid); if (rc == 0) { // Mark the future completed with an Exception if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Cancel Successful, resetting CancelInProgress state to 0"); } future.setCancelInProgress(0); future.completed(reason); } else { // could not cancel if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Cancel could not be completed"); } future.setCancelInProgress(0); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "cancel"); } }
[ "void", "cancel", "(", "AsyncChannelFuture", "future", ",", "Exception", "reason", ")", "throws", "ClosedChannelException", ",", "IOException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "entry", "(", "tc", ",", "\"cancel\"", ")", ";", "}", "if", "(", "!", "isOpen", "(", ")", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Cancel request on closed connection\"", ")", ";", "}", "future", ".", "setCancelInProgress", "(", "0", ")", ";", "throw", "new", "ClosedChannelException", "(", ")", ";", "}", "// Cannot cancel a completed call.", "if", "(", "future", ".", "isCompleted", "(", ")", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Cancel request on completed future\"", ")", ";", "}", "future", ".", "setCancelInProgress", "(", "0", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "exit", "(", "tc", ",", "\"cancel\"", ")", ";", "}", "return", ";", "}", "long", "callid", ";", "if", "(", "(", "(", "AsyncFuture", ")", "future", ")", ".", "isRead", "(", ")", ")", "{", "callid", "=", "this", ".", "readIOCB", ".", "getCallIdentifier", "(", ")", ";", "}", "else", "{", "callid", "=", "this", ".", "writeIOCB", ".", "getCallIdentifier", "(", ")", ";", "}", "int", "rc", "=", "provider", ".", "cancel2", "(", "this", ".", "channelIdentifier", ",", "callid", ")", ";", "if", "(", "rc", "==", "0", ")", "{", "// Mark the future completed with an Exception", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Cancel Successful, resetting CancelInProgress state to 0\"", ")", ";", "}", "future", ".", "setCancelInProgress", "(", "0", ")", ";", "future", ".", "completed", "(", "reason", ")", ";", "}", "else", "{", "// could not cancel", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Cancel could not be completed\"", ")", ";", "}", "future", ".", "setCancelInProgress", "(", "0", ")", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "exit", "(", "tc", ",", "\"cancel\"", ")", ";", "}", "}" ]
Package private version of cancel, which takes an exception as an additional parameter. The exception is applied to the future on cancellation. @param future @param reason @throws ClosedChannelException @throws IOException
[ "Package", "private", "version", "of", "cancel", "which", "takes", "an", "exception", "as", "an", "additional", "parameter", ".", "The", "exception", "is", "applied", "to", "the", "future", "on", "cancellation", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/io/async/AbstractAsyncChannel.java#L226-L276
train
OpenLiberty/open-liberty
dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/server/data/SpdDataImpl.java
SpdDataImpl.enable
public void enable(int level) { if (level >= PmiConstants.LEVEL_HIGH) sync = true; else sync = false; if (!enabled) { enabled = true; reset(); } }
java
public void enable(int level) { if (level >= PmiConstants.LEVEL_HIGH) sync = true; else sync = false; if (!enabled) { enabled = true; reset(); } }
[ "public", "void", "enable", "(", "int", "level", ")", "{", "if", "(", "level", ">=", "PmiConstants", ".", "LEVEL_HIGH", ")", "sync", "=", "true", ";", "else", "sync", "=", "false", ";", "if", "(", "!", "enabled", ")", "{", "enabled", "=", "true", ";", "reset", "(", ")", ";", "}", "}" ]
mark the data enabled and reset the value and createTime
[ "mark", "the", "data", "enabled", "and", "reset", "the", "value", "and", "createTime" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/server/data/SpdDataImpl.java#L57-L67
train
OpenLiberty/open-liberty
dev/com.ibm.ws.container.service.compat/src/com/ibm/ejs/util/FastHashtable.java
FastHashtable.getBucketForKey
protected final Bucket<K, V> getBucketForKey(K key) { int bucket_index = (key.hashCode() & 0x7FFFFFFF) % buckets.length; Bucket<K, V> thebucket = buckets[bucket_index]; if (thebucket == null) { synchronized (this) { thebucket = buckets[bucket_index]; if (thebucket == null) { thebucket = new Bucket<K, V>(); buckets[bucket_index] = thebucket; } // if } // sync } // if return thebucket; }
java
protected final Bucket<K, V> getBucketForKey(K key) { int bucket_index = (key.hashCode() & 0x7FFFFFFF) % buckets.length; Bucket<K, V> thebucket = buckets[bucket_index]; if (thebucket == null) { synchronized (this) { thebucket = buckets[bucket_index]; if (thebucket == null) { thebucket = new Bucket<K, V>(); buckets[bucket_index] = thebucket; } // if } // sync } // if return thebucket; }
[ "protected", "final", "Bucket", "<", "K", ",", "V", ">", "getBucketForKey", "(", "K", "key", ")", "{", "int", "bucket_index", "=", "(", "key", ".", "hashCode", "(", ")", "&", "0x7FFFFFFF", ")", "%", "buckets", ".", "length", ";", "Bucket", "<", "K", ",", "V", ">", "thebucket", "=", "buckets", "[", "bucket_index", "]", ";", "if", "(", "thebucket", "==", "null", ")", "{", "synchronized", "(", "this", ")", "{", "thebucket", "=", "buckets", "[", "bucket_index", "]", ";", "if", "(", "thebucket", "==", "null", ")", "{", "thebucket", "=", "new", "Bucket", "<", "K", ",", "V", ">", "(", ")", ";", "buckets", "[", "bucket_index", "]", "=", "thebucket", ";", "}", "// if", "}", "// sync", "}", "// if", "return", "thebucket", ";", "}" ]
Returns the bucket which the specified key hashes to
[ "Returns", "the", "bucket", "which", "the", "specified", "key", "hashes", "to" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.container.service.compat/src/com/ibm/ejs/util/FastHashtable.java#L140-L153
train
OpenLiberty/open-liberty
dev/com.ibm.ws.diagnostics/src/com/ibm/ws/diagnostics/AbstractMBeanIntrospector.java
AbstractMBeanIntrospector.introspect
protected void introspect(ObjectName objectName, QueryExp query, PrintWriter writer) { // Iterate over the mbean servers, query for the beans, introspect for (MBeanServer mbeanServer : getMBeanServers()) { for (ObjectName mbean : mbeanServer.queryNames(objectName, query)) { introspectMBeanAttributes(mbeanServer, mbean, writer); } } }
java
protected void introspect(ObjectName objectName, QueryExp query, PrintWriter writer) { // Iterate over the mbean servers, query for the beans, introspect for (MBeanServer mbeanServer : getMBeanServers()) { for (ObjectName mbean : mbeanServer.queryNames(objectName, query)) { introspectMBeanAttributes(mbeanServer, mbean, writer); } } }
[ "protected", "void", "introspect", "(", "ObjectName", "objectName", ",", "QueryExp", "query", ",", "PrintWriter", "writer", ")", "{", "// Iterate over the mbean servers, query for the beans, introspect", "for", "(", "MBeanServer", "mbeanServer", ":", "getMBeanServers", "(", ")", ")", "{", "for", "(", "ObjectName", "mbean", ":", "mbeanServer", ".", "queryNames", "(", "objectName", ",", "query", ")", ")", "{", "introspectMBeanAttributes", "(", "mbeanServer", ",", "mbean", ",", "writer", ")", ";", "}", "}", "}" ]
GIven a JMX object name and a filter, introspect all matching MBeans that are found associated with registered MBean servers. @param objectName the object name pattern to provide to {@link javax.management.MBeanServer#queryNames(ObjectName, QueryExp) queryNames} @param query the query expression to provide to {@code queryNames}
[ "GIven", "a", "JMX", "object", "name", "and", "a", "filter", "introspect", "all", "matching", "MBeans", "that", "are", "found", "associated", "with", "registered", "MBean", "servers", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.diagnostics/src/com/ibm/ws/diagnostics/AbstractMBeanIntrospector.java#L56-L63
train
OpenLiberty/open-liberty
dev/com.ibm.ws.diagnostics/src/com/ibm/ws/diagnostics/AbstractMBeanIntrospector.java
AbstractMBeanIntrospector.getFormattedArray
String getFormattedArray(Object attribute, String indent) { int arrayLength = Array.getLength(attribute); if (arrayLength == 0) { return "[]"; } Class<?> componentType = attribute.getClass().getComponentType(); // For the 8 primitive types, a cast is necessary when invoking // Arrays.toString. The array data is then broken into separate // lines if (componentType.equals(boolean.class)) { return formatPrimitiveArrayString(Arrays.toString((boolean[]) attribute), indent); } else if (componentType.equals(byte.class)) { return formatPrimitiveArrayString(Arrays.toString((byte[]) attribute), indent); } else if (componentType.equals(char.class)) { return formatPrimitiveArrayString(Arrays.toString((char[]) attribute), indent); } else if (componentType.equals(double.class)) { return formatPrimitiveArrayString(Arrays.toString((double[]) attribute), indent); } else if (componentType.equals(float.class)) { return formatPrimitiveArrayString(Arrays.toString((float[]) attribute), indent); } else if (componentType.equals(int.class)) { return formatPrimitiveArrayString(Arrays.toString((int[]) attribute), indent); } else if (componentType.equals(long.class)) { return formatPrimitiveArrayString(Arrays.toString((long[]) attribute), indent); } else if (componentType.equals(short.class)) { return formatPrimitiveArrayString(Arrays.toString((short[]) attribute), indent); } // Arbitrary strings can have ', ' in them so we iterate here StringBuilder sb = new StringBuilder(); indent += INDENT; Object[] array = (Object[]) attribute; for (int i = 0; i < array.length; i++) { sb.append("\n").append(indent).append("[").append(i).append("]: "); sb.append(String.valueOf(array[i])); } return sb.toString(); }
java
String getFormattedArray(Object attribute, String indent) { int arrayLength = Array.getLength(attribute); if (arrayLength == 0) { return "[]"; } Class<?> componentType = attribute.getClass().getComponentType(); // For the 8 primitive types, a cast is necessary when invoking // Arrays.toString. The array data is then broken into separate // lines if (componentType.equals(boolean.class)) { return formatPrimitiveArrayString(Arrays.toString((boolean[]) attribute), indent); } else if (componentType.equals(byte.class)) { return formatPrimitiveArrayString(Arrays.toString((byte[]) attribute), indent); } else if (componentType.equals(char.class)) { return formatPrimitiveArrayString(Arrays.toString((char[]) attribute), indent); } else if (componentType.equals(double.class)) { return formatPrimitiveArrayString(Arrays.toString((double[]) attribute), indent); } else if (componentType.equals(float.class)) { return formatPrimitiveArrayString(Arrays.toString((float[]) attribute), indent); } else if (componentType.equals(int.class)) { return formatPrimitiveArrayString(Arrays.toString((int[]) attribute), indent); } else if (componentType.equals(long.class)) { return formatPrimitiveArrayString(Arrays.toString((long[]) attribute), indent); } else if (componentType.equals(short.class)) { return formatPrimitiveArrayString(Arrays.toString((short[]) attribute), indent); } // Arbitrary strings can have ', ' in them so we iterate here StringBuilder sb = new StringBuilder(); indent += INDENT; Object[] array = (Object[]) attribute; for (int i = 0; i < array.length; i++) { sb.append("\n").append(indent).append("[").append(i).append("]: "); sb.append(String.valueOf(array[i])); } return sb.toString(); }
[ "String", "getFormattedArray", "(", "Object", "attribute", ",", "String", "indent", ")", "{", "int", "arrayLength", "=", "Array", ".", "getLength", "(", "attribute", ")", ";", "if", "(", "arrayLength", "==", "0", ")", "{", "return", "\"[]\"", ";", "}", "Class", "<", "?", ">", "componentType", "=", "attribute", ".", "getClass", "(", ")", ".", "getComponentType", "(", ")", ";", "// For the 8 primitive types, a cast is necessary when invoking", "// Arrays.toString. The array data is then broken into separate", "// lines", "if", "(", "componentType", ".", "equals", "(", "boolean", ".", "class", ")", ")", "{", "return", "formatPrimitiveArrayString", "(", "Arrays", ".", "toString", "(", "(", "boolean", "[", "]", ")", "attribute", ")", ",", "indent", ")", ";", "}", "else", "if", "(", "componentType", ".", "equals", "(", "byte", ".", "class", ")", ")", "{", "return", "formatPrimitiveArrayString", "(", "Arrays", ".", "toString", "(", "(", "byte", "[", "]", ")", "attribute", ")", ",", "indent", ")", ";", "}", "else", "if", "(", "componentType", ".", "equals", "(", "char", ".", "class", ")", ")", "{", "return", "formatPrimitiveArrayString", "(", "Arrays", ".", "toString", "(", "(", "char", "[", "]", ")", "attribute", ")", ",", "indent", ")", ";", "}", "else", "if", "(", "componentType", ".", "equals", "(", "double", ".", "class", ")", ")", "{", "return", "formatPrimitiveArrayString", "(", "Arrays", ".", "toString", "(", "(", "double", "[", "]", ")", "attribute", ")", ",", "indent", ")", ";", "}", "else", "if", "(", "componentType", ".", "equals", "(", "float", ".", "class", ")", ")", "{", "return", "formatPrimitiveArrayString", "(", "Arrays", ".", "toString", "(", "(", "float", "[", "]", ")", "attribute", ")", ",", "indent", ")", ";", "}", "else", "if", "(", "componentType", ".", "equals", "(", "int", ".", "class", ")", ")", "{", "return", "formatPrimitiveArrayString", "(", "Arrays", ".", "toString", "(", "(", "int", "[", "]", ")", "attribute", ")", ",", "indent", ")", ";", "}", "else", "if", "(", "componentType", ".", "equals", "(", "long", ".", "class", ")", ")", "{", "return", "formatPrimitiveArrayString", "(", "Arrays", ".", "toString", "(", "(", "long", "[", "]", ")", "attribute", ")", ",", "indent", ")", ";", "}", "else", "if", "(", "componentType", ".", "equals", "(", "short", ".", "class", ")", ")", "{", "return", "formatPrimitiveArrayString", "(", "Arrays", ".", "toString", "(", "(", "short", "[", "]", ")", "attribute", ")", ",", "indent", ")", ";", "}", "// Arbitrary strings can have ', ' in them so we iterate here", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "indent", "+=", "INDENT", ";", "Object", "[", "]", "array", "=", "(", "Object", "[", "]", ")", "attribute", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "array", ".", "length", ";", "i", "++", ")", "{", "sb", ".", "append", "(", "\"\\n\"", ")", ".", "append", "(", "indent", ")", ".", "append", "(", "\"[\"", ")", ".", "append", "(", "i", ")", ".", "append", "(", "\"]: \"", ")", ";", "sb", ".", "append", "(", "String", ".", "valueOf", "(", "array", "[", "i", "]", ")", ")", ";", "}", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Format an array. Note: This doesn't properly format arrays of composite types. @param attribute the mbean attribute to format @param the current indent level of the formatted report @return the formatted array
[ "Format", "an", "array", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.diagnostics/src/com/ibm/ws/diagnostics/AbstractMBeanIntrospector.java#L171-L210
train
OpenLiberty/open-liberty
dev/com.ibm.ws.diagnostics/src/com/ibm/ws/diagnostics/AbstractMBeanIntrospector.java
AbstractMBeanIntrospector.getFormattedCompositeData
String getFormattedCompositeData(CompositeData cd, String indent) { StringBuilder sb = new StringBuilder(); indent += INDENT; CompositeType type = cd.getCompositeType(); for (String key : type.keySet()) { sb.append("\n").append(indent); sb.append(key).append(": "); OpenType<?> openType = type.getType(key); if (openType instanceof SimpleType) { sb.append(cd.get(key)); } else if (openType instanceof CompositeType) { CompositeData nestedData = (CompositeData) cd.get(key); sb.append(getFormattedCompositeData(nestedData, indent)); } else if (openType instanceof TabularType) { TabularData tabularData = (TabularData) cd.get(key); sb.append(tabularData); } } return String.valueOf(sb); }
java
String getFormattedCompositeData(CompositeData cd, String indent) { StringBuilder sb = new StringBuilder(); indent += INDENT; CompositeType type = cd.getCompositeType(); for (String key : type.keySet()) { sb.append("\n").append(indent); sb.append(key).append(": "); OpenType<?> openType = type.getType(key); if (openType instanceof SimpleType) { sb.append(cd.get(key)); } else if (openType instanceof CompositeType) { CompositeData nestedData = (CompositeData) cd.get(key); sb.append(getFormattedCompositeData(nestedData, indent)); } else if (openType instanceof TabularType) { TabularData tabularData = (TabularData) cd.get(key); sb.append(tabularData); } } return String.valueOf(sb); }
[ "String", "getFormattedCompositeData", "(", "CompositeData", "cd", ",", "String", "indent", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "indent", "+=", "INDENT", ";", "CompositeType", "type", "=", "cd", ".", "getCompositeType", "(", ")", ";", "for", "(", "String", "key", ":", "type", ".", "keySet", "(", ")", ")", "{", "sb", ".", "append", "(", "\"\\n\"", ")", ".", "append", "(", "indent", ")", ";", "sb", ".", "append", "(", "key", ")", ".", "append", "(", "\": \"", ")", ";", "OpenType", "<", "?", ">", "openType", "=", "type", ".", "getType", "(", "key", ")", ";", "if", "(", "openType", "instanceof", "SimpleType", ")", "{", "sb", ".", "append", "(", "cd", ".", "get", "(", "key", ")", ")", ";", "}", "else", "if", "(", "openType", "instanceof", "CompositeType", ")", "{", "CompositeData", "nestedData", "=", "(", "CompositeData", ")", "cd", ".", "get", "(", "key", ")", ";", "sb", ".", "append", "(", "getFormattedCompositeData", "(", "nestedData", ",", "indent", ")", ")", ";", "}", "else", "if", "(", "openType", "instanceof", "TabularType", ")", "{", "TabularData", "tabularData", "=", "(", "TabularData", ")", "cd", ".", "get", "(", "key", ")", ";", "sb", ".", "append", "(", "tabularData", ")", ";", "}", "}", "return", "String", ".", "valueOf", "(", "sb", ")", ";", "}" ]
Format an open MBean composite data attribute. @param cd the composite data attribute @param indent the current indent level of the formatted report @return the formatted composite data
[ "Format", "an", "open", "MBean", "composite", "data", "attribute", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.diagnostics/src/com/ibm/ws/diagnostics/AbstractMBeanIntrospector.java#L242-L261
train
OpenLiberty/open-liberty
dev/com.ibm.ws.diagnostics/src/com/ibm/ws/diagnostics/AbstractMBeanIntrospector.java
AbstractMBeanIntrospector.getFormattedTabularData
@SuppressWarnings("unchecked") String getFormattedTabularData(TabularData td, String indent) { StringBuilder sb = new StringBuilder(); indent += INDENT; sb.append("{"); Collection<CompositeData> values = (Collection<CompositeData>) td.values(); int valuesRemaining = values.size(); for (CompositeData cd : values) { sb.append(getFormattedCompositeData(cd, indent)); if (--valuesRemaining > 0) { sb.append("\n").append(indent).append("}, {"); } } sb.append("}"); return String.valueOf(sb); }
java
@SuppressWarnings("unchecked") String getFormattedTabularData(TabularData td, String indent) { StringBuilder sb = new StringBuilder(); indent += INDENT; sb.append("{"); Collection<CompositeData> values = (Collection<CompositeData>) td.values(); int valuesRemaining = values.size(); for (CompositeData cd : values) { sb.append(getFormattedCompositeData(cd, indent)); if (--valuesRemaining > 0) { sb.append("\n").append(indent).append("}, {"); } } sb.append("}"); return String.valueOf(sb); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "String", "getFormattedTabularData", "(", "TabularData", "td", ",", "String", "indent", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "indent", "+=", "INDENT", ";", "sb", ".", "append", "(", "\"{\"", ")", ";", "Collection", "<", "CompositeData", ">", "values", "=", "(", "Collection", "<", "CompositeData", ">", ")", "td", ".", "values", "(", ")", ";", "int", "valuesRemaining", "=", "values", ".", "size", "(", ")", ";", "for", "(", "CompositeData", "cd", ":", "values", ")", "{", "sb", ".", "append", "(", "getFormattedCompositeData", "(", "cd", ",", "indent", ")", ")", ";", "if", "(", "--", "valuesRemaining", ">", "0", ")", "{", "sb", ".", "append", "(", "\"\\n\"", ")", ".", "append", "(", "indent", ")", ".", "append", "(", "\"}, {\"", ")", ";", "}", "}", "sb", ".", "append", "(", "\"}\"", ")", ";", "return", "String", ".", "valueOf", "(", "sb", ")", ";", "}" ]
Format an open MBean tabular data attribute. @param td the tabular data attribute @param indent the current indent level of the formatted report @return the formatted composite data
[ "Format", "an", "open", "MBean", "tabular", "data", "attribute", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.diagnostics/src/com/ibm/ws/diagnostics/AbstractMBeanIntrospector.java#L271-L288
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jca.inbound.security/src/com/ibm/ws/jca/security/internal/J2CSecurityCallbackHandler.java
J2CSecurityCallbackHandler.handle
@Override public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "handle"); } if (callbacks == null || callbacks.length == 0) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "handle", "No Callbacks received, do nothing."); } return; } arrangeCallbacks(callbacks); // 675924 try { for (Callback callback : callbacks) { if (callback instanceof CallerPrincipalCallback) { J2CSecurityHelper.handleCallerPrincipalCallback((CallerPrincipalCallback) callback, _executionSubject, _addedCred, _realmName, _unauthenticated, _invocations); // TODO Mapping to principals in the same domain in case the inflown // principal is not in the same security domain as the application server. } else if (callback instanceof GroupPrincipalCallback) { // Names of group principals to be added to the subject J2CSecurityHelper.handleGroupPrincipalCallback((GroupPrincipalCallback) callback, _executionSubject, _addedCred, _realmName, _invocations); } else if (callback instanceof PasswordValidationCallback) { J2CSecurityHelper.handlePasswordValidationCallback((PasswordValidationCallback) callback, _executionSubject, _addedCred, _realmName, _invocations); } else { throw new UnsupportedCallbackException(callback); } } J2CSecurityHelper.addSubjectCustomData(_executionSubject, _addedCred); } catch (Exception ex) { Tr.error(tc, "ERROR_HANDLING_CALLBACK_J2CA0672", new Object[] { ex.getClass().getName(), ex.getMessage() }); FFDCFilter.processException(ex, getClass().getName() + ".handle", "153"); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "The exception is " + ex); //ex.printStackTrace(System.out); } if (ex instanceof IOException) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "handle"); } throw (IOException) ex; } else if (ex instanceof UnsupportedCallbackException) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "handle"); } throw (UnsupportedCallbackException) ex; } else { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "handle"); } throw new IOException(ex); } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "handle"); } }
java
@Override public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "handle"); } if (callbacks == null || callbacks.length == 0) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "handle", "No Callbacks received, do nothing."); } return; } arrangeCallbacks(callbacks); // 675924 try { for (Callback callback : callbacks) { if (callback instanceof CallerPrincipalCallback) { J2CSecurityHelper.handleCallerPrincipalCallback((CallerPrincipalCallback) callback, _executionSubject, _addedCred, _realmName, _unauthenticated, _invocations); // TODO Mapping to principals in the same domain in case the inflown // principal is not in the same security domain as the application server. } else if (callback instanceof GroupPrincipalCallback) { // Names of group principals to be added to the subject J2CSecurityHelper.handleGroupPrincipalCallback((GroupPrincipalCallback) callback, _executionSubject, _addedCred, _realmName, _invocations); } else if (callback instanceof PasswordValidationCallback) { J2CSecurityHelper.handlePasswordValidationCallback((PasswordValidationCallback) callback, _executionSubject, _addedCred, _realmName, _invocations); } else { throw new UnsupportedCallbackException(callback); } } J2CSecurityHelper.addSubjectCustomData(_executionSubject, _addedCred); } catch (Exception ex) { Tr.error(tc, "ERROR_HANDLING_CALLBACK_J2CA0672", new Object[] { ex.getClass().getName(), ex.getMessage() }); FFDCFilter.processException(ex, getClass().getName() + ".handle", "153"); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "The exception is " + ex); //ex.printStackTrace(System.out); } if (ex instanceof IOException) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "handle"); } throw (IOException) ex; } else if (ex instanceof UnsupportedCallbackException) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "handle"); } throw (UnsupportedCallbackException) ex; } else { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "handle"); } throw new IOException(ex); } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "handle"); } }
[ "@", "Override", "public", "void", "handle", "(", "Callback", "[", "]", "callbacks", ")", "throws", "IOException", ",", "UnsupportedCallbackException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "entry", "(", "tc", ",", "\"handle\"", ")", ";", "}", "if", "(", "callbacks", "==", "null", "||", "callbacks", ".", "length", "==", "0", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "exit", "(", "tc", ",", "\"handle\"", ",", "\"No Callbacks received, do nothing.\"", ")", ";", "}", "return", ";", "}", "arrangeCallbacks", "(", "callbacks", ")", ";", "// 675924", "try", "{", "for", "(", "Callback", "callback", ":", "callbacks", ")", "{", "if", "(", "callback", "instanceof", "CallerPrincipalCallback", ")", "{", "J2CSecurityHelper", ".", "handleCallerPrincipalCallback", "(", "(", "CallerPrincipalCallback", ")", "callback", ",", "_executionSubject", ",", "_addedCred", ",", "_realmName", ",", "_unauthenticated", ",", "_invocations", ")", ";", "// TODO Mapping to principals in the same domain in case the inflown", "// principal is not in the same security domain as the application server.", "}", "else", "if", "(", "callback", "instanceof", "GroupPrincipalCallback", ")", "{", "// Names of group principals to be added to the subject", "J2CSecurityHelper", ".", "handleGroupPrincipalCallback", "(", "(", "GroupPrincipalCallback", ")", "callback", ",", "_executionSubject", ",", "_addedCred", ",", "_realmName", ",", "_invocations", ")", ";", "}", "else", "if", "(", "callback", "instanceof", "PasswordValidationCallback", ")", "{", "J2CSecurityHelper", ".", "handlePasswordValidationCallback", "(", "(", "PasswordValidationCallback", ")", "callback", ",", "_executionSubject", ",", "_addedCred", ",", "_realmName", ",", "_invocations", ")", ";", "}", "else", "{", "throw", "new", "UnsupportedCallbackException", "(", "callback", ")", ";", "}", "}", "J2CSecurityHelper", ".", "addSubjectCustomData", "(", "_executionSubject", ",", "_addedCred", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "Tr", ".", "error", "(", "tc", ",", "\"ERROR_HANDLING_CALLBACK_J2CA0672\"", ",", "new", "Object", "[", "]", "{", "ex", ".", "getClass", "(", ")", ".", "getName", "(", ")", ",", "ex", ".", "getMessage", "(", ")", "}", ")", ";", "FFDCFilter", ".", "processException", "(", "ex", ",", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\".handle\"", ",", "\"153\"", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"The exception is \"", "+", "ex", ")", ";", "//ex.printStackTrace(System.out);", "}", "if", "(", "ex", "instanceof", "IOException", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "exit", "(", "tc", ",", "\"handle\"", ")", ";", "}", "throw", "(", "IOException", ")", "ex", ";", "}", "else", "if", "(", "ex", "instanceof", "UnsupportedCallbackException", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "exit", "(", "tc", ",", "\"handle\"", ")", ";", "}", "throw", "(", "UnsupportedCallbackException", ")", "ex", ";", "}", "else", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "exit", "(", "tc", ",", "\"handle\"", ")", ";", "}", "throw", "new", "IOException", "(", "ex", ")", ";", "}", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "exit", "(", "tc", ",", "\"handle\"", ")", ";", "}", "}" ]
This method is invoked by the resource adapter after passing the list of callbacks that it needs the application server to handle. The behaviour of the handler for each of the callbacks is given below 1) CallerPrincipalCallback: The handler gets the caller principal that this callback returns and sets it on the subject that is provided by the same callback after converting it into a principal object internal to WebSphere application server. In the case of the resource adapter also using the application server's security domain the principals returned from the CallerPrincipalCallback can be used as is without any translation. In case the security policy domain of the resource adapter is different from that of the application server the Identity that is set in the given Subject should be the corresponding mapped identity in the Application Server's security domain. Note that the subject mentioned above will finally be used to set the caller context for the inbound Work. Thus this subject must be the same subject that the application server passes as the second parameter in the setupSecurityContext method of the {@link javax.resource.spi.work.SecurityContext} class. If the callback returns a null Principal on getCallerPrincipal, then the handler will set WebSphere Application Server's representation of the UNAUTHENTICATED principal on the given Subject. 2) GroupPrincipalCallback: A resource adapter might use the GroupPrincipalCallback to establish the container�s representation of the corresponding group principals within the Subject. When a null value is passed to the groups argument, the handler will establish the container�s representation of no group principals within the Subject. Otherwise, the handler�s processing of this callback is additive, yielding the union (without duplicates) of the principals existing within the Subject, and those created with the names occurring within the argument array. The CallbackHandler will define the type of the created principals. 3) PasswordValidationCallback: A resource adapter might use the PasswordValidationCallback to employ the password validation facilities of its containing runtime. Valid only if both RA and the Application Server are in the same security domain. @param callbacks The array of callbacks that this handler must handle @return void @throws IOException if name is not a valid property name
[ "This", "method", "is", "invoked", "by", "the", "resource", "adapter", "after", "passing", "the", "list", "of", "callbacks", "that", "it", "needs", "the", "application", "server", "to", "handle", ".", "The", "behaviour", "of", "the", "handler", "for", "each", "of", "the", "callbacks", "is", "given", "below" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca.inbound.security/src/com/ibm/ws/jca/security/internal/J2CSecurityCallbackHandler.java#L107-L165
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jca.inbound.security/src/com/ibm/ws/jca/security/internal/J2CSecurityCallbackHandler.java
J2CSecurityCallbackHandler.arrangeCallbacks
private void arrangeCallbacks(Callback[] callbacks) { if (callbacks[0] instanceof CallerPrincipalCallback) return; int length = callbacks.length; for (int i = 0; i < length; i++) { if (callbacks[i] instanceof CallerPrincipalCallback) { Callback callback = callbacks[0]; callbacks[0] = callbacks[i]; callbacks[i] = callback; break; } } }
java
private void arrangeCallbacks(Callback[] callbacks) { if (callbacks[0] instanceof CallerPrincipalCallback) return; int length = callbacks.length; for (int i = 0; i < length; i++) { if (callbacks[i] instanceof CallerPrincipalCallback) { Callback callback = callbacks[0]; callbacks[0] = callbacks[i]; callbacks[i] = callback; break; } } }
[ "private", "void", "arrangeCallbacks", "(", "Callback", "[", "]", "callbacks", ")", "{", "if", "(", "callbacks", "[", "0", "]", "instanceof", "CallerPrincipalCallback", ")", "return", ";", "int", "length", "=", "callbacks", ".", "length", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "if", "(", "callbacks", "[", "i", "]", "instanceof", "CallerPrincipalCallback", ")", "{", "Callback", "callback", "=", "callbacks", "[", "0", "]", ";", "callbacks", "[", "0", "]", "=", "callbacks", "[", "i", "]", ";", "callbacks", "[", "i", "]", "=", "callback", ";", "break", ";", "}", "}", "}" ]
This method is called to ensure that the first callback is always a CallerPrincipalCallback irrespective of the order in which the callbacks are passed in by the resource adapter. If we need to return false to the PasswordValidationCallback when the name passed in by the CallerPrincipalCallback is different from the one set in the PasswordValidationCallback, the PasswordValidationCallback should always be processed after the CallerPrincipalCallback. @param callbacks
[ "This", "method", "is", "called", "to", "ensure", "that", "the", "first", "callback", "is", "always", "a", "CallerPrincipalCallback", "irrespective", "of", "the", "order", "in", "which", "the", "callbacks", "are", "passed", "in", "by", "the", "resource", "adapter", ".", "If", "we", "need", "to", "return", "false", "to", "the", "PasswordValidationCallback", "when", "the", "name", "passed", "in", "by", "the", "CallerPrincipalCallback", "is", "different", "from", "the", "one", "set", "in", "the", "PasswordValidationCallback", "the", "PasswordValidationCallback", "should", "always", "be", "processed", "after", "the", "CallerPrincipalCallback", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca.inbound.security/src/com/ibm/ws/jca/security/internal/J2CSecurityCallbackHandler.java#L188-L201
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/Queue.java
Queue.makeEmptyAndClean
public final void makeEmptyAndClean() { // if (tc.isEntryEnabled()) // SibTr.entry(tc, "makeEmptyAndClean"); makeEmpty(); for (int i=0;i<m_array.length;++i) m_array[i]=null; // if (tc.isEntryEnabled()) // SibTr.entry(tc, "makeEmptyAndClean"); }
java
public final void makeEmptyAndClean() { // if (tc.isEntryEnabled()) // SibTr.entry(tc, "makeEmptyAndClean"); makeEmpty(); for (int i=0;i<m_array.length;++i) m_array[i]=null; // if (tc.isEntryEnabled()) // SibTr.entry(tc, "makeEmptyAndClean"); }
[ "public", "final", "void", "makeEmptyAndClean", "(", ")", "{", "// if (tc.isEntryEnabled())", "// SibTr.entry(tc, \"makeEmptyAndClean\");", "makeEmpty", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "m_array", ".", "length", ";", "++", "i", ")", "m_array", "[", "i", "]", "=", "null", ";", "// if (tc.isEntryEnabled())", "// SibTr.entry(tc, \"makeEmptyAndClean\");", "}" ]
Empty the queue, and also set every element of the internal array to "null" so that the removed elements can be GC'd.
[ "Empty", "the", "queue", "and", "also", "set", "every", "element", "of", "the", "internal", "array", "to", "null", "so", "that", "the", "removed", "elements", "can", "be", "GC", "d", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/Queue.java#L88-L96
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/Queue.java
Queue.size
public final int size() { if (tc.isEntryEnabled()) SibTr.entry(tc, "size"); int result = (m_tail >= m_head) ? (m_tail - m_head) : (m_array.length - m_head + m_tail); if (tc.isEntryEnabled()) SibTr.exit(tc, "size", new Integer(result)); return result; }
java
public final int size() { if (tc.isEntryEnabled()) SibTr.entry(tc, "size"); int result = (m_tail >= m_head) ? (m_tail - m_head) : (m_array.length - m_head + m_tail); if (tc.isEntryEnabled()) SibTr.exit(tc, "size", new Integer(result)); return result; }
[ "public", "final", "int", "size", "(", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"size\"", ")", ";", "int", "result", "=", "(", "m_tail", ">=", "m_head", ")", "?", "(", "m_tail", "-", "m_head", ")", ":", "(", "m_array", ".", "length", "-", "m_head", "+", "m_tail", ")", ";", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"size\"", ",", "new", "Integer", "(", "result", ")", ")", ";", "return", "result", ";", "}" ]
Return the number of elements in the queue. @return the number of elements in the queue.
[ "Return", "the", "number", "of", "elements", "in", "the", "queue", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/Queue.java#L103-L111
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/Queue.java
Queue.enqueue
public final void enqueue(Object obj) { // if (tc.isEntryEnabled()) // SibTr.entry(tc, "enqueue", obj); // m_array has at least one position in it that is free. m_array[m_tail++] = obj; if (m_tail == m_array.length) m_tail = 0; if (m_head == m_tail) expand_array(); // if (tc.isEntryEnabled()) // SibTr.exit(tc, "enqueue"); }
java
public final void enqueue(Object obj) { // if (tc.isEntryEnabled()) // SibTr.entry(tc, "enqueue", obj); // m_array has at least one position in it that is free. m_array[m_tail++] = obj; if (m_tail == m_array.length) m_tail = 0; if (m_head == m_tail) expand_array(); // if (tc.isEntryEnabled()) // SibTr.exit(tc, "enqueue"); }
[ "public", "final", "void", "enqueue", "(", "Object", "obj", ")", "{", "// if (tc.isEntryEnabled())", "// SibTr.entry(tc, \"enqueue\", obj);", "// m_array has at least one position in it that is free.", "m_array", "[", "m_tail", "++", "]", "=", "obj", ";", "if", "(", "m_tail", "==", "m_array", ".", "length", ")", "m_tail", "=", "0", ";", "if", "(", "m_head", "==", "m_tail", ")", "expand_array", "(", ")", ";", "// if (tc.isEntryEnabled())", "// SibTr.exit(tc, \"enqueue\");", "}" ]
Store an object in the queue. @param obj the object to be stored.
[ "Store", "an", "object", "in", "the", "queue", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/Queue.java#L118-L130
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/Queue.java
Queue.dequeue
public final Object dequeue() throws NoSuchElementException { // if (tc.isEntryEnabled()) // SibTr.entry(tc, "dequeue"); if (m_head == m_tail) throw new NoSuchElementException(); Object obj = m_array[m_head]; m_array[m_head++] = null; if (m_head == m_array.length) m_head = 0; // if (tc.isEntryEnabled()) // SibTr.exit(tc, "dequeue", obj); return obj; }
java
public final Object dequeue() throws NoSuchElementException { // if (tc.isEntryEnabled()) // SibTr.entry(tc, "dequeue"); if (m_head == m_tail) throw new NoSuchElementException(); Object obj = m_array[m_head]; m_array[m_head++] = null; if (m_head == m_array.length) m_head = 0; // if (tc.isEntryEnabled()) // SibTr.exit(tc, "dequeue", obj); return obj; }
[ "public", "final", "Object", "dequeue", "(", ")", "throws", "NoSuchElementException", "{", "// if (tc.isEntryEnabled())", "// SibTr.entry(tc, \"dequeue\");", "if", "(", "m_head", "==", "m_tail", ")", "throw", "new", "NoSuchElementException", "(", ")", ";", "Object", "obj", "=", "m_array", "[", "m_head", "]", ";", "m_array", "[", "m_head", "++", "]", "=", "null", ";", "if", "(", "m_head", "==", "m_array", ".", "length", ")", "m_head", "=", "0", ";", "// if (tc.isEntryEnabled())", "// SibTr.exit(tc, \"dequeue\", obj);", "return", "obj", ";", "}" ]
Return the first element on the queue. @return the first element on the queue. @throws NoSuchElementException if the queue is empty.
[ "Return", "the", "first", "element", "on", "the", "queue", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/Queue.java#L138-L154
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/Queue.java
Queue.expand_array
private final void expand_array() { // if (tc.isEntryEnabled()) // SibTr.entry(tc, "expand_array"); int length = m_array.length; Object[] m_new = new Object[length*2]; System.arraycopy(m_array, m_head, m_new, m_head, length-m_head); System.arraycopy(m_array, 0, m_new, length, m_tail); m_tail += length; m_array = m_new; // if (tc.isEntryEnabled()) // SibTr.exit(tc, "expand_array"); }
java
private final void expand_array() { // if (tc.isEntryEnabled()) // SibTr.entry(tc, "expand_array"); int length = m_array.length; Object[] m_new = new Object[length*2]; System.arraycopy(m_array, m_head, m_new, m_head, length-m_head); System.arraycopy(m_array, 0, m_new, length, m_tail); m_tail += length; m_array = m_new; // if (tc.isEntryEnabled()) // SibTr.exit(tc, "expand_array"); }
[ "private", "final", "void", "expand_array", "(", ")", "{", "// if (tc.isEntryEnabled())", "// SibTr.entry(tc, \"expand_array\");", "int", "length", "=", "m_array", ".", "length", ";", "Object", "[", "]", "m_new", "=", "new", "Object", "[", "length", "*", "2", "]", ";", "System", ".", "arraycopy", "(", "m_array", ",", "m_head", ",", "m_new", ",", "m_head", ",", "length", "-", "m_head", ")", ";", "System", ".", "arraycopy", "(", "m_array", ",", "0", ",", "m_new", ",", "length", ",", "m_tail", ")", ";", "m_tail", "+=", "length", ";", "m_array", "=", "m_new", ";", "// if (tc.isEntryEnabled())", "// SibTr.exit(tc, \"expand_array\");", "}" ]
Increase the size of the internal array to accomodate more queue elements.
[ "Increase", "the", "size", "of", "the", "internal", "array", "to", "accomodate", "more", "queue", "elements", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/Queue.java#L180-L194
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jca.cm/src/com/ibm/ejs/j2c/CMConfigDataImpl.java
CMConfigDataImpl.getConfigDump
@Override public LinkedHashMap<String, Object> getConfigDump(String aLocalId, boolean aRegisteredOnly) { // 327843 removed unused parameter if (TC.isEntryEnabled()) { Tr.entry(this, TC, "getConfigDump"); } LinkedHashMap<String, Object> cp = new LinkedHashMap<String, Object>(); if (TC.isEntryEnabled()) { Tr.exit(this, TC, "getConfigDump"); } return cp; }
java
@Override public LinkedHashMap<String, Object> getConfigDump(String aLocalId, boolean aRegisteredOnly) { // 327843 removed unused parameter if (TC.isEntryEnabled()) { Tr.entry(this, TC, "getConfigDump"); } LinkedHashMap<String, Object> cp = new LinkedHashMap<String, Object>(); if (TC.isEntryEnabled()) { Tr.exit(this, TC, "getConfigDump"); } return cp; }
[ "@", "Override", "public", "LinkedHashMap", "<", "String", ",", "Object", ">", "getConfigDump", "(", "String", "aLocalId", ",", "boolean", "aRegisteredOnly", ")", "{", "// 327843 removed unused parameter", "if", "(", "TC", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "entry", "(", "this", ",", "TC", ",", "\"getConfigDump\"", ")", ";", "}", "LinkedHashMap", "<", "String", ",", "Object", ">", "cp", "=", "new", "LinkedHashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "if", "(", "TC", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "exit", "(", "this", ",", "TC", ",", "\"getConfigDump\"", ")", ";", "}", "return", "cp", ";", "}" ]
Generate a config dump containing all the attributes which match the regular expression. @param aLocalId The regular expression which will be used to determine which attributes to display. Ie, .* will enable everything, current-resourceAdapterDD-transactionSupport enables just the transactionSupport level. @param aRegisteredOnly If true only registered attributes will be displayed.
[ "Generate", "a", "config", "dump", "containing", "all", "the", "attributes", "which", "match", "the", "regular", "expression", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca.cm/src/com/ibm/ejs/j2c/CMConfigDataImpl.java#L626-L640
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transaction.cdi/src/com/ibm/tx/jta/cdi/interceptors/TransactionalInterceptor.java
TransactionalInterceptor.findInterceptorFromStereotype
private Transactional findInterceptorFromStereotype(Annotation[] anns) { if (tc.isEntryEnabled()) Tr.entry(tc, "findInterceptorFromStereotype", new Object[] { anns, this }); Transactional ret = null; for (Annotation ann : anns) { if (tc.isDebugEnabled()) Tr.debug(tc, "Examining annotation: " + ann.toString()); Class<? extends Annotation> annType = ann.annotationType(); if (annType.getAnnotation(Stereotype.class) != null) { // we've found a stereotype. Check if it has an interceptor, // and if not recurse! ret = findTransactionalInterceptor(annType); if (ret != null) { if (tc.isEntryEnabled()) Tr.exit(tc, "findInterceptorFromStereotype", ret); return ret; } } } if (tc.isEntryEnabled()) Tr.exit(tc, "findInterceptorFromStereotype", null); return null; }
java
private Transactional findInterceptorFromStereotype(Annotation[] anns) { if (tc.isEntryEnabled()) Tr.entry(tc, "findInterceptorFromStereotype", new Object[] { anns, this }); Transactional ret = null; for (Annotation ann : anns) { if (tc.isDebugEnabled()) Tr.debug(tc, "Examining annotation: " + ann.toString()); Class<? extends Annotation> annType = ann.annotationType(); if (annType.getAnnotation(Stereotype.class) != null) { // we've found a stereotype. Check if it has an interceptor, // and if not recurse! ret = findTransactionalInterceptor(annType); if (ret != null) { if (tc.isEntryEnabled()) Tr.exit(tc, "findInterceptorFromStereotype", ret); return ret; } } } if (tc.isEntryEnabled()) Tr.exit(tc, "findInterceptorFromStereotype", null); return null; }
[ "private", "Transactional", "findInterceptorFromStereotype", "(", "Annotation", "[", "]", "anns", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "tc", ",", "\"findInterceptorFromStereotype\"", ",", "new", "Object", "[", "]", "{", "anns", ",", "this", "}", ")", ";", "Transactional", "ret", "=", "null", ";", "for", "(", "Annotation", "ann", ":", "anns", ")", "{", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "tc", ",", "\"Examining annotation: \"", "+", "ann", ".", "toString", "(", ")", ")", ";", "Class", "<", "?", "extends", "Annotation", ">", "annType", "=", "ann", ".", "annotationType", "(", ")", ";", "if", "(", "annType", ".", "getAnnotation", "(", "Stereotype", ".", "class", ")", "!=", "null", ")", "{", "// we've found a stereotype. Check if it has an interceptor,", "// and if not recurse!", "ret", "=", "findTransactionalInterceptor", "(", "annType", ")", ";", "if", "(", "ret", "!=", "null", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"findInterceptorFromStereotype\"", ",", "ret", ")", ";", "return", "ret", ";", "}", "}", "}", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"findInterceptorFromStereotype\"", ",", "null", ")", ";", "return", "null", ";", "}" ]
it here.
[ "it", "here", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transaction.cdi/src/com/ibm/tx/jta/cdi/interceptors/TransactionalInterceptor.java#L89-L116
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jpa.container.core/src/com/ibm/ws/jpa/management/JPATxEntityManager.java
JPATxEntityManager.writeObject
private void writeObject(java.io.ObjectOutputStream out) throws IOException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.entry(tc, "writeObject : " + this); // d468174 out.writeObject(ivPuRefId); out.writeObject(ivJ2eeName); // d510184 out.writeObject(ivRefName); // d510184 out.writeObject(ivProperties); out.writeBoolean(ivUnsynchronized); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(tc, "writeObject : " + this); }
java
private void writeObject(java.io.ObjectOutputStream out) throws IOException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.entry(tc, "writeObject : " + this); // d468174 out.writeObject(ivPuRefId); out.writeObject(ivJ2eeName); // d510184 out.writeObject(ivRefName); // d510184 out.writeObject(ivProperties); out.writeBoolean(ivUnsynchronized); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(tc, "writeObject : " + this); }
[ "private", "void", "writeObject", "(", "java", ".", "io", ".", "ObjectOutputStream", "out", ")", "throws", "IOException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "tc", ",", "\"writeObject : \"", "+", "this", ")", ";", "// d468174", "out", ".", "writeObject", "(", "ivPuRefId", ")", ";", "out", ".", "writeObject", "(", "ivJ2eeName", ")", ";", "// d510184", "out", ".", "writeObject", "(", "ivRefName", ")", ";", "// d510184", "out", ".", "writeObject", "(", "ivProperties", ")", ";", "out", ".", "writeBoolean", "(", "ivUnsynchronized", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"writeObject : \"", "+", "this", ")", ";", "}" ]
Instance serialization.
[ "Instance", "serialization", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jpa.container.core/src/com/ibm/ws/jpa/management/JPATxEntityManager.java#L408-L421
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jpa.container.core/src/com/ibm/ws/jpa/management/JPATxEntityManager.java
JPATxEntityManager.registerEmInvocation
protected void registerEmInvocation(UOWCoordinator uowCoord, Synchronization emInvocation) { try { ivAbstractJPAComponent.getEmbeddableWebSphereTransactionManager().registerSynchronization(uowCoord, emInvocation, SYNC_TIER_OUTER); //d638095.4 } catch (Exception e) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "registerEmInvocation experienced unexpected exception while registering with transaction: " + e); FFDCFilter.processException(e, CLASS_NAME + ".registerEmInvocation", "507", this); throw new RuntimeException("Registration of Entity Manager invocation with Transaction failed.", e); } }
java
protected void registerEmInvocation(UOWCoordinator uowCoord, Synchronization emInvocation) { try { ivAbstractJPAComponent.getEmbeddableWebSphereTransactionManager().registerSynchronization(uowCoord, emInvocation, SYNC_TIER_OUTER); //d638095.4 } catch (Exception e) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "registerEmInvocation experienced unexpected exception while registering with transaction: " + e); FFDCFilter.processException(e, CLASS_NAME + ".registerEmInvocation", "507", this); throw new RuntimeException("Registration of Entity Manager invocation with Transaction failed.", e); } }
[ "protected", "void", "registerEmInvocation", "(", "UOWCoordinator", "uowCoord", ",", "Synchronization", "emInvocation", ")", "{", "try", "{", "ivAbstractJPAComponent", ".", "getEmbeddableWebSphereTransactionManager", "(", ")", ".", "registerSynchronization", "(", "uowCoord", ",", "emInvocation", ",", "SYNC_TIER_OUTER", ")", ";", "//d638095.4", "}", "catch", "(", "Exception", "e", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "tc", ",", "\"registerEmInvocation experienced unexpected exception while registering with transaction: \"", "+", "e", ")", ";", "FFDCFilter", ".", "processException", "(", "e", ",", "CLASS_NAME", "+", "\".registerEmInvocation\"", ",", "\"507\"", ",", "this", ")", ";", "throw", "new", "RuntimeException", "(", "\"Registration of Entity Manager invocation with Transaction failed.\"", ",", "e", ")", ";", "}", "}" ]
d638095.4
[ "d638095", ".", "4" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jpa.container.core/src/com/ibm/ws/jpa/management/JPATxEntityManager.java#L467-L481
train
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/discrim/DiscriminationProcessImpl.java
DiscriminationProcessImpl.buildDiscriminatorNodes
private void buildDiscriminatorNodes(DiscriminatorNode node) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "buildDiscriminatorNodes: " + node); } DiscriminatorNode dn = node; if (dn == null) { return; } DiscriminatorNode newDN = null, lastDN = null; discriminators = new DiscriminatorNode(dn.disc, dn.weight, null, null); discAL.add(dn.disc); Channel chan = dn.disc.getChannel(); addChannel(chan); newDN = discriminators; lastDN = discriminators; while (dn.next != null) { dn = dn.next; newDN = new DiscriminatorNode(dn.disc, dn.weight, null, lastDN); lastDN.next = newDN; lastDN = newDN; discAL.add(dn.disc); chan = dn.disc.getChannel(); addChannel(chan); } }
java
private void buildDiscriminatorNodes(DiscriminatorNode node) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "buildDiscriminatorNodes: " + node); } DiscriminatorNode dn = node; if (dn == null) { return; } DiscriminatorNode newDN = null, lastDN = null; discriminators = new DiscriminatorNode(dn.disc, dn.weight, null, null); discAL.add(dn.disc); Channel chan = dn.disc.getChannel(); addChannel(chan); newDN = discriminators; lastDN = discriminators; while (dn.next != null) { dn = dn.next; newDN = new DiscriminatorNode(dn.disc, dn.weight, null, lastDN); lastDN.next = newDN; lastDN = newDN; discAL.add(dn.disc); chan = dn.disc.getChannel(); addChannel(chan); } }
[ "private", "void", "buildDiscriminatorNodes", "(", "DiscriminatorNode", "node", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"buildDiscriminatorNodes: \"", "+", "node", ")", ";", "}", "DiscriminatorNode", "dn", "=", "node", ";", "if", "(", "dn", "==", "null", ")", "{", "return", ";", "}", "DiscriminatorNode", "newDN", "=", "null", ",", "lastDN", "=", "null", ";", "discriminators", "=", "new", "DiscriminatorNode", "(", "dn", ".", "disc", ",", "dn", ".", "weight", ",", "null", ",", "null", ")", ";", "discAL", ".", "add", "(", "dn", ".", "disc", ")", ";", "Channel", "chan", "=", "dn", ".", "disc", ".", "getChannel", "(", ")", ";", "addChannel", "(", "chan", ")", ";", "newDN", "=", "discriminators", ";", "lastDN", "=", "discriminators", ";", "while", "(", "dn", ".", "next", "!=", "null", ")", "{", "dn", "=", "dn", ".", "next", ";", "newDN", "=", "new", "DiscriminatorNode", "(", "dn", ".", "disc", ",", "dn", ".", "weight", ",", "null", ",", "lastDN", ")", ";", "lastDN", ".", "next", "=", "newDN", ";", "lastDN", "=", "newDN", ";", "discAL", ".", "add", "(", "dn", ".", "disc", ")", ";", "chan", "=", "dn", ".", "disc", ".", "getChannel", "(", ")", ";", "addChannel", "(", "chan", ")", ";", "}", "}" ]
Copy this DiscriminatorNode list. @param node
[ "Copy", "this", "DiscriminatorNode", "list", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/discrim/DiscriminationProcessImpl.java#L162-L186
train
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/discrim/DiscriminationProcessImpl.java
DiscriminationProcessImpl.addDiscriminator
@Override public void addDiscriminator(Discriminator d, int weight) throws DiscriminationProcessException { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "addDiscriminator: " + d + " weight=" + weight); } if (status == STARTED) { DiscriminationProcessException e = new DiscriminationProcessException("Should not add to DiscriminationGroup while started!"); FFDCFilter.processException(e, getClass().getName() + ".addDiscriminator", "239", this, new Object[] { d }); throw e; } if (weight < 0) { DiscriminationProcessException e = new DiscriminationProcessException("Invalid weight for discriminator, " + weight); FFDCFilter.processException(e, getClass().getName() + ".addDiscriminator", "260", this, new Object[] { Long.valueOf(weight) }); throw e; } if (!discAL.contains(d)) { if (d.getDiscriminatoryDataType().isAssignableFrom(discriminantClass)) { if (d.getChannel() == null || d.getChannel().getName() == null) { DiscriminationProcessException e = new DiscriminationProcessException("Discriminator does not have channel or its channel has no name"); FFDCFilter.processException(e, getClass().getName() + ".addDiscriminator", "273", this, new Object[] { d }); throw e; } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Add discriminator " + d.getChannel().getName()); } addDiscriminatorNode(new DiscriminatorNode(d, weight)); discAL.add(d); Channel chan = d.getChannel(); addChannel(chan); this.changed = true; } else { ClassCastException e = new ClassCastException(); FFDCFilter.processException(e, getClass().getName() + ".addDiscriminator", "292", this, new Object[] { d }); throw e; } } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Same discriminator added twice?"); } } }
java
@Override public void addDiscriminator(Discriminator d, int weight) throws DiscriminationProcessException { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "addDiscriminator: " + d + " weight=" + weight); } if (status == STARTED) { DiscriminationProcessException e = new DiscriminationProcessException("Should not add to DiscriminationGroup while started!"); FFDCFilter.processException(e, getClass().getName() + ".addDiscriminator", "239", this, new Object[] { d }); throw e; } if (weight < 0) { DiscriminationProcessException e = new DiscriminationProcessException("Invalid weight for discriminator, " + weight); FFDCFilter.processException(e, getClass().getName() + ".addDiscriminator", "260", this, new Object[] { Long.valueOf(weight) }); throw e; } if (!discAL.contains(d)) { if (d.getDiscriminatoryDataType().isAssignableFrom(discriminantClass)) { if (d.getChannel() == null || d.getChannel().getName() == null) { DiscriminationProcessException e = new DiscriminationProcessException("Discriminator does not have channel or its channel has no name"); FFDCFilter.processException(e, getClass().getName() + ".addDiscriminator", "273", this, new Object[] { d }); throw e; } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Add discriminator " + d.getChannel().getName()); } addDiscriminatorNode(new DiscriminatorNode(d, weight)); discAL.add(d); Channel chan = d.getChannel(); addChannel(chan); this.changed = true; } else { ClassCastException e = new ClassCastException(); FFDCFilter.processException(e, getClass().getName() + ".addDiscriminator", "292", this, new Object[] { d }); throw e; } } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Same discriminator added twice?"); } } }
[ "@", "Override", "public", "void", "addDiscriminator", "(", "Discriminator", "d", ",", "int", "weight", ")", "throws", "DiscriminationProcessException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"addDiscriminator: \"", "+", "d", "+", "\" weight=\"", "+", "weight", ")", ";", "}", "if", "(", "status", "==", "STARTED", ")", "{", "DiscriminationProcessException", "e", "=", "new", "DiscriminationProcessException", "(", "\"Should not add to DiscriminationGroup while started!\"", ")", ";", "FFDCFilter", ".", "processException", "(", "e", ",", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\".addDiscriminator\"", ",", "\"239\"", ",", "this", ",", "new", "Object", "[", "]", "{", "d", "}", ")", ";", "throw", "e", ";", "}", "if", "(", "weight", "<", "0", ")", "{", "DiscriminationProcessException", "e", "=", "new", "DiscriminationProcessException", "(", "\"Invalid weight for discriminator, \"", "+", "weight", ")", ";", "FFDCFilter", ".", "processException", "(", "e", ",", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\".addDiscriminator\"", ",", "\"260\"", ",", "this", ",", "new", "Object", "[", "]", "{", "Long", ".", "valueOf", "(", "weight", ")", "}", ")", ";", "throw", "e", ";", "}", "if", "(", "!", "discAL", ".", "contains", "(", "d", ")", ")", "{", "if", "(", "d", ".", "getDiscriminatoryDataType", "(", ")", ".", "isAssignableFrom", "(", "discriminantClass", ")", ")", "{", "if", "(", "d", ".", "getChannel", "(", ")", "==", "null", "||", "d", ".", "getChannel", "(", ")", ".", "getName", "(", ")", "==", "null", ")", "{", "DiscriminationProcessException", "e", "=", "new", "DiscriminationProcessException", "(", "\"Discriminator does not have channel or its channel has no name\"", ")", ";", "FFDCFilter", ".", "processException", "(", "e", ",", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\".addDiscriminator\"", ",", "\"273\"", ",", "this", ",", "new", "Object", "[", "]", "{", "d", "}", ")", ";", "throw", "e", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Add discriminator \"", "+", "d", ".", "getChannel", "(", ")", ".", "getName", "(", ")", ")", ";", "}", "addDiscriminatorNode", "(", "new", "DiscriminatorNode", "(", "d", ",", "weight", ")", ")", ";", "discAL", ".", "add", "(", "d", ")", ";", "Channel", "chan", "=", "d", ".", "getChannel", "(", ")", ";", "addChannel", "(", "chan", ")", ";", "this", ".", "changed", "=", "true", ";", "}", "else", "{", "ClassCastException", "e", "=", "new", "ClassCastException", "(", ")", ";", "FFDCFilter", ".", "processException", "(", "e", ",", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\".addDiscriminator\"", ",", "\"292\"", ",", "this", ",", "new", "Object", "[", "]", "{", "d", "}", ")", ";", "throw", "e", ";", "}", "}", "else", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Same discriminator added twice?\"", ")", ";", "}", "}", "}" ]
Adds a discriminator to the group. Attempts to add the same discriminator more than once are ignored. It is an error to attempt to add a discriminator which is not able to deal with the groups type of discriminatory data. A class cast exception is thrown if this is attempted. @param d The discriminator to add. @param weight The discrimintor weight. Must be greater than 0. @throws DiscriminationProcessException
[ "Adds", "a", "discriminator", "to", "the", "group", ".", "Attempts", "to", "add", "the", "same", "discriminator", "more", "than", "once", "are", "ignored", ".", "It", "is", "an", "error", "to", "attempt", "to", "add", "a", "discriminator", "which", "is", "not", "able", "to", "deal", "with", "the", "groups", "type", "of", "discriminatory", "data", ".", "A", "class", "cast", "exception", "is", "thrown", "if", "this", "is", "attempted", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/discrim/DiscriminationProcessImpl.java#L268-L308
train
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/discrim/DiscriminationProcessImpl.java
DiscriminationProcessImpl.addDiscriminatorNode
private void addDiscriminatorNode(DiscriminatorNode dn) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "addDiscriminatorNode, weight=" + dn.weight); } if (discriminators == null) { // add it as the first node discriminators = dn; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "addDiscriminatorNode"); } return; } DiscriminatorNode thisDN = discriminators; if (thisDN.weight > dn.weight) { // add it as the first node if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Adding disc first in list"); } thisDN.prev = dn; dn.next = thisDN; discriminators = dn; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "addDiscriminatorNode"); } return; } DiscriminatorNode lastDN = discriminators; while (thisDN.next != null) { // somewhere in the middle lastDN = thisDN; thisDN = thisDN.next; if (thisDN.weight > dn.weight) { // put it in the middle if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Adding disc before " + thisDN.disc.getChannel().getName()); } thisDN.prev = dn; dn.next = thisDN; lastDN.next = dn; dn.prev = lastDN; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "addDiscriminatorNode"); } return; } } // guess its at the end thisDN.next = dn; dn.prev = thisDN; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "addDiscriminatorNode"); } }
java
private void addDiscriminatorNode(DiscriminatorNode dn) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "addDiscriminatorNode, weight=" + dn.weight); } if (discriminators == null) { // add it as the first node discriminators = dn; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "addDiscriminatorNode"); } return; } DiscriminatorNode thisDN = discriminators; if (thisDN.weight > dn.weight) { // add it as the first node if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Adding disc first in list"); } thisDN.prev = dn; dn.next = thisDN; discriminators = dn; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "addDiscriminatorNode"); } return; } DiscriminatorNode lastDN = discriminators; while (thisDN.next != null) { // somewhere in the middle lastDN = thisDN; thisDN = thisDN.next; if (thisDN.weight > dn.weight) { // put it in the middle if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Adding disc before " + thisDN.disc.getChannel().getName()); } thisDN.prev = dn; dn.next = thisDN; lastDN.next = dn; dn.prev = lastDN; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "addDiscriminatorNode"); } return; } } // guess its at the end thisDN.next = dn; dn.prev = thisDN; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "addDiscriminatorNode"); } }
[ "private", "void", "addDiscriminatorNode", "(", "DiscriminatorNode", "dn", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "entry", "(", "tc", ",", "\"addDiscriminatorNode, weight=\"", "+", "dn", ".", "weight", ")", ";", "}", "if", "(", "discriminators", "==", "null", ")", "{", "// add it as the first node", "discriminators", "=", "dn", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "exit", "(", "tc", ",", "\"addDiscriminatorNode\"", ")", ";", "}", "return", ";", "}", "DiscriminatorNode", "thisDN", "=", "discriminators", ";", "if", "(", "thisDN", ".", "weight", ">", "dn", ".", "weight", ")", "{", "// add it as the first node", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Adding disc first in list\"", ")", ";", "}", "thisDN", ".", "prev", "=", "dn", ";", "dn", ".", "next", "=", "thisDN", ";", "discriminators", "=", "dn", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "exit", "(", "tc", ",", "\"addDiscriminatorNode\"", ")", ";", "}", "return", ";", "}", "DiscriminatorNode", "lastDN", "=", "discriminators", ";", "while", "(", "thisDN", ".", "next", "!=", "null", ")", "{", "// somewhere in the middle", "lastDN", "=", "thisDN", ";", "thisDN", "=", "thisDN", ".", "next", ";", "if", "(", "thisDN", ".", "weight", ">", "dn", ".", "weight", ")", "{", "// put it in the middle", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Adding disc before \"", "+", "thisDN", ".", "disc", ".", "getChannel", "(", ")", ".", "getName", "(", ")", ")", ";", "}", "thisDN", ".", "prev", "=", "dn", ";", "dn", ".", "next", "=", "thisDN", ";", "lastDN", ".", "next", "=", "dn", ";", "dn", ".", "prev", "=", "lastDN", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "exit", "(", "tc", ",", "\"addDiscriminatorNode\"", ")", ";", "}", "return", ";", "}", "}", "// guess its at the end", "thisDN", ".", "next", "=", "dn", ";", "dn", ".", "prev", "=", "thisDN", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "exit", "(", "tc", ",", "\"addDiscriminatorNode\"", ")", ";", "}", "}" ]
add a discriminatorNode to the linked list. @param dn
[ "add", "a", "discriminatorNode", "to", "the", "linked", "list", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/discrim/DiscriminationProcessImpl.java#L343-L395
train
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/discrim/DiscriminationProcessImpl.java
DiscriminationProcessImpl.removeDiscriminatorNode
private void removeDiscriminatorNode(Discriminator d) throws DiscriminationProcessException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "removeDiscriminatorNode: " + d); } if (d == null) { DiscriminationProcessException e = new DiscriminationProcessException("Can't remove a null discriminator"); FFDCFilter.processException(e, getClass().getName() + ".removeDiscriminatorNode", "484", this); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "removeDiscriminatorNode"); } throw e; } if (discriminators.disc.equals(d)) { // removing the first discriminator discriminators = discriminators.next; if (discriminators != null) { discriminators.prev = null; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "removeDiscriminatorNode"); } return; } // search through the list of discriminators DiscriminatorNode thisDN = discriminators.next, lastDN = discriminators; while (thisDN.next != null) { if (thisDN.disc.equals(d)) { thisDN.next.prev = lastDN; lastDN.next = thisDN.next; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "removeDiscriminatorNode"); } return; } // somewhere in the middle lastDN = thisDN; thisDN = thisDN.next; } if (thisDN.disc.equals(d)) { // found it! lastDN.next = null; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "removeDiscriminatorNode"); } return; } // Does not exist? if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "removeDiscriminatorNode: not found"); } throw new NoSuchElementException(); }
java
private void removeDiscriminatorNode(Discriminator d) throws DiscriminationProcessException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "removeDiscriminatorNode: " + d); } if (d == null) { DiscriminationProcessException e = new DiscriminationProcessException("Can't remove a null discriminator"); FFDCFilter.processException(e, getClass().getName() + ".removeDiscriminatorNode", "484", this); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "removeDiscriminatorNode"); } throw e; } if (discriminators.disc.equals(d)) { // removing the first discriminator discriminators = discriminators.next; if (discriminators != null) { discriminators.prev = null; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "removeDiscriminatorNode"); } return; } // search through the list of discriminators DiscriminatorNode thisDN = discriminators.next, lastDN = discriminators; while (thisDN.next != null) { if (thisDN.disc.equals(d)) { thisDN.next.prev = lastDN; lastDN.next = thisDN.next; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "removeDiscriminatorNode"); } return; } // somewhere in the middle lastDN = thisDN; thisDN = thisDN.next; } if (thisDN.disc.equals(d)) { // found it! lastDN.next = null; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "removeDiscriminatorNode"); } return; } // Does not exist? if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "removeDiscriminatorNode: not found"); } throw new NoSuchElementException(); }
[ "private", "void", "removeDiscriminatorNode", "(", "Discriminator", "d", ")", "throws", "DiscriminationProcessException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "entry", "(", "tc", ",", "\"removeDiscriminatorNode: \"", "+", "d", ")", ";", "}", "if", "(", "d", "==", "null", ")", "{", "DiscriminationProcessException", "e", "=", "new", "DiscriminationProcessException", "(", "\"Can't remove a null discriminator\"", ")", ";", "FFDCFilter", ".", "processException", "(", "e", ",", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\".removeDiscriminatorNode\"", ",", "\"484\"", ",", "this", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "exit", "(", "tc", ",", "\"removeDiscriminatorNode\"", ")", ";", "}", "throw", "e", ";", "}", "if", "(", "discriminators", ".", "disc", ".", "equals", "(", "d", ")", ")", "{", "// removing the first discriminator", "discriminators", "=", "discriminators", ".", "next", ";", "if", "(", "discriminators", "!=", "null", ")", "{", "discriminators", ".", "prev", "=", "null", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "exit", "(", "tc", ",", "\"removeDiscriminatorNode\"", ")", ";", "}", "return", ";", "}", "// search through the list of discriminators", "DiscriminatorNode", "thisDN", "=", "discriminators", ".", "next", ",", "lastDN", "=", "discriminators", ";", "while", "(", "thisDN", ".", "next", "!=", "null", ")", "{", "if", "(", "thisDN", ".", "disc", ".", "equals", "(", "d", ")", ")", "{", "thisDN", ".", "next", ".", "prev", "=", "lastDN", ";", "lastDN", ".", "next", "=", "thisDN", ".", "next", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "exit", "(", "tc", ",", "\"removeDiscriminatorNode\"", ")", ";", "}", "return", ";", "}", "// somewhere in the middle", "lastDN", "=", "thisDN", ";", "thisDN", "=", "thisDN", ".", "next", ";", "}", "if", "(", "thisDN", ".", "disc", ".", "equals", "(", "d", ")", ")", "{", "// found it!", "lastDN", ".", "next", "=", "null", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "exit", "(", "tc", ",", "\"removeDiscriminatorNode\"", ")", ";", "}", "return", ";", "}", "// Does not exist?", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "exit", "(", "tc", ",", "\"removeDiscriminatorNode: not found\"", ")", ";", "}", "throw", "new", "NoSuchElementException", "(", ")", ";", "}" ]
remove the discriminatorNode from the linkedList. @param d @throws DiscriminationProcessException
[ "remove", "the", "discriminatorNode", "from", "the", "linkedList", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/discrim/DiscriminationProcessImpl.java#L452-L503
train
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/discrim/DiscriminationProcessImpl.java
DiscriminationProcessImpl.start
@Override public void start() { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Started discriminator list " + discAL + "with size" + discAL.size()); } if (discAL.size() > 1) { rebuildDiscriminatorList(); discriminationAlgorithm = new MultiDiscriminatorAlgorithm(this); } else if (discAL.size() == 1) { discriminationAlgorithm = new SingleDiscriminatorAlgorithm(this); } else { discriminationAlgorithm = new FailureDiscriminatorAlgorithm(); } status = STARTED; }
java
@Override public void start() { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Started discriminator list " + discAL + "with size" + discAL.size()); } if (discAL.size() > 1) { rebuildDiscriminatorList(); discriminationAlgorithm = new MultiDiscriminatorAlgorithm(this); } else if (discAL.size() == 1) { discriminationAlgorithm = new SingleDiscriminatorAlgorithm(this); } else { discriminationAlgorithm = new FailureDiscriminatorAlgorithm(); } status = STARTED; }
[ "@", "Override", "public", "void", "start", "(", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Started discriminator list \"", "+", "discAL", "+", "\"with size\"", "+", "discAL", ".", "size", "(", ")", ")", ";", "}", "if", "(", "discAL", ".", "size", "(", ")", ">", "1", ")", "{", "rebuildDiscriminatorList", "(", ")", ";", "discriminationAlgorithm", "=", "new", "MultiDiscriminatorAlgorithm", "(", "this", ")", ";", "}", "else", "if", "(", "discAL", ".", "size", "(", ")", "==", "1", ")", "{", "discriminationAlgorithm", "=", "new", "SingleDiscriminatorAlgorithm", "(", "this", ")", ";", "}", "else", "{", "discriminationAlgorithm", "=", "new", "FailureDiscriminatorAlgorithm", "(", ")", ";", "}", "status", "=", "STARTED", ";", "}" ]
Start this DiscriminatorProcess.
[ "Start", "this", "DiscriminatorProcess", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/discrim/DiscriminationProcessImpl.java#L547-L561
train
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/discrim/DiscriminationProcessImpl.java
DiscriminationProcessImpl.rebuildDiscriminatorList
private void rebuildDiscriminatorList() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "rebuildDiscriminatorList"); } discAL.clear(); DiscriminatorNode dn = discriminators; discAL.add(dn.disc); dn = dn.next; while (dn != null) { discAL.add(dn.disc); dn = dn.next; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "rebuildDiscriminatorList"); } }
java
private void rebuildDiscriminatorList() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "rebuildDiscriminatorList"); } discAL.clear(); DiscriminatorNode dn = discriminators; discAL.add(dn.disc); dn = dn.next; while (dn != null) { discAL.add(dn.disc); dn = dn.next; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "rebuildDiscriminatorList"); } }
[ "private", "void", "rebuildDiscriminatorList", "(", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "entry", "(", "tc", ",", "\"rebuildDiscriminatorList\"", ")", ";", "}", "discAL", ".", "clear", "(", ")", ";", "DiscriminatorNode", "dn", "=", "discriminators", ";", "discAL", ".", "add", "(", "dn", ".", "disc", ")", ";", "dn", "=", "dn", ".", "next", ";", "while", "(", "dn", "!=", "null", ")", "{", "discAL", ".", "add", "(", "dn", ".", "disc", ")", ";", "dn", "=", "dn", ".", "next", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "exit", "(", "tc", ",", "\"rebuildDiscriminatorList\"", ")", ";", "}", "}" ]
Rebuild the array list from the linked list.
[ "Rebuild", "the", "array", "list", "from", "the", "linked", "list", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/discrim/DiscriminationProcessImpl.java#L575-L590
train
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/discrim/DiscriminationProcessImpl.java
DiscriminationProcessImpl.addChannel
private void addChannel(Channel chan) { if (channelList == null) { channelList = new Channel[1]; channelList[0] = chan; } else { Channel[] oldList = channelList; channelList = new Channel[oldList.length + 1]; System.arraycopy(oldList, 0, channelList, 0, oldList.length); channelList[oldList.length] = chan; } }
java
private void addChannel(Channel chan) { if (channelList == null) { channelList = new Channel[1]; channelList[0] = chan; } else { Channel[] oldList = channelList; channelList = new Channel[oldList.length + 1]; System.arraycopy(oldList, 0, channelList, 0, oldList.length); channelList[oldList.length] = chan; } }
[ "private", "void", "addChannel", "(", "Channel", "chan", ")", "{", "if", "(", "channelList", "==", "null", ")", "{", "channelList", "=", "new", "Channel", "[", "1", "]", ";", "channelList", "[", "0", "]", "=", "chan", ";", "}", "else", "{", "Channel", "[", "]", "oldList", "=", "channelList", ";", "channelList", "=", "new", "Channel", "[", "oldList", ".", "length", "+", "1", "]", ";", "System", ".", "arraycopy", "(", "oldList", ",", "0", ",", "channelList", ",", "0", ",", "oldList", ".", "length", ")", ";", "channelList", "[", "oldList", ".", "length", "]", "=", "chan", ";", "}", "}" ]
Add a channel to the channel list to be searched. @param chan
[ "Add", "a", "channel", "to", "the", "channel", "list", "to", "be", "searched", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/discrim/DiscriminationProcessImpl.java#L639-L649
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jndi/src/com/ibm/ws/jndi/internal/WSContext.java
WSContext.resolveObject
@FFDCIgnore({ NamingException.class }) @Sensitive Object resolveObject(Object o, WSName subname) throws NamingException { ServiceReference<?> ref = null; try { if (o instanceof ContextNode) return new WSContext(userContext, (ContextNode) o, env); if (tc.isDebugEnabled()) Tr.debug(tc, "Resolving object", o); if (o instanceof ServiceReference) { ref = (ServiceReference<?>) o; if (tc.isDebugEnabled()) Tr.debug(tc, "External service registry entry."); } else if (o instanceof AutoBindNode) { if (tc.isDebugEnabled()) Tr.debug(tc, "AutoBindNode entry."); AutoBindNode abNode = (AutoBindNode) o; ref = (ServiceReference<?>) abNode.getLastEntry(); // null means the node was removed in another thread. if (ref == null) { // Use the same semantics as ContextNode.lookup. throw new NameNotFoundException(subname.toString()); } } else if (o instanceof ServiceRegistration) { ref = ((ServiceRegistration<?>) o).getReference(); if (tc.isDebugEnabled()) Tr.debug(tc, "Programmatic JNDI entry."); } boolean getObjectInstance; if (ref == null) { getObjectInstance = true; } else { o = getReference(userContext, ref); if (o == null) { throw new NamingException(Tr.formatMessage(tc, "jndi.servicereference.failed", subname.toString())); } Object origin = ref.getProperty(JNDIServiceBinder.OSGI_JNDI_SERVICE_ORIGIN); if (tc.isDebugEnabled()) Tr.debug(tc, "Retrieved service from registry", o, JNDIServiceBinder.OSGI_JNDI_SERVICE_ORIGIN + "=" + origin, Constants.OBJECTCLASS + "=" + Arrays.toString((String[]) ref.getProperty(Constants.OBJECTCLASS))); getObjectInstance = JNDIServiceBinder.OSGI_JNDI_SERVICE_ORIGIN_VALUE.equals(origin) || contains((String[]) ref.getProperty(Constants.OBJECTCLASS), Reference.class.getName()); } if (getObjectInstance) { // give JNDI a chance to resolve any references try { Object oldO = o; o = NamingManager.getObjectInstance(o, subname, this, env); if (o != oldO) if (tc.isDebugEnabled()) Tr.debug(tc, "Resolved object through NamingManager"); // remove logging object o since it might contain the sensitive information. } catch (NamingException e) { throw e; } catch (Exception e) { // FFDC and proceed } } return o; } catch (NamingException e) { throw e; } catch (Exception e) { NamingException ne = new NamingException(); ne.setRootCause(e); throw ne; } }
java
@FFDCIgnore({ NamingException.class }) @Sensitive Object resolveObject(Object o, WSName subname) throws NamingException { ServiceReference<?> ref = null; try { if (o instanceof ContextNode) return new WSContext(userContext, (ContextNode) o, env); if (tc.isDebugEnabled()) Tr.debug(tc, "Resolving object", o); if (o instanceof ServiceReference) { ref = (ServiceReference<?>) o; if (tc.isDebugEnabled()) Tr.debug(tc, "External service registry entry."); } else if (o instanceof AutoBindNode) { if (tc.isDebugEnabled()) Tr.debug(tc, "AutoBindNode entry."); AutoBindNode abNode = (AutoBindNode) o; ref = (ServiceReference<?>) abNode.getLastEntry(); // null means the node was removed in another thread. if (ref == null) { // Use the same semantics as ContextNode.lookup. throw new NameNotFoundException(subname.toString()); } } else if (o instanceof ServiceRegistration) { ref = ((ServiceRegistration<?>) o).getReference(); if (tc.isDebugEnabled()) Tr.debug(tc, "Programmatic JNDI entry."); } boolean getObjectInstance; if (ref == null) { getObjectInstance = true; } else { o = getReference(userContext, ref); if (o == null) { throw new NamingException(Tr.formatMessage(tc, "jndi.servicereference.failed", subname.toString())); } Object origin = ref.getProperty(JNDIServiceBinder.OSGI_JNDI_SERVICE_ORIGIN); if (tc.isDebugEnabled()) Tr.debug(tc, "Retrieved service from registry", o, JNDIServiceBinder.OSGI_JNDI_SERVICE_ORIGIN + "=" + origin, Constants.OBJECTCLASS + "=" + Arrays.toString((String[]) ref.getProperty(Constants.OBJECTCLASS))); getObjectInstance = JNDIServiceBinder.OSGI_JNDI_SERVICE_ORIGIN_VALUE.equals(origin) || contains((String[]) ref.getProperty(Constants.OBJECTCLASS), Reference.class.getName()); } if (getObjectInstance) { // give JNDI a chance to resolve any references try { Object oldO = o; o = NamingManager.getObjectInstance(o, subname, this, env); if (o != oldO) if (tc.isDebugEnabled()) Tr.debug(tc, "Resolved object through NamingManager"); // remove logging object o since it might contain the sensitive information. } catch (NamingException e) { throw e; } catch (Exception e) { // FFDC and proceed } } return o; } catch (NamingException e) { throw e; } catch (Exception e) { NamingException ne = new NamingException(); ne.setRootCause(e); throw ne; } }
[ "@", "FFDCIgnore", "(", "{", "NamingException", ".", "class", "}", ")", "@", "Sensitive", "Object", "resolveObject", "(", "Object", "o", ",", "WSName", "subname", ")", "throws", "NamingException", "{", "ServiceReference", "<", "?", ">", "ref", "=", "null", ";", "try", "{", "if", "(", "o", "instanceof", "ContextNode", ")", "return", "new", "WSContext", "(", "userContext", ",", "(", "ContextNode", ")", "o", ",", "env", ")", ";", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "tc", ",", "\"Resolving object\"", ",", "o", ")", ";", "if", "(", "o", "instanceof", "ServiceReference", ")", "{", "ref", "=", "(", "ServiceReference", "<", "?", ">", ")", "o", ";", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "tc", ",", "\"External service registry entry.\"", ")", ";", "}", "else", "if", "(", "o", "instanceof", "AutoBindNode", ")", "{", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "tc", ",", "\"AutoBindNode entry.\"", ")", ";", "AutoBindNode", "abNode", "=", "(", "AutoBindNode", ")", "o", ";", "ref", "=", "(", "ServiceReference", "<", "?", ">", ")", "abNode", ".", "getLastEntry", "(", ")", ";", "// null means the node was removed in another thread.", "if", "(", "ref", "==", "null", ")", "{", "// Use the same semantics as ContextNode.lookup.", "throw", "new", "NameNotFoundException", "(", "subname", ".", "toString", "(", ")", ")", ";", "}", "}", "else", "if", "(", "o", "instanceof", "ServiceRegistration", ")", "{", "ref", "=", "(", "(", "ServiceRegistration", "<", "?", ">", ")", "o", ")", ".", "getReference", "(", ")", ";", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "tc", ",", "\"Programmatic JNDI entry.\"", ")", ";", "}", "boolean", "getObjectInstance", ";", "if", "(", "ref", "==", "null", ")", "{", "getObjectInstance", "=", "true", ";", "}", "else", "{", "o", "=", "getReference", "(", "userContext", ",", "ref", ")", ";", "if", "(", "o", "==", "null", ")", "{", "throw", "new", "NamingException", "(", "Tr", ".", "formatMessage", "(", "tc", ",", "\"jndi.servicereference.failed\"", ",", "subname", ".", "toString", "(", ")", ")", ")", ";", "}", "Object", "origin", "=", "ref", ".", "getProperty", "(", "JNDIServiceBinder", ".", "OSGI_JNDI_SERVICE_ORIGIN", ")", ";", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "tc", ",", "\"Retrieved service from registry\"", ",", "o", ",", "JNDIServiceBinder", ".", "OSGI_JNDI_SERVICE_ORIGIN", "+", "\"=\"", "+", "origin", ",", "Constants", ".", "OBJECTCLASS", "+", "\"=\"", "+", "Arrays", ".", "toString", "(", "(", "String", "[", "]", ")", "ref", ".", "getProperty", "(", "Constants", ".", "OBJECTCLASS", ")", ")", ")", ";", "getObjectInstance", "=", "JNDIServiceBinder", ".", "OSGI_JNDI_SERVICE_ORIGIN_VALUE", ".", "equals", "(", "origin", ")", "||", "contains", "(", "(", "String", "[", "]", ")", "ref", ".", "getProperty", "(", "Constants", ".", "OBJECTCLASS", ")", ",", "Reference", ".", "class", ".", "getName", "(", ")", ")", ";", "}", "if", "(", "getObjectInstance", ")", "{", "// give JNDI a chance to resolve any references", "try", "{", "Object", "oldO", "=", "o", ";", "o", "=", "NamingManager", ".", "getObjectInstance", "(", "o", ",", "subname", ",", "this", ",", "env", ")", ";", "if", "(", "o", "!=", "oldO", ")", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "tc", ",", "\"Resolved object through NamingManager\"", ")", ";", "// remove logging object o since it might contain the sensitive information.", "}", "catch", "(", "NamingException", "e", ")", "{", "throw", "e", ";", "}", "catch", "(", "Exception", "e", ")", "{", "// FFDC and proceed", "}", "}", "return", "o", ";", "}", "catch", "(", "NamingException", "e", ")", "{", "throw", "e", ";", "}", "catch", "(", "Exception", "e", ")", "{", "NamingException", "ne", "=", "new", "NamingException", "(", ")", ";", "ne", ".", "setRootCause", "(", "e", ")", ";", "throw", "ne", ";", "}", "}" ]
Perform any needed conversions on an object retrieved from the context tree. @param o the object to be resolved @return the resolved object @throws Exception @throws NamingException
[ "Perform", "any", "needed", "conversions", "on", "an", "object", "retrieved", "from", "the", "context", "tree", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jndi/src/com/ibm/ws/jndi/internal/WSContext.java#L102-L173
train
OpenLiberty/open-liberty
dev/com.ibm.websphere.security/src/com/ibm/websphere/security/audit/AuditEvent.java
AuditEvent.send
public void send() throws AuditServiceUnavailableException { AuditService auditService = SecurityUtils.getAuditService(); if (auditService != null) { auditService.sendEvent(this); } else { throw new AuditServiceUnavailableException(); } }
java
public void send() throws AuditServiceUnavailableException { AuditService auditService = SecurityUtils.getAuditService(); if (auditService != null) { auditService.sendEvent(this); } else { throw new AuditServiceUnavailableException(); } }
[ "public", "void", "send", "(", ")", "throws", "AuditServiceUnavailableException", "{", "AuditService", "auditService", "=", "SecurityUtils", ".", "getAuditService", "(", ")", ";", "if", "(", "auditService", "!=", "null", ")", "{", "auditService", ".", "sendEvent", "(", "this", ")", ";", "}", "else", "{", "throw", "new", "AuditServiceUnavailableException", "(", ")", ";", "}", "}" ]
Send this event to the audit service for logging. @throws AuditServiceUnavailableException
[ "Send", "this", "event", "to", "the", "audit", "service", "for", "logging", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.security/src/com/ibm/websphere/security/audit/AuditEvent.java#L564-L571
train
OpenLiberty/open-liberty
dev/com.ibm.websphere.security/src/com/ibm/websphere/security/audit/AuditEvent.java
AuditEvent.isAuditRequired
public static boolean isAuditRequired(String eventType, String outcome) throws AuditServiceUnavailableException { AuditService auditService = SecurityUtils.getAuditService(); if (auditService != null) { return auditService.isAuditRequired(eventType, outcome); } else { throw new AuditServiceUnavailableException(); } }
java
public static boolean isAuditRequired(String eventType, String outcome) throws AuditServiceUnavailableException { AuditService auditService = SecurityUtils.getAuditService(); if (auditService != null) { return auditService.isAuditRequired(eventType, outcome); } else { throw new AuditServiceUnavailableException(); } }
[ "public", "static", "boolean", "isAuditRequired", "(", "String", "eventType", ",", "String", "outcome", ")", "throws", "AuditServiceUnavailableException", "{", "AuditService", "auditService", "=", "SecurityUtils", ".", "getAuditService", "(", ")", ";", "if", "(", "auditService", "!=", "null", ")", "{", "return", "auditService", ".", "isAuditRequired", "(", "eventType", ",", "outcome", ")", ";", "}", "else", "{", "throw", "new", "AuditServiceUnavailableException", "(", ")", ";", "}", "}" ]
Check to see if auditing is required for an event type and outcome. @param eventType SECURITY_AUTHN, SECURITY_AUTHZ, etc @param outcome OUTCOME_SUCCESS, OUTCOME_DENIED, etc. @return true - events with the type/outcome should be audited false - events with the type/outcome should not be audited @throws AuditServiceUnavailableException
[ "Check", "to", "see", "if", "auditing", "is", "required", "for", "an", "event", "type", "and", "outcome", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.security/src/com/ibm/websphere/security/audit/AuditEvent.java#L595-L602
train
OpenLiberty/open-liberty
dev/com.ibm.websphere.security/src/com/ibm/websphere/security/audit/AuditEvent.java
AuditEvent.removeEntriesStartingWith
private void removeEntriesStartingWith(String key) { synchronized (eventMap) { Iterator<String> iter = eventMap.keySet().iterator(); while (iter.hasNext()) { String str = iter.next(); if (str.startsWith(key)) { iter.remove(); } } } }
java
private void removeEntriesStartingWith(String key) { synchronized (eventMap) { Iterator<String> iter = eventMap.keySet().iterator(); while (iter.hasNext()) { String str = iter.next(); if (str.startsWith(key)) { iter.remove(); } } } }
[ "private", "void", "removeEntriesStartingWith", "(", "String", "key", ")", "{", "synchronized", "(", "eventMap", ")", "{", "Iterator", "<", "String", ">", "iter", "=", "eventMap", ".", "keySet", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "iter", ".", "hasNext", "(", ")", ")", "{", "String", "str", "=", "iter", ".", "next", "(", ")", ";", "if", "(", "str", ".", "startsWith", "(", "key", ")", ")", "{", "iter", ".", "remove", "(", ")", ";", "}", "}", "}", "}" ]
Remove all entries starting with the given key @param key
[ "Remove", "all", "entries", "starting", "with", "the", "given", "key" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.security/src/com/ibm/websphere/security/audit/AuditEvent.java#L609-L619
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/linkedlist/SimpleLinkedList.java
SimpleLinkedList.put
public void put(SimpleEntry simpleEntry) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "put", simpleEntry); simpleEntry.previous = last; simpleEntry.list = this; if(last != null) last.next = simpleEntry; else first = simpleEntry; last = simpleEntry; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "put", printList()); }
java
public void put(SimpleEntry simpleEntry) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "put", simpleEntry); simpleEntry.previous = last; simpleEntry.list = this; if(last != null) last.next = simpleEntry; else first = simpleEntry; last = simpleEntry; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "put", printList()); }
[ "public", "void", "put", "(", "SimpleEntry", "simpleEntry", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "this", ",", "tc", ",", "\"put\"", ",", "simpleEntry", ")", ";", "simpleEntry", ".", "previous", "=", "last", ";", "simpleEntry", ".", "list", "=", "this", ";", "if", "(", "last", "!=", "null", ")", "last", ".", "next", "=", "simpleEntry", ";", "else", "first", "=", "simpleEntry", ";", "last", "=", "simpleEntry", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "this", ",", "tc", ",", "\"put\"", ",", "printList", "(", ")", ")", ";", "}" ]
Add an entry to the list @param simpleEntry
[ "Add", "an", "entry", "to", "the", "list" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/linkedlist/SimpleLinkedList.java#L49-L66
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/linkedlist/SimpleLinkedList.java
SimpleLinkedList.printList
protected String printList() { String output = "["; SimpleEntry pointer = first; int counter = 0; while((pointer != null) && (counter < 3)) { output += "@"+Integer.toHexString(pointer.hashCode()); pointer = pointer.next; if(pointer != null) output += ", "; counter++; } if(pointer != null) { output += "..., @"+Integer.toHexString(last.hashCode()) + "]"; } else output += "]"; return output; }
java
protected String printList() { String output = "["; SimpleEntry pointer = first; int counter = 0; while((pointer != null) && (counter < 3)) { output += "@"+Integer.toHexString(pointer.hashCode()); pointer = pointer.next; if(pointer != null) output += ", "; counter++; } if(pointer != null) { output += "..., @"+Integer.toHexString(last.hashCode()) + "]"; } else output += "]"; return output; }
[ "protected", "String", "printList", "(", ")", "{", "String", "output", "=", "\"[\"", ";", "SimpleEntry", "pointer", "=", "first", ";", "int", "counter", "=", "0", ";", "while", "(", "(", "pointer", "!=", "null", ")", "&&", "(", "counter", "<", "3", ")", ")", "{", "output", "+=", "\"@\"", "+", "Integer", ".", "toHexString", "(", "pointer", ".", "hashCode", "(", ")", ")", ";", "pointer", "=", "pointer", ".", "next", ";", "if", "(", "pointer", "!=", "null", ")", "output", "+=", "\", \"", ";", "counter", "++", ";", "}", "if", "(", "pointer", "!=", "null", ")", "{", "output", "+=", "\"..., @\"", "+", "Integer", ".", "toHexString", "(", "last", ".", "hashCode", "(", ")", ")", "+", "\"]\"", ";", "}", "else", "output", "+=", "\"]\"", ";", "return", "output", ";", "}" ]
Return the first and last entries in the list
[ "Return", "the", "first", "and", "last", "entries", "in", "the", "list" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/linkedlist/SimpleLinkedList.java#L85-L107
train
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/TCPChannel.java
TCPChannel.initializePort
private void initializePort() throws ChannelException { try { this.endPoint.initServerSocket(); } catch (IOException ioe) { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "TCP Channel: " + getExternalName() + "- Problem occurred while initializing TCP Channel: " + ioe.getMessage()); } throw new ChannelException("TCP Channel: " + getExternalName() + "- Problem occurred while starting channel: " + ioe.getMessage()); } catch (RetryableChannelException e) { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "TCP Channel: " + getExternalName() + "- Problem occurred while starting TCP Channel: " + e.getMessage()); } throw e; } // add property to config to provide actual port used (could be ephemeral // port if '0' passed in) this.channelData.getPropertyBag().put(TCPConfigConstants.LISTENING_PORT, String.valueOf(this.endPoint.getListenPort())); }
java
private void initializePort() throws ChannelException { try { this.endPoint.initServerSocket(); } catch (IOException ioe) { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "TCP Channel: " + getExternalName() + "- Problem occurred while initializing TCP Channel: " + ioe.getMessage()); } throw new ChannelException("TCP Channel: " + getExternalName() + "- Problem occurred while starting channel: " + ioe.getMessage()); } catch (RetryableChannelException e) { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "TCP Channel: " + getExternalName() + "- Problem occurred while starting TCP Channel: " + e.getMessage()); } throw e; } // add property to config to provide actual port used (could be ephemeral // port if '0' passed in) this.channelData.getPropertyBag().put(TCPConfigConstants.LISTENING_PORT, String.valueOf(this.endPoint.getListenPort())); }
[ "private", "void", "initializePort", "(", ")", "throws", "ChannelException", "{", "try", "{", "this", ".", "endPoint", ".", "initServerSocket", "(", ")", ";", "}", "catch", "(", "IOException", "ioe", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEventEnabled", "(", ")", ")", "{", "Tr", ".", "event", "(", "tc", ",", "\"TCP Channel: \"", "+", "getExternalName", "(", ")", "+", "\"- Problem occurred while initializing TCP Channel: \"", "+", "ioe", ".", "getMessage", "(", ")", ")", ";", "}", "throw", "new", "ChannelException", "(", "\"TCP Channel: \"", "+", "getExternalName", "(", ")", "+", "\"- Problem occurred while starting channel: \"", "+", "ioe", ".", "getMessage", "(", ")", ")", ";", "}", "catch", "(", "RetryableChannelException", "e", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEventEnabled", "(", ")", ")", "{", "Tr", ".", "event", "(", "tc", ",", "\"TCP Channel: \"", "+", "getExternalName", "(", ")", "+", "\"- Problem occurred while starting TCP Channel: \"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "throw", "e", ";", "}", "// add property to config to provide actual port used (could be ephemeral", "// port if '0' passed in)", "this", ".", "channelData", ".", "getPropertyBag", "(", ")", ".", "put", "(", "TCPConfigConstants", ".", "LISTENING_PORT", ",", "String", ".", "valueOf", "(", "this", ".", "endPoint", ".", "getListenPort", "(", ")", ")", ")", ";", "}" ]
Initialize the endpoint listening socket. @throws ChannelException
[ "Initialize", "the", "endpoint", "listening", "socket", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/TCPChannel.java#L325-L343
train
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/TCPChannel.java
TCPChannel.destroyConnLinks
private synchronized void destroyConnLinks() { // inUse queue is still open to modification // during this time. Returned iterator is a "weakly consistent" // I don't believe this has (yet) caused any issues. for (Queue<TCPConnLink> queue : this.inUse) { try { TCPConnLink tcl = queue.poll(); while (tcl != null) { tcl.close(tcl.getVirtualConnection(), null); tcl = queue.poll(); } } catch (Throwable t) { FFDCFilter.processException(t, getClass().getName(), "destroyConnLinks", new Object[] { this }); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Error closing connection: " + t + " " + queue); } } } }
java
private synchronized void destroyConnLinks() { // inUse queue is still open to modification // during this time. Returned iterator is a "weakly consistent" // I don't believe this has (yet) caused any issues. for (Queue<TCPConnLink> queue : this.inUse) { try { TCPConnLink tcl = queue.poll(); while (tcl != null) { tcl.close(tcl.getVirtualConnection(), null); tcl = queue.poll(); } } catch (Throwable t) { FFDCFilter.processException(t, getClass().getName(), "destroyConnLinks", new Object[] { this }); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Error closing connection: " + t + " " + queue); } } } }
[ "private", "synchronized", "void", "destroyConnLinks", "(", ")", "{", "// inUse queue is still open to modification", "// during this time. Returned iterator is a \"weakly consistent\"", "// I don't believe this has (yet) caused any issues.", "for", "(", "Queue", "<", "TCPConnLink", ">", "queue", ":", "this", ".", "inUse", ")", "{", "try", "{", "TCPConnLink", "tcl", "=", "queue", ".", "poll", "(", ")", ";", "while", "(", "tcl", "!=", "null", ")", "{", "tcl", ".", "close", "(", "tcl", ".", "getVirtualConnection", "(", ")", ",", "null", ")", ";", "tcl", "=", "queue", ".", "poll", "(", ")", ";", "}", "}", "catch", "(", "Throwable", "t", ")", "{", "FFDCFilter", ".", "processException", "(", "t", ",", "getClass", "(", ")", ".", "getName", "(", ")", ",", "\"destroyConnLinks\"", ",", "new", "Object", "[", "]", "{", "this", "}", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Error closing connection: \"", "+", "t", "+", "\" \"", "+", "queue", ")", ";", "}", "}", "}", "}" ]
call the destroy on all the TCPConnLink objects related to this TCPChannel which are currently "in use".
[ "call", "the", "destroy", "on", "all", "the", "TCPConnLink", "objects", "related", "to", "this", "TCPChannel", "which", "are", "currently", "in", "use", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/TCPChannel.java#L521-L541
train
OpenLiberty/open-liberty
dev/com.ibm.ws.microprofile.config.1.1/src/com/ibm/ws/microprofile/config/impl/AbstractConfig.java
AbstractConfig.getValue
protected Object getValue(String propertyName, Type propertyType, boolean optional, String defaultString) { Object value = null; assertNotClosed(); SourcedValue sourced = getSourcedValue(propertyName, propertyType); if (sourced != null) { value = sourced.getValue(); } else { if (optional) { value = convertValue(defaultString, propertyType); } else { throw new NoSuchElementException(Tr.formatMessage(tc, "no.such.element.CWMCG0015E", propertyName)); } } return value; }
java
protected Object getValue(String propertyName, Type propertyType, boolean optional, String defaultString) { Object value = null; assertNotClosed(); SourcedValue sourced = getSourcedValue(propertyName, propertyType); if (sourced != null) { value = sourced.getValue(); } else { if (optional) { value = convertValue(defaultString, propertyType); } else { throw new NoSuchElementException(Tr.formatMessage(tc, "no.such.element.CWMCG0015E", propertyName)); } } return value; }
[ "protected", "Object", "getValue", "(", "String", "propertyName", ",", "Type", "propertyType", ",", "boolean", "optional", ",", "String", "defaultString", ")", "{", "Object", "value", "=", "null", ";", "assertNotClosed", "(", ")", ";", "SourcedValue", "sourced", "=", "getSourcedValue", "(", "propertyName", ",", "propertyType", ")", ";", "if", "(", "sourced", "!=", "null", ")", "{", "value", "=", "sourced", ".", "getValue", "(", ")", ";", "}", "else", "{", "if", "(", "optional", ")", "{", "value", "=", "convertValue", "(", "defaultString", ",", "propertyType", ")", ";", "}", "else", "{", "throw", "new", "NoSuchElementException", "(", "Tr", ".", "formatMessage", "(", "tc", ",", "\"no.such.element.CWMCG0015E\"", ",", "propertyName", ")", ")", ";", "}", "}", "return", "value", ";", "}" ]
Get the converted value of the given property. If the property is not found and optional is true then use the default string to create a value to return. If the property is not found and optional is false then throw an exception. @param propertyName the property to get @param propertyType the type to convert to @param optional is the property optional @param defaultString the default string to use if the property was not found and optional is true @return the converted value @throws NoSuchElementException thrown if the property was not found and optional was false
[ "Get", "the", "converted", "value", "of", "the", "given", "property", ".", "If", "the", "property", "is", "not", "found", "and", "optional", "is", "true", "then", "use", "the", "default", "string", "to", "create", "a", "value", "to", "return", ".", "If", "the", "property", "is", "not", "found", "and", "optional", "is", "false", "then", "throw", "an", "exception", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.config.1.1/src/com/ibm/ws/microprofile/config/impl/AbstractConfig.java#L164-L179
train
OpenLiberty/open-liberty
dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/ws/JoblogUtil.java
JoblogUtil.logToJobLogAndTraceOnly
@Trivial public static void logToJobLogAndTraceOnly(Level level, String msg, Object[] params, Logger traceLogger){ String formattedMsg = getFormattedMessage(msg, params, "Job event."); logRawMsgToJobLogAndTraceOnly(level, formattedMsg, traceLogger); }
java
@Trivial public static void logToJobLogAndTraceOnly(Level level, String msg, Object[] params, Logger traceLogger){ String formattedMsg = getFormattedMessage(msg, params, "Job event."); logRawMsgToJobLogAndTraceOnly(level, formattedMsg, traceLogger); }
[ "@", "Trivial", "public", "static", "void", "logToJobLogAndTraceOnly", "(", "Level", "level", ",", "String", "msg", ",", "Object", "[", "]", "params", ",", "Logger", "traceLogger", ")", "{", "String", "formattedMsg", "=", "getFormattedMessage", "(", "msg", ",", "params", ",", "\"Job event.\"", ")", ";", "logRawMsgToJobLogAndTraceOnly", "(", "level", ",", "formattedMsg", ",", "traceLogger", ")", ";", "}" ]
Logs the message to joblog and trace. If level > FINE, this method will reduce the level to FINE while logging to trace to prevent the message to be logged in console.log and messages.log file Joblog messages will be logged as per original logging level Use this method when you don't want a very verbose stack in messages.log and console.log @param level Original logging level the message was logged at by the code writing the log msg. @param msgKey Message key. @param params Message params (fillins) @param traceLogger Logger to use to attempt to log message to trace.log (whether it will or not depends on config)
[ "Logs", "the", "message", "to", "joblog", "and", "trace", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/ws/JoblogUtil.java#L50-L54
train
OpenLiberty/open-liberty
dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/ws/JoblogUtil.java
JoblogUtil.logRawMsgToJobLogAndTraceOnly
@Trivial public static void logRawMsgToJobLogAndTraceOnly(Level level, String msg, Logger traceLogger){ if(level.intValue() > Level.FINE.intValue()){ traceLogger.log(Level.FINE, msg); logToJoblogIfNotTraceLoggable(Level.FINE, msg, traceLogger); } else{ traceLogger.log(level, msg); logToJoblogIfNotTraceLoggable(level, msg, traceLogger); } }
java
@Trivial public static void logRawMsgToJobLogAndTraceOnly(Level level, String msg, Logger traceLogger){ if(level.intValue() > Level.FINE.intValue()){ traceLogger.log(Level.FINE, msg); logToJoblogIfNotTraceLoggable(Level.FINE, msg, traceLogger); } else{ traceLogger.log(level, msg); logToJoblogIfNotTraceLoggable(level, msg, traceLogger); } }
[ "@", "Trivial", "public", "static", "void", "logRawMsgToJobLogAndTraceOnly", "(", "Level", "level", ",", "String", "msg", ",", "Logger", "traceLogger", ")", "{", "if", "(", "level", ".", "intValue", "(", ")", ">", "Level", ".", "FINE", ".", "intValue", "(", ")", ")", "{", "traceLogger", ".", "log", "(", "Level", ".", "FINE", ",", "msg", ")", ";", "logToJoblogIfNotTraceLoggable", "(", "Level", ".", "FINE", ",", "msg", ",", "traceLogger", ")", ";", "}", "else", "{", "traceLogger", ".", "log", "(", "level", ",", "msg", ")", ";", "logToJoblogIfNotTraceLoggable", "(", "level", ",", "msg", ",", "traceLogger", ")", ";", "}", "}" ]
logs the message to joblog and trace. If Level > FINE, this method will reduce the level to FINE while logging to trace.log to prevent the message to be logged in console.log and messages.log file Joblog messages will be logged as per supplied logging level Use this method when you don't want a very verbose stack in messages.log and console.log @param level Original logging level the message was logged at by the code writing the log msg. @param rawMsg Message is complete, it has already been translated with parameters a filled in, or it is a raw, non-translated message like an exception or similar trace. @param traceLogger Logger to use to attempt to log message to trace.log (whether it will or not depends on config)
[ "logs", "the", "message", "to", "joblog", "and", "trace", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/ws/JoblogUtil.java#L72-L83
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/CompatibilityMap.java
CompatibilityMap.toEncodedForm
public byte[] toEncodedForm() { if (encodedForm == null) { encodedForm = new byte[encodedSize()]; ArrayUtil.writeLong(encodedForm, 0, accessSchemaId); encode(encodedForm, new int[] { 8, encodedForm.length }); } return encodedForm; }
java
public byte[] toEncodedForm() { if (encodedForm == null) { encodedForm = new byte[encodedSize()]; ArrayUtil.writeLong(encodedForm, 0, accessSchemaId); encode(encodedForm, new int[] { 8, encodedForm.length }); } return encodedForm; }
[ "public", "byte", "[", "]", "toEncodedForm", "(", ")", "{", "if", "(", "encodedForm", "==", "null", ")", "{", "encodedForm", "=", "new", "byte", "[", "encodedSize", "(", ")", "]", ";", "ArrayUtil", ".", "writeLong", "(", "encodedForm", ",", "0", ",", "accessSchemaId", ")", ";", "encode", "(", "encodedForm", ",", "new", "int", "[", "]", "{", "8", ",", "encodedForm", ".", "length", "}", ")", ";", "}", "return", "encodedForm", ";", "}" ]
Turn an CompatibilityMap into its encoded form @return the encoded form as a byte array
[ "Turn", "an", "CompatibilityMap", "into", "its", "encoded", "form" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/CompatibilityMap.java#L131-L138
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/CompatibilityMap.java
CompatibilityMap.encode
private void encode(byte[] frame, int[] limits) { JSType.setCount(frame, limits, indices.length); for (int i = 0; i < indices.length; i++) JSType.setCount(frame, limits, indices[i]); JSType.setCount(frame, limits, varBias); JSType.setCount(frame, limits, setCases.length); for (int i = 0; i < setCases.length; i++) { int[] cases = setCases[i]; if (cases == null) JSType.setCount(frame, limits, -1); else { JSType.setCount(frame, limits, cases.length); for (int j = 0; j < cases.length; j++) JSType.setCount(frame, limits, cases[j]); } } JSType.setCount(frame, limits, getCases.length); for (int i = 0; i < getCases.length; i++) { int[] cases = getCases[i]; if (cases == null) JSType.setCount(frame, limits, -1); else { JSType.setCount(frame, limits, cases.length); for (int j = 0; j < cases.length; j++) JSType.setCount(frame, limits, cases[j]); } } }
java
private void encode(byte[] frame, int[] limits) { JSType.setCount(frame, limits, indices.length); for (int i = 0; i < indices.length; i++) JSType.setCount(frame, limits, indices[i]); JSType.setCount(frame, limits, varBias); JSType.setCount(frame, limits, setCases.length); for (int i = 0; i < setCases.length; i++) { int[] cases = setCases[i]; if (cases == null) JSType.setCount(frame, limits, -1); else { JSType.setCount(frame, limits, cases.length); for (int j = 0; j < cases.length; j++) JSType.setCount(frame, limits, cases[j]); } } JSType.setCount(frame, limits, getCases.length); for (int i = 0; i < getCases.length; i++) { int[] cases = getCases[i]; if (cases == null) JSType.setCount(frame, limits, -1); else { JSType.setCount(frame, limits, cases.length); for (int j = 0; j < cases.length; j++) JSType.setCount(frame, limits, cases[j]); } } }
[ "private", "void", "encode", "(", "byte", "[", "]", "frame", ",", "int", "[", "]", "limits", ")", "{", "JSType", ".", "setCount", "(", "frame", ",", "limits", ",", "indices", ".", "length", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "indices", ".", "length", ";", "i", "++", ")", "JSType", ".", "setCount", "(", "frame", ",", "limits", ",", "indices", "[", "i", "]", ")", ";", "JSType", ".", "setCount", "(", "frame", ",", "limits", ",", "varBias", ")", ";", "JSType", ".", "setCount", "(", "frame", ",", "limits", ",", "setCases", ".", "length", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "setCases", ".", "length", ";", "i", "++", ")", "{", "int", "[", "]", "cases", "=", "setCases", "[", "i", "]", ";", "if", "(", "cases", "==", "null", ")", "JSType", ".", "setCount", "(", "frame", ",", "limits", ",", "-", "1", ")", ";", "else", "{", "JSType", ".", "setCount", "(", "frame", ",", "limits", ",", "cases", ".", "length", ")", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "cases", ".", "length", ";", "j", "++", ")", "JSType", ".", "setCount", "(", "frame", ",", "limits", ",", "cases", "[", "j", "]", ")", ";", "}", "}", "JSType", ".", "setCount", "(", "frame", ",", "limits", ",", "getCases", ".", "length", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "getCases", ".", "length", ";", "i", "++", ")", "{", "int", "[", "]", "cases", "=", "getCases", "[", "i", "]", ";", "if", "(", "cases", "==", "null", ")", "JSType", ".", "setCount", "(", "frame", ",", "limits", ",", "-", "1", ")", ";", "else", "{", "JSType", ".", "setCount", "(", "frame", ",", "limits", ",", "cases", ".", "length", ")", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "cases", ".", "length", ";", "j", "++", ")", "JSType", ".", "setCount", "(", "frame", ",", "limits", ",", "cases", "[", "j", "]", ")", ";", "}", "}", "}" ]
Encode subroutine used by toEncodedForm
[ "Encode", "subroutine", "used", "by", "toEncodedForm" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/CompatibilityMap.java#L141-L168
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/CompatibilityMap.java
CompatibilityMap.encodedSize
private int encodedSize() { int ans = 16 /* for accessSchemaID, indices.length, varBias, setCases.length, and getCases.length */ + 2*indices.length; // for the elements in indices for (int i = 0; i < setCases.length; i++) { int[] cases = setCases[i]; ans += 2; // for cases.length or null indicator if (cases != null) ans += 2 * cases.length; } for (int i = 0; i < getCases.length; i++) { int[] cases = getCases[i]; ans += 2; // for cases.length or null indicator if (cases != null) ans += 2 * cases.length; } return ans; }
java
private int encodedSize() { int ans = 16 /* for accessSchemaID, indices.length, varBias, setCases.length, and getCases.length */ + 2*indices.length; // for the elements in indices for (int i = 0; i < setCases.length; i++) { int[] cases = setCases[i]; ans += 2; // for cases.length or null indicator if (cases != null) ans += 2 * cases.length; } for (int i = 0; i < getCases.length; i++) { int[] cases = getCases[i]; ans += 2; // for cases.length or null indicator if (cases != null) ans += 2 * cases.length; } return ans; }
[ "private", "int", "encodedSize", "(", ")", "{", "int", "ans", "=", "16", "/* for accessSchemaID, indices.length, varBias, setCases.length,\n and getCases.length */", "+", "2", "*", "indices", ".", "length", ";", "// for the elements in indices", "for", "(", "int", "i", "=", "0", ";", "i", "<", "setCases", ".", "length", ";", "i", "++", ")", "{", "int", "[", "]", "cases", "=", "setCases", "[", "i", "]", ";", "ans", "+=", "2", ";", "// for cases.length or null indicator", "if", "(", "cases", "!=", "null", ")", "ans", "+=", "2", "*", "cases", ".", "length", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "getCases", ".", "length", ";", "i", "++", ")", "{", "int", "[", "]", "cases", "=", "getCases", "[", "i", "]", ";", "ans", "+=", "2", ";", "// for cases.length or null indicator", "if", "(", "cases", "!=", "null", ")", "ans", "+=", "2", "*", "cases", ".", "length", ";", "}", "return", "ans", ";", "}" ]
Find the number of bytes it takes to encode this CompatibilityMap
[ "Find", "the", "number", "of", "bytes", "it", "takes", "to", "encode", "this", "CompatibilityMap" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/CompatibilityMap.java#L171-L189
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/CompatibilityMap.java
CompatibilityMap.violation
private static void violation(JMFType from, JMFType to) throws JMFSchemaViolationException { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) JmfTr.debug(tc, "Violation:" + " from = " + from.getFeatureName() + " : " + from + ", to = " + to.getFeatureName() + " : " + to ); throw new JMFSchemaViolationException(from.getFeatureName() + " not compatible with " + to.getFeatureName()); }
java
private static void violation(JMFType from, JMFType to) throws JMFSchemaViolationException { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) JmfTr.debug(tc, "Violation:" + " from = " + from.getFeatureName() + " : " + from + ", to = " + to.getFeatureName() + " : " + to ); throw new JMFSchemaViolationException(from.getFeatureName() + " not compatible with " + to.getFeatureName()); }
[ "private", "static", "void", "violation", "(", "JMFType", "from", ",", "JMFType", "to", ")", "throws", "JMFSchemaViolationException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "JmfTr", ".", "debug", "(", "tc", ",", "\"Violation:\"", "+", "\" from = \"", "+", "from", ".", "getFeatureName", "(", ")", "+", "\" : \"", "+", "from", "+", "\", to = \"", "+", "to", ".", "getFeatureName", "(", ")", "+", "\" : \"", "+", "to", ")", ";", "throw", "new", "JMFSchemaViolationException", "(", "from", ".", "getFeatureName", "(", ")", "+", "\" not compatible with \"", "+", "to", ".", "getFeatureName", "(", ")", ")", ";", "}" ]
Handle violation of the compatibility rules by throwing an informative exception
[ "Handle", "violation", "of", "the", "compatibility", "rules", "by", "throwing", "an", "informative", "exception" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/CompatibilityMap.java#L229-L235
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/CompatibilityMap.java
CompatibilityMap.recordOnePair
private void recordOnePair(JSField access, JSchema accSchema, JSField encoding, JSchema encSchema) { int acc = access.getAccessor(accSchema); if (acc >= indices.length) return; indices[acc] = encoding.getAccessor(encSchema); }
java
private void recordOnePair(JSField access, JSchema accSchema, JSField encoding, JSchema encSchema) { int acc = access.getAccessor(accSchema); if (acc >= indices.length) return; indices[acc] = encoding.getAccessor(encSchema); }
[ "private", "void", "recordOnePair", "(", "JSField", "access", ",", "JSchema", "accSchema", ",", "JSField", "encoding", ",", "JSchema", "encSchema", ")", "{", "int", "acc", "=", "access", ".", "getAccessor", "(", "accSchema", ")", ";", "if", "(", "acc", ">=", "indices", ".", "length", ")", "return", ";", "indices", "[", "acc", "]", "=", "encoding", ".", "getAccessor", "(", "encSchema", ")", ";", "}" ]
later when maps are built for variant box schemas.
[ "later", "when", "maps", "are", "built", "for", "variant", "box", "schemas", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/CompatibilityMap.java#L340-L347
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/CompatibilityMap.java
CompatibilityMap.checkForDeletingVariant
private void checkForDeletingVariant(JMFType nonVar, JSVariant var, boolean varIsAccess, JSchema accSchema, JSchema encSchema) throws JMFSchemaViolationException { // Deleting variant always has exactly two cases if (var.getCaseCount() != 2) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) JmfTr.debug(this, tc, "Compatibility violation (deleting variant):" + " var CaseCount = " + var.getCaseCount() + ", varIsAccess " + varIsAccess ); if (varIsAccess) { violation(var, nonVar); } else { violation(nonVar, var); } } if (isEmpty(var.getCase(1))) { // Second case is empty tuple, so we proceed to compare the first case to the // candidate deletable type. JMFType compare = var.getCase(0); if (varIsAccess) recordCompatibilityInfo(compare, accSchema, nonVar, encSchema); else recordCompatibilityInfo(nonVar, accSchema, compare, encSchema); } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) JmfTr.debug(this, tc, "Compatibility violation (deleting variant):" + " var Case(1) not empty" ); if (varIsAccess) { violation(var, nonVar); } else { violation(nonVar, var); } } }
java
private void checkForDeletingVariant(JMFType nonVar, JSVariant var, boolean varIsAccess, JSchema accSchema, JSchema encSchema) throws JMFSchemaViolationException { // Deleting variant always has exactly two cases if (var.getCaseCount() != 2) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) JmfTr.debug(this, tc, "Compatibility violation (deleting variant):" + " var CaseCount = " + var.getCaseCount() + ", varIsAccess " + varIsAccess ); if (varIsAccess) { violation(var, nonVar); } else { violation(nonVar, var); } } if (isEmpty(var.getCase(1))) { // Second case is empty tuple, so we proceed to compare the first case to the // candidate deletable type. JMFType compare = var.getCase(0); if (varIsAccess) recordCompatibilityInfo(compare, accSchema, nonVar, encSchema); else recordCompatibilityInfo(nonVar, accSchema, compare, encSchema); } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) JmfTr.debug(this, tc, "Compatibility violation (deleting variant):" + " var Case(1) not empty" ); if (varIsAccess) { violation(var, nonVar); } else { violation(nonVar, var); } } }
[ "private", "void", "checkForDeletingVariant", "(", "JMFType", "nonVar", ",", "JSVariant", "var", ",", "boolean", "varIsAccess", ",", "JSchema", "accSchema", ",", "JSchema", "encSchema", ")", "throws", "JMFSchemaViolationException", "{", "// Deleting variant always has exactly two cases", "if", "(", "var", ".", "getCaseCount", "(", ")", "!=", "2", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "JmfTr", ".", "debug", "(", "this", ",", "tc", ",", "\"Compatibility violation (deleting variant):\"", "+", "\" var CaseCount = \"", "+", "var", ".", "getCaseCount", "(", ")", "+", "\", varIsAccess \"", "+", "varIsAccess", ")", ";", "if", "(", "varIsAccess", ")", "{", "violation", "(", "var", ",", "nonVar", ")", ";", "}", "else", "{", "violation", "(", "nonVar", ",", "var", ")", ";", "}", "}", "if", "(", "isEmpty", "(", "var", ".", "getCase", "(", "1", ")", ")", ")", "{", "// Second case is empty tuple, so we proceed to compare the first case to the", "// candidate deletable type.", "JMFType", "compare", "=", "var", ".", "getCase", "(", "0", ")", ";", "if", "(", "varIsAccess", ")", "recordCompatibilityInfo", "(", "compare", ",", "accSchema", ",", "nonVar", ",", "encSchema", ")", ";", "else", "recordCompatibilityInfo", "(", "nonVar", ",", "accSchema", ",", "compare", ",", "encSchema", ")", ";", "}", "else", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "JmfTr", ".", "debug", "(", "this", ",", "tc", ",", "\"Compatibility violation (deleting variant):\"", "+", "\" var Case(1) not empty\"", ")", ";", "if", "(", "varIsAccess", ")", "{", "violation", "(", "var", ",", "nonVar", ")", ";", "}", "else", "{", "violation", "(", "nonVar", ",", "var", ")", ";", "}", "}", "}" ]
info stripping off the deleting variant.
[ "info", "stripping", "off", "the", "deleting", "variant", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/CompatibilityMap.java#L357-L393
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/CompatibilityMap.java
CompatibilityMap.checkExtraFields
private static void checkExtraFields(JSTuple tuple, int startCol, int count) throws JMFSchemaViolationException { for (int i = startCol; i < count; i++) { JMFType field = tuple.getField(i); if (field instanceof JSVariant) { JMFType firstCase = ((JSVariant)field).getCase(0); if (firstCase instanceof JSTuple) if (((JSTuple)firstCase).getFieldCount() == 0) continue; } throw new JMFSchemaViolationException(field.getFeatureName() + " not defaulting variant"); } }
java
private static void checkExtraFields(JSTuple tuple, int startCol, int count) throws JMFSchemaViolationException { for (int i = startCol; i < count; i++) { JMFType field = tuple.getField(i); if (field instanceof JSVariant) { JMFType firstCase = ((JSVariant)field).getCase(0); if (firstCase instanceof JSTuple) if (((JSTuple)firstCase).getFieldCount() == 0) continue; } throw new JMFSchemaViolationException(field.getFeatureName() + " not defaulting variant"); } }
[ "private", "static", "void", "checkExtraFields", "(", "JSTuple", "tuple", ",", "int", "startCol", ",", "int", "count", ")", "throws", "JMFSchemaViolationException", "{", "for", "(", "int", "i", "=", "startCol", ";", "i", "<", "count", ";", "i", "++", ")", "{", "JMFType", "field", "=", "tuple", ".", "getField", "(", "i", ")", ";", "if", "(", "field", "instanceof", "JSVariant", ")", "{", "JMFType", "firstCase", "=", "(", "(", "JSVariant", ")", "field", ")", ".", "getCase", "(", "0", ")", ";", "if", "(", "firstCase", "instanceof", "JSTuple", ")", "if", "(", "(", "(", "JSTuple", ")", "firstCase", ")", ".", "getFieldCount", "(", ")", "==", "0", ")", "continue", ";", "}", "throw", "new", "JMFSchemaViolationException", "(", "field", ".", "getFeatureName", "(", ")", "+", "\" not defaulting variant\"", ")", ";", "}", "}" ]
Check the extra columns in a tuple to make sure they are all defaultable
[ "Check", "the", "extra", "columns", "in", "a", "tuple", "to", "make", "sure", "they", "are", "all", "defaultable" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/CompatibilityMap.java#L476-L487
train
OpenLiberty/open-liberty
dev/com.ibm.ws.microprofile.config.1.1/src/com/ibm/ws/microprofile/config/archaius/cache/TypeContainer.java
TypeContainer.asType
public StampedValue asType(final Type type) { StampedValue cachedValue = null; //looping around a list is probably quicker than having a map since there are probably only one or two different //types in use at any one time for (StampedValue value : typeCache) { if (value.getType().equals(type)) { cachedValue = value; break; } } if (cachedValue == null) { StampedValue newValue = new StampedValue(type, this, config); typeCache.add(newValue); cachedValue = newValue; } return cachedValue; }
java
public StampedValue asType(final Type type) { StampedValue cachedValue = null; //looping around a list is probably quicker than having a map since there are probably only one or two different //types in use at any one time for (StampedValue value : typeCache) { if (value.getType().equals(type)) { cachedValue = value; break; } } if (cachedValue == null) { StampedValue newValue = new StampedValue(type, this, config); typeCache.add(newValue); cachedValue = newValue; } return cachedValue; }
[ "public", "StampedValue", "asType", "(", "final", "Type", "type", ")", "{", "StampedValue", "cachedValue", "=", "null", ";", "//looping around a list is probably quicker than having a map since there are probably only one or two different", "//types in use at any one time", "for", "(", "StampedValue", "value", ":", "typeCache", ")", "{", "if", "(", "value", ".", "getType", "(", ")", ".", "equals", "(", "type", ")", ")", "{", "cachedValue", "=", "value", ";", "break", ";", "}", "}", "if", "(", "cachedValue", "==", "null", ")", "{", "StampedValue", "newValue", "=", "new", "StampedValue", "(", "type", ",", "this", ",", "config", ")", ";", "typeCache", ".", "add", "(", "newValue", ")", ";", "cachedValue", "=", "newValue", ";", "}", "return", "cachedValue", ";", "}" ]
Check if a StampedValue already exists for the type, if it does, return it, otherwise create a new one and add it @param type @return
[ "Check", "if", "a", "StampedValue", "already", "exists", "for", "the", "type", "if", "it", "does", "return", "it", "otherwise", "create", "a", "new", "one", "and", "add", "it" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.config.1.1/src/com/ibm/ws/microprofile/config/archaius/cache/TypeContainer.java#L74-L93
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/jsf/ComponentSupport.java
ComponentSupport.finalizeForDeletion
@Deprecated public static void finalizeForDeletion(UIComponent component) { // remove any existing marks of deletion component.getAttributes().remove(MARK_DELETED); // finally remove any children marked as deleted if (component.getChildCount() > 0) { for (Iterator<UIComponent> iter = component.getChildren().iterator(); iter.hasNext();) { UIComponent child = iter.next(); if (child.getAttributes().containsKey(MARK_DELETED)) { iter.remove(); } } } // remove any facets marked as deleted if (component.getFacetCount() > 0) { Map<String, UIComponent> facets = component.getFacets(); Collection<UIComponent> col = facets.values(); for (Iterator<UIComponent> itr = col.iterator(); itr.hasNext();) { UIComponent fc = itr.next(); if (fc.getAttributes().containsKey(MARK_DELETED)) { itr.remove(); } } } }
java
@Deprecated public static void finalizeForDeletion(UIComponent component) { // remove any existing marks of deletion component.getAttributes().remove(MARK_DELETED); // finally remove any children marked as deleted if (component.getChildCount() > 0) { for (Iterator<UIComponent> iter = component.getChildren().iterator(); iter.hasNext();) { UIComponent child = iter.next(); if (child.getAttributes().containsKey(MARK_DELETED)) { iter.remove(); } } } // remove any facets marked as deleted if (component.getFacetCount() > 0) { Map<String, UIComponent> facets = component.getFacets(); Collection<UIComponent> col = facets.values(); for (Iterator<UIComponent> itr = col.iterator(); itr.hasNext();) { UIComponent fc = itr.next(); if (fc.getAttributes().containsKey(MARK_DELETED)) { itr.remove(); } } } }
[ "@", "Deprecated", "public", "static", "void", "finalizeForDeletion", "(", "UIComponent", "component", ")", "{", "// remove any existing marks of deletion", "component", ".", "getAttributes", "(", ")", ".", "remove", "(", "MARK_DELETED", ")", ";", "// finally remove any children marked as deleted", "if", "(", "component", ".", "getChildCount", "(", ")", ">", "0", ")", "{", "for", "(", "Iterator", "<", "UIComponent", ">", "iter", "=", "component", ".", "getChildren", "(", ")", ".", "iterator", "(", ")", ";", "iter", ".", "hasNext", "(", ")", ";", ")", "{", "UIComponent", "child", "=", "iter", ".", "next", "(", ")", ";", "if", "(", "child", ".", "getAttributes", "(", ")", ".", "containsKey", "(", "MARK_DELETED", ")", ")", "{", "iter", ".", "remove", "(", ")", ";", "}", "}", "}", "// remove any facets marked as deleted", "if", "(", "component", ".", "getFacetCount", "(", ")", ">", "0", ")", "{", "Map", "<", "String", ",", "UIComponent", ">", "facets", "=", "component", ".", "getFacets", "(", ")", ";", "Collection", "<", "UIComponent", ">", "col", "=", "facets", ".", "values", "(", ")", ";", "for", "(", "Iterator", "<", "UIComponent", ">", "itr", "=", "col", ".", "iterator", "(", ")", ";", "itr", ".", "hasNext", "(", ")", ";", ")", "{", "UIComponent", "fc", "=", "itr", ".", "next", "(", ")", ";", "if", "(", "fc", ".", "getAttributes", "(", ")", ".", "containsKey", "(", "MARK_DELETED", ")", ")", "{", "itr", ".", "remove", "(", ")", ";", "}", "}", "}", "}" ]
Used in conjunction with markForDeletion where any UIComponent marked will be removed. @deprecated use FaceletCompositionContext.finalizeForDeletion @param component UIComponent to finalize
[ "Used", "in", "conjunction", "with", "markForDeletion", "where", "any", "UIComponent", "marked", "will", "be", "removed", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/jsf/ComponentSupport.java#L108-L141
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/jsf/ComponentSupport.java
ComponentSupport.findChild
public static UIComponent findChild(UIComponent parent, String id) { int childCount = parent.getChildCount(); if (childCount > 0) { for (int i = 0; i < childCount; i++) { UIComponent child = parent.getChildren().get(i); if (id.equals(child.getId())) { return child; } } } return null; }
java
public static UIComponent findChild(UIComponent parent, String id) { int childCount = parent.getChildCount(); if (childCount > 0) { for (int i = 0; i < childCount; i++) { UIComponent child = parent.getChildren().get(i); if (id.equals(child.getId())) { return child; } } } return null; }
[ "public", "static", "UIComponent", "findChild", "(", "UIComponent", "parent", ",", "String", "id", ")", "{", "int", "childCount", "=", "parent", ".", "getChildCount", "(", ")", ";", "if", "(", "childCount", ">", "0", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "childCount", ";", "i", "++", ")", "{", "UIComponent", "child", "=", "parent", ".", "getChildren", "(", ")", ".", "get", "(", "i", ")", ";", "if", "(", "id", ".", "equals", "(", "child", ".", "getId", "(", ")", ")", ")", "{", "return", "child", ";", "}", "}", "}", "return", "null", ";", "}" ]
A lighter-weight version of UIComponent's findChild. @param parent parent to start searching from @param id to match to @return UIComponent found or null
[ "A", "lighter", "-", "weight", "version", "of", "UIComponent", "s", "findChild", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/jsf/ComponentSupport.java#L152-L167
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/jsf/ComponentSupport.java
ComponentSupport.findChildByTagId
public static UIComponent findChildByTagId(UIComponent parent, String id) { Iterator<UIComponent> itr = null; if (parent.getChildCount() > 0) { for (int i = 0, childCount = parent.getChildCount(); i < childCount; i ++) { UIComponent child = parent.getChildren().get(i); if (id.equals(child.getAttributes().get(MARK_CREATED))) { return child; } } } if (parent.getFacetCount() > 0) { itr = parent.getFacets().values().iterator(); while (itr.hasNext()) { UIComponent facet = itr.next(); // check if this is a dynamically generated UIPanel if (Boolean.TRUE.equals(facet.getAttributes() .get(FACET_CREATED_UIPANEL_MARKER))) { // only check the children and facets of the panel if (facet.getChildCount() > 0) { for (int i = 0, childCount = facet.getChildCount(); i < childCount; i ++) { UIComponent child = facet.getChildren().get(i); if (id.equals(child.getAttributes().get(MARK_CREATED))) { return child; } } } if (facet.getFacetCount() > 0) { Iterator<UIComponent> itr2 = facet.getFacets().values().iterator(); while (itr2.hasNext()) { UIComponent child = itr2.next(); if (id.equals(child.getAttributes().get(MARK_CREATED))) { return child; } } } } else if (id.equals(facet.getAttributes().get(MARK_CREATED))) { return facet; } } } return null; }
java
public static UIComponent findChildByTagId(UIComponent parent, String id) { Iterator<UIComponent> itr = null; if (parent.getChildCount() > 0) { for (int i = 0, childCount = parent.getChildCount(); i < childCount; i ++) { UIComponent child = parent.getChildren().get(i); if (id.equals(child.getAttributes().get(MARK_CREATED))) { return child; } } } if (parent.getFacetCount() > 0) { itr = parent.getFacets().values().iterator(); while (itr.hasNext()) { UIComponent facet = itr.next(); // check if this is a dynamically generated UIPanel if (Boolean.TRUE.equals(facet.getAttributes() .get(FACET_CREATED_UIPANEL_MARKER))) { // only check the children and facets of the panel if (facet.getChildCount() > 0) { for (int i = 0, childCount = facet.getChildCount(); i < childCount; i ++) { UIComponent child = facet.getChildren().get(i); if (id.equals(child.getAttributes().get(MARK_CREATED))) { return child; } } } if (facet.getFacetCount() > 0) { Iterator<UIComponent> itr2 = facet.getFacets().values().iterator(); while (itr2.hasNext()) { UIComponent child = itr2.next(); if (id.equals(child.getAttributes().get(MARK_CREATED))) { return child; } } } } else if (id.equals(facet.getAttributes().get(MARK_CREATED))) { return facet; } } } return null; }
[ "public", "static", "UIComponent", "findChildByTagId", "(", "UIComponent", "parent", ",", "String", "id", ")", "{", "Iterator", "<", "UIComponent", ">", "itr", "=", "null", ";", "if", "(", "parent", ".", "getChildCount", "(", ")", ">", "0", ")", "{", "for", "(", "int", "i", "=", "0", ",", "childCount", "=", "parent", ".", "getChildCount", "(", ")", ";", "i", "<", "childCount", ";", "i", "++", ")", "{", "UIComponent", "child", "=", "parent", ".", "getChildren", "(", ")", ".", "get", "(", "i", ")", ";", "if", "(", "id", ".", "equals", "(", "child", ".", "getAttributes", "(", ")", ".", "get", "(", "MARK_CREATED", ")", ")", ")", "{", "return", "child", ";", "}", "}", "}", "if", "(", "parent", ".", "getFacetCount", "(", ")", ">", "0", ")", "{", "itr", "=", "parent", ".", "getFacets", "(", ")", ".", "values", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "itr", ".", "hasNext", "(", ")", ")", "{", "UIComponent", "facet", "=", "itr", ".", "next", "(", ")", ";", "// check if this is a dynamically generated UIPanel", "if", "(", "Boolean", ".", "TRUE", ".", "equals", "(", "facet", ".", "getAttributes", "(", ")", ".", "get", "(", "FACET_CREATED_UIPANEL_MARKER", ")", ")", ")", "{", "// only check the children and facets of the panel", "if", "(", "facet", ".", "getChildCount", "(", ")", ">", "0", ")", "{", "for", "(", "int", "i", "=", "0", ",", "childCount", "=", "facet", ".", "getChildCount", "(", ")", ";", "i", "<", "childCount", ";", "i", "++", ")", "{", "UIComponent", "child", "=", "facet", ".", "getChildren", "(", ")", ".", "get", "(", "i", ")", ";", "if", "(", "id", ".", "equals", "(", "child", ".", "getAttributes", "(", ")", ".", "get", "(", "MARK_CREATED", ")", ")", ")", "{", "return", "child", ";", "}", "}", "}", "if", "(", "facet", ".", "getFacetCount", "(", ")", ">", "0", ")", "{", "Iterator", "<", "UIComponent", ">", "itr2", "=", "facet", ".", "getFacets", "(", ")", ".", "values", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "itr2", ".", "hasNext", "(", ")", ")", "{", "UIComponent", "child", "=", "itr2", ".", "next", "(", ")", ";", "if", "(", "id", ".", "equals", "(", "child", ".", "getAttributes", "(", ")", ".", "get", "(", "MARK_CREATED", ")", ")", ")", "{", "return", "child", ";", "}", "}", "}", "}", "else", "if", "(", "id", ".", "equals", "(", "facet", ".", "getAttributes", "(", ")", ".", "get", "(", "MARK_CREATED", ")", ")", ")", "{", "return", "facet", ";", "}", "}", "}", "return", "null", ";", "}" ]
By TagId, find Child @param parent @param id @return
[ "By", "TagId", "find", "Child" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/jsf/ComponentSupport.java#L286-L343
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/jsf/ComponentSupport.java
ComponentSupport.getLocale
public static Locale getLocale(FaceletContext ctx, TagAttribute attr) throws TagAttributeException { Object obj = attr.getObject(ctx); if (obj instanceof Locale) { return (Locale) obj; } if (obj instanceof String) { String s = (String) obj; if (s.length() == 2) { return new Locale(s); } if (s.length() == 5) { return new Locale(s.substring(0, 2), s.substring(3, 5).toUpperCase()); } if (s.length() >= 7) { return new Locale(s.substring(0, 2), s.substring(3, 5).toUpperCase(), s.substring(6, s.length())); } throw new TagAttributeException(attr, "Invalid Locale Specified: " + s); } else { throw new TagAttributeException(attr, "Attribute did not evaluate to a String or Locale: " + obj); } }
java
public static Locale getLocale(FaceletContext ctx, TagAttribute attr) throws TagAttributeException { Object obj = attr.getObject(ctx); if (obj instanceof Locale) { return (Locale) obj; } if (obj instanceof String) { String s = (String) obj; if (s.length() == 2) { return new Locale(s); } if (s.length() == 5) { return new Locale(s.substring(0, 2), s.substring(3, 5).toUpperCase()); } if (s.length() >= 7) { return new Locale(s.substring(0, 2), s.substring(3, 5).toUpperCase(), s.substring(6, s.length())); } throw new TagAttributeException(attr, "Invalid Locale Specified: " + s); } else { throw new TagAttributeException(attr, "Attribute did not evaluate to a String or Locale: " + obj); } }
[ "public", "static", "Locale", "getLocale", "(", "FaceletContext", "ctx", ",", "TagAttribute", "attr", ")", "throws", "TagAttributeException", "{", "Object", "obj", "=", "attr", ".", "getObject", "(", "ctx", ")", ";", "if", "(", "obj", "instanceof", "Locale", ")", "{", "return", "(", "Locale", ")", "obj", ";", "}", "if", "(", "obj", "instanceof", "String", ")", "{", "String", "s", "=", "(", "String", ")", "obj", ";", "if", "(", "s", ".", "length", "(", ")", "==", "2", ")", "{", "return", "new", "Locale", "(", "s", ")", ";", "}", "if", "(", "s", ".", "length", "(", ")", "==", "5", ")", "{", "return", "new", "Locale", "(", "s", ".", "substring", "(", "0", ",", "2", ")", ",", "s", ".", "substring", "(", "3", ",", "5", ")", ".", "toUpperCase", "(", ")", ")", ";", "}", "if", "(", "s", ".", "length", "(", ")", ">=", "7", ")", "{", "return", "new", "Locale", "(", "s", ".", "substring", "(", "0", ",", "2", ")", ",", "s", ".", "substring", "(", "3", ",", "5", ")", ".", "toUpperCase", "(", ")", ",", "s", ".", "substring", "(", "6", ",", "s", ".", "length", "(", ")", ")", ")", ";", "}", "throw", "new", "TagAttributeException", "(", "attr", ",", "\"Invalid Locale Specified: \"", "+", "s", ")", ";", "}", "else", "{", "throw", "new", "TagAttributeException", "(", "attr", ",", "\"Attribute did not evaluate to a String or Locale: \"", "+", "obj", ")", ";", "}", "}" ]
According to JSF 1.2 tag specs, this helper method will use the TagAttribute passed in determining the Locale intended. @param ctx FaceletContext to evaluate from @param attr TagAttribute representing a Locale @return Locale found @throws TagAttributeException if the Locale cannot be determined
[ "According", "to", "JSF", "1", ".", "2", "tag", "specs", "this", "helper", "method", "will", "use", "the", "TagAttribute", "passed", "in", "determining", "the", "Locale", "intended", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/jsf/ComponentSupport.java#L405-L436
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/jsf/ComponentSupport.java
ComponentSupport.getViewRoot
public static UIViewRoot getViewRoot(FaceletContext ctx, UIComponent parent) { UIComponent c = parent; do { if (c instanceof UIViewRoot) { return (UIViewRoot) c; } else { c = c.getParent(); } } while (c != null); UIViewRoot root = ctx.getFacesContext().getViewRoot(); if (root == null) { root = FaceletCompositionContext.getCurrentInstance(ctx).getViewRoot(ctx.getFacesContext()); } return root; }
java
public static UIViewRoot getViewRoot(FaceletContext ctx, UIComponent parent) { UIComponent c = parent; do { if (c instanceof UIViewRoot) { return (UIViewRoot) c; } else { c = c.getParent(); } } while (c != null); UIViewRoot root = ctx.getFacesContext().getViewRoot(); if (root == null) { root = FaceletCompositionContext.getCurrentInstance(ctx).getViewRoot(ctx.getFacesContext()); } return root; }
[ "public", "static", "UIViewRoot", "getViewRoot", "(", "FaceletContext", "ctx", ",", "UIComponent", "parent", ")", "{", "UIComponent", "c", "=", "parent", ";", "do", "{", "if", "(", "c", "instanceof", "UIViewRoot", ")", "{", "return", "(", "UIViewRoot", ")", "c", ";", "}", "else", "{", "c", "=", "c", ".", "getParent", "(", ")", ";", "}", "}", "while", "(", "c", "!=", "null", ")", ";", "UIViewRoot", "root", "=", "ctx", ".", "getFacesContext", "(", ")", ".", "getViewRoot", "(", ")", ";", "if", "(", "root", "==", "null", ")", "{", "root", "=", "FaceletCompositionContext", ".", "getCurrentInstance", "(", "ctx", ")", ".", "getViewRoot", "(", "ctx", ".", "getFacesContext", "(", ")", ")", ";", "}", "return", "root", ";", "}" ]
Tries to walk up the parent to find the UIViewRoot, if not found, then go to FaceletContext's FacesContext for the view root. @param ctx FaceletContext @param parent UIComponent to search from @return UIViewRoot instance for this evaluation
[ "Tries", "to", "walk", "up", "the", "parent", "to", "find", "the", "UIViewRoot", "if", "not", "found", "then", "go", "to", "FaceletContext", "s", "FacesContext", "for", "the", "view", "root", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/jsf/ComponentSupport.java#L448-L469
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/jsf/ComponentSupport.java
ComponentSupport.markForDeletion
@Deprecated public static void markForDeletion(UIComponent component) { // flag this component as deleted component.getAttributes().put(MARK_DELETED, Boolean.TRUE); Iterator<UIComponent> iter = component.getFacetsAndChildren(); while (iter.hasNext()) { UIComponent child = iter.next(); if (child.getAttributes().containsKey(MARK_CREATED)) { child.getAttributes().put(MARK_DELETED, Boolean.TRUE); } } }
java
@Deprecated public static void markForDeletion(UIComponent component) { // flag this component as deleted component.getAttributes().put(MARK_DELETED, Boolean.TRUE); Iterator<UIComponent> iter = component.getFacetsAndChildren(); while (iter.hasNext()) { UIComponent child = iter.next(); if (child.getAttributes().containsKey(MARK_CREATED)) { child.getAttributes().put(MARK_DELETED, Boolean.TRUE); } } }
[ "@", "Deprecated", "public", "static", "void", "markForDeletion", "(", "UIComponent", "component", ")", "{", "// flag this component as deleted", "component", ".", "getAttributes", "(", ")", ".", "put", "(", "MARK_DELETED", ",", "Boolean", ".", "TRUE", ")", ";", "Iterator", "<", "UIComponent", ">", "iter", "=", "component", ".", "getFacetsAndChildren", "(", ")", ";", "while", "(", "iter", ".", "hasNext", "(", ")", ")", "{", "UIComponent", "child", "=", "iter", ".", "next", "(", ")", ";", "if", "(", "child", ".", "getAttributes", "(", ")", ".", "containsKey", "(", "MARK_CREATED", ")", ")", "{", "child", ".", "getAttributes", "(", ")", ".", "put", "(", "MARK_DELETED", ",", "Boolean", ".", "TRUE", ")", ";", "}", "}", "}" ]
Marks all direct children and Facets with an attribute for deletion. @deprecated use FaceletCompositionContext.markForDeletion @see #finalizeForDeletion(UIComponent) @param component UIComponent to mark
[ "Marks", "all", "direct", "children", "and", "Facets", "with", "an", "attribute", "for", "deletion", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/jsf/ComponentSupport.java#L479-L494
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/jsf/ComponentSupport.java
ComponentSupport.createFacetUIPanel
private static UIComponent createFacetUIPanel(FaceletContext ctx, UIComponent parent, String facetName) { FacesContext facesContext = ctx.getFacesContext(); UIComponent panel = facesContext.getApplication().createComponent(facesContext, UIPanel.COMPONENT_TYPE, null); // The panel created by this method is special. To be restored properly and do not // create duplicate ids or any other unwanted conflicts, it requires an unique id. // This code is usually called when more than one component is added to a facet and // it is necessary to create a shared container. // Use FaceletCompositionContext.generateUniqueComponentId() is not possible, because // <c:if> blocks inside a facet will make component ids unstable. Use UniqueIdVendor // is feasible but also will be affected by <c:if> blocks inside a facet. // The only solution that will generate real unique ids is use the parent id and the // facet name and derive an unique id that cannot be generated by SectionUniqueIdCounter, // doing the same trick as with metadata: use a double __ and add a prefix (f). // Note this id will never be printed into the response, because this is just a container. FaceletCompositionContext mctx = FaceletCompositionContext.getCurrentInstance(ctx); UniqueIdVendor uniqueIdVendor = mctx.getUniqueIdVendorFromStack(); if (uniqueIdVendor == null) { uniqueIdVendor = ComponentSupport.getViewRoot(ctx, parent); } if (uniqueIdVendor != null) { // UIViewRoot implements UniqueIdVendor, so there is no need to cast to UIViewRoot // and call createUniqueId(). See ComponentTagHandlerDelegate int index = facetName.indexOf('.'); String cleanFacetName = facetName; if (index >= 0) { cleanFacetName = facetName.replace('.', '_'); } panel.setId(uniqueIdVendor.createUniqueId(facesContext, mctx.getSharedStringBuilder() .append(parent.getId()) .append("__f_") .append(cleanFacetName).toString())); } panel.getAttributes().put(FACET_CREATED_UIPANEL_MARKER, Boolean.TRUE); panel.getAttributes().put(ComponentSupport.COMPONENT_ADDED_BY_HANDLER_MARKER, Boolean.TRUE); return panel; }
java
private static UIComponent createFacetUIPanel(FaceletContext ctx, UIComponent parent, String facetName) { FacesContext facesContext = ctx.getFacesContext(); UIComponent panel = facesContext.getApplication().createComponent(facesContext, UIPanel.COMPONENT_TYPE, null); // The panel created by this method is special. To be restored properly and do not // create duplicate ids or any other unwanted conflicts, it requires an unique id. // This code is usually called when more than one component is added to a facet and // it is necessary to create a shared container. // Use FaceletCompositionContext.generateUniqueComponentId() is not possible, because // <c:if> blocks inside a facet will make component ids unstable. Use UniqueIdVendor // is feasible but also will be affected by <c:if> blocks inside a facet. // The only solution that will generate real unique ids is use the parent id and the // facet name and derive an unique id that cannot be generated by SectionUniqueIdCounter, // doing the same trick as with metadata: use a double __ and add a prefix (f). // Note this id will never be printed into the response, because this is just a container. FaceletCompositionContext mctx = FaceletCompositionContext.getCurrentInstance(ctx); UniqueIdVendor uniqueIdVendor = mctx.getUniqueIdVendorFromStack(); if (uniqueIdVendor == null) { uniqueIdVendor = ComponentSupport.getViewRoot(ctx, parent); } if (uniqueIdVendor != null) { // UIViewRoot implements UniqueIdVendor, so there is no need to cast to UIViewRoot // and call createUniqueId(). See ComponentTagHandlerDelegate int index = facetName.indexOf('.'); String cleanFacetName = facetName; if (index >= 0) { cleanFacetName = facetName.replace('.', '_'); } panel.setId(uniqueIdVendor.createUniqueId(facesContext, mctx.getSharedStringBuilder() .append(parent.getId()) .append("__f_") .append(cleanFacetName).toString())); } panel.getAttributes().put(FACET_CREATED_UIPANEL_MARKER, Boolean.TRUE); panel.getAttributes().put(ComponentSupport.COMPONENT_ADDED_BY_HANDLER_MARKER, Boolean.TRUE); return panel; }
[ "private", "static", "UIComponent", "createFacetUIPanel", "(", "FaceletContext", "ctx", ",", "UIComponent", "parent", ",", "String", "facetName", ")", "{", "FacesContext", "facesContext", "=", "ctx", ".", "getFacesContext", "(", ")", ";", "UIComponent", "panel", "=", "facesContext", ".", "getApplication", "(", ")", ".", "createComponent", "(", "facesContext", ",", "UIPanel", ".", "COMPONENT_TYPE", ",", "null", ")", ";", "// The panel created by this method is special. To be restored properly and do not", "// create duplicate ids or any other unwanted conflicts, it requires an unique id.", "// This code is usually called when more than one component is added to a facet and", "// it is necessary to create a shared container.", "// Use FaceletCompositionContext.generateUniqueComponentId() is not possible, because", "// <c:if> blocks inside a facet will make component ids unstable. Use UniqueIdVendor", "// is feasible but also will be affected by <c:if> blocks inside a facet.", "// The only solution that will generate real unique ids is use the parent id and the", "// facet name and derive an unique id that cannot be generated by SectionUniqueIdCounter,", "// doing the same trick as with metadata: use a double __ and add a prefix (f).", "// Note this id will never be printed into the response, because this is just a container.", "FaceletCompositionContext", "mctx", "=", "FaceletCompositionContext", ".", "getCurrentInstance", "(", "ctx", ")", ";", "UniqueIdVendor", "uniqueIdVendor", "=", "mctx", ".", "getUniqueIdVendorFromStack", "(", ")", ";", "if", "(", "uniqueIdVendor", "==", "null", ")", "{", "uniqueIdVendor", "=", "ComponentSupport", ".", "getViewRoot", "(", "ctx", ",", "parent", ")", ";", "}", "if", "(", "uniqueIdVendor", "!=", "null", ")", "{", "// UIViewRoot implements UniqueIdVendor, so there is no need to cast to UIViewRoot", "// and call createUniqueId(). See ComponentTagHandlerDelegate", "int", "index", "=", "facetName", ".", "indexOf", "(", "'", "'", ")", ";", "String", "cleanFacetName", "=", "facetName", ";", "if", "(", "index", ">=", "0", ")", "{", "cleanFacetName", "=", "facetName", ".", "replace", "(", "'", "'", ",", "'", "'", ")", ";", "}", "panel", ".", "setId", "(", "uniqueIdVendor", ".", "createUniqueId", "(", "facesContext", ",", "mctx", ".", "getSharedStringBuilder", "(", ")", ".", "append", "(", "parent", ".", "getId", "(", ")", ")", ".", "append", "(", "\"__f_\"", ")", ".", "append", "(", "cleanFacetName", ")", ".", "toString", "(", ")", ")", ")", ";", "}", "panel", ".", "getAttributes", "(", ")", ".", "put", "(", "FACET_CREATED_UIPANEL_MARKER", ",", "Boolean", ".", "TRUE", ")", ";", "panel", ".", "getAttributes", "(", ")", ".", "put", "(", "ComponentSupport", ".", "COMPONENT_ADDED_BY_HANDLER_MARKER", ",", "Boolean", ".", "TRUE", ")", ";", "return", "panel", ";", "}" ]
Create a new UIPanel for the use as a dynamically created container for multiple children in a facet. Duplicate in javax.faces.webapp.UIComponentClassicTagBase. @param facesContext @return
[ "Create", "a", "new", "UIPanel", "for", "the", "use", "as", "a", "dynamically", "created", "container", "for", "multiple", "children", "in", "a", "facet", ".", "Duplicate", "in", "javax", ".", "faces", ".", "webapp", ".", "UIComponentClassicTagBase", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/jsf/ComponentSupport.java#L577-L618
train
OpenLiberty/open-liberty
dev/com.ibm.ws.threading/src/com/ibm/ws/threading/PolicyExecutorProvider.java
PolicyExecutorProvider.create
public PolicyExecutor create(Map<String, Object> props) { PolicyExecutor executor = new PolicyExecutorImpl((ExecutorServiceImpl) globalExecutor, (String) props.get("config.displayId"), null, policyExecutors); executor.updateConfig(props); return executor; }
java
public PolicyExecutor create(Map<String, Object> props) { PolicyExecutor executor = new PolicyExecutorImpl((ExecutorServiceImpl) globalExecutor, (String) props.get("config.displayId"), null, policyExecutors); executor.updateConfig(props); return executor; }
[ "public", "PolicyExecutor", "create", "(", "Map", "<", "String", ",", "Object", ">", "props", ")", "{", "PolicyExecutor", "executor", "=", "new", "PolicyExecutorImpl", "(", "(", "ExecutorServiceImpl", ")", "globalExecutor", ",", "(", "String", ")", "props", ".", "get", "(", "\"config.displayId\"", ")", ",", "null", ",", "policyExecutors", ")", ";", "executor", ".", "updateConfig", "(", "props", ")", ";", "return", "executor", ";", "}" ]
Creates a new policy executor instance and initializes it per the specified OSGi service component properties. The config.displayId of the OSGi service component properties is used as the unique identifier. @param props properties for a configuration-based OSGi service component instance. For example, an instance of concurrencyPolicy. @return a new policy executor instance. @throws IllegalStateException if an instance with the specified unique identifier already exists and has not been shut down. @throws NullPointerException if the specified identifier is null
[ "Creates", "a", "new", "policy", "executor", "instance", "and", "initializes", "it", "per", "the", "specified", "OSGi", "service", "component", "properties", ".", "The", "config", ".", "displayId", "of", "the", "OSGi", "service", "component", "properties", "is", "used", "as", "the", "unique", "identifier", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.threading/src/com/ibm/ws/threading/PolicyExecutorProvider.java#L66-L70
train
OpenLiberty/open-liberty
dev/com.ibm.ws.threading/src/com/ibm/ws/threading/PolicyExecutorProvider.java
PolicyExecutorProvider.create
public PolicyExecutor create(String identifier) { return new PolicyExecutorImpl((ExecutorServiceImpl) globalExecutor, "PolicyExecutorProvider-" + identifier, null, policyExecutors); }
java
public PolicyExecutor create(String identifier) { return new PolicyExecutorImpl((ExecutorServiceImpl) globalExecutor, "PolicyExecutorProvider-" + identifier, null, policyExecutors); }
[ "public", "PolicyExecutor", "create", "(", "String", "identifier", ")", "{", "return", "new", "PolicyExecutorImpl", "(", "(", "ExecutorServiceImpl", ")", "globalExecutor", ",", "\"PolicyExecutorProvider-\"", "+", "identifier", ",", "null", ",", "policyExecutors", ")", ";", "}" ]
Creates a new policy executor instance. @param identifier unique identifier for the new instance, to be used for monitoring and problem determination. Note: The prefix, PolicyExecutorProvider-, is prepended to the identifier. @return a new policy executor instance. @throws IllegalStateException if an instance with the specified unique identifier already exists and has not been shut down. @throws NullPointerException if the specified identifier is null
[ "Creates", "a", "new", "policy", "executor", "instance", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.threading/src/com/ibm/ws/threading/PolicyExecutorProvider.java#L81-L83
train
OpenLiberty/open-liberty
dev/com.ibm.ws.threading/src/com/ibm/ws/threading/PolicyExecutorProvider.java
PolicyExecutorProvider.create
public PolicyExecutor create(String fullIdentifier, String owner) { return new PolicyExecutorImpl((ExecutorServiceImpl) globalExecutor, fullIdentifier, owner, policyExecutors); }
java
public PolicyExecutor create(String fullIdentifier, String owner) { return new PolicyExecutorImpl((ExecutorServiceImpl) globalExecutor, fullIdentifier, owner, policyExecutors); }
[ "public", "PolicyExecutor", "create", "(", "String", "fullIdentifier", ",", "String", "owner", ")", "{", "return", "new", "PolicyExecutorImpl", "(", "(", "ExecutorServiceImpl", ")", "globalExecutor", ",", "fullIdentifier", ",", "owner", ",", "policyExecutors", ")", ";", "}" ]
Creates a new policy executor instance for use by a single application. Policy executors owned by this application can be shut down via the shutdownNow method of this class. @param fullIdentifier unique identifier for the new instance, to be used for monitoring and problem determination. @param owner name of application that the policy executor is created for. @return a new policy executor instance. @throws IllegalStateException if an instance with the specified unique identifier already exists and has not been shut down. @throws NullPointerException if the specified identifier is null
[ "Creates", "a", "new", "policy", "executor", "instance", "for", "use", "by", "a", "single", "application", ".", "Policy", "executors", "owned", "by", "this", "application", "can", "be", "shut", "down", "via", "the", "shutdownNow", "method", "of", "this", "class", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.threading/src/com/ibm/ws/threading/PolicyExecutorProvider.java#L95-L97
train
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/csi/FileBeanStore.java
FileBeanStore.getGZIPOutputStream
public GZIPOutputStream getGZIPOutputStream(BeanId beanId) throws CSIException { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(tc, "getOutputStream", beanId); final String fileName = getPortableFilename(beanId); final long beanTimeoutTime = getBeanTimeoutTime(beanId); GZIPOutputStream result = null; try { result = (GZIPOutputStream) AccessController.doPrivileged(new PrivilegedExceptionAction<GZIPOutputStream>() { public GZIPOutputStream run() throws IOException { File statefulBeanFile = getStatefulBeanFile(fileName, false); FileOutputStream fos = EJSPlatformHelper.isZOS() ? new WSFileOutputStream(statefulBeanFile, beanTimeoutTime) : new FileOutputStream(statefulBeanFile); return new GZIPOutputStream(fos); // d651126 } }); } catch (PrivilegedActionException ex2) { Exception ex = ex2.getException(); FFDCFilter.processException(ex, CLASS_NAME + ".getOutputStream", "127", this); Tr.warning(tc, "IOEXCEPTION_WRITING_FILE_FOR_STATEFUL_SESSION_BEAN_CNTR0025W", new Object[] { fileName, this, ex }); //p111002.3 throw new CSIException("Unable to open output stream", ex); } if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "getOutputStream"); return result; }
java
public GZIPOutputStream getGZIPOutputStream(BeanId beanId) throws CSIException { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(tc, "getOutputStream", beanId); final String fileName = getPortableFilename(beanId); final long beanTimeoutTime = getBeanTimeoutTime(beanId); GZIPOutputStream result = null; try { result = (GZIPOutputStream) AccessController.doPrivileged(new PrivilegedExceptionAction<GZIPOutputStream>() { public GZIPOutputStream run() throws IOException { File statefulBeanFile = getStatefulBeanFile(fileName, false); FileOutputStream fos = EJSPlatformHelper.isZOS() ? new WSFileOutputStream(statefulBeanFile, beanTimeoutTime) : new FileOutputStream(statefulBeanFile); return new GZIPOutputStream(fos); // d651126 } }); } catch (PrivilegedActionException ex2) { Exception ex = ex2.getException(); FFDCFilter.processException(ex, CLASS_NAME + ".getOutputStream", "127", this); Tr.warning(tc, "IOEXCEPTION_WRITING_FILE_FOR_STATEFUL_SESSION_BEAN_CNTR0025W", new Object[] { fileName, this, ex }); //p111002.3 throw new CSIException("Unable to open output stream", ex); } if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "getOutputStream"); return result; }
[ "public", "GZIPOutputStream", "getGZIPOutputStream", "(", "BeanId", "beanId", ")", "throws", "CSIException", "{", "final", "boolean", "isTraceOn", "=", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", ";", "if", "(", "isTraceOn", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "tc", ",", "\"getOutputStream\"", ",", "beanId", ")", ";", "final", "String", "fileName", "=", "getPortableFilename", "(", "beanId", ")", ";", "final", "long", "beanTimeoutTime", "=", "getBeanTimeoutTime", "(", "beanId", ")", ";", "GZIPOutputStream", "result", "=", "null", ";", "try", "{", "result", "=", "(", "GZIPOutputStream", ")", "AccessController", ".", "doPrivileged", "(", "new", "PrivilegedExceptionAction", "<", "GZIPOutputStream", ">", "(", ")", "{", "public", "GZIPOutputStream", "run", "(", ")", "throws", "IOException", "{", "File", "statefulBeanFile", "=", "getStatefulBeanFile", "(", "fileName", ",", "false", ")", ";", "FileOutputStream", "fos", "=", "EJSPlatformHelper", ".", "isZOS", "(", ")", "?", "new", "WSFileOutputStream", "(", "statefulBeanFile", ",", "beanTimeoutTime", ")", ":", "new", "FileOutputStream", "(", "statefulBeanFile", ")", ";", "return", "new", "GZIPOutputStream", "(", "fos", ")", ";", "// d651126", "}", "}", ")", ";", "}", "catch", "(", "PrivilegedActionException", "ex2", ")", "{", "Exception", "ex", "=", "ex2", ".", "getException", "(", ")", ";", "FFDCFilter", ".", "processException", "(", "ex", ",", "CLASS_NAME", "+", "\".getOutputStream\"", ",", "\"127\"", ",", "this", ")", ";", "Tr", ".", "warning", "(", "tc", ",", "\"IOEXCEPTION_WRITING_FILE_FOR_STATEFUL_SESSION_BEAN_CNTR0025W\"", ",", "new", "Object", "[", "]", "{", "fileName", ",", "this", ",", "ex", "}", ")", ";", "//p111002.3", "throw", "new", "CSIException", "(", "\"Unable to open output stream\"", ",", "ex", ")", ";", "}", "if", "(", "isTraceOn", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"getOutputStream\"", ")", ";", "return", "result", ";", "}" ]
Get object ouput stream suitable for reading persistent state associated with given key.
[ "Get", "object", "ouput", "stream", "suitable", "for", "reading", "persistent", "state", "associated", "with", "given", "key", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/csi/FileBeanStore.java#L273-L310
train
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/csi/FileBeanStore.java
FileBeanStore.getPortableFilename
private String getPortableFilename(BeanId beanId) { // Historically, this method returned the equivalent of // appendPortableFilenameString(beanId.toString()), where BeanId.toString // returned "BeanId(" + j2eeName + ", " + pkey + ")", which translates to // "BeanId_" + j2eeName + "__" + pkey + "_". RTC102568 StringBuilder result = new StringBuilder(); result.append(FILENAME_PREFIX); appendPortableFilenameString(result, beanId.getJ2EEName().toString()); result.append("__"); appendPortableFilenameString(result, beanId.getPrimaryKey().toString()); result.append('_'); return result.toString(); }
java
private String getPortableFilename(BeanId beanId) { // Historically, this method returned the equivalent of // appendPortableFilenameString(beanId.toString()), where BeanId.toString // returned "BeanId(" + j2eeName + ", " + pkey + ")", which translates to // "BeanId_" + j2eeName + "__" + pkey + "_". RTC102568 StringBuilder result = new StringBuilder(); result.append(FILENAME_PREFIX); appendPortableFilenameString(result, beanId.getJ2EEName().toString()); result.append("__"); appendPortableFilenameString(result, beanId.getPrimaryKey().toString()); result.append('_'); return result.toString(); }
[ "private", "String", "getPortableFilename", "(", "BeanId", "beanId", ")", "{", "// Historically, this method returned the equivalent of", "// appendPortableFilenameString(beanId.toString()), where BeanId.toString", "// returned \"BeanId(\" + j2eeName + \", \" + pkey + \")\", which translates to", "// \"BeanId_\" + j2eeName + \"__\" + pkey + \"_\". RTC102568", "StringBuilder", "result", "=", "new", "StringBuilder", "(", ")", ";", "result", ".", "append", "(", "FILENAME_PREFIX", ")", ";", "appendPortableFilenameString", "(", "result", ",", "beanId", ".", "getJ2EEName", "(", ")", ".", "toString", "(", ")", ")", ";", "result", ".", "append", "(", "\"__\"", ")", ";", "appendPortableFilenameString", "(", "result", ",", "beanId", ".", "getPrimaryKey", "(", ")", ".", "toString", "(", ")", ")", ";", "result", ".", "append", "(", "'", "'", ")", ";", "return", "result", ".", "toString", "(", ")", ";", "}" ]
Create a "safe" file name given the BeanId. There are a number of characters which can cause problems on different platforms. A safe file name will container only the following characters a-z, A-Z, _, -, . All other characters will get converted to a _
[ "Create", "a", "safe", "file", "name", "given", "the", "BeanId", ".", "There", "are", "a", "number", "of", "characters", "which", "can", "cause", "problems", "on", "different", "platforms", ".", "A", "safe", "file", "name", "will", "container", "only", "the", "following", "characters", "a", "-", "z", "A", "-", "Z", "_", "-", ".", "All", "other", "characters", "will", "get", "converted", "to", "a", "_" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/csi/FileBeanStore.java#L359-L373
train
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/csi/FileBeanStore.java
FileBeanStore.getOutputStream
public OutputStream getOutputStream(BeanId beanId) throws CSIException { final String fileName = getPortableFilename(beanId); final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(tc, "getOutputStream: key=" + beanId + ", file=", fileName); //d248740 final long beanTimeoutTime = getBeanTimeoutTime(beanId); FileOutputStream result = null; try { result = (FileOutputStream) AccessController.doPrivileged(new PrivilegedExceptionAction<FileOutputStream>() { public FileOutputStream run() throws IOException { File file = new File(passivationDir, fileName); if (EJSPlatformHelper.isZOS()) { return new WSFileOutputStream(file, beanTimeoutTime); } return new FileOutputStream(file); //LIDB2018 } }); } catch (PrivilegedActionException ex) { FFDCFilter.processException(ex, CLASS_NAME + ".getUnCompressedOutputStream", "460", this); Tr.warning(tc, "IOEXCEPTION_WRITING_FILE_FOR_STATEFUL_SESSION_BEAN_CNTR0025W", new Object[] { fileName, this, ex }); //p111002.3 throw new CSIException("Unable to open output stream", ex); } if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "getOutputStream"); return result; }
java
public OutputStream getOutputStream(BeanId beanId) throws CSIException { final String fileName = getPortableFilename(beanId); final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(tc, "getOutputStream: key=" + beanId + ", file=", fileName); //d248740 final long beanTimeoutTime = getBeanTimeoutTime(beanId); FileOutputStream result = null; try { result = (FileOutputStream) AccessController.doPrivileged(new PrivilegedExceptionAction<FileOutputStream>() { public FileOutputStream run() throws IOException { File file = new File(passivationDir, fileName); if (EJSPlatformHelper.isZOS()) { return new WSFileOutputStream(file, beanTimeoutTime); } return new FileOutputStream(file); //LIDB2018 } }); } catch (PrivilegedActionException ex) { FFDCFilter.processException(ex, CLASS_NAME + ".getUnCompressedOutputStream", "460", this); Tr.warning(tc, "IOEXCEPTION_WRITING_FILE_FOR_STATEFUL_SESSION_BEAN_CNTR0025W", new Object[] { fileName, this, ex }); //p111002.3 throw new CSIException("Unable to open output stream", ex); } if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "getOutputStream"); return result; }
[ "public", "OutputStream", "getOutputStream", "(", "BeanId", "beanId", ")", "throws", "CSIException", "{", "final", "String", "fileName", "=", "getPortableFilename", "(", "beanId", ")", ";", "final", "boolean", "isTraceOn", "=", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", ";", "if", "(", "isTraceOn", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "tc", ",", "\"getOutputStream: key=\"", "+", "beanId", "+", "\", file=\"", ",", "fileName", ")", ";", "//d248740", "final", "long", "beanTimeoutTime", "=", "getBeanTimeoutTime", "(", "beanId", ")", ";", "FileOutputStream", "result", "=", "null", ";", "try", "{", "result", "=", "(", "FileOutputStream", ")", "AccessController", ".", "doPrivileged", "(", "new", "PrivilegedExceptionAction", "<", "FileOutputStream", ">", "(", ")", "{", "public", "FileOutputStream", "run", "(", ")", "throws", "IOException", "{", "File", "file", "=", "new", "File", "(", "passivationDir", ",", "fileName", ")", ";", "if", "(", "EJSPlatformHelper", ".", "isZOS", "(", ")", ")", "{", "return", "new", "WSFileOutputStream", "(", "file", ",", "beanTimeoutTime", ")", ";", "}", "return", "new", "FileOutputStream", "(", "file", ")", ";", "//LIDB2018", "}", "}", ")", ";", "}", "catch", "(", "PrivilegedActionException", "ex", ")", "{", "FFDCFilter", ".", "processException", "(", "ex", ",", "CLASS_NAME", "+", "\".getUnCompressedOutputStream\"", ",", "\"460\"", ",", "this", ")", ";", "Tr", ".", "warning", "(", "tc", ",", "\"IOEXCEPTION_WRITING_FILE_FOR_STATEFUL_SESSION_BEAN_CNTR0025W\"", ",", "new", "Object", "[", "]", "{", "fileName", ",", "this", ",", "ex", "}", ")", ";", "//p111002.3", "throw", "new", "CSIException", "(", "\"Unable to open output stream\"", ",", "ex", ")", ";", "}", "if", "(", "isTraceOn", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"getOutputStream\"", ")", ";", "return", "result", ";", "}" ]
LIDB2018-1 new method for just dumping in the byte array to a file, byte array in gzip format. @param key the BeanId for this SFSB @return an OutputStream
[ "LIDB2018", "-", "1", "new", "method", "for", "just", "dumping", "in", "the", "byte", "array", "to", "a", "file", "byte", "array", "in", "gzip", "format", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/csi/FileBeanStore.java#L401-L439
train