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.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java
WSRdbManagedConnectionImpl.enforceAutoCommit
public final void enforceAutoCommit(boolean autoCommit) throws SQLException { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(this, tc, "enforceAutoCommit", autoCommit); // Only set values if the requested value is different from the current value, // or if required as a workaround. if (autoCommit != currentAutoCommit || helper.alwaysSetAutoCommit()) { if (isTraceOn && tc.isDebugEnabled()) Tr.debug(this, tc, "currentAutoCommit: " + currentAutoCommit + " --> " + autoCommit); sqlConn.setAutoCommit(autoCommit); currentAutoCommit = autoCommit; } if (isTraceOn && tc.isEntryEnabled()) { Tr.exit(this, tc, "enforceAutoCommit"); } }
java
public final void enforceAutoCommit(boolean autoCommit) throws SQLException { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(this, tc, "enforceAutoCommit", autoCommit); // Only set values if the requested value is different from the current value, // or if required as a workaround. if (autoCommit != currentAutoCommit || helper.alwaysSetAutoCommit()) { if (isTraceOn && tc.isDebugEnabled()) Tr.debug(this, tc, "currentAutoCommit: " + currentAutoCommit + " --> " + autoCommit); sqlConn.setAutoCommit(autoCommit); currentAutoCommit = autoCommit; } if (isTraceOn && tc.isEntryEnabled()) { Tr.exit(this, tc, "enforceAutoCommit"); } }
[ "public", "final", "void", "enforceAutoCommit", "(", "boolean", "autoCommit", ")", "throws", "SQLException", "{", "final", "boolean", "isTraceOn", "=", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", ";", "if", "(", "isTraceOn", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "this", ",", "tc", ",", "\"enforceAutoCommit\"", ",", "autoCommit", ")", ";", "// Only set values if the requested value is different from the current value, ", "// or if required as a workaround. ", "if", "(", "autoCommit", "!=", "currentAutoCommit", "||", "helper", ".", "alwaysSetAutoCommit", "(", ")", ")", "{", "if", "(", "isTraceOn", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "this", ",", "tc", ",", "\"currentAutoCommit: \"", "+", "currentAutoCommit", "+", "\" --> \"", "+", "autoCommit", ")", ";", "sqlConn", ".", "setAutoCommit", "(", "autoCommit", ")", ";", "currentAutoCommit", "=", "autoCommit", ";", "}", "if", "(", "isTraceOn", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "exit", "(", "this", ",", "tc", ",", "\"enforceAutoCommit\"", ")", ";", "}", "}" ]
Enforce the autoCommit setting in the underlying database and update the current value on the MC. This method must be invoked by the Connection handle before doing any work on the database. @param autoCommit Indicates if the autoCommit is true or false. @throws SQLException if an error occurs setting the AutoCommit. This exception is not mapped. Any mapping required is the caller's responsibility.
[ "Enforce", "the", "autoCommit", "setting", "in", "the", "underlying", "database", "and", "update", "the", "current", "value", "on", "the", "MC", ".", "This", "method", "must", "be", "invoked", "by", "the", "Connection", "handle", "before", "doing", "any", "work", "on", "the", "database", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java#L801-L823
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java
WSRdbManagedConnectionImpl.getStatementCache
private CacheMap getStatementCache() { int newSize = dsConfig.get().statementCacheSize; // Check if statement cache is dynamically enabled if (statementCache == null && newSize > 0) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "enable statement cache with size", newSize); statementCache = new CacheMap(newSize); } // Check if statement cache is dynamically resized or disabled else if (statementCache != null && statementCache.getMaxSize() != newSize) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "resize statement cache to", newSize); CacheMap oldCache = statementCache; statementCache = newSize > 0 ? new CacheMap(newSize) : null; Object[] discards = newSize > 0 ? statementCache.addAll(oldCache) : oldCache.removeAll(); for (Object stmt : discards) destroyStatement(stmt); } return statementCache; }
java
private CacheMap getStatementCache() { int newSize = dsConfig.get().statementCacheSize; // Check if statement cache is dynamically enabled if (statementCache == null && newSize > 0) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "enable statement cache with size", newSize); statementCache = new CacheMap(newSize); } // Check if statement cache is dynamically resized or disabled else if (statementCache != null && statementCache.getMaxSize() != newSize) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "resize statement cache to", newSize); CacheMap oldCache = statementCache; statementCache = newSize > 0 ? new CacheMap(newSize) : null; Object[] discards = newSize > 0 ? statementCache.addAll(oldCache) : oldCache.removeAll(); for (Object stmt : discards) destroyStatement(stmt); } return statementCache; }
[ "private", "CacheMap", "getStatementCache", "(", ")", "{", "int", "newSize", "=", "dsConfig", ".", "get", "(", ")", ".", "statementCacheSize", ";", "// Check if statement cache is dynamically enabled", "if", "(", "statementCache", "==", "null", "&&", "newSize", ">", "0", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "this", ",", "tc", ",", "\"enable statement cache with size\"", ",", "newSize", ")", ";", "statementCache", "=", "new", "CacheMap", "(", "newSize", ")", ";", "}", "// Check if statement cache is dynamically resized or disabled", "else", "if", "(", "statementCache", "!=", "null", "&&", "statementCache", ".", "getMaxSize", "(", ")", "!=", "newSize", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "this", ",", "tc", ",", "\"resize statement cache to\"", ",", "newSize", ")", ";", "CacheMap", "oldCache", "=", "statementCache", ";", "statementCache", "=", "newSize", ">", "0", "?", "new", "CacheMap", "(", "newSize", ")", ":", "null", ";", "Object", "[", "]", "discards", "=", "newSize", ">", "0", "?", "statementCache", ".", "addAll", "(", "oldCache", ")", ":", "oldCache", ".", "removeAll", "(", ")", ";", "for", "(", "Object", "stmt", ":", "discards", ")", "destroyStatement", "(", "stmt", ")", ";", "}", "return", "statementCache", ";", "}" ]
Processes any dynamic updates to the statement cache size and then returns the statement cache. @return the statement cache. Null if caching is not enabled.
[ "Processes", "any", "dynamic", "updates", "to", "the", "statement", "cache", "size", "and", "then", "returns", "the", "statement", "cache", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java#L912-L936
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java
WSRdbManagedConnectionImpl.isGlobalTransactionActive
public final boolean isGlobalTransactionActive() { UOWCurrent uow = (UOWCurrent) mcf.connectorSvc.getTransactionManager(); UOWCoordinator coord = uow == null ? null : uow.getUOWCoord(); return coord != null && coord.isGlobal(); }
java
public final boolean isGlobalTransactionActive() { UOWCurrent uow = (UOWCurrent) mcf.connectorSvc.getTransactionManager(); UOWCoordinator coord = uow == null ? null : uow.getUOWCoord(); return coord != null && coord.isGlobal(); }
[ "public", "final", "boolean", "isGlobalTransactionActive", "(", ")", "{", "UOWCurrent", "uow", "=", "(", "UOWCurrent", ")", "mcf", ".", "connectorSvc", ".", "getTransactionManager", "(", ")", ";", "UOWCoordinator", "coord", "=", "uow", "==", "null", "?", "null", ":", "uow", ".", "getUOWCoord", "(", ")", ";", "return", "coord", "!=", "null", "&&", "coord", ".", "isGlobal", "(", ")", ";", "}" ]
Returns true if a global transaction is active on the thread, otherwise false. @return true if a global transaction is active on the thread, otherwise false.
[ "Returns", "true", "if", "a", "global", "transaction", "is", "active", "on", "the", "thread", "otherwise", "false", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java#L1197-L1201
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java
WSRdbManagedConnectionImpl.isTransactional
public final boolean isTransactional() { // Take a snapshot of the value with first use (or reuse from pool) of the managed connection. // This value will be cleared when the managed connection is returned to the pool. if (transactional == null) { transactional = mcf.dsConfig.get().transactional; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "transactional=", transactional); } return transactional; }
java
public final boolean isTransactional() { // Take a snapshot of the value with first use (or reuse from pool) of the managed connection. // This value will be cleared when the managed connection is returned to the pool. if (transactional == null) { transactional = mcf.dsConfig.get().transactional; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "transactional=", transactional); } return transactional; }
[ "public", "final", "boolean", "isTransactional", "(", ")", "{", "// Take a snapshot of the value with first use (or reuse from pool) of the managed connection.", "// This value will be cleared when the managed connection is returned to the pool.", "if", "(", "transactional", "==", "null", ")", "{", "transactional", "=", "mcf", ".", "dsConfig", ".", "get", "(", ")", ".", "transactional", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "this", ",", "tc", ",", "\"transactional=\"", ",", "transactional", ")", ";", "}", "return", "transactional", ";", "}" ]
This method checks if transaction enlistment is enabled on the MC @return true if transaction enlistment is enabled and supported, false otherwise.
[ "This", "method", "checks", "if", "transaction", "enlistment", "is", "enabled", "on", "the", "MC" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java#L1208-L1218
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java
WSRdbManagedConnectionImpl.processConnectionClosedEvent
public void processConnectionClosedEvent(WSJdbcConnection handle) throws ResourceException { //A connection handle was closed - must notify the connection manager // of the close on the handle. JDBC connection handles // which are closed are not allowed to be reused because there is no // guarantee that the user will not try to reuse an already closed JDBC handle. // Only send the event if the application is requesting the close. if (cleaningUpHandles) return; final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); // Fill in the ConnectionEvent only if needed. connEvent.recycle(ConnectionEvent.CONNECTION_CLOSED, null, handle); if (isTraceOn && tc.isEventEnabled()) Tr.event(this, tc, "Firing CONNECTION CLOSED", handle); try { removeHandle(handle); // - Remove resetting autocommit in connection close time } catch (NullPointerException nullX) { // No FFDC code needed. ManagedConnection is already closed. // A ConnectionError situation may // trigger a ManagedConnection close before the handle sends the ConnectionClosed // event. When the event is sent the ManagedConnection is already closed. If so, // just do a no-op here. if (handlesInUse == null) { if (isTraceOn && tc.isEventEnabled()) Tr.event(this, tc, "ManagedConnection already closed"); return; } else throw nullX; } if (numHandlesInUse == 0) { if (haveVendorConnectionPropertiesChanged) { try { helper.doConnectionVendorPropertyReset(this.sqlConn, CONNECTION_VENDOR_DEFAULT_PROPERTIES); } catch (SQLException sqle) { FFDCFilter.processException(sqle, getClass().getName(), "1905", this); throw new DataStoreAdapterException("DSA_ERROR", sqle, getClass()); } haveVendorConnectionPropertiesChanged = false; } } // loop through the listeners // Not synchronized because of contract that listeners will only be changed on // ManagedConnection create/destroy. for (int i = 0; i < numListeners; i++) { // send Connection Closed event to the current listener ivEventListeners[i].connectionClosed(connEvent); } // Replace ConnectionEvent caching with a single reusable instance per // ManagedConnection. }
java
public void processConnectionClosedEvent(WSJdbcConnection handle) throws ResourceException { //A connection handle was closed - must notify the connection manager // of the close on the handle. JDBC connection handles // which are closed are not allowed to be reused because there is no // guarantee that the user will not try to reuse an already closed JDBC handle. // Only send the event if the application is requesting the close. if (cleaningUpHandles) return; final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); // Fill in the ConnectionEvent only if needed. connEvent.recycle(ConnectionEvent.CONNECTION_CLOSED, null, handle); if (isTraceOn && tc.isEventEnabled()) Tr.event(this, tc, "Firing CONNECTION CLOSED", handle); try { removeHandle(handle); // - Remove resetting autocommit in connection close time } catch (NullPointerException nullX) { // No FFDC code needed. ManagedConnection is already closed. // A ConnectionError situation may // trigger a ManagedConnection close before the handle sends the ConnectionClosed // event. When the event is sent the ManagedConnection is already closed. If so, // just do a no-op here. if (handlesInUse == null) { if (isTraceOn && tc.isEventEnabled()) Tr.event(this, tc, "ManagedConnection already closed"); return; } else throw nullX; } if (numHandlesInUse == 0) { if (haveVendorConnectionPropertiesChanged) { try { helper.doConnectionVendorPropertyReset(this.sqlConn, CONNECTION_VENDOR_DEFAULT_PROPERTIES); } catch (SQLException sqle) { FFDCFilter.processException(sqle, getClass().getName(), "1905", this); throw new DataStoreAdapterException("DSA_ERROR", sqle, getClass()); } haveVendorConnectionPropertiesChanged = false; } } // loop through the listeners // Not synchronized because of contract that listeners will only be changed on // ManagedConnection create/destroy. for (int i = 0; i < numListeners; i++) { // send Connection Closed event to the current listener ivEventListeners[i].connectionClosed(connEvent); } // Replace ConnectionEvent caching with a single reusable instance per // ManagedConnection. }
[ "public", "void", "processConnectionClosedEvent", "(", "WSJdbcConnection", "handle", ")", "throws", "ResourceException", "{", "//A connection handle was closed - must notify the connection manager", "// of the close on the handle. JDBC connection handles", "// which are closed are not allowed to be reused because there is no", "// guarantee that the user will not try to reuse an already closed JDBC handle.", "// Only send the event if the application is requesting the close. ", "if", "(", "cleaningUpHandles", ")", "return", ";", "final", "boolean", "isTraceOn", "=", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", ";", "// Fill in the ConnectionEvent only if needed. ", "connEvent", ".", "recycle", "(", "ConnectionEvent", ".", "CONNECTION_CLOSED", ",", "null", ",", "handle", ")", ";", "if", "(", "isTraceOn", "&&", "tc", ".", "isEventEnabled", "(", ")", ")", "Tr", ".", "event", "(", "this", ",", "tc", ",", "\"Firing CONNECTION CLOSED\"", ",", "handle", ")", ";", "try", "{", "removeHandle", "(", "handle", ")", ";", "// - Remove resetting autocommit in connection close time", "}", "catch", "(", "NullPointerException", "nullX", ")", "{", "// No FFDC code needed. ManagedConnection is already closed.", "// A ConnectionError situation may", "// trigger a ManagedConnection close before the handle sends the ConnectionClosed", "// event. When the event is sent the ManagedConnection is already closed. If so,", "// just do a no-op here.", "if", "(", "handlesInUse", "==", "null", ")", "{", "if", "(", "isTraceOn", "&&", "tc", ".", "isEventEnabled", "(", ")", ")", "Tr", ".", "event", "(", "this", ",", "tc", ",", "\"ManagedConnection already closed\"", ")", ";", "return", ";", "}", "else", "throw", "nullX", ";", "}", "if", "(", "numHandlesInUse", "==", "0", ")", "{", "if", "(", "haveVendorConnectionPropertiesChanged", ")", "{", "try", "{", "helper", ".", "doConnectionVendorPropertyReset", "(", "this", ".", "sqlConn", ",", "CONNECTION_VENDOR_DEFAULT_PROPERTIES", ")", ";", "}", "catch", "(", "SQLException", "sqle", ")", "{", "FFDCFilter", ".", "processException", "(", "sqle", ",", "getClass", "(", ")", ".", "getName", "(", ")", ",", "\"1905\"", ",", "this", ")", ";", "throw", "new", "DataStoreAdapterException", "(", "\"DSA_ERROR\"", ",", "sqle", ",", "getClass", "(", ")", ")", ";", "}", "haveVendorConnectionPropertiesChanged", "=", "false", ";", "}", "}", "// loop through the listeners", "// Not synchronized because of contract that listeners will only be changed on", "// ManagedConnection create/destroy. ", "for", "(", "int", "i", "=", "0", ";", "i", "<", "numListeners", ";", "i", "++", ")", "{", "// send Connection Closed event to the current listener", "ivEventListeners", "[", "i", "]", ".", "connectionClosed", "(", "connEvent", ")", ";", "}", "// Replace ConnectionEvent caching with a single reusable instance per", "// ManagedConnection. ", "}" ]
Process request for a CONNECTION_CLOSED event. @param handle the Connection handle requesting to fire the event. @throws ResourceException if an error occurs processing the request.
[ "Process", "request", "for", "a", "CONNECTION_CLOSED", "event", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java#L1245-L1309
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java
WSRdbManagedConnectionImpl.processLocalTransactionStartedEvent
public void processLocalTransactionStartedEvent(Object handle) throws ResourceException { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn) { if (tc.isEntryEnabled()) Tr.entry(this, tc, "processLocalTransactionStartedEvent", handle); if (tc.isDebugEnabled()) { String cId = null; try { cId = mcf.getCorrelator(this); } 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 (xares != null) { stbuf.append(" Transaction : "); stbuf.append(xares); } stbuf.append(" BEGIN"); Tr.debug(this, tc, stbuf.toString()); } } } // An application level local transaction has been requested started //The isValid method returns an exception if it is not valid. This allows the // WSStateManager to create a more detailed message than this class could. ResourceException re = stateMgr.isValid(WSStateManager.LT_BEGIN); if (re == null) { if (currentAutoCommit) { try { if (isTraceOn && tc.isDebugEnabled()) Tr.debug(this, tc, "current autocommit is true, set to false"); setAutoCommit(false); } catch (SQLException sqle) { FFDCFilter.processException(sqle, getClass().getName() + ".processLocalTransactionStartedEvent", "550", this); throw new DataStoreAdapterException("DSA_ERROR", sqle, getClass()); } } // Already validated the state so just set it. stateMgr.transtate = WSStateManager.LOCAL_TRANSACTION_ACTIVE; } else { throw re; } // Fill in the ConnectionEvent only if needed. connEvent.recycle(ConnectionEvent.LOCAL_TRANSACTION_STARTED, null, handle); if (isTraceOn && tc.isEventEnabled()) Tr.event(this, tc, "Firing LOCAL TRANSACTION STARTED event for: " + handle, this); //Notification of the eventListeners must happen after the state change because if the statechange // is illegal, we need to throw an exception. If this exception occurs, we do not want to // notify the cm of the tx started because we are not allowing it to start. // loop through the listeners for (int i = 0; i < numListeners; i++) { // send Local Transaction Started event to the current listener ivEventListeners[i].localTransactionStarted(connEvent); } // Replace ConnectionEvent caching with a single reusable instance per // ManagedConnection. if (isTraceOn && tc.isEntryEnabled()) { Tr.exit(this, tc, "processLocalTransactionStartedEvent", handle); } }
java
public void processLocalTransactionStartedEvent(Object handle) throws ResourceException { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn) { if (tc.isEntryEnabled()) Tr.entry(this, tc, "processLocalTransactionStartedEvent", handle); if (tc.isDebugEnabled()) { String cId = null; try { cId = mcf.getCorrelator(this); } 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 (xares != null) { stbuf.append(" Transaction : "); stbuf.append(xares); } stbuf.append(" BEGIN"); Tr.debug(this, tc, stbuf.toString()); } } } // An application level local transaction has been requested started //The isValid method returns an exception if it is not valid. This allows the // WSStateManager to create a more detailed message than this class could. ResourceException re = stateMgr.isValid(WSStateManager.LT_BEGIN); if (re == null) { if (currentAutoCommit) { try { if (isTraceOn && tc.isDebugEnabled()) Tr.debug(this, tc, "current autocommit is true, set to false"); setAutoCommit(false); } catch (SQLException sqle) { FFDCFilter.processException(sqle, getClass().getName() + ".processLocalTransactionStartedEvent", "550", this); throw new DataStoreAdapterException("DSA_ERROR", sqle, getClass()); } } // Already validated the state so just set it. stateMgr.transtate = WSStateManager.LOCAL_TRANSACTION_ACTIVE; } else { throw re; } // Fill in the ConnectionEvent only if needed. connEvent.recycle(ConnectionEvent.LOCAL_TRANSACTION_STARTED, null, handle); if (isTraceOn && tc.isEventEnabled()) Tr.event(this, tc, "Firing LOCAL TRANSACTION STARTED event for: " + handle, this); //Notification of the eventListeners must happen after the state change because if the statechange // is illegal, we need to throw an exception. If this exception occurs, we do not want to // notify the cm of the tx started because we are not allowing it to start. // loop through the listeners for (int i = 0; i < numListeners; i++) { // send Local Transaction Started event to the current listener ivEventListeners[i].localTransactionStarted(connEvent); } // Replace ConnectionEvent caching with a single reusable instance per // ManagedConnection. if (isTraceOn && tc.isEntryEnabled()) { Tr.exit(this, tc, "processLocalTransactionStartedEvent", handle); } }
[ "public", "void", "processLocalTransactionStartedEvent", "(", "Object", "handle", ")", "throws", "ResourceException", "{", "final", "boolean", "isTraceOn", "=", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", ";", "if", "(", "isTraceOn", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "this", ",", "tc", ",", "\"processLocalTransactionStartedEvent\"", ",", "handle", ")", ";", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "String", "cId", "=", "null", ";", "try", "{", "cId", "=", "mcf", ".", "getCorrelator", "(", "this", ")", ";", "}", "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", "(", "xares", "!=", "null", ")", "{", "stbuf", ".", "append", "(", "\" Transaction : \"", ")", ";", "stbuf", ".", "append", "(", "xares", ")", ";", "}", "stbuf", ".", "append", "(", "\" BEGIN\"", ")", ";", "Tr", ".", "debug", "(", "this", ",", "tc", ",", "stbuf", ".", "toString", "(", ")", ")", ";", "}", "}", "}", "// An application level local transaction has been requested started", "//The isValid method returns an exception if it is not valid. This allows the", "// WSStateManager to create a more detailed message than this class could.", "ResourceException", "re", "=", "stateMgr", ".", "isValid", "(", "WSStateManager", ".", "LT_BEGIN", ")", ";", "if", "(", "re", "==", "null", ")", "{", "if", "(", "currentAutoCommit", ")", "{", "try", "{", "if", "(", "isTraceOn", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "this", ",", "tc", ",", "\"current autocommit is true, set to false\"", ")", ";", "setAutoCommit", "(", "false", ")", ";", "}", "catch", "(", "SQLException", "sqle", ")", "{", "FFDCFilter", ".", "processException", "(", "sqle", ",", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\".processLocalTransactionStartedEvent\"", ",", "\"550\"", ",", "this", ")", ";", "throw", "new", "DataStoreAdapterException", "(", "\"DSA_ERROR\"", ",", "sqle", ",", "getClass", "(", ")", ")", ";", "}", "}", "// Already validated the state so just set it. ", "stateMgr", ".", "transtate", "=", "WSStateManager", ".", "LOCAL_TRANSACTION_ACTIVE", ";", "}", "else", "{", "throw", "re", ";", "}", "// Fill in the ConnectionEvent only if needed. ", "connEvent", ".", "recycle", "(", "ConnectionEvent", ".", "LOCAL_TRANSACTION_STARTED", ",", "null", ",", "handle", ")", ";", "if", "(", "isTraceOn", "&&", "tc", ".", "isEventEnabled", "(", ")", ")", "Tr", ".", "event", "(", "this", ",", "tc", ",", "\"Firing LOCAL TRANSACTION STARTED event for: \"", "+", "handle", ",", "this", ")", ";", "//Notification of the eventListeners must happen after the state change because if the statechange", "// is illegal, we need to throw an exception. If this exception occurs, we do not want to", "// notify the cm of the tx started because we are not allowing it to start.", "// loop through the listeners", "for", "(", "int", "i", "=", "0", ";", "i", "<", "numListeners", ";", "i", "++", ")", "{", "// send Local Transaction Started event to the current listener", "ivEventListeners", "[", "i", "]", ".", "localTransactionStarted", "(", "connEvent", ")", ";", "}", "// Replace ConnectionEvent caching with a single reusable instance per", "// ManagedConnection. ", "if", "(", "isTraceOn", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "exit", "(", "this", ",", "tc", ",", "\"processLocalTransactionStartedEvent\"", ",", "handle", ")", ";", "}", "}" ]
Process request for a LOCAL_TRANSACTION_STARTED event. @param handle the Connection handle requesting the event. @throws ResourceException if an error occurs starting the local transaction, or if the state is not valid.
[ "Process", "request", "for", "a", "LOCAL_TRANSACTION_STARTED", "event", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java#L1383-L1465
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java
WSRdbManagedConnectionImpl.processLocalTransactionCommittedEvent
public void processLocalTransactionCommittedEvent(Object handle) throws ResourceException { // A application level local transaction has been committed. final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn) { if (tc.isEntryEnabled()) Tr.entry(this, tc, "processLocalTransactionCommittedEvent", handle); if (tc.isDebugEnabled()) { String cId = null; try { cId = mcf.getCorrelator(this); } 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 (xares != null) { stbuf.append(" Transaction : "); stbuf.append(xares); } stbuf.append(" COMMIT"); Tr.debug(this, tc, stbuf.toString()); } } } ResourceException re = stateMgr.isValid(WSStateManager.LT_COMMIT); if (re == null) { // 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. if (!currentAutoCommit) try { // autoCommit is off sqlConn.commit(); } catch (SQLException se) { FFDCFilter.processException(se, "com.ibm.ws.rsadapter.spi.WSRdbManagedConnectionImpl.processLocalTransactionCommittedEvent", "554", this); throw AdapterUtil.translateSQLException(se, this, true, getClass()); } //Set the state only after the commit has succeeded. Else, we change the // state but it has not yet been committed. - a real mess // Already validated the state so just set it. stateMgr.transtate = WSStateManager.NO_TRANSACTION_ACTIVE; } else { throw re; } // Fill in the ConnectionEvent only if needed. connEvent.recycle(ConnectionEvent.LOCAL_TRANSACTION_COMMITTED, null, handle); if (isTraceOn && tc.isEventEnabled()) Tr.event(this, tc, "Firing LOCAL TRANSACTION COMMITTED event for: " + handle, this); // loop through the listeners for (int i = 0; i < numListeners; i++) { // send Local Transaction Committed event to the current listener ivEventListeners[i].localTransactionCommitted(connEvent); } // Reset the indicator so lazy enlistment will be signaled if we end up in a // Global Transaction. wasLazilyEnlistedInGlobalTran = false; // Replace ConnectionEvent caching with a single reusable instance per // ManagedConnection. if (isTraceOn && tc.isEntryEnabled()) { Tr.exit(this, tc, "processLocalTransactionCommittedEvent"); } }
java
public void processLocalTransactionCommittedEvent(Object handle) throws ResourceException { // A application level local transaction has been committed. final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn) { if (tc.isEntryEnabled()) Tr.entry(this, tc, "processLocalTransactionCommittedEvent", handle); if (tc.isDebugEnabled()) { String cId = null; try { cId = mcf.getCorrelator(this); } 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 (xares != null) { stbuf.append(" Transaction : "); stbuf.append(xares); } stbuf.append(" COMMIT"); Tr.debug(this, tc, stbuf.toString()); } } } ResourceException re = stateMgr.isValid(WSStateManager.LT_COMMIT); if (re == null) { // 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. if (!currentAutoCommit) try { // autoCommit is off sqlConn.commit(); } catch (SQLException se) { FFDCFilter.processException(se, "com.ibm.ws.rsadapter.spi.WSRdbManagedConnectionImpl.processLocalTransactionCommittedEvent", "554", this); throw AdapterUtil.translateSQLException(se, this, true, getClass()); } //Set the state only after the commit has succeeded. Else, we change the // state but it has not yet been committed. - a real mess // Already validated the state so just set it. stateMgr.transtate = WSStateManager.NO_TRANSACTION_ACTIVE; } else { throw re; } // Fill in the ConnectionEvent only if needed. connEvent.recycle(ConnectionEvent.LOCAL_TRANSACTION_COMMITTED, null, handle); if (isTraceOn && tc.isEventEnabled()) Tr.event(this, tc, "Firing LOCAL TRANSACTION COMMITTED event for: " + handle, this); // loop through the listeners for (int i = 0; i < numListeners; i++) { // send Local Transaction Committed event to the current listener ivEventListeners[i].localTransactionCommitted(connEvent); } // Reset the indicator so lazy enlistment will be signaled if we end up in a // Global Transaction. wasLazilyEnlistedInGlobalTran = false; // Replace ConnectionEvent caching with a single reusable instance per // ManagedConnection. if (isTraceOn && tc.isEntryEnabled()) { Tr.exit(this, tc, "processLocalTransactionCommittedEvent"); } }
[ "public", "void", "processLocalTransactionCommittedEvent", "(", "Object", "handle", ")", "throws", "ResourceException", "{", "// A application level local transaction has been committed.", "final", "boolean", "isTraceOn", "=", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", ";", "if", "(", "isTraceOn", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "this", ",", "tc", ",", "\"processLocalTransactionCommittedEvent\"", ",", "handle", ")", ";", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "String", "cId", "=", "null", ";", "try", "{", "cId", "=", "mcf", ".", "getCorrelator", "(", "this", ")", ";", "}", "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", "(", "xares", "!=", "null", ")", "{", "stbuf", ".", "append", "(", "\" Transaction : \"", ")", ";", "stbuf", ".", "append", "(", "xares", ")", ";", "}", "stbuf", ".", "append", "(", "\" COMMIT\"", ")", ";", "Tr", ".", "debug", "(", "this", ",", "tc", ",", "stbuf", ".", "toString", "(", ")", ")", ";", "}", "}", "}", "ResourceException", "re", "=", "stateMgr", ".", "isValid", "(", "WSStateManager", ".", "LT_COMMIT", ")", ";", "if", "(", "re", "==", "null", ")", "{", "// 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. ", "if", "(", "!", "currentAutoCommit", ")", "try", "{", "// autoCommit is off", "sqlConn", ".", "commit", "(", ")", ";", "}", "catch", "(", "SQLException", "se", ")", "{", "FFDCFilter", ".", "processException", "(", "se", ",", "\"com.ibm.ws.rsadapter.spi.WSRdbManagedConnectionImpl.processLocalTransactionCommittedEvent\"", ",", "\"554\"", ",", "this", ")", ";", "throw", "AdapterUtil", ".", "translateSQLException", "(", "se", ",", "this", ",", "true", ",", "getClass", "(", ")", ")", ";", "}", "//Set the state only after the commit has succeeded. Else, we change the", "// state but it has not yet been committed. - a real mess", "// Already validated the state so just set it. ", "stateMgr", ".", "transtate", "=", "WSStateManager", ".", "NO_TRANSACTION_ACTIVE", ";", "}", "else", "{", "throw", "re", ";", "}", "// Fill in the ConnectionEvent only if needed. ", "connEvent", ".", "recycle", "(", "ConnectionEvent", ".", "LOCAL_TRANSACTION_COMMITTED", ",", "null", ",", "handle", ")", ";", "if", "(", "isTraceOn", "&&", "tc", ".", "isEventEnabled", "(", ")", ")", "Tr", ".", "event", "(", "this", ",", "tc", ",", "\"Firing LOCAL TRANSACTION COMMITTED event for: \"", "+", "handle", ",", "this", ")", ";", "// loop through the listeners", "for", "(", "int", "i", "=", "0", ";", "i", "<", "numListeners", ";", "i", "++", ")", "{", "// send Local Transaction Committed event to the current listener", "ivEventListeners", "[", "i", "]", ".", "localTransactionCommitted", "(", "connEvent", ")", ";", "}", "// Reset the indicator so lazy enlistment will be signaled if we end up in a", "// Global Transaction. ", "wasLazilyEnlistedInGlobalTran", "=", "false", ";", "// Replace ConnectionEvent caching with a single reusable instance per", "// ManagedConnection. ", "if", "(", "isTraceOn", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "exit", "(", "this", ",", "tc", ",", "\"processLocalTransactionCommittedEvent\"", ")", ";", "}", "}" ]
Process request for a LOCAL_TRANSACTION_COMMITTED event. @param handle the Connection handle requesting to send an event. @throws ResourceException if an error occurs committing the transaction or the state is not valid.
[ "Process", "request", "for", "a", "LOCAL_TRANSACTION_COMMITTED", "event", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java#L1475-L1557
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java
WSRdbManagedConnectionImpl.processConnectionErrorOccurredEvent
public void processConnectionErrorOccurredEvent(Object handle, Exception ex, boolean logEvent) { // Method is not synchronized because of the contract that add/remove event // listeners will only be used on ManagedConnection create/destroy, when the // ManagedConnection is not used by any other threads. // Some object using the physical jdbc connection has received a SQLException that // when translated to a ResourceException is determined to be a connection event error. // The SQLException is mapped to a StaleConnectionException in the // helper. SCE's will (almost) always be connection errors. // Track whether a fatal Connection error was detected. // Technically, the Connection Manager is required to be able to handle duplicate // events, but since we already have a flag for the occasion, we'll be nice and skip // the unnecessary event when convenient. final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (inCleanup) { if (isTraceOn && tc.isDebugEnabled()) Tr.debug(this, tc, "An error occured during connection cleanup. Since the container drives " + "the cleanup op, it will directly receive the exception."); return; } if (connectionErrorDetected) { if (isTraceOn && tc.isEventEnabled()) Tr.event(this, tc, "CONNECTION_ERROR_OCCURRED event already fired"); return; } if (ex instanceof SQLException && mcf.helper.isAnAuthorizationException((SQLException) ex)) { if (isTraceOn && tc.isDebugEnabled()) Tr.debug(this, tc, "CONNECTION_ERROR_OCCURRED will fire an event to only purge and destroy this connection"); connectionErrorDetected = true; closeHandles(); // Create a Connection Error Event with the given SQLException. // Reuse a single ConnectionEvent instance. // - Modified to use J2C defined event. connEvent.recycle(WSConnectionEvent.SINGLE_CONNECTION_ERROR_OCCURRED, ex, handle); if (isTraceOn && tc.isEventEnabled()) Tr.event(this, tc, "Firing Single CONNECTION_ERROR_OCCURRED", handle); // loop through the listeners for (int i = 0; i < numListeners; i++) { // send Connection Error Occurred event to the current listener ivEventListeners[i].connectionErrorOccurred(connEvent); } return; } mcf.fatalErrorCount.incrementAndGet(); if (mcf.oracleRACXARetryDelay > 0l) mcf.oracleRACLastStale.set(System.currentTimeMillis()); connectionErrorDetected = true; // The connectionErrorDetected indicator is no longer required for ManagedConnection // cleanup since we are now required to invalidate all handles at that point // regardless of whether a connection error has occurred. // Close all active handles for this ManagedConnection, since we cannot rely on the // ConnectionManager to request cleanup/destroy immediately. The ConnectionManager is // required to wait until the transaction has ended. closeHandles(); // Create a Connection Error Event with the given SQLException. // Reuse a single ConnectionEvent instance. // - Fire the normal logging event if logEvent == true. Otherwise, fire the non-logging connection error event. connEvent.recycle((logEvent ? ConnectionEvent.CONNECTION_ERROR_OCCURRED : WSConnectionEvent.CONNECTION_ERROR_OCCURRED_NO_EVENT), ex, handle); if (isTraceOn && tc.isEventEnabled()) Tr.event(this, tc, "Firing " + (logEvent ? "CONNECTION_ERROR_OCCURRED" : "CONNECTION_ERROR_OCCURRED_NO_EVENT"), handle); // loop through the listeners for (int i = 0; i < numListeners; i++) { // send Connection Error Occurred event to the current listener ivEventListeners[i].connectionErrorOccurred(connEvent); } // Replace ConnectionEvent caching with a single reusable instance per // ManagedConnection. }
java
public void processConnectionErrorOccurredEvent(Object handle, Exception ex, boolean logEvent) { // Method is not synchronized because of the contract that add/remove event // listeners will only be used on ManagedConnection create/destroy, when the // ManagedConnection is not used by any other threads. // Some object using the physical jdbc connection has received a SQLException that // when translated to a ResourceException is determined to be a connection event error. // The SQLException is mapped to a StaleConnectionException in the // helper. SCE's will (almost) always be connection errors. // Track whether a fatal Connection error was detected. // Technically, the Connection Manager is required to be able to handle duplicate // events, but since we already have a flag for the occasion, we'll be nice and skip // the unnecessary event when convenient. final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (inCleanup) { if (isTraceOn && tc.isDebugEnabled()) Tr.debug(this, tc, "An error occured during connection cleanup. Since the container drives " + "the cleanup op, it will directly receive the exception."); return; } if (connectionErrorDetected) { if (isTraceOn && tc.isEventEnabled()) Tr.event(this, tc, "CONNECTION_ERROR_OCCURRED event already fired"); return; } if (ex instanceof SQLException && mcf.helper.isAnAuthorizationException((SQLException) ex)) { if (isTraceOn && tc.isDebugEnabled()) Tr.debug(this, tc, "CONNECTION_ERROR_OCCURRED will fire an event to only purge and destroy this connection"); connectionErrorDetected = true; closeHandles(); // Create a Connection Error Event with the given SQLException. // Reuse a single ConnectionEvent instance. // - Modified to use J2C defined event. connEvent.recycle(WSConnectionEvent.SINGLE_CONNECTION_ERROR_OCCURRED, ex, handle); if (isTraceOn && tc.isEventEnabled()) Tr.event(this, tc, "Firing Single CONNECTION_ERROR_OCCURRED", handle); // loop through the listeners for (int i = 0; i < numListeners; i++) { // send Connection Error Occurred event to the current listener ivEventListeners[i].connectionErrorOccurred(connEvent); } return; } mcf.fatalErrorCount.incrementAndGet(); if (mcf.oracleRACXARetryDelay > 0l) mcf.oracleRACLastStale.set(System.currentTimeMillis()); connectionErrorDetected = true; // The connectionErrorDetected indicator is no longer required for ManagedConnection // cleanup since we are now required to invalidate all handles at that point // regardless of whether a connection error has occurred. // Close all active handles for this ManagedConnection, since we cannot rely on the // ConnectionManager to request cleanup/destroy immediately. The ConnectionManager is // required to wait until the transaction has ended. closeHandles(); // Create a Connection Error Event with the given SQLException. // Reuse a single ConnectionEvent instance. // - Fire the normal logging event if logEvent == true. Otherwise, fire the non-logging connection error event. connEvent.recycle((logEvent ? ConnectionEvent.CONNECTION_ERROR_OCCURRED : WSConnectionEvent.CONNECTION_ERROR_OCCURRED_NO_EVENT), ex, handle); if (isTraceOn && tc.isEventEnabled()) Tr.event(this, tc, "Firing " + (logEvent ? "CONNECTION_ERROR_OCCURRED" : "CONNECTION_ERROR_OCCURRED_NO_EVENT"), handle); // loop through the listeners for (int i = 0; i < numListeners; i++) { // send Connection Error Occurred event to the current listener ivEventListeners[i].connectionErrorOccurred(connEvent); } // Replace ConnectionEvent caching with a single reusable instance per // ManagedConnection. }
[ "public", "void", "processConnectionErrorOccurredEvent", "(", "Object", "handle", ",", "Exception", "ex", ",", "boolean", "logEvent", ")", "{", "// Method is not synchronized because of the contract that add/remove event", "// listeners will only be used on ManagedConnection create/destroy, when the", "// ManagedConnection is not used by any other threads. ", "// Some object using the physical jdbc connection has received a SQLException that", "// when translated to a ResourceException is determined to be a connection event error.", "// The SQLException is mapped to a StaleConnectionException in the", "// helper. SCE's will (almost) always be connection errors.", "// Track whether a fatal Connection error was detected. ", "// Technically, the Connection Manager is required to be able to handle duplicate", "// events, but since we already have a flag for the occasion, we'll be nice and skip", "// the unnecessary event when convenient.", "final", "boolean", "isTraceOn", "=", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", ";", "if", "(", "inCleanup", ")", "{", "if", "(", "isTraceOn", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "this", ",", "tc", ",", "\"An error occured during connection cleanup. Since the container drives \"", "+", "\"the cleanup op, it will directly receive the exception.\"", ")", ";", "return", ";", "}", "if", "(", "connectionErrorDetected", ")", "{", "if", "(", "isTraceOn", "&&", "tc", ".", "isEventEnabled", "(", ")", ")", "Tr", ".", "event", "(", "this", ",", "tc", ",", "\"CONNECTION_ERROR_OCCURRED event already fired\"", ")", ";", "return", ";", "}", "if", "(", "ex", "instanceof", "SQLException", "&&", "mcf", ".", "helper", ".", "isAnAuthorizationException", "(", "(", "SQLException", ")", "ex", ")", ")", "{", "if", "(", "isTraceOn", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "this", ",", "tc", ",", "\"CONNECTION_ERROR_OCCURRED will fire an event to only purge and destroy this connection\"", ")", ";", "connectionErrorDetected", "=", "true", ";", "closeHandles", "(", ")", ";", "// Create a Connection Error Event with the given SQLException.", "// Reuse a single ConnectionEvent instance.", "// - Modified to use J2C defined event.", "connEvent", ".", "recycle", "(", "WSConnectionEvent", ".", "SINGLE_CONNECTION_ERROR_OCCURRED", ",", "ex", ",", "handle", ")", ";", "if", "(", "isTraceOn", "&&", "tc", ".", "isEventEnabled", "(", ")", ")", "Tr", ".", "event", "(", "this", ",", "tc", ",", "\"Firing Single CONNECTION_ERROR_OCCURRED\"", ",", "handle", ")", ";", "// loop through the listeners", "for", "(", "int", "i", "=", "0", ";", "i", "<", "numListeners", ";", "i", "++", ")", "{", "// send Connection Error Occurred event to the current listener", "ivEventListeners", "[", "i", "]", ".", "connectionErrorOccurred", "(", "connEvent", ")", ";", "}", "return", ";", "}", "mcf", ".", "fatalErrorCount", ".", "incrementAndGet", "(", ")", ";", "if", "(", "mcf", ".", "oracleRACXARetryDelay", ">", "0l", ")", "mcf", ".", "oracleRACLastStale", ".", "set", "(", "System", ".", "currentTimeMillis", "(", ")", ")", ";", "connectionErrorDetected", "=", "true", ";", "// The connectionErrorDetected indicator is no longer required for ManagedConnection", "// cleanup since we are now required to invalidate all handles at that point", "// regardless of whether a connection error has occurred. ", "// Close all active handles for this ManagedConnection, since we cannot rely on the", "// ConnectionManager to request cleanup/destroy immediately. The ConnectionManager is", "// required to wait until the transaction has ended. ", "closeHandles", "(", ")", ";", "// Create a Connection Error Event with the given SQLException.", "// Reuse a single ConnectionEvent instance. ", "// - Fire the normal logging event if logEvent == true. Otherwise, fire the non-logging connection error event.", "connEvent", ".", "recycle", "(", "(", "logEvent", "?", "ConnectionEvent", ".", "CONNECTION_ERROR_OCCURRED", ":", "WSConnectionEvent", ".", "CONNECTION_ERROR_OCCURRED_NO_EVENT", ")", ",", "ex", ",", "handle", ")", ";", "if", "(", "isTraceOn", "&&", "tc", ".", "isEventEnabled", "(", ")", ")", "Tr", ".", "event", "(", "this", ",", "tc", ",", "\"Firing \"", "+", "(", "logEvent", "?", "\"CONNECTION_ERROR_OCCURRED\"", ":", "\"CONNECTION_ERROR_OCCURRED_NO_EVENT\"", ")", ",", "handle", ")", ";", "// loop through the listeners", "for", "(", "int", "i", "=", "0", ";", "i", "<", "numListeners", ";", "i", "++", ")", "{", "// send Connection Error Occurred event to the current listener", "ivEventListeners", "[", "i", "]", ".", "connectionErrorOccurred", "(", "connEvent", ")", ";", "}", "// Replace ConnectionEvent caching with a single reusable instance per", "// ManagedConnection. ", "}" ]
Process request for a CONNECTION_ERROR_OCCURRED event. @param event the Connection handle requesting to send the event. @param ex the exception which indicates the connection error, or null if no exception. @param logEvent fire a logging or non-logging event to be interpreted by the connection manager.
[ "Process", "request", "for", "a", "CONNECTION_ERROR_OCCURRED", "event", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java#L1674-L1764
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java
WSRdbManagedConnectionImpl.statementClosed
public void statementClosed(javax.sql.StatementEvent event) { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) Tr.event(this, tc, "statementClosed", "Notification of statement closed received from the JDBC driver", AdapterUtil.toString(event.getSource()), AdapterUtil.toString(event.getStatement()) ); // Statement.close is used instead of these signals. }
java
public void statementClosed(javax.sql.StatementEvent event) { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) Tr.event(this, tc, "statementClosed", "Notification of statement closed received from the JDBC driver", AdapterUtil.toString(event.getSource()), AdapterUtil.toString(event.getStatement()) ); // Statement.close is used instead of these signals. }
[ "public", "void", "statementClosed", "(", "javax", ".", "sql", ".", "StatementEvent", "event", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEventEnabled", "(", ")", ")", "Tr", ".", "event", "(", "this", ",", "tc", ",", "\"statementClosed\"", ",", "\"Notification of statement closed received from the JDBC driver\"", ",", "AdapterUtil", ".", "toString", "(", "event", ".", "getSource", "(", ")", ")", ",", "AdapterUtil", ".", "toString", "(", "event", ".", "getStatement", "(", ")", ")", ")", ";", "// Statement.close is used instead of these signals.", "}" ]
Invoked by the JDBC driver when a prepared statement is closed. @param event a data structure containing information about the event.
[ "Invoked", "by", "the", "JDBC", "driver", "when", "a", "prepared", "statement", "is", "closed", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java#L1772-L1781
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java
WSRdbManagedConnectionImpl.statementErrorOccurred
public void statementErrorOccurred(StatementEvent event) { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(this, tc, "statementErrorOccurred", "Notification of a fatal statement error received from the JDBC driver", AdapterUtil.toString(event.getSource()), AdapterUtil.toString(event.getStatement()), event.getSQLException() ); for (int i = 0; i < numHandlesInUse; i++) ((WSJdbcConnection) handlesInUse[i]).setPoolableFlag(event.getStatement(), false); if (isTraceOn && tc.isEntryEnabled()) Tr.exit(this, tc, "statementErrorOccurred"); }
java
public void statementErrorOccurred(StatementEvent event) { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(this, tc, "statementErrorOccurred", "Notification of a fatal statement error received from the JDBC driver", AdapterUtil.toString(event.getSource()), AdapterUtil.toString(event.getStatement()), event.getSQLException() ); for (int i = 0; i < numHandlesInUse; i++) ((WSJdbcConnection) handlesInUse[i]).setPoolableFlag(event.getStatement(), false); if (isTraceOn && tc.isEntryEnabled()) Tr.exit(this, tc, "statementErrorOccurred"); }
[ "public", "void", "statementErrorOccurred", "(", "StatementEvent", "event", ")", "{", "final", "boolean", "isTraceOn", "=", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", ";", "if", "(", "isTraceOn", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "this", ",", "tc", ",", "\"statementErrorOccurred\"", ",", "\"Notification of a fatal statement error received from the JDBC driver\"", ",", "AdapterUtil", ".", "toString", "(", "event", ".", "getSource", "(", ")", ")", ",", "AdapterUtil", ".", "toString", "(", "event", ".", "getStatement", "(", ")", ")", ",", "event", ".", "getSQLException", "(", ")", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "numHandlesInUse", ";", "i", "++", ")", "", "(", "(", "WSJdbcConnection", ")", "handlesInUse", "[", "i", "]", ")", ".", "setPoolableFlag", "(", "event", ".", "getStatement", "(", ")", ",", "false", ")", ";", "if", "(", "isTraceOn", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "this", ",", "tc", ",", "\"statementErrorOccurred\"", ")", ";", "}" ]
Invoked by the JDBC driver when a fatal statement error occurs. @param event a data structure containing information about the event.
[ "Invoked", "by", "the", "JDBC", "driver", "when", "a", "fatal", "statement", "error", "occurs", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java#L1789-L1805
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java
WSRdbManagedConnectionImpl.lazyEnlistInGlobalTran
public void lazyEnlistInGlobalTran(LazyEnlistableConnectionManager lazyEnlistableConnectionManager) throws ResourceException { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn) { if (tc.isEntryEnabled()) Tr.entry(this, tc, "lazyEnlist", lazyEnlistableConnectionManager); if (tc.isDebugEnabled()) { String cId = null; try { cId = mcf.getCorrelator(this); } 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 (xares != null) { // doing this because otherwise, we will hvae an extra Begin that does't match commit/rollback stbuf.append(" Transaction : "); stbuf.append(xares); stbuf.append(" BEGIN"); } Tr.debug(this, tc, stbuf.toString()); } } } // Signal the ConnectionManager directly to lazily enlist. if (wasLazilyEnlistedInGlobalTran) // Already enlisted; don't need to do anything. { if (isTraceOn && tc.isEntryEnabled()) Tr.exit(this, tc, "lazyEnlist", "already enlisted"); } else { lazyEnlistableConnectionManager.lazyEnlist(this); // Indicate we lazily enlisted in the current transaction, if so. wasLazilyEnlistedInGlobalTran |= stateMgr.transtate != WSStateManager.NO_TRANSACTION_ACTIVE; if (isTraceOn && tc.isEntryEnabled()) Tr.exit(this, tc, "lazyEnlist", wasLazilyEnlistedInGlobalTran); } }
java
public void lazyEnlistInGlobalTran(LazyEnlistableConnectionManager lazyEnlistableConnectionManager) throws ResourceException { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn) { if (tc.isEntryEnabled()) Tr.entry(this, tc, "lazyEnlist", lazyEnlistableConnectionManager); if (tc.isDebugEnabled()) { String cId = null; try { cId = mcf.getCorrelator(this); } 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 (xares != null) { // doing this because otherwise, we will hvae an extra Begin that does't match commit/rollback stbuf.append(" Transaction : "); stbuf.append(xares); stbuf.append(" BEGIN"); } Tr.debug(this, tc, stbuf.toString()); } } } // Signal the ConnectionManager directly to lazily enlist. if (wasLazilyEnlistedInGlobalTran) // Already enlisted; don't need to do anything. { if (isTraceOn && tc.isEntryEnabled()) Tr.exit(this, tc, "lazyEnlist", "already enlisted"); } else { lazyEnlistableConnectionManager.lazyEnlist(this); // Indicate we lazily enlisted in the current transaction, if so. wasLazilyEnlistedInGlobalTran |= stateMgr.transtate != WSStateManager.NO_TRANSACTION_ACTIVE; if (isTraceOn && tc.isEntryEnabled()) Tr.exit(this, tc, "lazyEnlist", wasLazilyEnlistedInGlobalTran); } }
[ "public", "void", "lazyEnlistInGlobalTran", "(", "LazyEnlistableConnectionManager", "lazyEnlistableConnectionManager", ")", "throws", "ResourceException", "{", "final", "boolean", "isTraceOn", "=", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", ";", "if", "(", "isTraceOn", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "this", ",", "tc", ",", "\"lazyEnlist\"", ",", "lazyEnlistableConnectionManager", ")", ";", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "String", "cId", "=", "null", ";", "try", "{", "cId", "=", "mcf", ".", "getCorrelator", "(", "this", ")", ";", "}", "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", "(", "xares", "!=", "null", ")", "{", "// doing this because otherwise, we will hvae an extra Begin that does't match commit/rollback", "stbuf", ".", "append", "(", "\" Transaction : \"", ")", ";", "stbuf", ".", "append", "(", "xares", ")", ";", "stbuf", ".", "append", "(", "\" BEGIN\"", ")", ";", "}", "Tr", ".", "debug", "(", "this", ",", "tc", ",", "stbuf", ".", "toString", "(", ")", ")", ";", "}", "}", "}", "// Signal the ConnectionManager directly to lazily enlist.", "if", "(", "wasLazilyEnlistedInGlobalTran", ")", "// Already enlisted; don't need to do anything.", "{", "if", "(", "isTraceOn", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "this", ",", "tc", ",", "\"lazyEnlist\"", ",", "\"already enlisted\"", ")", ";", "}", "else", "{", "lazyEnlistableConnectionManager", ".", "lazyEnlist", "(", "this", ")", ";", "// Indicate we lazily enlisted in the current transaction, if so.", "wasLazilyEnlistedInGlobalTran", "|=", "stateMgr", ".", "transtate", "!=", "WSStateManager", ".", "NO_TRANSACTION_ACTIVE", ";", "if", "(", "isTraceOn", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "this", ",", "tc", ",", "\"lazyEnlist\"", ",", "wasLazilyEnlistedInGlobalTran", ")", ";", "}", "}" ]
Signal the Application Server for lazy enlistment if we aren't already enlisted in a transaction. The lazy enlistment signal should only be sent once for a transaction. Connection handles will always invoke this method when doing work in the database, regardless of whether we are already enlisted. In the case where we are already enlisted, this request should be ignored. @param lazyEnlistableConnectionManager a ConnectionManager capable of lazy enlistment. @throws ResourceException if an error occurs signaling for lazy enlistement.
[ "Signal", "the", "Application", "Server", "for", "lazy", "enlistment", "if", "we", "aren", "t", "already", "enlisted", "in", "a", "transaction", ".", "The", "lazy", "enlistment", "signal", "should", "only", "be", "sent", "once", "for", "a", "transaction", ".", "Connection", "handles", "will", "always", "invoke", "this", "method", "when", "doing", "work", "in", "the", "database", "regardless", "of", "whether", "we", "are", "already", "enlisted", ".", "In", "the", "case", "where", "we", "are", "already", "enlisted", "this", "request", "should", "be", "ignored", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java#L1818-L1865
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java
WSRdbManagedConnectionImpl.refreshCachedAutoCommit
void refreshCachedAutoCommit() { try { boolean autoCommit = sqlConn.getAutoCommit(); if (currentAutoCommit != autoCommit) { currentAutoCommit = autoCommit; for (int i = 0; i < numHandlesInUse; i++) handlesInUse[i].setCurrentAutoCommit(autoCommit, key); } } catch (SQLException x) { // Mark the connection stale and close all handles if we cannot accurately determine the autocommit value. processConnectionErrorOccurredEvent(null, x); } }
java
void refreshCachedAutoCommit() { try { boolean autoCommit = sqlConn.getAutoCommit(); if (currentAutoCommit != autoCommit) { currentAutoCommit = autoCommit; for (int i = 0; i < numHandlesInUse; i++) handlesInUse[i].setCurrentAutoCommit(autoCommit, key); } } catch (SQLException x) { // Mark the connection stale and close all handles if we cannot accurately determine the autocommit value. processConnectionErrorOccurredEvent(null, x); } }
[ "void", "refreshCachedAutoCommit", "(", ")", "{", "try", "{", "boolean", "autoCommit", "=", "sqlConn", ".", "getAutoCommit", "(", ")", ";", "if", "(", "currentAutoCommit", "!=", "autoCommit", ")", "{", "currentAutoCommit", "=", "autoCommit", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "numHandlesInUse", ";", "i", "++", ")", "handlesInUse", "[", "i", "]", ".", "setCurrentAutoCommit", "(", "autoCommit", ",", "key", ")", ";", "}", "}", "catch", "(", "SQLException", "x", ")", "{", "// Mark the connection stale and close all handles if we cannot accurately determine the autocommit value.", "processConnectionErrorOccurredEvent", "(", "null", ",", "x", ")", ";", "}", "}" ]
After XAResource.end, Oracle resets the autocommit value to whatever it was before the transaction instead of leaving it as the value that the application set during the transaction. Refresh our cached copy of the autocommit value to be consistent with the JDBC driver's behavior.
[ "After", "XAResource", ".", "end", "Oracle", "resets", "the", "autocommit", "value", "to", "whatever", "it", "was", "before", "the", "transaction", "instead", "of", "leaving", "it", "as", "the", "value", "that", "the", "application", "set", "during", "the", "transaction", ".", "Refresh", "our", "cached", "copy", "of", "the", "autocommit", "value", "to", "be", "consistent", "with", "the", "JDBC", "driver", "s", "behavior", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java#L1872-L1884
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java
WSRdbManagedConnectionImpl.removeHandle
private final boolean removeHandle(WSJdbcConnection handle) { // Find the handle in the list and remove it. for (int i = numHandlesInUse; i > 0;) if (handle == handlesInUse[--i]) { // Once found, the handle is removed by replacing it with the last handle in the // list and nulling out the previous entry for the last handle. handlesInUse[i] = handlesInUse[--numHandlesInUse]; handlesInUse[numHandlesInUse] = null; return true; } // The handle wasn't found in the list. return false; }
java
private final boolean removeHandle(WSJdbcConnection handle) { // Find the handle in the list and remove it. for (int i = numHandlesInUse; i > 0;) if (handle == handlesInUse[--i]) { // Once found, the handle is removed by replacing it with the last handle in the // list and nulling out the previous entry for the last handle. handlesInUse[i] = handlesInUse[--numHandlesInUse]; handlesInUse[numHandlesInUse] = null; return true; } // The handle wasn't found in the list. return false; }
[ "private", "final", "boolean", "removeHandle", "(", "WSJdbcConnection", "handle", ")", "{", "// Find the handle in the list and remove it.", "for", "(", "int", "i", "=", "numHandlesInUse", ";", "i", ">", "0", ";", ")", "if", "(", "handle", "==", "handlesInUse", "[", "--", "i", "]", ")", "{", "// Once found, the handle is removed by replacing it with the last handle in the", "// list and nulling out the previous entry for the last handle.", "handlesInUse", "[", "i", "]", "=", "handlesInUse", "[", "--", "numHandlesInUse", "]", ";", "handlesInUse", "[", "numHandlesInUse", "]", "=", "null", ";", "return", "true", ";", "}", "// The handle wasn't found in the list.", "return", "false", ";", "}" ]
Remove a handle from the list of handles associated with this ManagedConnection. @param handle the handle to remove from the list. @return true if we removed the requested handle, otherwise false.
[ "Remove", "a", "handle", "from", "the", "list", "of", "handles", "associated", "with", "this", "ManagedConnection", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java#L1894-L1910
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java
WSRdbManagedConnectionImpl.replaceCRI
private void replaceCRI(WSConnectionRequestInfoImpl newCRI) throws ResourceException { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(this, tc, "replaceCRI", "Current:", cri, "New:", newCRI); if (numHandlesInUse > 0 || !cri.isReconfigurable(newCRI, false)) { if (numHandlesInUse > 0) { ResourceException resX = new DataStoreAdapterException("WS_INTERNAL_ERROR", null, getClass(), "ConnectionRequestInfo cannot be changed on a ManagedConnection with active handles.", AdapterUtil.EOLN + "Existing CRI: " + cri, AdapterUtil.EOLN + "Requested CRI: " + newCRI); if (isTraceOn && tc.isEntryEnabled()) Tr.exit(this, tc, "replaceCRI", resX); throw resX; } else // Users, passwords, or DataSource configurations do not match. { ResourceException resX = new DataStoreAdapterException("WS_INTERNAL_ERROR", null, getClass(), "ConnectionRequestInfo cannot be changed because the users, passwords, or DataSource configurations do not match.", AdapterUtil.EOLN + "Existing CRI: " + cri, AdapterUtil.EOLN + "Requested CRI: " + newCRI); if (isTraceOn && tc.isEntryEnabled()) Tr.exit(this, tc, "replaceCRI", resX); throw resX; } } // The ManagedConnection should use the new CRI value in place of its current CRI. if (!newCRI.isCRIChangable()) newCRI = WSConnectionRequestInfoImpl.createChangableCRIFromNon(newCRI); newCRI.setDefaultValues(defaultCatalog, defaultHoldability, defaultReadOnly, defaultTypeMap, defaultSchema, defaultNetworkTimeout); cri = newCRI; // -- don't intialize the properties, deplay to synchronizePropertiesWithCRI(). if (isTraceOn && tc.isEntryEnabled()) Tr.exit(this, tc, "replaceCRI"); }
java
private void replaceCRI(WSConnectionRequestInfoImpl newCRI) throws ResourceException { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(this, tc, "replaceCRI", "Current:", cri, "New:", newCRI); if (numHandlesInUse > 0 || !cri.isReconfigurable(newCRI, false)) { if (numHandlesInUse > 0) { ResourceException resX = new DataStoreAdapterException("WS_INTERNAL_ERROR", null, getClass(), "ConnectionRequestInfo cannot be changed on a ManagedConnection with active handles.", AdapterUtil.EOLN + "Existing CRI: " + cri, AdapterUtil.EOLN + "Requested CRI: " + newCRI); if (isTraceOn && tc.isEntryEnabled()) Tr.exit(this, tc, "replaceCRI", resX); throw resX; } else // Users, passwords, or DataSource configurations do not match. { ResourceException resX = new DataStoreAdapterException("WS_INTERNAL_ERROR", null, getClass(), "ConnectionRequestInfo cannot be changed because the users, passwords, or DataSource configurations do not match.", AdapterUtil.EOLN + "Existing CRI: " + cri, AdapterUtil.EOLN + "Requested CRI: " + newCRI); if (isTraceOn && tc.isEntryEnabled()) Tr.exit(this, tc, "replaceCRI", resX); throw resX; } } // The ManagedConnection should use the new CRI value in place of its current CRI. if (!newCRI.isCRIChangable()) newCRI = WSConnectionRequestInfoImpl.createChangableCRIFromNon(newCRI); newCRI.setDefaultValues(defaultCatalog, defaultHoldability, defaultReadOnly, defaultTypeMap, defaultSchema, defaultNetworkTimeout); cri = newCRI; // -- don't intialize the properties, deplay to synchronizePropertiesWithCRI(). if (isTraceOn && tc.isEntryEnabled()) Tr.exit(this, tc, "replaceCRI"); }
[ "private", "void", "replaceCRI", "(", "WSConnectionRequestInfoImpl", "newCRI", ")", "throws", "ResourceException", "{", "final", "boolean", "isTraceOn", "=", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", ";", "if", "(", "isTraceOn", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "this", ",", "tc", ",", "\"replaceCRI\"", ",", "\"Current:\"", ",", "cri", ",", "\"New:\"", ",", "newCRI", ")", ";", "if", "(", "numHandlesInUse", ">", "0", "||", "!", "cri", ".", "isReconfigurable", "(", "newCRI", ",", "false", ")", ")", "{", "if", "(", "numHandlesInUse", ">", "0", ")", "{", "ResourceException", "resX", "=", "new", "DataStoreAdapterException", "(", "\"WS_INTERNAL_ERROR\"", ",", "null", ",", "getClass", "(", ")", ",", "\"ConnectionRequestInfo cannot be changed on a ManagedConnection with active handles.\"", ",", "AdapterUtil", ".", "EOLN", "+", "\"Existing CRI: \"", "+", "cri", ",", "AdapterUtil", ".", "EOLN", "+", "\"Requested CRI: \"", "+", "newCRI", ")", ";", "if", "(", "isTraceOn", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "this", ",", "tc", ",", "\"replaceCRI\"", ",", "resX", ")", ";", "throw", "resX", ";", "}", "else", "// Users, passwords, or DataSource configurations do not match. ", "{", "ResourceException", "resX", "=", "new", "DataStoreAdapterException", "(", "\"WS_INTERNAL_ERROR\"", ",", "null", ",", "getClass", "(", ")", ",", "\"ConnectionRequestInfo cannot be changed because the users, passwords, or DataSource configurations do not match.\"", ",", "AdapterUtil", ".", "EOLN", "+", "\"Existing CRI: \"", "+", "cri", ",", "AdapterUtil", ".", "EOLN", "+", "\"Requested CRI: \"", "+", "newCRI", ")", ";", "if", "(", "isTraceOn", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "this", ",", "tc", ",", "\"replaceCRI\"", ",", "resX", ")", ";", "throw", "resX", ";", "}", "}", "// The ManagedConnection should use the new CRI value in place of its current CRI.", "if", "(", "!", "newCRI", ".", "isCRIChangable", "(", ")", ")", "newCRI", "=", "WSConnectionRequestInfoImpl", ".", "createChangableCRIFromNon", "(", "newCRI", ")", ";", "newCRI", ".", "setDefaultValues", "(", "defaultCatalog", ",", "defaultHoldability", ",", "defaultReadOnly", ",", "defaultTypeMap", ",", "defaultSchema", ",", "defaultNetworkTimeout", ")", ";", "cri", "=", "newCRI", ";", "// -- don't intialize the properties, deplay to synchronizePropertiesWithCRI().", "if", "(", "isTraceOn", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "this", ",", "tc", ",", "\"replaceCRI\"", ")", ";", "}" ]
Replace the CRI of this ManagedConnection with the new CRI. @param newCRI the new CRI. @throws ResourceException if handles already exist on the ManagedConnection or if the requested CRI contains a different user, password, or DataSource configuration than the existing CRI.
[ "Replace", "the", "CRI", "of", "this", "ManagedConnection", "with", "the", "new", "CRI", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java#L1921-L1969
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java
WSRdbManagedConnectionImpl.resizeHandleList
private WSJdbcConnection[] resizeHandleList() { System.arraycopy(handlesInUse, 0, handlesInUse = new WSJdbcConnection[ maxHandlesInUse > numHandlesInUse ? maxHandlesInUse : (maxHandlesInUse = numHandlesInUse * 2)], 0, numHandlesInUse); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "Handle limit increased to: " + maxHandlesInUse); return handlesInUse; }
java
private WSJdbcConnection[] resizeHandleList() { System.arraycopy(handlesInUse, 0, handlesInUse = new WSJdbcConnection[ maxHandlesInUse > numHandlesInUse ? maxHandlesInUse : (maxHandlesInUse = numHandlesInUse * 2)], 0, numHandlesInUse); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "Handle limit increased to: " + maxHandlesInUse); return handlesInUse; }
[ "private", "WSJdbcConnection", "[", "]", "resizeHandleList", "(", ")", "{", "System", ".", "arraycopy", "(", "handlesInUse", ",", "0", ",", "handlesInUse", "=", "new", "WSJdbcConnection", "[", "maxHandlesInUse", ">", "numHandlesInUse", "?", "maxHandlesInUse", ":", "(", "maxHandlesInUse", "=", "numHandlesInUse", "*", "2", ")", "]", ",", "0", ",", "numHandlesInUse", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "this", ",", "tc", ",", "\"Handle limit increased to: \"", "+", "maxHandlesInUse", ")", ";", "return", "handlesInUse", ";", "}" ]
Increase the size of the array that keeps track of handles associated with this ManagedConnection. @return the resized handle list.
[ "Increase", "the", "size", "of", "the", "array", "that", "keeps", "track", "of", "handles", "associated", "with", "this", "ManagedConnection", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java#L2020-L2035
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java
WSRdbManagedConnectionImpl.handleCleanReuse
private void handleCleanReuse() throws ResourceException { // moved clearing the cache to before we issue the reuse connection //Now since a reuse was issued, the connection is restored to its orginal properties, so make sure // that you match the cri. try { currentTransactionIsolation = sqlConn.getTransactionIsolation(); currentHoldability = defaultHoldability; // get the autoCommit value as it will be reset when reusing the connection currentAutoCommit = sqlConn.getAutoCommit(); } catch (SQLException sqlX) { FFDCFilter.processException(sqlX, getClass().getName() + ".handleCleanReuse", "2787", this); throw AdapterUtil.translateSQLException(sqlX, this, true, getClass()); } // start: turn out that tracing will be reset once the connection is reused. // so will need to reset it on our end too and then enable it if needed. loggingEnabled = false; // reset the tracing flag for this mc. if (helper.shouldTraceBeEnabled(this)) { helper.enableJdbcLogging(this); } }
java
private void handleCleanReuse() throws ResourceException { // moved clearing the cache to before we issue the reuse connection //Now since a reuse was issued, the connection is restored to its orginal properties, so make sure // that you match the cri. try { currentTransactionIsolation = sqlConn.getTransactionIsolation(); currentHoldability = defaultHoldability; // get the autoCommit value as it will be reset when reusing the connection currentAutoCommit = sqlConn.getAutoCommit(); } catch (SQLException sqlX) { FFDCFilter.processException(sqlX, getClass().getName() + ".handleCleanReuse", "2787", this); throw AdapterUtil.translateSQLException(sqlX, this, true, getClass()); } // start: turn out that tracing will be reset once the connection is reused. // so will need to reset it on our end too and then enable it if needed. loggingEnabled = false; // reset the tracing flag for this mc. if (helper.shouldTraceBeEnabled(this)) { helper.enableJdbcLogging(this); } }
[ "private", "void", "handleCleanReuse", "(", ")", "throws", "ResourceException", "{", "// moved clearing the cache to before we issue the reuse connection", "//Now since a reuse was issued, the connection is restored to its orginal properties, so make sure", "// that you match the cri.", "try", "{", "currentTransactionIsolation", "=", "sqlConn", ".", "getTransactionIsolation", "(", ")", ";", "currentHoldability", "=", "defaultHoldability", ";", "// get the autoCommit value as it will be reset when reusing the connection", "currentAutoCommit", "=", "sqlConn", ".", "getAutoCommit", "(", ")", ";", "}", "catch", "(", "SQLException", "sqlX", ")", "{", "FFDCFilter", ".", "processException", "(", "sqlX", ",", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\".handleCleanReuse\"", ",", "\"2787\"", ",", "this", ")", ";", "throw", "AdapterUtil", ".", "translateSQLException", "(", "sqlX", ",", "this", ",", "true", ",", "getClass", "(", ")", ")", ";", "}", "// start: turn out that tracing will be reset once the connection is reused.", "// so will need to reset it on our end too and then enable it if needed.", "loggingEnabled", "=", "false", ";", "// reset the tracing flag for this mc.", "if", "(", "helper", ".", "shouldTraceBeEnabled", "(", "this", ")", ")", "{", "helper", ".", "enableJdbcLogging", "(", "this", ")", ";", "}", "}" ]
used to do some cleanup after a reuse of connection @param sqConn @throws ResourceException @throws Exception
[ "used", "to", "do", "some", "cleanup", "after", "a", "reuse", "of", "connection" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java#L2190-L2211
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java
WSRdbManagedConnectionImpl.getStatement
public final Object getStatement(StatementCacheKey key) { Object stmt = statementCache.remove(key); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { if (stmt == null) { Tr.debug(this, tc, "No Matching Prepared Statement found in cache"); } else { Tr.debug(this, tc, "Matching Prepared Statement found in cache: " + stmt); } } return stmt; }
java
public final Object getStatement(StatementCacheKey key) { Object stmt = statementCache.remove(key); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { if (stmt == null) { Tr.debug(this, tc, "No Matching Prepared Statement found in cache"); } else { Tr.debug(this, tc, "Matching Prepared Statement found in cache: " + stmt); } } return stmt; }
[ "public", "final", "Object", "getStatement", "(", "StatementCacheKey", "key", ")", "{", "Object", "stmt", "=", "statementCache", ".", "remove", "(", "key", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "if", "(", "stmt", "==", "null", ")", "{", "Tr", ".", "debug", "(", "this", ",", "tc", ",", "\"No Matching Prepared Statement found in cache\"", ")", ";", "}", "else", "{", "Tr", ".", "debug", "(", "this", ",", "tc", ",", "\"Matching Prepared Statement found in cache: \"", "+", "stmt", ")", ";", "}", "}", "return", "stmt", ";", "}" ]
Return a statement from the cache matching the key provided. Null is returned if no statement matches. @param key the statement cache key. @return a matching statement from the cache or null if none is found. @throws SQLException if an error occurs obtaining a new statement.
[ "Return", "a", "statement", "from", "the", "cache", "matching", "the", "key", "provided", ".", "Null", "is", "returned", "if", "no", "statement", "matches", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java#L2223-L2234
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java
WSRdbManagedConnectionImpl.cacheStatement
public final void cacheStatement(Statement statement, StatementCacheKey key) { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) Tr.event(this, tc, "cacheStatement", AdapterUtil.toString(statement), key); // Add the statement to the cache. If there is no room in the cache, a statement from // the least recently used bucket will be cast out of the cache. Any statement cast // out of the cache must be closed. CacheMap cache = getStatementCache(); Object discardedStatement = cache == null ? statement : statementCache.add(key, statement); if (discardedStatement != null) destroyStatement(discardedStatement); }
java
public final void cacheStatement(Statement statement, StatementCacheKey key) { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) Tr.event(this, tc, "cacheStatement", AdapterUtil.toString(statement), key); // Add the statement to the cache. If there is no room in the cache, a statement from // the least recently used bucket will be cast out of the cache. Any statement cast // out of the cache must be closed. CacheMap cache = getStatementCache(); Object discardedStatement = cache == null ? statement : statementCache.add(key, statement); if (discardedStatement != null) destroyStatement(discardedStatement); }
[ "public", "final", "void", "cacheStatement", "(", "Statement", "statement", ",", "StatementCacheKey", "key", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEventEnabled", "(", ")", ")", "Tr", ".", "event", "(", "this", ",", "tc", ",", "\"cacheStatement\"", ",", "AdapterUtil", ".", "toString", "(", "statement", ")", ",", "key", ")", ";", "// Add the statement to the cache. If there is no room in the cache, a statement from", "// the least recently used bucket will be cast out of the cache. Any statement cast", "// out of the cache must be closed. ", "CacheMap", "cache", "=", "getStatementCache", "(", ")", ";", "Object", "discardedStatement", "=", "cache", "==", "null", "?", "statement", ":", "statementCache", ".", "add", "(", "key", ",", "statement", ")", ";", "if", "(", "discardedStatement", "!=", "null", ")", "destroyStatement", "(", "discardedStatement", ")", ";", "}" ]
Returns the statement into the cache. The statement is closed if an error occurs attempting to cache it. This method will only called if statement caching was enabled at some point, although it might not be enabled anymore. @param statement the statement to return to the cache. @param key the statement cache key.
[ "Returns", "the", "statement", "into", "the", "cache", ".", "The", "statement", "is", "closed", "if", "an", "error", "occurs", "attempting", "to", "cache", "it", ".", "This", "method", "will", "only", "called", "if", "statement", "caching", "was", "enabled", "at", "some", "point", "although", "it", "might", "not", "be", "enabled", "anymore", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java#L2244-L2257
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java
WSRdbManagedConnectionImpl.dissociateHandle
public void dissociateHandle(WSJdbcConnection connHandle) { if (!cleaningUpHandles && !removeHandle(connHandle)) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "Unable to dissociate Connection handle with current ManagedConnection because it is not currently associated with the ManagedConnection.", connHandle); } }
java
public void dissociateHandle(WSJdbcConnection connHandle) { if (!cleaningUpHandles && !removeHandle(connHandle)) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "Unable to dissociate Connection handle with current ManagedConnection because it is not currently associated with the ManagedConnection.", connHandle); } }
[ "public", "void", "dissociateHandle", "(", "WSJdbcConnection", "connHandle", ")", "{", "if", "(", "!", "cleaningUpHandles", "&&", "!", "removeHandle", "(", "connHandle", ")", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "this", ",", "tc", ",", "\"Unable to dissociate Connection handle with current ManagedConnection because it is not currently associated with the ManagedConnection.\"", ",", "connHandle", ")", ";", "}", "}" ]
This method is invoked by the connection handle during dissociation to signal the ManagedConnection to remove all references to the handle. If the ManagedConnection is not associated with the specified handle, this method is a no-op and a warning message is traced. @param the connection handle.
[ "This", "method", "is", "invoked", "by", "the", "connection", "handle", "during", "dissociation", "to", "signal", "the", "ManagedConnection", "to", "remove", "all", "references", "to", "the", "handle", ".", "If", "the", "ManagedConnection", "is", "not", "associated", "with", "the", "specified", "handle", "this", "method", "is", "a", "no", "-", "op", "and", "a", "warning", "message", "is", "traced", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java#L2648-L2658
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java
WSRdbManagedConnectionImpl.clearStatementCache
public final void clearStatementCache() { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); // The closing of cached statements is now separated from the removing of statements // from the cache to avoid synchronization during the closing of statements. if (statementCache == null) { if (isTraceOn && tc.isDebugEnabled()) Tr.debug(this, tc, "statement cache is null. caching is disabled"); return; } if (isTraceOn && tc.isEntryEnabled()) Tr.entry(this, tc, "clearStatementCache"); Object[] stmts = statementCache.removeAll(); for (int i = stmts.length; i > 0;) try { ((Statement) stmts[--i]).close(); } catch (SQLException closeX) { FFDCFilter.processException( closeX, getClass().getName() + ".clearStatementCache", "2169", this); if (isTraceOn && tc.isDebugEnabled()) Tr.debug(this, tc, "Error closing statement", closeX); } if (isTraceOn && tc.isEntryEnabled()) Tr.exit(this, tc, "clearStatementCache"); }
java
public final void clearStatementCache() { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); // The closing of cached statements is now separated from the removing of statements // from the cache to avoid synchronization during the closing of statements. if (statementCache == null) { if (isTraceOn && tc.isDebugEnabled()) Tr.debug(this, tc, "statement cache is null. caching is disabled"); return; } if (isTraceOn && tc.isEntryEnabled()) Tr.entry(this, tc, "clearStatementCache"); Object[] stmts = statementCache.removeAll(); for (int i = stmts.length; i > 0;) try { ((Statement) stmts[--i]).close(); } catch (SQLException closeX) { FFDCFilter.processException( closeX, getClass().getName() + ".clearStatementCache", "2169", this); if (isTraceOn && tc.isDebugEnabled()) Tr.debug(this, tc, "Error closing statement", closeX); } if (isTraceOn && tc.isEntryEnabled()) Tr.exit(this, tc, "clearStatementCache"); }
[ "public", "final", "void", "clearStatementCache", "(", ")", "{", "final", "boolean", "isTraceOn", "=", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", ";", "// The closing of cached statements is now separated from the removing of statements", "// from the cache to avoid synchronization during the closing of statements.", "if", "(", "statementCache", "==", "null", ")", "{", "if", "(", "isTraceOn", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "this", ",", "tc", ",", "\"statement cache is null. caching is disabled\"", ")", ";", "return", ";", "}", "if", "(", "isTraceOn", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "this", ",", "tc", ",", "\"clearStatementCache\"", ")", ";", "Object", "[", "]", "stmts", "=", "statementCache", ".", "removeAll", "(", ")", ";", "for", "(", "int", "i", "=", "stmts", ".", "length", ";", "i", ">", "0", ";", ")", "try", "{", "(", "(", "Statement", ")", "stmts", "[", "--", "i", "]", ")", ".", "close", "(", ")", ";", "}", "catch", "(", "SQLException", "closeX", ")", "{", "FFDCFilter", ".", "processException", "(", "closeX", ",", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\".clearStatementCache\"", ",", "\"2169\"", ",", "this", ")", ";", "if", "(", "isTraceOn", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "this", ",", "tc", ",", "\"Error closing statement\"", ",", "closeX", ")", ";", "}", "if", "(", "isTraceOn", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "this", ",", "tc", ",", "\"clearStatementCache\"", ")", ";", "}" ]
Removes and closes all statements in the statement cache for this ManagedConnection.
[ "Removes", "and", "closes", "all", "statements", "in", "the", "statement", "cache", "for", "this", "ManagedConnection", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java#L3429-L3460
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java
WSRdbManagedConnectionImpl.closeHandles
private ResourceException closeHandles() { ResourceException firstX = null; Object conn = null; // Indicate that we are cleaning up handles, so we know not to send events for // operations done in the cleanup. cleaningUpHandles = true; for (int i = numHandlesInUse; i > 0;) { conn = handlesInUse[--i]; handlesInUse[i] = null; try { ((WSJdbcConnection) conn).close(); } catch (SQLException closeX) { FFDCFilter.processException(closeX, getClass().getName() + ".closeHandles", "1414", this); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) Tr.event(this, tc, "Error closing handle. Continuing...", conn); ResourceException resX = new DataStoreAdapterException( "DSA_ERROR", closeX, getClass()); if (firstX == null) firstX = resX; } } numHandlesInUse = 0; cleaningUpHandles = false; return firstX; }
java
private ResourceException closeHandles() { ResourceException firstX = null; Object conn = null; // Indicate that we are cleaning up handles, so we know not to send events for // operations done in the cleanup. cleaningUpHandles = true; for (int i = numHandlesInUse; i > 0;) { conn = handlesInUse[--i]; handlesInUse[i] = null; try { ((WSJdbcConnection) conn).close(); } catch (SQLException closeX) { FFDCFilter.processException(closeX, getClass().getName() + ".closeHandles", "1414", this); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) Tr.event(this, tc, "Error closing handle. Continuing...", conn); ResourceException resX = new DataStoreAdapterException( "DSA_ERROR", closeX, getClass()); if (firstX == null) firstX = resX; } } numHandlesInUse = 0; cleaningUpHandles = false; return firstX; }
[ "private", "ResourceException", "closeHandles", "(", ")", "{", "ResourceException", "firstX", "=", "null", ";", "Object", "conn", "=", "null", ";", "// Indicate that we are cleaning up handles, so we know not to send events for", "// operations done in the cleanup. ", "cleaningUpHandles", "=", "true", ";", "for", "(", "int", "i", "=", "numHandlesInUse", ";", "i", ">", "0", ";", ")", "{", "conn", "=", "handlesInUse", "[", "--", "i", "]", ";", "handlesInUse", "[", "i", "]", "=", "null", ";", "try", "{", "(", "(", "WSJdbcConnection", ")", "conn", ")", ".", "close", "(", ")", ";", "}", "catch", "(", "SQLException", "closeX", ")", "{", "FFDCFilter", ".", "processException", "(", "closeX", ",", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\".closeHandles\"", ",", "\"1414\"", ",", "this", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEventEnabled", "(", ")", ")", "Tr", ".", "event", "(", "this", ",", "tc", ",", "\"Error closing handle. Continuing...\"", ",", "conn", ")", ";", "ResourceException", "resX", "=", "new", "DataStoreAdapterException", "(", "\"DSA_ERROR\"", ",", "closeX", ",", "getClass", "(", ")", ")", ";", "if", "(", "firstX", "==", "null", ")", "firstX", "=", "resX", ";", "}", "}", "numHandlesInUse", "=", "0", ";", "cleaningUpHandles", "=", "false", ";", "return", "firstX", ";", "}" ]
Closes all handles associated with this ManagedConnection. Processing continues even if close fails on a handle. All errors are logged, and the first error is saved to be returned when processing completes. @return the first error to occur closing a handle, or null if none.
[ "Closes", "all", "handles", "associated", "with", "this", "ManagedConnection", ".", "Processing", "continues", "even", "if", "close", "fails", "on", "a", "handle", ".", "All", "errors", "are", "logged", "and", "the", "first", "error", "is", "saved", "to", "be", "returned", "when", "processing", "completes", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java#L3469-L3504
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java
WSRdbManagedConnectionImpl.getXAResource
public XAResource getXAResource() throws ResourceException { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(this, tc, "getXAResource"); if (xares != null) { if (isTraceOn && tc.isEventEnabled()) Tr.event(this, tc, "Returning existing XAResource", xares); } else if (is2Phase) { //this is a JTAEnabled dataSource, so get a real XaResource object try { XAResource xa = ((javax.sql.XAConnection) poolConn).getXAResource(); xares = new WSRdbXaResourceImpl(xa, this); } catch (SQLException se) { FFDCFilter.processException(se, "com.ibm.ws.rsadapter.spi.WSRdbManagedConnectionImpl.getXAResource", "1638", this); if (isTraceOn && tc.isEntryEnabled()) Tr.exit(this, tc, "getXAResource", se); throw AdapterUtil.translateSQLException(se, this, true, getClass()); } } else { //this is not a JTAEnabled dataSource, so can't get an xaResource //instead get a OnePhaseXAResource xares = new WSRdbOnePhaseXaResourceImpl(sqlConn, this); } if (isTraceOn && tc.isEntryEnabled()) Tr.exit(this, tc, "getXAResource"); return xares; }
java
public XAResource getXAResource() throws ResourceException { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(this, tc, "getXAResource"); if (xares != null) { if (isTraceOn && tc.isEventEnabled()) Tr.event(this, tc, "Returning existing XAResource", xares); } else if (is2Phase) { //this is a JTAEnabled dataSource, so get a real XaResource object try { XAResource xa = ((javax.sql.XAConnection) poolConn).getXAResource(); xares = new WSRdbXaResourceImpl(xa, this); } catch (SQLException se) { FFDCFilter.processException(se, "com.ibm.ws.rsadapter.spi.WSRdbManagedConnectionImpl.getXAResource", "1638", this); if (isTraceOn && tc.isEntryEnabled()) Tr.exit(this, tc, "getXAResource", se); throw AdapterUtil.translateSQLException(se, this, true, getClass()); } } else { //this is not a JTAEnabled dataSource, so can't get an xaResource //instead get a OnePhaseXAResource xares = new WSRdbOnePhaseXaResourceImpl(sqlConn, this); } if (isTraceOn && tc.isEntryEnabled()) Tr.exit(this, tc, "getXAResource"); return xares; }
[ "public", "XAResource", "getXAResource", "(", ")", "throws", "ResourceException", "{", "final", "boolean", "isTraceOn", "=", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", ";", "if", "(", "isTraceOn", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "this", ",", "tc", ",", "\"getXAResource\"", ")", ";", "if", "(", "xares", "!=", "null", ")", "{", "if", "(", "isTraceOn", "&&", "tc", ".", "isEventEnabled", "(", ")", ")", "Tr", ".", "event", "(", "this", ",", "tc", ",", "\"Returning existing XAResource\"", ",", "xares", ")", ";", "}", "else", "if", "(", "is2Phase", ")", "{", "//this is a JTAEnabled dataSource, so get a real XaResource object", "try", "{", "XAResource", "xa", "=", "(", "(", "javax", ".", "sql", ".", "XAConnection", ")", "poolConn", ")", ".", "getXAResource", "(", ")", ";", "xares", "=", "new", "WSRdbXaResourceImpl", "(", "xa", ",", "this", ")", ";", "}", "catch", "(", "SQLException", "se", ")", "{", "FFDCFilter", ".", "processException", "(", "se", ",", "\"com.ibm.ws.rsadapter.spi.WSRdbManagedConnectionImpl.getXAResource\"", ",", "\"1638\"", ",", "this", ")", ";", "if", "(", "isTraceOn", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "this", ",", "tc", ",", "\"getXAResource\"", ",", "se", ")", ";", "throw", "AdapterUtil", ".", "translateSQLException", "(", "se", ",", "this", ",", "true", ",", "getClass", "(", ")", ")", ";", "}", "}", "else", "{", "//this is not a JTAEnabled dataSource, so can't get an xaResource", "//instead get a OnePhaseXAResource", "xares", "=", "new", "WSRdbOnePhaseXaResourceImpl", "(", "sqlConn", ",", "this", ")", ";", "}", "if", "(", "isTraceOn", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "this", ",", "tc", ",", "\"getXAResource\"", ")", ";", "return", "xares", ";", "}" ]
Returns a javax.transaction.xa.XAresource instance. An application server enlists this XAResource instance with the Transaction Manager if the ManagedConnection instance is being used in a JTA transaction that is being coordinated by the Transaction Manager. @return a XAResource - if the dataSource specified for this ManagedConnection is of type XADataSource, then an XAResource from the physical connection is returned wrappered in our WSRdbXaResourceImpl. If the dataSource is of type ConnectionPoolDataSource, then our wrapper WSRdbOnePhaseXaResourceImpl is returned as the connection will not be capable of returning an XAResource as it is not two phase capable. @exception ResourceException - Possible causes for this exception are: 1) failed to get an XAResource from the XAConnection object.
[ "Returns", "a", "javax", ".", "transaction", ".", "xa", ".", "XAresource", "instance", ".", "An", "application", "server", "enlists", "this", "XAResource", "instance", "with", "the", "Transaction", "Manager", "if", "the", "ManagedConnection", "instance", "is", "being", "used", "in", "a", "JTA", "transaction", "that", "is", "being", "coordinated", "by", "the", "Transaction", "Manager", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java#L3776-L3807
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java
WSRdbManagedConnectionImpl.getLocalTransaction
public final LocalTransaction getLocalTransaction() throws ResourceException { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(this, tc, "getLocalTransaction"); localTran = localTran == null ? new WSRdbSpiLocalTransactionImpl(this, sqlConn) : localTran; if (isTraceOn && tc.isEntryEnabled()) Tr.exit(this, tc, "getLocalTransaction", localTran); return localTran; }
java
public final LocalTransaction getLocalTransaction() throws ResourceException { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(this, tc, "getLocalTransaction"); localTran = localTran == null ? new WSRdbSpiLocalTransactionImpl(this, sqlConn) : localTran; if (isTraceOn && tc.isEntryEnabled()) Tr.exit(this, tc, "getLocalTransaction", localTran); return localTran; }
[ "public", "final", "LocalTransaction", "getLocalTransaction", "(", ")", "throws", "ResourceException", "{", "final", "boolean", "isTraceOn", "=", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", ";", "if", "(", "isTraceOn", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "this", ",", "tc", ",", "\"getLocalTransaction\"", ")", ";", "localTran", "=", "localTran", "==", "null", "?", "new", "WSRdbSpiLocalTransactionImpl", "(", "this", ",", "sqlConn", ")", ":", "localTran", ";", "if", "(", "isTraceOn", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "this", ",", "tc", ",", "\"getLocalTransaction\"", ",", "localTran", ")", ";", "return", "localTran", ";", "}" ]
Returns an javax.resource.spi.LocalTransaction instance. The LocalTransaction interface is used by the container to manage local transactions for a RM instance. @return a LocalTransaction instance @exception ResourceException - There should not be an exception thrown in this case. We just need to declare it as it is part of the interface.
[ "Returns", "an", "javax", ".", "resource", ".", "spi", ".", "LocalTransaction", "instance", ".", "The", "LocalTransaction", "interface", "is", "used", "by", "the", "container", "to", "manage", "local", "transactions", "for", "a", "RM", "instance", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java#L3819-L3832
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java
WSRdbManagedConnectionImpl.setTransactionIsolation
public final void setTransactionIsolation(int isoLevel) throws SQLException { if (currentTransactionIsolation != isoLevel) { // Reject switching to an isolation level of TRANSACTION_NONE if (isoLevel == Connection.TRANSACTION_NONE) { throw new SQLException(AdapterUtil.getNLSMessage("DSRA4011.tran.none.iso.switch.unsupported", dsConfig.get().id)); } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "Set Isolation Level to " + AdapterUtil.getIsolationLevelString(isoLevel)); // Don't update the isolation level until AFTER the operation completes // succesfully on the underlying Connection. sqlConn.setTransactionIsolation(isoLevel); currentTransactionIsolation = isoLevel; isolationChanged = true; } if (cachedConnection != null) cachedConnection.setCurrentTransactionIsolation(currentTransactionIsolation, key); }
java
public final void setTransactionIsolation(int isoLevel) throws SQLException { if (currentTransactionIsolation != isoLevel) { // Reject switching to an isolation level of TRANSACTION_NONE if (isoLevel == Connection.TRANSACTION_NONE) { throw new SQLException(AdapterUtil.getNLSMessage("DSRA4011.tran.none.iso.switch.unsupported", dsConfig.get().id)); } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "Set Isolation Level to " + AdapterUtil.getIsolationLevelString(isoLevel)); // Don't update the isolation level until AFTER the operation completes // succesfully on the underlying Connection. sqlConn.setTransactionIsolation(isoLevel); currentTransactionIsolation = isoLevel; isolationChanged = true; } if (cachedConnection != null) cachedConnection.setCurrentTransactionIsolation(currentTransactionIsolation, key); }
[ "public", "final", "void", "setTransactionIsolation", "(", "int", "isoLevel", ")", "throws", "SQLException", "{", "if", "(", "currentTransactionIsolation", "!=", "isoLevel", ")", "{", "// Reject switching to an isolation level of TRANSACTION_NONE", "if", "(", "isoLevel", "==", "Connection", ".", "TRANSACTION_NONE", ")", "{", "throw", "new", "SQLException", "(", "AdapterUtil", ".", "getNLSMessage", "(", "\"DSRA4011.tran.none.iso.switch.unsupported\"", ",", "dsConfig", ".", "get", "(", ")", ".", "id", ")", ")", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "this", ",", "tc", ",", "\"Set Isolation Level to \"", "+", "AdapterUtil", ".", "getIsolationLevelString", "(", "isoLevel", ")", ")", ";", "// Don't update the isolation level until AFTER the operation completes", "// succesfully on the underlying Connection. ", "sqlConn", ".", "setTransactionIsolation", "(", "isoLevel", ")", ";", "currentTransactionIsolation", "=", "isoLevel", ";", "isolationChanged", "=", "true", ";", "}", "if", "(", "cachedConnection", "!=", "null", ")", "cachedConnection", ".", "setCurrentTransactionIsolation", "(", "currentTransactionIsolation", ",", "key", ")", ";", "}" ]
Set the transactionIsolation level to the requested Isolation Level. If the requested and current are the same, then do not drive it to the database If they are different, drive it all the way to the database.
[ "Set", "the", "transactionIsolation", "level", "to", "the", "requested", "Isolation", "Level", ".", "If", "the", "requested", "and", "current", "are", "the", "same", "then", "do", "not", "drive", "it", "to", "the", "database", "If", "they", "are", "different", "drive", "it", "all", "the", "way", "to", "the", "database", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java#L3975-L3995
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java
WSRdbManagedConnectionImpl.getTransactionIsolation
public final int getTransactionIsolation() { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { try { Tr.debug(this, tc, "The current isolation level from our tracking is: ", currentTransactionIsolation); Tr.debug(this, tc, "Isolation reported by the JDBC driver: ", sqlConn.getTransactionIsolation()); } catch (Throwable x) { // NO FFDC needed // do nothing as we are taking the isolation level here for debugging reasons only } } return currentTransactionIsolation; }
java
public final int getTransactionIsolation() { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { try { Tr.debug(this, tc, "The current isolation level from our tracking is: ", currentTransactionIsolation); Tr.debug(this, tc, "Isolation reported by the JDBC driver: ", sqlConn.getTransactionIsolation()); } catch (Throwable x) { // NO FFDC needed // do nothing as we are taking the isolation level here for debugging reasons only } } return currentTransactionIsolation; }
[ "public", "final", "int", "getTransactionIsolation", "(", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "try", "{", "Tr", ".", "debug", "(", "this", ",", "tc", ",", "\"The current isolation level from our tracking is: \"", ",", "currentTransactionIsolation", ")", ";", "Tr", ".", "debug", "(", "this", ",", "tc", ",", "\"Isolation reported by the JDBC driver: \"", ",", "sqlConn", ".", "getTransactionIsolation", "(", ")", ")", ";", "}", "catch", "(", "Throwable", "x", ")", "{", "// NO FFDC needed", "// do nothing as we are taking the isolation level here for debugging reasons only", "}", "}", "return", "currentTransactionIsolation", ";", "}" ]
Get the transactionIsolation level
[ "Get", "the", "transactionIsolation", "level" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java#L4000-L4014
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java
WSRdbManagedConnectionImpl.setHoldability
public final void setHoldability(int holdability) throws SQLException { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "setHoldability", "Set Holdability to " + AdapterUtil.getCursorHoldabilityString(holdability)); sqlConn.setHoldability(holdability); currentHoldability = holdability; holdabilityChanged = true; }
java
public final void setHoldability(int holdability) throws SQLException { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "setHoldability", "Set Holdability to " + AdapterUtil.getCursorHoldabilityString(holdability)); sqlConn.setHoldability(holdability); currentHoldability = holdability; holdabilityChanged = true; }
[ "public", "final", "void", "setHoldability", "(", "int", "holdability", ")", "throws", "SQLException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "this", ",", "tc", ",", "\"setHoldability\"", ",", "\"Set Holdability to \"", "+", "AdapterUtil", ".", "getCursorHoldabilityString", "(", "holdability", ")", ")", ";", "sqlConn", ".", "setHoldability", "(", "holdability", ")", ";", "currentHoldability", "=", "holdability", ";", "holdabilityChanged", "=", "true", ";", "}" ]
Set the cursor holdability value to the request value @param holdability the cursor holdability
[ "Set", "the", "cursor", "holdability", "value", "to", "the", "request", "value" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java#L4021-L4028
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java
WSRdbManagedConnectionImpl.setCatalog
public final void setCatalog(String catalog) throws SQLException { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "Set Catalog to " + catalog); sqlConn.setCatalog(catalog); connectionPropertyChanged = true; }
java
public final void setCatalog(String catalog) throws SQLException { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "Set Catalog to " + catalog); sqlConn.setCatalog(catalog); connectionPropertyChanged = true; }
[ "public", "final", "void", "setCatalog", "(", "String", "catalog", ")", "throws", "SQLException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "this", ",", "tc", ",", "\"Set Catalog to \"", "+", "catalog", ")", ";", "sqlConn", ".", "setCatalog", "(", "catalog", ")", ";", "connectionPropertyChanged", "=", "true", ";", "}" ]
Updates the value of the catalog property. @param catalog the new catalog.
[ "Updates", "the", "value", "of", "the", "catalog", "property", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java#L4062-L4068
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java
WSRdbManagedConnectionImpl.setReadOnly
public final void setReadOnly(boolean isReadOnly) throws SQLException { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "Set readOnly to " + isReadOnly); sqlConn.setReadOnly(isReadOnly); connectionPropertyChanged = true; }
java
public final void setReadOnly(boolean isReadOnly) throws SQLException { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "Set readOnly to " + isReadOnly); sqlConn.setReadOnly(isReadOnly); connectionPropertyChanged = true; }
[ "public", "final", "void", "setReadOnly", "(", "boolean", "isReadOnly", ")", "throws", "SQLException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "this", ",", "tc", ",", "\"Set readOnly to \"", "+", "isReadOnly", ")", ";", "sqlConn", ".", "setReadOnly", "(", "isReadOnly", ")", ";", "connectionPropertyChanged", "=", "true", ";", "}" ]
Updates the value of the readOnly property. @param readOnly the new isReadOnly value.
[ "Updates", "the", "value", "of", "the", "readOnly", "property", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java#L4075-L4081
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java
WSRdbManagedConnectionImpl.setShardingKeys
public final void setShardingKeys(Object shardingKey, Object superShardingKey) throws SQLException { if (mcf.beforeJDBCVersion(JDBCRuntimeVersion.VERSION_4_3)) throw new SQLFeatureNotSupportedException(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "Set sharding key/super sharding key to " + shardingKey + "/" + superShardingKey); mcf.jdbcRuntime.doSetShardingKeys(sqlConn, shardingKey, superShardingKey); currentShardingKey = shardingKey; if (superShardingKey != JDBCRuntimeVersion.SUPER_SHARDING_KEY_UNCHANGED) currentSuperShardingKey = superShardingKey; connectionPropertyChanged = true; }
java
public final void setShardingKeys(Object shardingKey, Object superShardingKey) throws SQLException { if (mcf.beforeJDBCVersion(JDBCRuntimeVersion.VERSION_4_3)) throw new SQLFeatureNotSupportedException(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "Set sharding key/super sharding key to " + shardingKey + "/" + superShardingKey); mcf.jdbcRuntime.doSetShardingKeys(sqlConn, shardingKey, superShardingKey); currentShardingKey = shardingKey; if (superShardingKey != JDBCRuntimeVersion.SUPER_SHARDING_KEY_UNCHANGED) currentSuperShardingKey = superShardingKey; connectionPropertyChanged = true; }
[ "public", "final", "void", "setShardingKeys", "(", "Object", "shardingKey", ",", "Object", "superShardingKey", ")", "throws", "SQLException", "{", "if", "(", "mcf", ".", "beforeJDBCVersion", "(", "JDBCRuntimeVersion", ".", "VERSION_4_3", ")", ")", "throw", "new", "SQLFeatureNotSupportedException", "(", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "this", ",", "tc", ",", "\"Set sharding key/super sharding key to \"", "+", "shardingKey", "+", "\"/\"", "+", "superShardingKey", ")", ";", "mcf", ".", "jdbcRuntime", ".", "doSetShardingKeys", "(", "sqlConn", ",", "shardingKey", ",", "superShardingKey", ")", ";", "currentShardingKey", "=", "shardingKey", ";", "if", "(", "superShardingKey", "!=", "JDBCRuntimeVersion", ".", "SUPER_SHARDING_KEY_UNCHANGED", ")", "currentSuperShardingKey", "=", "superShardingKey", ";", "connectionPropertyChanged", "=", "true", ";", "}" ]
Updates the value of the sharding keys. @param shardingKey the new sharding key. @param superShardingKey the new super sharding key. The 'unchanged' constant can be used to avoid changing it.
[ "Updates", "the", "value", "of", "the", "sharding", "keys", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java#L4097-L4109
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java
WSRdbManagedConnectionImpl.setShardingKeysIfValid
public final boolean setShardingKeysIfValid(Object shardingKey, Object superShardingKey, int timeout) throws SQLException { if (mcf.beforeJDBCVersion(JDBCRuntimeVersion.VERSION_4_3)) throw new SQLFeatureNotSupportedException(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "Set sharding key/super sharding key to " + shardingKey + "/" + superShardingKey + " within " + timeout + " seconds"); boolean updated = mcf.jdbcRuntime.doSetShardingKeysIfValid(sqlConn, shardingKey, superShardingKey, timeout); if (updated) { currentShardingKey = shardingKey; if (superShardingKey != JDBCRuntimeVersion.SUPER_SHARDING_KEY_UNCHANGED) currentSuperShardingKey = superShardingKey; connectionPropertyChanged = true; } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "successful? " + updated); return updated; }
java
public final boolean setShardingKeysIfValid(Object shardingKey, Object superShardingKey, int timeout) throws SQLException { if (mcf.beforeJDBCVersion(JDBCRuntimeVersion.VERSION_4_3)) throw new SQLFeatureNotSupportedException(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "Set sharding key/super sharding key to " + shardingKey + "/" + superShardingKey + " within " + timeout + " seconds"); boolean updated = mcf.jdbcRuntime.doSetShardingKeysIfValid(sqlConn, shardingKey, superShardingKey, timeout); if (updated) { currentShardingKey = shardingKey; if (superShardingKey != JDBCRuntimeVersion.SUPER_SHARDING_KEY_UNCHANGED) currentSuperShardingKey = superShardingKey; connectionPropertyChanged = true; } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "successful? " + updated); return updated; }
[ "public", "final", "boolean", "setShardingKeysIfValid", "(", "Object", "shardingKey", ",", "Object", "superShardingKey", ",", "int", "timeout", ")", "throws", "SQLException", "{", "if", "(", "mcf", ".", "beforeJDBCVersion", "(", "JDBCRuntimeVersion", ".", "VERSION_4_3", ")", ")", "throw", "new", "SQLFeatureNotSupportedException", "(", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "this", ",", "tc", ",", "\"Set sharding key/super sharding key to \"", "+", "shardingKey", "+", "\"/\"", "+", "superShardingKey", "+", "\" within \"", "+", "timeout", "+", "\" seconds\"", ")", ";", "boolean", "updated", "=", "mcf", ".", "jdbcRuntime", ".", "doSetShardingKeysIfValid", "(", "sqlConn", ",", "shardingKey", ",", "superShardingKey", ",", "timeout", ")", ";", "if", "(", "updated", ")", "{", "currentShardingKey", "=", "shardingKey", ";", "if", "(", "superShardingKey", "!=", "JDBCRuntimeVersion", ".", "SUPER_SHARDING_KEY_UNCHANGED", ")", "currentSuperShardingKey", "=", "superShardingKey", ";", "connectionPropertyChanged", "=", "true", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "this", ",", "tc", ",", "\"successful? \"", "+", "updated", ")", ";", "return", "updated", ";", "}" ]
Updates the value of the sharding keys after validating them. @param shardingKey the new sharding key. @param superShardingKey the new super sharding key. The 'unchanged' constant can be used to avoid changing it. @param timeout number of seconds within which validation must be done. 0 indicates no timeout. @return true if the sharding keys are valid and were successfully set on the connection. Otherwise, false.
[ "Updates", "the", "value", "of", "the", "sharding", "keys", "after", "validating", "them", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java#L4119-L4138
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java
WSRdbManagedConnectionImpl.setTypeMap
public final void setTypeMap(Map<String, Class<?>> typeMap) throws SQLException { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "Set TypeMap to " + typeMap); try{ sqlConn.setTypeMap(typeMap); } catch(SQLFeatureNotSupportedException nse){ if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "supportsGetTypeMap false due to ", nse); mcf.supportsGetTypeMap = false; throw nse; } catch(UnsupportedOperationException uoe){ if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "supportsGetTypeMap false due to ", uoe); mcf.supportsGetTypeMap = false; throw uoe; } connectionPropertyChanged = true; }
java
public final void setTypeMap(Map<String, Class<?>> typeMap) throws SQLException { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "Set TypeMap to " + typeMap); try{ sqlConn.setTypeMap(typeMap); } catch(SQLFeatureNotSupportedException nse){ if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "supportsGetTypeMap false due to ", nse); mcf.supportsGetTypeMap = false; throw nse; } catch(UnsupportedOperationException uoe){ if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "supportsGetTypeMap false due to ", uoe); mcf.supportsGetTypeMap = false; throw uoe; } connectionPropertyChanged = true; }
[ "public", "final", "void", "setTypeMap", "(", "Map", "<", "String", ",", "Class", "<", "?", ">", ">", "typeMap", ")", "throws", "SQLException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "this", ",", "tc", ",", "\"Set TypeMap to \"", "+", "typeMap", ")", ";", "try", "{", "sqlConn", ".", "setTypeMap", "(", "typeMap", ")", ";", "}", "catch", "(", "SQLFeatureNotSupportedException", "nse", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "this", ",", "tc", ",", "\"supportsGetTypeMap false due to \"", ",", "nse", ")", ";", "mcf", ".", "supportsGetTypeMap", "=", "false", ";", "throw", "nse", ";", "}", "catch", "(", "UnsupportedOperationException", "uoe", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "this", ",", "tc", ",", "\"supportsGetTypeMap false due to \"", ",", "uoe", ")", ";", "mcf", ".", "supportsGetTypeMap", "=", "false", ";", "throw", "uoe", ";", "}", "connectionPropertyChanged", "=", "true", ";", "}" ]
Updates the value of the typeMap property. @param typeMap the new type map.
[ "Updates", "the", "value", "of", "the", "typeMap", "property", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java#L4174-L4192
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java
WSRdbManagedConnectionImpl.getSQLJConnectionContext
public final Object getSQLJConnectionContext(Class<?> DefaultContext, WSConnectionManager cm) throws SQLException { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(this, tc, "getSQLJConnectionContext"); if (sqljContext == null) { // get the sqljContext if necessary. let the helper handle it // the helper does the sqlex mapping try { sqljContext = helper.getSQLJContext(this, DefaultContext, cm); } catch (SQLException se) { // the helper already did the sqlj error mapping and ffdc.. if (isTraceOn && tc.isEntryEnabled()) Tr.exit(this, tc, "getSQLJConnectionContext", se); throw se; } } if (isTraceOn && tc.isEntryEnabled()) Tr.exit(this, tc, "getSQLJConnectionContext", sqljContext); return sqljContext; }
java
public final Object getSQLJConnectionContext(Class<?> DefaultContext, WSConnectionManager cm) throws SQLException { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(this, tc, "getSQLJConnectionContext"); if (sqljContext == null) { // get the sqljContext if necessary. let the helper handle it // the helper does the sqlex mapping try { sqljContext = helper.getSQLJContext(this, DefaultContext, cm); } catch (SQLException se) { // the helper already did the sqlj error mapping and ffdc.. if (isTraceOn && tc.isEntryEnabled()) Tr.exit(this, tc, "getSQLJConnectionContext", se); throw se; } } if (isTraceOn && tc.isEntryEnabled()) Tr.exit(this, tc, "getSQLJConnectionContext", sqljContext); return sqljContext; }
[ "public", "final", "Object", "getSQLJConnectionContext", "(", "Class", "<", "?", ">", "DefaultContext", ",", "WSConnectionManager", "cm", ")", "throws", "SQLException", "{", "final", "boolean", "isTraceOn", "=", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", ";", "if", "(", "isTraceOn", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "this", ",", "tc", ",", "\"getSQLJConnectionContext\"", ")", ";", "if", "(", "sqljContext", "==", "null", ")", "{", "// get the sqljContext if necessary. let the helper handle it", "// the helper does the sqlex mapping", "try", "{", "sqljContext", "=", "helper", ".", "getSQLJContext", "(", "this", ",", "DefaultContext", ",", "cm", ")", ";", "}", "catch", "(", "SQLException", "se", ")", "{", "// the helper already did the sqlj error mapping and ffdc..", "if", "(", "isTraceOn", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "this", ",", "tc", ",", "\"getSQLJConnectionContext\"", ",", "se", ")", ";", "throw", "se", ";", "}", "}", "if", "(", "isTraceOn", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "this", ",", "tc", ",", "\"getSQLJConnectionContext\"", ",", "sqljContext", ")", ";", "return", "sqljContext", ";", "}" ]
This method returns the SQLJ ConnectionContext. This method is only called by the WSJccConnection class. The ConnectionContext caches all the RTStatements @param DefaultContext the sqlj.runtime.ref.DefaultContext class @return sqlj.runtime.ref.DefaultContext @exception SQLException - failed to create SQLJ Connection Context
[ "This", "method", "returns", "the", "SQLJ", "ConnectionContext", ".", "This", "method", "is", "only", "called", "by", "the", "WSJccConnection", "class", ".", "The", "ConnectionContext", "caches", "all", "the", "RTStatements" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java#L4202-L4222
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java
WSRdbManagedConnectionImpl.setClaimedVictim
public void setClaimedVictim() { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "marking this mc as _claimedVictim"); _claimedVictim = true; }
java
public void setClaimedVictim() { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "marking this mc as _claimedVictim"); _claimedVictim = true; }
[ "public", "void", "setClaimedVictim", "(", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "this", ",", "tc", ",", "\"marking this mc as _claimedVictim\"", ")", ";", "_claimedVictim", "=", "true", ";", "}" ]
Claim the unused managed connection as a victim connection, which can then be reauthenticated and reused.
[ "Claim", "the", "unused", "managed", "connection", "as", "a", "victim", "connection", "which", "can", "then", "be", "reauthenticated", "and", "reused", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java#L4349-L4354
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java
WSRdbManagedConnectionImpl.setSchema
public void setSchema(String schema) throws SQLException { Transaction suspendTx = null; if (mcf.beforeJDBCVersion(JDBCRuntimeVersion.VERSION_4_1)) throw new SQLFeatureNotSupportedException(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "Set Schema to " + schema); // Global trans must be suspended for jdbc-4.1 getters and setters on zOS if (AdapterUtil.isZOS() && isGlobalTransactionActive()) suspendTx = suspendGlobalTran(); try { mcf.jdbcRuntime.doSetSchema(sqlConn, schema); currentSchema = schema; connectionPropertyChanged = true; } catch (SQLException sqle) { throw sqle; } finally { if (suspendTx != null) resumeGlobalTran(suspendTx); } }
java
public void setSchema(String schema) throws SQLException { Transaction suspendTx = null; if (mcf.beforeJDBCVersion(JDBCRuntimeVersion.VERSION_4_1)) throw new SQLFeatureNotSupportedException(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "Set Schema to " + schema); // Global trans must be suspended for jdbc-4.1 getters and setters on zOS if (AdapterUtil.isZOS() && isGlobalTransactionActive()) suspendTx = suspendGlobalTran(); try { mcf.jdbcRuntime.doSetSchema(sqlConn, schema); currentSchema = schema; connectionPropertyChanged = true; } catch (SQLException sqle) { throw sqle; } finally { if (suspendTx != null) resumeGlobalTran(suspendTx); } }
[ "public", "void", "setSchema", "(", "String", "schema", ")", "throws", "SQLException", "{", "Transaction", "suspendTx", "=", "null", ";", "if", "(", "mcf", ".", "beforeJDBCVersion", "(", "JDBCRuntimeVersion", ".", "VERSION_4_1", ")", ")", "throw", "new", "SQLFeatureNotSupportedException", "(", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "this", ",", "tc", ",", "\"Set Schema to \"", "+", "schema", ")", ";", "// Global trans must be suspended for jdbc-4.1 getters and setters on zOS ", "if", "(", "AdapterUtil", ".", "isZOS", "(", ")", "&&", "isGlobalTransactionActive", "(", ")", ")", "suspendTx", "=", "suspendGlobalTran", "(", ")", ";", "try", "{", "mcf", ".", "jdbcRuntime", ".", "doSetSchema", "(", "sqlConn", ",", "schema", ")", ";", "currentSchema", "=", "schema", ";", "connectionPropertyChanged", "=", "true", ";", "}", "catch", "(", "SQLException", "sqle", ")", "{", "throw", "sqle", ";", "}", "finally", "{", "if", "(", "suspendTx", "!=", "null", ")", "resumeGlobalTran", "(", "suspendTx", ")", ";", "}", "}" ]
Set a schema for this managed connection. @param schema The schema to set on the connection.
[ "Set", "a", "schema", "for", "this", "managed", "connection", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java#L4375-L4397
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java
WSRdbManagedConnectionImpl.getSchema
public String getSchema() throws SQLException { Transaction suspendTx = null; if (mcf.beforeJDBCVersion(JDBCRuntimeVersion.VERSION_4_1)) return null; // Global trans must be suspended for jdbc-4.1 getters and setters on zOS if (AdapterUtil.isZOS() && isGlobalTransactionActive()) suspendTx = suspendGlobalTran(); String schema; try { schema = mcf.jdbcRuntime.doGetSchema(sqlConn); } catch (SQLException sqle) { throw sqle; } finally { if (suspendTx != null) resumeGlobalTran(suspendTx); } return schema; }
java
public String getSchema() throws SQLException { Transaction suspendTx = null; if (mcf.beforeJDBCVersion(JDBCRuntimeVersion.VERSION_4_1)) return null; // Global trans must be suspended for jdbc-4.1 getters and setters on zOS if (AdapterUtil.isZOS() && isGlobalTransactionActive()) suspendTx = suspendGlobalTran(); String schema; try { schema = mcf.jdbcRuntime.doGetSchema(sqlConn); } catch (SQLException sqle) { throw sqle; } finally { if (suspendTx != null) resumeGlobalTran(suspendTx); } return schema; }
[ "public", "String", "getSchema", "(", ")", "throws", "SQLException", "{", "Transaction", "suspendTx", "=", "null", ";", "if", "(", "mcf", ".", "beforeJDBCVersion", "(", "JDBCRuntimeVersion", ".", "VERSION_4_1", ")", ")", "return", "null", ";", "// Global trans must be suspended for jdbc-4.1 getters and setters on zOS ", "if", "(", "AdapterUtil", ".", "isZOS", "(", ")", "&&", "isGlobalTransactionActive", "(", ")", ")", "suspendTx", "=", "suspendGlobalTran", "(", ")", ";", "String", "schema", ";", "try", "{", "schema", "=", "mcf", ".", "jdbcRuntime", ".", "doGetSchema", "(", "sqlConn", ")", ";", "}", "catch", "(", "SQLException", "sqle", ")", "{", "throw", "sqle", ";", "}", "finally", "{", "if", "(", "suspendTx", "!=", "null", ")", "resumeGlobalTran", "(", "suspendTx", ")", ";", "}", "return", "schema", ";", "}" ]
Retrieve the schema being used by this managed connection. @return The schema used by this managed connection. <BR> NOTE: If this method is called below JDBC version 4.1, null will be returned.
[ "Retrieve", "the", "schema", "being", "used", "by", "this", "managed", "connection", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java#L4404-L4422
train
OpenLiberty/open-liberty
dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/logging/TaggedFileOutputStream.java
TaggedFileOutputStream.setFileTag
void setFileTag(File file) throws IOException { if (initialized && fileEncodingCcsid != 0) { int returnCode = setFileTag(file.getAbsolutePath(), fileEncodingCcsid); if (returnCode != 0) { issueTaggingFailedMessage(returnCode); } } }
java
void setFileTag(File file) throws IOException { if (initialized && fileEncodingCcsid != 0) { int returnCode = setFileTag(file.getAbsolutePath(), fileEncodingCcsid); if (returnCode != 0) { issueTaggingFailedMessage(returnCode); } } }
[ "void", "setFileTag", "(", "File", "file", ")", "throws", "IOException", "{", "if", "(", "initialized", "&&", "fileEncodingCcsid", "!=", "0", ")", "{", "int", "returnCode", "=", "setFileTag", "(", "file", ".", "getAbsolutePath", "(", ")", ",", "fileEncodingCcsid", ")", ";", "if", "(", "returnCode", "!=", "0", ")", "{", "issueTaggingFailedMessage", "(", "returnCode", ")", ";", "}", "}", "}" ]
Tag the specified file as ISO8859-1 text. @param file the file to tag as ISO8859-1 text
[ "Tag", "the", "specified", "file", "as", "ISO8859", "-", "1", "text", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/logging/TaggedFileOutputStream.java#L63-L70
train
OpenLiberty/open-liberty
dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/logging/TaggedFileOutputStream.java
TaggedFileOutputStream.issueTaggingFailedMessage
private synchronized void issueTaggingFailedMessage(int returnCode) { if (taggingFailedIssued) { return; } System.err.println(MessageFormat.format(BootstrapConstants.messages.getString("warn.unableTagFile"), returnCode)); taggingFailedIssued = true; }
java
private synchronized void issueTaggingFailedMessage(int returnCode) { if (taggingFailedIssued) { return; } System.err.println(MessageFormat.format(BootstrapConstants.messages.getString("warn.unableTagFile"), returnCode)); taggingFailedIssued = true; }
[ "private", "synchronized", "void", "issueTaggingFailedMessage", "(", "int", "returnCode", ")", "{", "if", "(", "taggingFailedIssued", ")", "{", "return", ";", "}", "System", ".", "err", ".", "println", "(", "MessageFormat", ".", "format", "(", "BootstrapConstants", ".", "messages", ".", "getString", "(", "\"warn.unableTagFile\"", ")", ",", "returnCode", ")", ")", ";", "taggingFailedIssued", "=", "true", ";", "}" ]
Issue the tagging failed message.
[ "Issue", "the", "tagging", "failed", "message", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/logging/TaggedFileOutputStream.java#L87-L94
train
OpenLiberty/open-liberty
dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/logging/TaggedFileOutputStream.java
TaggedFileOutputStream.registerNatives
private static boolean registerNatives() { try { final String methodDescriptor = "zJNIBOOT_" + TaggedFileOutputStream.class.getCanonicalName().replaceAll("\\.", "_"); long dllHandle = NativeMethodHelper.registerNatives(TaggedFileOutputStream.class, methodDescriptor, null); if (dllHandle > 0) { return true; } // if the native DLL doesnot exist, we fail quietly if (dllHandle == 0) { return false; } } catch (Throwable t) { // Eat exception from registerNatives if DLL can't be loaded } // if native DLL exists but failed to link the native method descriptor System.err.println(MessageFormat.format(BootstrapConstants.messages.getString("warn.registerNative"), TaggedFileOutputStream.class.getCanonicalName())); return false; }
java
private static boolean registerNatives() { try { final String methodDescriptor = "zJNIBOOT_" + TaggedFileOutputStream.class.getCanonicalName().replaceAll("\\.", "_"); long dllHandle = NativeMethodHelper.registerNatives(TaggedFileOutputStream.class, methodDescriptor, null); if (dllHandle > 0) { return true; } // if the native DLL doesnot exist, we fail quietly if (dllHandle == 0) { return false; } } catch (Throwable t) { // Eat exception from registerNatives if DLL can't be loaded } // if native DLL exists but failed to link the native method descriptor System.err.println(MessageFormat.format(BootstrapConstants.messages.getString("warn.registerNative"), TaggedFileOutputStream.class.getCanonicalName())); return false; }
[ "private", "static", "boolean", "registerNatives", "(", ")", "{", "try", "{", "final", "String", "methodDescriptor", "=", "\"zJNIBOOT_\"", "+", "TaggedFileOutputStream", ".", "class", ".", "getCanonicalName", "(", ")", ".", "replaceAll", "(", "\"\\\\.\"", ",", "\"_\"", ")", ";", "long", "dllHandle", "=", "NativeMethodHelper", ".", "registerNatives", "(", "TaggedFileOutputStream", ".", "class", ",", "methodDescriptor", ",", "null", ")", ";", "if", "(", "dllHandle", ">", "0", ")", "{", "return", "true", ";", "}", "// if the native DLL doesnot exist, we fail quietly", "if", "(", "dllHandle", "==", "0", ")", "{", "return", "false", ";", "}", "}", "catch", "(", "Throwable", "t", ")", "{", "// Eat exception from registerNatives if DLL can't be loaded", "}", "// if native DLL exists but failed to link the native method descriptor", "System", ".", "err", ".", "println", "(", "MessageFormat", ".", "format", "(", "BootstrapConstants", ".", "messages", ".", "getString", "(", "\"warn.registerNative\"", ")", ",", "TaggedFileOutputStream", ".", "class", ".", "getCanonicalName", "(", ")", ")", ")", ";", "return", "false", ";", "}" ]
Register the native method needed for file tagging. @return true if the methods were successfully registered
[ "Register", "the", "native", "method", "needed", "for", "file", "tagging", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/logging/TaggedFileOutputStream.java#L101-L119
train
OpenLiberty/open-liberty
dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/logging/TaggedFileOutputStream.java
TaggedFileOutputStream.acquireFileEncodingCcsid
private static int acquireFileEncodingCcsid() { // Get the charset represented by file.encoding Charset charset = null; String fileEncoding = System.getProperty("file.encoding"); try { charset = Charset.forName(fileEncoding); } catch (Throwable t) { // Problem with the JVM's file.encoding property } int ccsid = getCcsid(charset); if (ccsid == 0) { System.err.println(MessageFormat.format(BootstrapConstants.messages.getString("warn.fileEncodingNotFound"), fileEncoding)); } return ccsid; }
java
private static int acquireFileEncodingCcsid() { // Get the charset represented by file.encoding Charset charset = null; String fileEncoding = System.getProperty("file.encoding"); try { charset = Charset.forName(fileEncoding); } catch (Throwable t) { // Problem with the JVM's file.encoding property } int ccsid = getCcsid(charset); if (ccsid == 0) { System.err.println(MessageFormat.format(BootstrapConstants.messages.getString("warn.fileEncodingNotFound"), fileEncoding)); } return ccsid; }
[ "private", "static", "int", "acquireFileEncodingCcsid", "(", ")", "{", "// Get the charset represented by file.encoding", "Charset", "charset", "=", "null", ";", "String", "fileEncoding", "=", "System", ".", "getProperty", "(", "\"file.encoding\"", ")", ";", "try", "{", "charset", "=", "Charset", ".", "forName", "(", "fileEncoding", ")", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "// Problem with the JVM's file.encoding property", "}", "int", "ccsid", "=", "getCcsid", "(", "charset", ")", ";", "if", "(", "ccsid", "==", "0", ")", "{", "System", ".", "err", ".", "println", "(", "MessageFormat", ".", "format", "(", "BootstrapConstants", ".", "messages", ".", "getString", "(", "\"warn.fileEncodingNotFound\"", ")", ",", "fileEncoding", ")", ")", ";", "}", "return", "ccsid", ";", "}" ]
Get the character code set identifier that represents the JVM's file encoding. This should only be called by the class static initializer. @return the character code set id or 0 if the code set ID could not be determined
[ "Get", "the", "character", "code", "set", "identifier", "that", "represents", "the", "JVM", "s", "file", "encoding", ".", "This", "should", "only", "be", "called", "by", "the", "class", "static", "initializer", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/logging/TaggedFileOutputStream.java#L128-L143
train
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/util/ScheduleExpressionParser.java
ScheduleExpressionParser.parse
public static ParsedScheduleExpression parse(ScheduleExpression expr) { ParsedScheduleExpression parsedExpr = new ParsedScheduleExpression(expr); parse(parsedExpr); return parsedExpr; }
java
public static ParsedScheduleExpression parse(ScheduleExpression expr) { ParsedScheduleExpression parsedExpr = new ParsedScheduleExpression(expr); parse(parsedExpr); return parsedExpr; }
[ "public", "static", "ParsedScheduleExpression", "parse", "(", "ScheduleExpression", "expr", ")", "{", "ParsedScheduleExpression", "parsedExpr", "=", "new", "ParsedScheduleExpression", "(", "expr", ")", ";", "parse", "(", "parsedExpr", ")", ";", "return", "parsedExpr", ";", "}" ]
Parses the specified schedule expression and returns the result. @param expr the expression to parse @return the parsed schedule expression @throws ScheduleExpressionParserException if the expression contains an invalid attribute value
[ "Parses", "the", "specified", "schedule", "expression", "and", "returns", "the", "result", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/util/ScheduleExpressionParser.java#L242-L247
train
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/util/ScheduleExpressionParser.java
ScheduleExpressionParser.parse
static void parse(ParsedScheduleExpression parsedExpr) // d639610 { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(tc, "parse: " + toString(parsedExpr.getSchedule())); ScheduleExpression expr = parsedExpr.getSchedule(); ScheduleExpressionParser parser = new ScheduleExpressionParser(); try { parser.parseTimeZone(parsedExpr, expr.getTimezone()); parser.parseAttribute(parsedExpr, Attribute.SECOND, expr.getSecond()); parser.parseAttribute(parsedExpr, Attribute.MINUTE, expr.getMinute()); parser.parseAttribute(parsedExpr, Attribute.HOUR, expr.getHour()); parser.parseAttribute(parsedExpr, Attribute.DAY_OF_MONTH, expr.getDayOfMonth()); parser.parseAttribute(parsedExpr, Attribute.MONTH, expr.getMonth()); parser.parseAttribute(parsedExpr, Attribute.DAY_OF_WEEK, expr.getDayOfWeek()); parser.parseAttribute(parsedExpr, Attribute.YEAR, expr.getYear()); } catch (IllegalArgumentException ex) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.exit(tc, "parse", ex); throw ex; } parsedExpr.start = parser.parseDate(expr.getStart(), 0); // d666295 parsedExpr.end = parser.parseDate(expr.getEnd(), Long.MAX_VALUE); // d666295 if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "parse", parsedExpr); }
java
static void parse(ParsedScheduleExpression parsedExpr) // d639610 { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(tc, "parse: " + toString(parsedExpr.getSchedule())); ScheduleExpression expr = parsedExpr.getSchedule(); ScheduleExpressionParser parser = new ScheduleExpressionParser(); try { parser.parseTimeZone(parsedExpr, expr.getTimezone()); parser.parseAttribute(parsedExpr, Attribute.SECOND, expr.getSecond()); parser.parseAttribute(parsedExpr, Attribute.MINUTE, expr.getMinute()); parser.parseAttribute(parsedExpr, Attribute.HOUR, expr.getHour()); parser.parseAttribute(parsedExpr, Attribute.DAY_OF_MONTH, expr.getDayOfMonth()); parser.parseAttribute(parsedExpr, Attribute.MONTH, expr.getMonth()); parser.parseAttribute(parsedExpr, Attribute.DAY_OF_WEEK, expr.getDayOfWeek()); parser.parseAttribute(parsedExpr, Attribute.YEAR, expr.getYear()); } catch (IllegalArgumentException ex) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.exit(tc, "parse", ex); throw ex; } parsedExpr.start = parser.parseDate(expr.getStart(), 0); // d666295 parsedExpr.end = parser.parseDate(expr.getEnd(), Long.MAX_VALUE); // d666295 if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "parse", parsedExpr); }
[ "static", "void", "parse", "(", "ParsedScheduleExpression", "parsedExpr", ")", "// d639610", "{", "final", "boolean", "isTraceOn", "=", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", ";", "if", "(", "isTraceOn", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "tc", ",", "\"parse: \"", "+", "toString", "(", "parsedExpr", ".", "getSchedule", "(", ")", ")", ")", ";", "ScheduleExpression", "expr", "=", "parsedExpr", ".", "getSchedule", "(", ")", ";", "ScheduleExpressionParser", "parser", "=", "new", "ScheduleExpressionParser", "(", ")", ";", "try", "{", "parser", ".", "parseTimeZone", "(", "parsedExpr", ",", "expr", ".", "getTimezone", "(", ")", ")", ";", "parser", ".", "parseAttribute", "(", "parsedExpr", ",", "Attribute", ".", "SECOND", ",", "expr", ".", "getSecond", "(", ")", ")", ";", "parser", ".", "parseAttribute", "(", "parsedExpr", ",", "Attribute", ".", "MINUTE", ",", "expr", ".", "getMinute", "(", ")", ")", ";", "parser", ".", "parseAttribute", "(", "parsedExpr", ",", "Attribute", ".", "HOUR", ",", "expr", ".", "getHour", "(", ")", ")", ";", "parser", ".", "parseAttribute", "(", "parsedExpr", ",", "Attribute", ".", "DAY_OF_MONTH", ",", "expr", ".", "getDayOfMonth", "(", ")", ")", ";", "parser", ".", "parseAttribute", "(", "parsedExpr", ",", "Attribute", ".", "MONTH", ",", "expr", ".", "getMonth", "(", ")", ")", ";", "parser", ".", "parseAttribute", "(", "parsedExpr", ",", "Attribute", ".", "DAY_OF_WEEK", ",", "expr", ".", "getDayOfWeek", "(", ")", ")", ";", "parser", ".", "parseAttribute", "(", "parsedExpr", ",", "Attribute", ".", "YEAR", ",", "expr", ".", "getYear", "(", ")", ")", ";", "}", "catch", "(", "IllegalArgumentException", "ex", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"parse\"", ",", "ex", ")", ";", "throw", "ex", ";", "}", "parsedExpr", ".", "start", "=", "parser", ".", "parseDate", "(", "expr", ".", "getStart", "(", ")", ",", "0", ")", ";", "// d666295", "parsedExpr", ".", "end", "=", "parser", ".", "parseDate", "(", "expr", ".", "getEnd", "(", ")", ",", "Long", ".", "MAX_VALUE", ")", ";", "// d666295", "if", "(", "isTraceOn", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"parse\"", ",", "parsedExpr", ")", ";", "}" ]
Parses the schedule expression contained within the ParsedScheduleExpression object and store the results in that object. @param parsedExpr the parsed schedule expression to populate @throws ScheduleExpressionParserException if the expression contains an invalid attribute value
[ "Parses", "the", "schedule", "expression", "contained", "within", "the", "ParsedScheduleExpression", "object", "and", "store", "the", "results", "in", "that", "object", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/util/ScheduleExpressionParser.java#L257-L289
train
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/util/ScheduleExpressionParser.java
ScheduleExpressionParser.parseTimeZone
private void parseTimeZone(ParsedScheduleExpression parsedExpr, String string) { if (parsedExpr.timeZone == null) // d639610 { if (string == null) { parsedExpr.timeZone = TimeZone.getDefault(); // d639610 } else { parsedExpr.timeZone = TimeZone.getTimeZone(string.trim()); // d664511 // If an invalid time zone is specified, getTimeZone will always // return a TimeZone with an ID of "GMT". Do not allow this unless it // was specifically requested. if (parsedExpr.timeZone.getID().equals("GMT") && !string.equalsIgnoreCase("GMT")) { throw new ScheduleExpressionParserException(ScheduleExpressionParserException.Error.VALUE, "timezone", string); // F743-506 } } } }
java
private void parseTimeZone(ParsedScheduleExpression parsedExpr, String string) { if (parsedExpr.timeZone == null) // d639610 { if (string == null) { parsedExpr.timeZone = TimeZone.getDefault(); // d639610 } else { parsedExpr.timeZone = TimeZone.getTimeZone(string.trim()); // d664511 // If an invalid time zone is specified, getTimeZone will always // return a TimeZone with an ID of "GMT". Do not allow this unless it // was specifically requested. if (parsedExpr.timeZone.getID().equals("GMT") && !string.equalsIgnoreCase("GMT")) { throw new ScheduleExpressionParserException(ScheduleExpressionParserException.Error.VALUE, "timezone", string); // F743-506 } } } }
[ "private", "void", "parseTimeZone", "(", "ParsedScheduleExpression", "parsedExpr", ",", "String", "string", ")", "{", "if", "(", "parsedExpr", ".", "timeZone", "==", "null", ")", "// d639610", "{", "if", "(", "string", "==", "null", ")", "{", "parsedExpr", ".", "timeZone", "=", "TimeZone", ".", "getDefault", "(", ")", ";", "// d639610", "}", "else", "{", "parsedExpr", ".", "timeZone", "=", "TimeZone", ".", "getTimeZone", "(", "string", ".", "trim", "(", ")", ")", ";", "// d664511", "// If an invalid time zone is specified, getTimeZone will always", "// return a TimeZone with an ID of \"GMT\". Do not allow this unless it", "// was specifically requested.", "if", "(", "parsedExpr", ".", "timeZone", ".", "getID", "(", ")", ".", "equals", "(", "\"GMT\"", ")", "&&", "!", "string", ".", "equalsIgnoreCase", "(", "\"GMT\"", ")", ")", "{", "throw", "new", "ScheduleExpressionParserException", "(", "ScheduleExpressionParserException", ".", "Error", ".", "VALUE", ",", "\"timezone\"", ",", "string", ")", ";", "// F743-506", "}", "}", "}", "}" ]
Parses the time zone ID and stores the result in parsedExpr. If the parsed schedule already has a time zone, then it is kept. If the time zone ID is null, then the default time zone is used. @param parsedExpr the object in which to store the result @param string the time zone ID @throws ScheduleExpressionParserException if the expression contains an invalid attribute value
[ "Parses", "the", "time", "zone", "ID", "and", "stores", "the", "result", "in", "parsedExpr", ".", "If", "the", "parsed", "schedule", "already", "has", "a", "time", "zone", "then", "it", "is", "kept", ".", "If", "the", "time", "zone", "ID", "is", "null", "then", "the", "default", "time", "zone", "is", "used", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/util/ScheduleExpressionParser.java#L301-L322
train
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/util/ScheduleExpressionParser.java
ScheduleExpressionParser.parseDate
private long parseDate(Date date, long defaultValue) // d666295 { if (date == null) { return defaultValue; } long value = date.getTime(); if (value > 0) { // Round up to the nearest second. long remainder = value % 1000; if (remainder != 0) { // Protect against overflow. long newValue = value - remainder + 1000; value = newValue > 0 || value < 0 ? newValue : Long.MAX_VALUE; } } return value; }
java
private long parseDate(Date date, long defaultValue) // d666295 { if (date == null) { return defaultValue; } long value = date.getTime(); if (value > 0) { // Round up to the nearest second. long remainder = value % 1000; if (remainder != 0) { // Protect against overflow. long newValue = value - remainder + 1000; value = newValue > 0 || value < 0 ? newValue : Long.MAX_VALUE; } } return value; }
[ "private", "long", "parseDate", "(", "Date", "date", ",", "long", "defaultValue", ")", "// d666295", "{", "if", "(", "date", "==", "null", ")", "{", "return", "defaultValue", ";", "}", "long", "value", "=", "date", ".", "getTime", "(", ")", ";", "if", "(", "value", ">", "0", ")", "{", "// Round up to the nearest second.", "long", "remainder", "=", "value", "%", "1000", ";", "if", "(", "remainder", "!=", "0", ")", "{", "// Protect against overflow.", "long", "newValue", "=", "value", "-", "remainder", "+", "1000", ";", "value", "=", "newValue", ">", "0", "||", "value", "<", "0", "?", "newValue", ":", "Long", ".", "MAX_VALUE", ";", "}", "}", "return", "value", ";", "}" ]
Parses the date to milliseconds and rounds up to the nearest second. @param date the date to parse @param defaultValue the default value if the date is null @return the rounded milliseconds
[ "Parses", "the", "date", "to", "milliseconds", "and", "rounds", "up", "to", "the", "nearest", "second", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/util/ScheduleExpressionParser.java#L331-L353
train
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/util/ScheduleExpressionParser.java
ScheduleExpressionParser.error
private void error(ScheduleExpressionParserException.Error error) // F743-506 { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "parse error in " + ivAttr + " at " + ivPos); throw new ScheduleExpressionParserException(error, ivAttr.getDisplayName(), ivString); // F7437591.codRev, F743-506 }
java
private void error(ScheduleExpressionParserException.Error error) // F743-506 { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "parse error in " + ivAttr + " at " + ivPos); throw new ScheduleExpressionParserException(error, ivAttr.getDisplayName(), ivString); // F7437591.codRev, F743-506 }
[ "private", "void", "error", "(", "ScheduleExpressionParserException", ".", "Error", "error", ")", "// F743-506", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "tc", ",", "\"parse error in \"", "+", "ivAttr", "+", "\" at \"", "+", "ivPos", ")", ";", "throw", "new", "ScheduleExpressionParserException", "(", "error", ",", "ivAttr", ".", "getDisplayName", "(", ")", ",", "ivString", ")", ";", "// F7437591.codRev, F743-506", "}" ]
Issues a lexical analysis or parsing error. @param message the error message @throws ScheduleExpressionParserException
[ "Issues", "a", "lexical", "analysis", "or", "parsing", "error", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/util/ScheduleExpressionParser.java#L361-L367
train
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/util/ScheduleExpressionParser.java
ScheduleExpressionParser.parseAttribute
private void parseAttribute(ParsedScheduleExpression parsedExpr, Attribute attr, String string) { // Reset state. ivAttr = attr; ivString = string; ivPos = 0; if (string == null) { // d660135 - Per CTS, null values must be rejected rather than being // translated to the default attribute value. error(ScheduleExpressionParserException.Error.VALUE); } // Loop for lists: "x, x, ..." for (boolean inList = false;; inList = true) { skipWhitespace(); int value = readSingleValue(); skipWhitespace(); // Ranges: "x-x" if (ivPos < ivString.length() && ivString.charAt(ivPos) == '-') { ivPos++; skipWhitespace(); int maxValue = readSingleValue(); skipWhitespace(); if (value == ENCODED_WILD_CARD || maxValue == ENCODED_WILD_CARD) { error(ScheduleExpressionParserException.Error.RANGE_BOUND); // F743-506 } attr.addRange(parsedExpr, value, maxValue); } // Increments: "x/x" else if (ivPos < ivString.length() && ivString.charAt(ivPos) == '/') { ivPos++; skipWhitespace(); int interval = readSingleValue(); skipWhitespace(); if (interval == ENCODED_WILD_CARD) { error(ScheduleExpressionParserException.Error.INCREMENT_INTERVAL); // F743-506 } if (inList) { error(ScheduleExpressionParserException.Error.LIST_VALUE); // F743-506 } if (!ivAttr.isIncrementable()) { error(ScheduleExpressionParserException.Error.UNINCREMENTABLE); // F743-506 } if (value == ENCODED_WILD_CARD) { value = 0; } if (interval == 0) { // "30/0" is interpreted as the single value "30". attr.add(parsedExpr, value); } else { for (; value <= ivAttr.getMax(); value += interval) { attr.add(parsedExpr, value); } } break; } // Wild cards: "*" else if (value == ENCODED_WILD_CARD) { if (inList) { error(ScheduleExpressionParserException.Error.LIST_VALUE); // F743-506 } attr.setWildCard(parsedExpr); break; } // Single values else { attr.add(parsedExpr, value); } if (ivPos >= ivString.length() || ivString.charAt(ivPos) != ',') { break; } // Skip the comma ivPos++; } skipWhitespace(); if (ivPos < ivString.length()) { error(ScheduleExpressionParserException.Error.VALUE); // F743-506 } }
java
private void parseAttribute(ParsedScheduleExpression parsedExpr, Attribute attr, String string) { // Reset state. ivAttr = attr; ivString = string; ivPos = 0; if (string == null) { // d660135 - Per CTS, null values must be rejected rather than being // translated to the default attribute value. error(ScheduleExpressionParserException.Error.VALUE); } // Loop for lists: "x, x, ..." for (boolean inList = false;; inList = true) { skipWhitespace(); int value = readSingleValue(); skipWhitespace(); // Ranges: "x-x" if (ivPos < ivString.length() && ivString.charAt(ivPos) == '-') { ivPos++; skipWhitespace(); int maxValue = readSingleValue(); skipWhitespace(); if (value == ENCODED_WILD_CARD || maxValue == ENCODED_WILD_CARD) { error(ScheduleExpressionParserException.Error.RANGE_BOUND); // F743-506 } attr.addRange(parsedExpr, value, maxValue); } // Increments: "x/x" else if (ivPos < ivString.length() && ivString.charAt(ivPos) == '/') { ivPos++; skipWhitespace(); int interval = readSingleValue(); skipWhitespace(); if (interval == ENCODED_WILD_CARD) { error(ScheduleExpressionParserException.Error.INCREMENT_INTERVAL); // F743-506 } if (inList) { error(ScheduleExpressionParserException.Error.LIST_VALUE); // F743-506 } if (!ivAttr.isIncrementable()) { error(ScheduleExpressionParserException.Error.UNINCREMENTABLE); // F743-506 } if (value == ENCODED_WILD_CARD) { value = 0; } if (interval == 0) { // "30/0" is interpreted as the single value "30". attr.add(parsedExpr, value); } else { for (; value <= ivAttr.getMax(); value += interval) { attr.add(parsedExpr, value); } } break; } // Wild cards: "*" else if (value == ENCODED_WILD_CARD) { if (inList) { error(ScheduleExpressionParserException.Error.LIST_VALUE); // F743-506 } attr.setWildCard(parsedExpr); break; } // Single values else { attr.add(parsedExpr, value); } if (ivPos >= ivString.length() || ivString.charAt(ivPos) != ',') { break; } // Skip the comma ivPos++; } skipWhitespace(); if (ivPos < ivString.length()) { error(ScheduleExpressionParserException.Error.VALUE); // F743-506 } }
[ "private", "void", "parseAttribute", "(", "ParsedScheduleExpression", "parsedExpr", ",", "Attribute", "attr", ",", "String", "string", ")", "{", "// Reset state.", "ivAttr", "=", "attr", ";", "ivString", "=", "string", ";", "ivPos", "=", "0", ";", "if", "(", "string", "==", "null", ")", "{", "// d660135 - Per CTS, null values must be rejected rather than being", "// translated to the default attribute value.", "error", "(", "ScheduleExpressionParserException", ".", "Error", ".", "VALUE", ")", ";", "}", "// Loop for lists: \"x, x, ...\"", "for", "(", "boolean", "inList", "=", "false", ";", ";", "inList", "=", "true", ")", "{", "skipWhitespace", "(", ")", ";", "int", "value", "=", "readSingleValue", "(", ")", ";", "skipWhitespace", "(", ")", ";", "// Ranges: \"x-x\"", "if", "(", "ivPos", "<", "ivString", ".", "length", "(", ")", "&&", "ivString", ".", "charAt", "(", "ivPos", ")", "==", "'", "'", ")", "{", "ivPos", "++", ";", "skipWhitespace", "(", ")", ";", "int", "maxValue", "=", "readSingleValue", "(", ")", ";", "skipWhitespace", "(", ")", ";", "if", "(", "value", "==", "ENCODED_WILD_CARD", "||", "maxValue", "==", "ENCODED_WILD_CARD", ")", "{", "error", "(", "ScheduleExpressionParserException", ".", "Error", ".", "RANGE_BOUND", ")", ";", "// F743-506", "}", "attr", ".", "addRange", "(", "parsedExpr", ",", "value", ",", "maxValue", ")", ";", "}", "// Increments: \"x/x\"", "else", "if", "(", "ivPos", "<", "ivString", ".", "length", "(", ")", "&&", "ivString", ".", "charAt", "(", "ivPos", ")", "==", "'", "'", ")", "{", "ivPos", "++", ";", "skipWhitespace", "(", ")", ";", "int", "interval", "=", "readSingleValue", "(", ")", ";", "skipWhitespace", "(", ")", ";", "if", "(", "interval", "==", "ENCODED_WILD_CARD", ")", "{", "error", "(", "ScheduleExpressionParserException", ".", "Error", ".", "INCREMENT_INTERVAL", ")", ";", "// F743-506", "}", "if", "(", "inList", ")", "{", "error", "(", "ScheduleExpressionParserException", ".", "Error", ".", "LIST_VALUE", ")", ";", "// F743-506", "}", "if", "(", "!", "ivAttr", ".", "isIncrementable", "(", ")", ")", "{", "error", "(", "ScheduleExpressionParserException", ".", "Error", ".", "UNINCREMENTABLE", ")", ";", "// F743-506", "}", "if", "(", "value", "==", "ENCODED_WILD_CARD", ")", "{", "value", "=", "0", ";", "}", "if", "(", "interval", "==", "0", ")", "{", "// \"30/0\" is interpreted as the single value \"30\".", "attr", ".", "add", "(", "parsedExpr", ",", "value", ")", ";", "}", "else", "{", "for", "(", ";", "value", "<=", "ivAttr", ".", "getMax", "(", ")", ";", "value", "+=", "interval", ")", "{", "attr", ".", "add", "(", "parsedExpr", ",", "value", ")", ";", "}", "}", "break", ";", "}", "// Wild cards: \"*\"", "else", "if", "(", "value", "==", "ENCODED_WILD_CARD", ")", "{", "if", "(", "inList", ")", "{", "error", "(", "ScheduleExpressionParserException", ".", "Error", ".", "LIST_VALUE", ")", ";", "// F743-506", "}", "attr", ".", "setWildCard", "(", "parsedExpr", ")", ";", "break", ";", "}", "// Single values", "else", "{", "attr", ".", "add", "(", "parsedExpr", ",", "value", ")", ";", "}", "if", "(", "ivPos", ">=", "ivString", ".", "length", "(", ")", "||", "ivString", ".", "charAt", "(", "ivPos", ")", "!=", "'", "'", ")", "{", "break", ";", "}", "// Skip the comma", "ivPos", "++", ";", "}", "skipWhitespace", "(", ")", ";", "if", "(", "ivPos", "<", "ivString", ".", "length", "(", ")", ")", "{", "error", "(", "ScheduleExpressionParserException", ".", "Error", ".", "VALUE", ")", ";", "// F743-506", "}", "}" ]
Parses the specified attribute of this parsers schedule expression and stores the result in parsedExpr. This method sets the ivAttr, ivString, and ivPos member variables that are accessed by other parsing methods. Only ivPos should be modified by those other methods. @param parsedExpr the object in which to store the result @param attr the attribute being parsed @param string the value of the attribute from the schedule expression @throws ScheduleExpressionParserException if the expression contains an invalid attribute value
[ "Parses", "the", "specified", "attribute", "of", "this", "parsers", "schedule", "expression", "and", "stores", "the", "result", "in", "parsedExpr", ".", "This", "method", "sets", "the", "ivAttr", "ivString", "and", "ivPos", "member", "variables", "that", "are", "accessed", "by", "other", "parsing", "methods", ".", "Only", "ivPos", "should", "be", "modified", "by", "those", "other", "methods", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/util/ScheduleExpressionParser.java#L381-L494
train
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/util/ScheduleExpressionParser.java
ScheduleExpressionParser.skipWhitespace
private void skipWhitespace() { while (ivPos < ivString.length() && Character.isWhitespace(ivString.charAt(ivPos))) { ivPos++; } }
java
private void skipWhitespace() { while (ivPos < ivString.length() && Character.isWhitespace(ivString.charAt(ivPos))) { ivPos++; } }
[ "private", "void", "skipWhitespace", "(", ")", "{", "while", "(", "ivPos", "<", "ivString", ".", "length", "(", ")", "&&", "Character", ".", "isWhitespace", "(", "ivString", ".", "charAt", "(", "ivPos", ")", ")", ")", "{", "ivPos", "++", ";", "}", "}" ]
Skip any whitespace at the current position in the parse string.
[ "Skip", "any", "whitespace", "at", "the", "current", "position", "in", "the", "parse", "string", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/util/ScheduleExpressionParser.java#L499-L505
train
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/util/ScheduleExpressionParser.java
ScheduleExpressionParser.scanToken
private int scanToken() { int begin = ivPos; if (ivPos < ivString.length()) { if (ivString.charAt(ivPos) == '-') { // dayOfWeek allows tokens to begin with "-" (e.g., "-7"). We // cannot add "-" to isTokenChar or else "1-2" would be parsed as a // single atom. ivPos++; } while (ivPos < ivString.length() && isTokenChar(ivString.charAt(ivPos))) { ivPos++; } } return begin; }
java
private int scanToken() { int begin = ivPos; if (ivPos < ivString.length()) { if (ivString.charAt(ivPos) == '-') { // dayOfWeek allows tokens to begin with "-" (e.g., "-7"). We // cannot add "-" to isTokenChar or else "1-2" would be parsed as a // single atom. ivPos++; } while (ivPos < ivString.length() && isTokenChar(ivString.charAt(ivPos))) { ivPos++; } } return begin; }
[ "private", "int", "scanToken", "(", ")", "{", "int", "begin", "=", "ivPos", ";", "if", "(", "ivPos", "<", "ivString", ".", "length", "(", ")", ")", "{", "if", "(", "ivString", ".", "charAt", "(", "ivPos", ")", "==", "'", "'", ")", "{", "// dayOfWeek allows tokens to begin with \"-\" (e.g., \"-7\"). We", "// cannot add \"-\" to isTokenChar or else \"1-2\" would be parsed as a", "// single atom.", "ivPos", "++", ";", "}", "while", "(", "ivPos", "<", "ivString", ".", "length", "(", ")", "&&", "isTokenChar", "(", "ivString", ".", "charAt", "(", "ivPos", ")", ")", ")", "{", "ivPos", "++", ";", "}", "}", "return", "begin", ";", "}" ]
Skip the minimum number of characters necessary to form a single unit of information within a value. Whitespace before the value is not skipped. @return the position in the parse string before skipping; if no atom was found, this value will be the same as <tt>ivPos</tt>
[ "Skip", "the", "minimum", "number", "of", "characters", "necessary", "to", "form", "a", "single", "unit", "of", "information", "within", "a", "value", ".", "Whitespace", "before", "the", "value", "is", "not", "skipped", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/util/ScheduleExpressionParser.java#L607-L628
train
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/util/ScheduleExpressionParser.java
ScheduleExpressionParser.findNamedValue
private int findNamedValue(int begin, String[] namedValues, int min) { int length = ivPos - begin; for (int i = 0; i < namedValues.length; i++) { String namedValue = namedValues[i]; if (length == namedValue.length() && ivString.regionMatches(true, begin, namedValue, 0, length)) { return min + i; } } return -1; }
java
private int findNamedValue(int begin, String[] namedValues, int min) { int length = ivPos - begin; for (int i = 0; i < namedValues.length; i++) { String namedValue = namedValues[i]; if (length == namedValue.length() && ivString.regionMatches(true, begin, namedValue, 0, length)) { return min + i; } } return -1; }
[ "private", "int", "findNamedValue", "(", "int", "begin", ",", "String", "[", "]", "namedValues", ",", "int", "min", ")", "{", "int", "length", "=", "ivPos", "-", "begin", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "namedValues", ".", "length", ";", "i", "++", ")", "{", "String", "namedValue", "=", "namedValues", "[", "i", "]", ";", "if", "(", "length", "==", "namedValue", ".", "length", "(", ")", "&&", "ivString", ".", "regionMatches", "(", "true", ",", "begin", ",", "namedValue", ",", "0", ",", "length", ")", ")", "{", "return", "min", "+", "i", ";", "}", "}", "return", "-", "1", ";", "}" ]
Case-insensitively search the specified list of named values for a substring of the parse string. The substring of the parse string is the range [begin, ivPos). @param begin the beginning index of the substring, inclusive @param namedValues the values to search @param min the non-negative adjustment for the return value @return <tt>min</tt> plus the position in the values list matching the substring, or <tt>-1</tt> if the value was not found
[ "Case", "-", "insensitively", "search", "the", "specified", "list", "of", "named", "values", "for", "a", "substring", "of", "the", "parse", "string", ".", "The", "substring", "of", "the", "parse", "string", "is", "the", "range", "[", "begin", "ivPos", ")", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/util/ScheduleExpressionParser.java#L655-L670
train
OpenLiberty/open-liberty
dev/com.ibm.ws.crypto.passwordutil/src/com/ibm/ws/crypto/util/PasswordHashGenerator.java
PasswordHashGenerator.generateSalt
public static byte[] generateSalt(String saltString) { byte[] output = null; if (saltString == null || saltString.length() < 1) { // use randomly generated value output = new byte[SEED_LENGTH]; SecureRandom rand = new SecureRandom(); rand.setSeed(rand.generateSeed(SEED_LENGTH)); rand.nextBytes(output); } else { try { output = saltString.getBytes("UTF-8"); } catch (UnsupportedEncodingException e) { // fall back to default encoding. since the value won't be converted to the string, this is not an issue. output = saltString.getBytes(); } } return output; }
java
public static byte[] generateSalt(String saltString) { byte[] output = null; if (saltString == null || saltString.length() < 1) { // use randomly generated value output = new byte[SEED_LENGTH]; SecureRandom rand = new SecureRandom(); rand.setSeed(rand.generateSeed(SEED_LENGTH)); rand.nextBytes(output); } else { try { output = saltString.getBytes("UTF-8"); } catch (UnsupportedEncodingException e) { // fall back to default encoding. since the value won't be converted to the string, this is not an issue. output = saltString.getBytes(); } } return output; }
[ "public", "static", "byte", "[", "]", "generateSalt", "(", "String", "saltString", ")", "{", "byte", "[", "]", "output", "=", "null", ";", "if", "(", "saltString", "==", "null", "||", "saltString", ".", "length", "(", ")", "<", "1", ")", "{", "// use randomly generated value", "output", "=", "new", "byte", "[", "SEED_LENGTH", "]", ";", "SecureRandom", "rand", "=", "new", "SecureRandom", "(", ")", ";", "rand", ".", "setSeed", "(", "rand", ".", "generateSeed", "(", "SEED_LENGTH", ")", ")", ";", "rand", ".", "nextBytes", "(", "output", ")", ";", "}", "else", "{", "try", "{", "output", "=", "saltString", ".", "getBytes", "(", "\"UTF-8\"", ")", ";", "}", "catch", "(", "UnsupportedEncodingException", "e", ")", "{", "// fall back to default encoding. since the value won't be converted to the string, this is not an issue.", "output", "=", "saltString", ".", "getBytes", "(", ")", ";", "}", "}", "return", "output", ";", "}" ]
generate salt value by using given string. salt was generated as following format String format of current time + given string + hostname
[ "generate", "salt", "value", "by", "using", "given", "string", ".", "salt", "was", "generated", "as", "following", "format", "String", "format", "of", "current", "time", "+", "given", "string", "+", "hostname" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.crypto.passwordutil/src/com/ibm/ws/crypto/util/PasswordHashGenerator.java#L36-L53
train
OpenLiberty/open-liberty
dev/com.ibm.ws.crypto.passwordutil/src/com/ibm/ws/crypto/util/PasswordHashGenerator.java
PasswordHashGenerator.digest
public static byte[] digest(char[] plainBytes, byte[] salt, String algorithm, int iteration, int length) throws InvalidPasswordCipherException { if (logger.isLoggable(Level.FINE)) { logger.fine("algorithm : " + algorithm + " iteration : " + iteration); logger.fine("input length: " + plainBytes.length); logger.fine("salt length: " + salt.length); logger.fine("output length: " + length); } byte[] oBytes = null; if (plainBytes != null && plainBytes.length > 0 && algorithm != null && algorithm.length() > 0 && iteration > 0) { long begin = 0; if (logger.isLoggable(Level.FINE)) { begin = System.nanoTime(); } try { SecretKeyFactory skf = SecretKeyFactory.getInstance(algorithm); PBEKeySpec ks = new PBEKeySpec(plainBytes, salt, iteration, length); SecretKey s = skf.generateSecret(ks); oBytes = s.getEncoded(); } catch (Exception e) { throw (InvalidPasswordCipherException) new InvalidPasswordCipherException(e.getMessage()).initCause(e); } if (logger.isLoggable(Level.FINE)) { long elapsed = System.nanoTime() - begin; logger.fine("Elapsed time : " + elapsed + " ns " + (elapsed / 1000000) + " ms"); //debug } } if ((logger.isLoggable(Level.FINE)) && oBytes != null) { logger.fine("digest length: " + oBytes.length); logger.fine(hexDump(oBytes)); } return oBytes; }
java
public static byte[] digest(char[] plainBytes, byte[] salt, String algorithm, int iteration, int length) throws InvalidPasswordCipherException { if (logger.isLoggable(Level.FINE)) { logger.fine("algorithm : " + algorithm + " iteration : " + iteration); logger.fine("input length: " + plainBytes.length); logger.fine("salt length: " + salt.length); logger.fine("output length: " + length); } byte[] oBytes = null; if (plainBytes != null && plainBytes.length > 0 && algorithm != null && algorithm.length() > 0 && iteration > 0) { long begin = 0; if (logger.isLoggable(Level.FINE)) { begin = System.nanoTime(); } try { SecretKeyFactory skf = SecretKeyFactory.getInstance(algorithm); PBEKeySpec ks = new PBEKeySpec(plainBytes, salt, iteration, length); SecretKey s = skf.generateSecret(ks); oBytes = s.getEncoded(); } catch (Exception e) { throw (InvalidPasswordCipherException) new InvalidPasswordCipherException(e.getMessage()).initCause(e); } if (logger.isLoggable(Level.FINE)) { long elapsed = System.nanoTime() - begin; logger.fine("Elapsed time : " + elapsed + " ns " + (elapsed / 1000000) + " ms"); //debug } } if ((logger.isLoggable(Level.FINE)) && oBytes != null) { logger.fine("digest length: " + oBytes.length); logger.fine(hexDump(oBytes)); } return oBytes; }
[ "public", "static", "byte", "[", "]", "digest", "(", "char", "[", "]", "plainBytes", ",", "byte", "[", "]", "salt", ",", "String", "algorithm", ",", "int", "iteration", ",", "int", "length", ")", "throws", "InvalidPasswordCipherException", "{", "if", "(", "logger", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "{", "logger", ".", "fine", "(", "\"algorithm : \"", "+", "algorithm", "+", "\" iteration : \"", "+", "iteration", ")", ";", "logger", ".", "fine", "(", "\"input length: \"", "+", "plainBytes", ".", "length", ")", ";", "logger", ".", "fine", "(", "\"salt length: \"", "+", "salt", ".", "length", ")", ";", "logger", ".", "fine", "(", "\"output length: \"", "+", "length", ")", ";", "}", "byte", "[", "]", "oBytes", "=", "null", ";", "if", "(", "plainBytes", "!=", "null", "&&", "plainBytes", ".", "length", ">", "0", "&&", "algorithm", "!=", "null", "&&", "algorithm", ".", "length", "(", ")", ">", "0", "&&", "iteration", ">", "0", ")", "{", "long", "begin", "=", "0", ";", "if", "(", "logger", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "{", "begin", "=", "System", ".", "nanoTime", "(", ")", ";", "}", "try", "{", "SecretKeyFactory", "skf", "=", "SecretKeyFactory", ".", "getInstance", "(", "algorithm", ")", ";", "PBEKeySpec", "ks", "=", "new", "PBEKeySpec", "(", "plainBytes", ",", "salt", ",", "iteration", ",", "length", ")", ";", "SecretKey", "s", "=", "skf", ".", "generateSecret", "(", "ks", ")", ";", "oBytes", "=", "s", ".", "getEncoded", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "(", "InvalidPasswordCipherException", ")", "new", "InvalidPasswordCipherException", "(", "e", ".", "getMessage", "(", ")", ")", ".", "initCause", "(", "e", ")", ";", "}", "if", "(", "logger", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "{", "long", "elapsed", "=", "System", ".", "nanoTime", "(", ")", "-", "begin", ";", "logger", ".", "fine", "(", "\"Elapsed time : \"", "+", "elapsed", "+", "\" ns \"", "+", "(", "elapsed", "/", "1000000", ")", "+", "\" ms\"", ")", ";", "//debug", "}", "}", "if", "(", "(", "logger", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "&&", "oBytes", "!=", "null", ")", "{", "logger", ".", "fine", "(", "\"digest length: \"", "+", "oBytes", ".", "length", ")", ";", "logger", ".", "fine", "(", "hexDump", "(", "oBytes", ")", ")", ";", "}", "return", "oBytes", ";", "}" ]
perform message digest and then append a salt at the end.
[ "perform", "message", "digest", "and", "then", "append", "a", "salt", "at", "the", "end", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.crypto.passwordutil/src/com/ibm/ws/crypto/util/PasswordHashGenerator.java#L82-L115
train
OpenLiberty/open-liberty
dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/transport/iiop/asn1/x509/ObjectDigestInfo.java
ObjectDigestInfo.toASN1Object
public DERObject toASN1Object() { ASN1EncodableVector v = new ASN1EncodableVector(); v.add(digestedObjectType); if (otherObjectTypeID != null) { v.add(otherObjectTypeID); } v.add(digestAlgorithm); v.add(objectDigest); return new DERSequence(v); }
java
public DERObject toASN1Object() { ASN1EncodableVector v = new ASN1EncodableVector(); v.add(digestedObjectType); if (otherObjectTypeID != null) { v.add(otherObjectTypeID); } v.add(digestAlgorithm); v.add(objectDigest); return new DERSequence(v); }
[ "public", "DERObject", "toASN1Object", "(", ")", "{", "ASN1EncodableVector", "v", "=", "new", "ASN1EncodableVector", "(", ")", ";", "v", ".", "add", "(", "digestedObjectType", ")", ";", "if", "(", "otherObjectTypeID", "!=", "null", ")", "{", "v", ".", "add", "(", "otherObjectTypeID", ")", ";", "}", "v", ".", "add", "(", "digestAlgorithm", ")", ";", "v", ".", "add", "(", "objectDigest", ")", ";", "return", "new", "DERSequence", "(", "v", ")", ";", "}" ]
Produce an object suitable for an ASN1OutputStream. <pre> ObjectDigestInfo ::= SEQUENCE { digestedObjectType ENUMERATED { publicKey (0), publicKeyCert (1), otherObjectTypes (2) }, -- otherObjectTypes MUST NOT -- be used in this profile otherObjectTypeID OBJECT IDENTIFIER OPTIONAL, digestAlgorithm AlgorithmIdentifier, objectDigest BIT STRING } </pre>
[ "Produce", "an", "object", "suitable", "for", "an", "ASN1OutputStream", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/transport/iiop/asn1/x509/ObjectDigestInfo.java#L119-L134
train
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/FilterListFastStr.java
FilterListFastStr.findInList
private boolean findInList(Entry oEntry) { return findInList(oEntry.getHashcodes(), oEntry.getLengths(), firstCell, oEntry.getCurrentSize() - 1); }
java
private boolean findInList(Entry oEntry) { return findInList(oEntry.getHashcodes(), oEntry.getLengths(), firstCell, oEntry.getCurrentSize() - 1); }
[ "private", "boolean", "findInList", "(", "Entry", "oEntry", ")", "{", "return", "findInList", "(", "oEntry", ".", "getHashcodes", "(", ")", ",", "oEntry", ".", "getLengths", "(", ")", ",", "firstCell", ",", "oEntry", ".", "getCurrentSize", "(", ")", "-", "1", ")", ";", "}" ]
Determine if an address represented by an Entry object is in the address tree @param oEntry Entry object for the address to look for @return true if this address is found in the address tree, false if it is not.
[ "Determine", "if", "an", "address", "represented", "by", "an", "Entry", "object", "is", "in", "the", "address", "tree" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/FilterListFastStr.java#L102-L104
train
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/FilterListFastStr.java
FilterListFastStr.putInList
private boolean putInList(Entry entry) { FilterCellFastStr currentCell = firstCell; FilterCellFastStr nextCell = null; int[] hashcodes = entry.getHashcodes(); int[] lengths = entry.getLengths(); // work from back to front int lastIndex = entry.getCurrentSize() - 1; for (int i = lastIndex; i >= 0; i--) { // test for wildcard if ((hashcodes[i] == 0) && (lengths[i] == 0)) { currentCell.addNewCell(hashcodes[i], lengths[i]); return true; } // check in nextCell has different lengths, if so, then // we can't use this "fast" method nextCell = currentCell.findNextCell(hashcodes[i]); if (nextCell != null) { if (nextCell.getHashLength() != lengths[i]) { return false; } } if (nextCell == null) { // new address, complete the tree for (int j = i; j >= 0; j--) { currentCell = currentCell.addNewCell(hashcodes[j], lengths[j]); if ((hashcodes[j] == 0) && (lengths[j] == 0)) { // nothing can come before a wildcard, so return return true; } } return true; } currentCell = nextCell; } return true; }
java
private boolean putInList(Entry entry) { FilterCellFastStr currentCell = firstCell; FilterCellFastStr nextCell = null; int[] hashcodes = entry.getHashcodes(); int[] lengths = entry.getLengths(); // work from back to front int lastIndex = entry.getCurrentSize() - 1; for (int i = lastIndex; i >= 0; i--) { // test for wildcard if ((hashcodes[i] == 0) && (lengths[i] == 0)) { currentCell.addNewCell(hashcodes[i], lengths[i]); return true; } // check in nextCell has different lengths, if so, then // we can't use this "fast" method nextCell = currentCell.findNextCell(hashcodes[i]); if (nextCell != null) { if (nextCell.getHashLength() != lengths[i]) { return false; } } if (nextCell == null) { // new address, complete the tree for (int j = i; j >= 0; j--) { currentCell = currentCell.addNewCell(hashcodes[j], lengths[j]); if ((hashcodes[j] == 0) && (lengths[j] == 0)) { // nothing can come before a wildcard, so return return true; } } return true; } currentCell = nextCell; } return true; }
[ "private", "boolean", "putInList", "(", "Entry", "entry", ")", "{", "FilterCellFastStr", "currentCell", "=", "firstCell", ";", "FilterCellFastStr", "nextCell", "=", "null", ";", "int", "[", "]", "hashcodes", "=", "entry", ".", "getHashcodes", "(", ")", ";", "int", "[", "]", "lengths", "=", "entry", ".", "getLengths", "(", ")", ";", "// work from back to front", "int", "lastIndex", "=", "entry", ".", "getCurrentSize", "(", ")", "-", "1", ";", "for", "(", "int", "i", "=", "lastIndex", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "// test for wildcard", "if", "(", "(", "hashcodes", "[", "i", "]", "==", "0", ")", "&&", "(", "lengths", "[", "i", "]", "==", "0", ")", ")", "{", "currentCell", ".", "addNewCell", "(", "hashcodes", "[", "i", "]", ",", "lengths", "[", "i", "]", ")", ";", "return", "true", ";", "}", "// check in nextCell has different lengths, if so, then", "// we can't use this \"fast\" method", "nextCell", "=", "currentCell", ".", "findNextCell", "(", "hashcodes", "[", "i", "]", ")", ";", "if", "(", "nextCell", "!=", "null", ")", "{", "if", "(", "nextCell", ".", "getHashLength", "(", ")", "!=", "lengths", "[", "i", "]", ")", "{", "return", "false", ";", "}", "}", "if", "(", "nextCell", "==", "null", ")", "{", "// new address, complete the tree", "for", "(", "int", "j", "=", "i", ";", "j", ">=", "0", ";", "j", "--", ")", "{", "currentCell", "=", "currentCell", ".", "addNewCell", "(", "hashcodes", "[", "j", "]", ",", "lengths", "[", "j", "]", ")", ";", "if", "(", "(", "hashcodes", "[", "j", "]", "==", "0", ")", "&&", "(", "lengths", "[", "j", "]", "==", "0", ")", ")", "{", "// nothing can come before a wildcard, so return", "return", "true", ";", "}", "}", "return", "true", ";", "}", "currentCell", "=", "nextCell", ";", "}", "return", "true", ";", "}" ]
Add and new address to the address tree, where the new address is represented by an Entry object. @param entry @return boolean
[ "Add", "and", "new", "address", "to", "the", "address", "tree", "where", "the", "new", "address", "is", "represented", "by", "an", "Entry", "object", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/FilterListFastStr.java#L157-L195
train
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/FilterListFastStr.java
FilterListFastStr.convertToEntries
private Entry convertToEntries(String newAddress) { byte[] ba = null; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "convertToEntries"); } try { ba = newAddress.getBytes("ISO-8859-1"); } catch (UnsupportedEncodingException x) { // should never happen, log a message and use default encoding if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "ISO-8859-1 encoding not supported. Exception: " + x); } ba = newAddress.getBytes(); } int baLength = ba.length; int hashValue = 0; int hashLength = 0; int e31 = 1; Entry oEntry = new Entry(); for (int i = 0; i < baLength; i++) { if (ba[i] == WILDCARD_VALUE) { boolean valid = true; // make sure it is the first entry, followed by a ".", or nothing if (i != 0) { valid = false; } if (baLength >= 2) { if (ba[1] != PERIOD_VALUE) { valid = false; } } if (valid) { // if isolated, then store it, and continue to next word. // Store as wildcard entry oEntry.addEntry(0, 0); // jump over next period to avoid processing this char again i = 1; // go back to start of for loop continue; } } if (ba[i] != PERIOD_VALUE) { // continue calculating hashcode for this entry hashValue += e31 * ba[i]; e31 = e31 * 31; hashLength++; } if ((ba[i] == PERIOD_VALUE) || (i == baLength - 1)) { // end of a "word", need to add if length is non-zero if (hashLength > 0) { oEntry.addEntry(hashValue, hashLength); } // prepare to calculate next entry hashLength = 0; e31 = 1; hashValue = 0; } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "convertToEntries"); } return oEntry; }
java
private Entry convertToEntries(String newAddress) { byte[] ba = null; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "convertToEntries"); } try { ba = newAddress.getBytes("ISO-8859-1"); } catch (UnsupportedEncodingException x) { // should never happen, log a message and use default encoding if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "ISO-8859-1 encoding not supported. Exception: " + x); } ba = newAddress.getBytes(); } int baLength = ba.length; int hashValue = 0; int hashLength = 0; int e31 = 1; Entry oEntry = new Entry(); for (int i = 0; i < baLength; i++) { if (ba[i] == WILDCARD_VALUE) { boolean valid = true; // make sure it is the first entry, followed by a ".", or nothing if (i != 0) { valid = false; } if (baLength >= 2) { if (ba[1] != PERIOD_VALUE) { valid = false; } } if (valid) { // if isolated, then store it, and continue to next word. // Store as wildcard entry oEntry.addEntry(0, 0); // jump over next period to avoid processing this char again i = 1; // go back to start of for loop continue; } } if (ba[i] != PERIOD_VALUE) { // continue calculating hashcode for this entry hashValue += e31 * ba[i]; e31 = e31 * 31; hashLength++; } if ((ba[i] == PERIOD_VALUE) || (i == baLength - 1)) { // end of a "word", need to add if length is non-zero if (hashLength > 0) { oEntry.addEntry(hashValue, hashLength); } // prepare to calculate next entry hashLength = 0; e31 = 1; hashValue = 0; } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "convertToEntries"); } return oEntry; }
[ "private", "Entry", "convertToEntries", "(", "String", "newAddress", ")", "{", "byte", "[", "]", "ba", "=", "null", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "entry", "(", "tc", ",", "\"convertToEntries\"", ")", ";", "}", "try", "{", "ba", "=", "newAddress", ".", "getBytes", "(", "\"ISO-8859-1\"", ")", ";", "}", "catch", "(", "UnsupportedEncodingException", "x", ")", "{", "// should never happen, log a message and use default encoding", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEventEnabled", "(", ")", ")", "{", "Tr", ".", "event", "(", "tc", ",", "\"ISO-8859-1 encoding not supported. Exception: \"", "+", "x", ")", ";", "}", "ba", "=", "newAddress", ".", "getBytes", "(", ")", ";", "}", "int", "baLength", "=", "ba", ".", "length", ";", "int", "hashValue", "=", "0", ";", "int", "hashLength", "=", "0", ";", "int", "e31", "=", "1", ";", "Entry", "oEntry", "=", "new", "Entry", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "baLength", ";", "i", "++", ")", "{", "if", "(", "ba", "[", "i", "]", "==", "WILDCARD_VALUE", ")", "{", "boolean", "valid", "=", "true", ";", "// make sure it is the first entry, followed by a \".\", or nothing", "if", "(", "i", "!=", "0", ")", "{", "valid", "=", "false", ";", "}", "if", "(", "baLength", ">=", "2", ")", "{", "if", "(", "ba", "[", "1", "]", "!=", "PERIOD_VALUE", ")", "{", "valid", "=", "false", ";", "}", "}", "if", "(", "valid", ")", "{", "// if isolated, then store it, and continue to next word.", "// Store as wildcard entry", "oEntry", ".", "addEntry", "(", "0", ",", "0", ")", ";", "// jump over next period to avoid processing this char again", "i", "=", "1", ";", "// go back to start of for loop", "continue", ";", "}", "}", "if", "(", "ba", "[", "i", "]", "!=", "PERIOD_VALUE", ")", "{", "// continue calculating hashcode for this entry", "hashValue", "+=", "e31", "*", "ba", "[", "i", "]", ";", "e31", "=", "e31", "*", "31", ";", "hashLength", "++", ";", "}", "if", "(", "(", "ba", "[", "i", "]", "==", "PERIOD_VALUE", ")", "||", "(", "i", "==", "baLength", "-", "1", ")", ")", "{", "// end of a \"word\", need to add if length is non-zero", "if", "(", "hashLength", ">", "0", ")", "{", "oEntry", ".", "addEntry", "(", "hashValue", ",", "hashLength", ")", ";", "}", "// prepare to calculate next entry", "hashLength", "=", "0", ";", "e31", "=", "1", ";", "hashValue", "=", "0", ";", "}", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "exit", "(", "tc", ",", "\"convertToEntries\"", ")", ";", "}", "return", "oEntry", ";", "}" ]
Convert a single URL address to an Entry object. The entry object will contain the hashcode array and length array of the substrings of this address @param newAddress address to convert @return the Entry object created from this address.
[ "Convert", "a", "single", "URL", "address", "to", "an", "Entry", "object", ".", "The", "entry", "object", "will", "contain", "the", "hashcode", "array", "and", "length", "array", "of", "the", "substrings", "of", "this", "address" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/FilterListFastStr.java#L206-L277
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.utils/src/com/ibm/ws/sib/utils/CryptoHash.java
CryptoHash.hash
public static void hash(byte[] data, byte[] output) { int len = output.length; if (len == 0) return; int[] code = calculate(data); for (int outIndex = 0, codeIndex = 0, shift = 24; outIndex < len && codeIndex < 5; ++outIndex, shift -= 8) { output[outIndex] = (byte) (code[codeIndex] >>> shift); if (shift == 0) { shift = 32; // will be decremented by 8 before next iteration ++codeIndex; } } }
java
public static void hash(byte[] data, byte[] output) { int len = output.length; if (len == 0) return; int[] code = calculate(data); for (int outIndex = 0, codeIndex = 0, shift = 24; outIndex < len && codeIndex < 5; ++outIndex, shift -= 8) { output[outIndex] = (byte) (code[codeIndex] >>> shift); if (shift == 0) { shift = 32; // will be decremented by 8 before next iteration ++codeIndex; } } }
[ "public", "static", "void", "hash", "(", "byte", "[", "]", "data", ",", "byte", "[", "]", "output", ")", "{", "int", "len", "=", "output", ".", "length", ";", "if", "(", "len", "==", "0", ")", "return", ";", "int", "[", "]", "code", "=", "calculate", "(", "data", ")", ";", "for", "(", "int", "outIndex", "=", "0", ",", "codeIndex", "=", "0", ",", "shift", "=", "24", ";", "outIndex", "<", "len", "&&", "codeIndex", "<", "5", ";", "++", "outIndex", ",", "shift", "-=", "8", ")", "{", "output", "[", "outIndex", "]", "=", "(", "byte", ")", "(", "code", "[", "codeIndex", "]", ">>>", "shift", ")", ";", "if", "(", "shift", "==", "0", ")", "{", "shift", "=", "32", ";", "// will be decremented by 8 before next iteration", "++", "codeIndex", ";", "}", "}", "}" ]
Calculates the SHA-1 hash code of the input data and writes up to 20 bytes of it in the output byte array parameter. @param data the byte array to be hashed @param output output parameter for the calculated hash code
[ "Calculates", "the", "SHA", "-", "1", "hash", "code", "of", "the", "input", "data", "and", "writes", "up", "to", "20", "bytes", "of", "it", "in", "the", "output", "byte", "array", "parameter", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.utils/src/com/ibm/ws/sib/utils/CryptoHash.java#L43-L57
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/view/ViewDeclarationLanguageBase.java
ViewDeclarationLanguageBase.createView
public UIViewRoot createView(FacesContext context, String viewId) { checkNull(context, "context"); //checkNull(viewId, "viewId"); try { viewId = calculateViewId(context, viewId); Application application = context.getApplication(); // Create a new UIViewRoot object instance using Application.createComponent(UIViewRoot.COMPONENT_TYPE). UIViewRoot newViewRoot = (UIViewRoot) application.createComponent( context, UIViewRoot.COMPONENT_TYPE, null); UIViewRoot oldViewRoot = context.getViewRoot(); if (oldViewRoot == null) { // If not, this method must call calculateLocale() and calculateRenderKitId(), and store the results // as the values of the locale and renderKitId, proeprties, respectively, of the newly created // UIViewRoot. ViewHandler handler = application.getViewHandler(); newViewRoot.setLocale(handler.calculateLocale(context)); newViewRoot.setRenderKitId(handler.calculateRenderKitId(context)); } else { // If there is an existing UIViewRoot available on the FacesContext, this method must copy its locale // and renderKitId to this new view root newViewRoot.setLocale(oldViewRoot.getLocale()); newViewRoot.setRenderKitId(oldViewRoot.getRenderKitId()); } // TODO: VALIDATE - The spec is silent on the following line, but I feel bad if I don't set it newViewRoot.setViewId(viewId); return newViewRoot; } catch (InvalidViewIdException e) { // If no viewId could be identified, or the viewId is exactly equal to the servlet mapping, // send the response error code SC_NOT_FOUND with a suitable message to the client. sendSourceNotFound(context, e.getMessage()); // TODO: VALIDATE - Spec is silent on the return value when an error was sent return null; } }
java
public UIViewRoot createView(FacesContext context, String viewId) { checkNull(context, "context"); //checkNull(viewId, "viewId"); try { viewId = calculateViewId(context, viewId); Application application = context.getApplication(); // Create a new UIViewRoot object instance using Application.createComponent(UIViewRoot.COMPONENT_TYPE). UIViewRoot newViewRoot = (UIViewRoot) application.createComponent( context, UIViewRoot.COMPONENT_TYPE, null); UIViewRoot oldViewRoot = context.getViewRoot(); if (oldViewRoot == null) { // If not, this method must call calculateLocale() and calculateRenderKitId(), and store the results // as the values of the locale and renderKitId, proeprties, respectively, of the newly created // UIViewRoot. ViewHandler handler = application.getViewHandler(); newViewRoot.setLocale(handler.calculateLocale(context)); newViewRoot.setRenderKitId(handler.calculateRenderKitId(context)); } else { // If there is an existing UIViewRoot available on the FacesContext, this method must copy its locale // and renderKitId to this new view root newViewRoot.setLocale(oldViewRoot.getLocale()); newViewRoot.setRenderKitId(oldViewRoot.getRenderKitId()); } // TODO: VALIDATE - The spec is silent on the following line, but I feel bad if I don't set it newViewRoot.setViewId(viewId); return newViewRoot; } catch (InvalidViewIdException e) { // If no viewId could be identified, or the viewId is exactly equal to the servlet mapping, // send the response error code SC_NOT_FOUND with a suitable message to the client. sendSourceNotFound(context, e.getMessage()); // TODO: VALIDATE - Spec is silent on the return value when an error was sent return null; } }
[ "public", "UIViewRoot", "createView", "(", "FacesContext", "context", ",", "String", "viewId", ")", "{", "checkNull", "(", "context", ",", "\"context\"", ")", ";", "//checkNull(viewId, \"viewId\");", "try", "{", "viewId", "=", "calculateViewId", "(", "context", ",", "viewId", ")", ";", "Application", "application", "=", "context", ".", "getApplication", "(", ")", ";", "// Create a new UIViewRoot object instance using Application.createComponent(UIViewRoot.COMPONENT_TYPE).", "UIViewRoot", "newViewRoot", "=", "(", "UIViewRoot", ")", "application", ".", "createComponent", "(", "context", ",", "UIViewRoot", ".", "COMPONENT_TYPE", ",", "null", ")", ";", "UIViewRoot", "oldViewRoot", "=", "context", ".", "getViewRoot", "(", ")", ";", "if", "(", "oldViewRoot", "==", "null", ")", "{", "// If not, this method must call calculateLocale() and calculateRenderKitId(), and store the results", "// as the values of the locale and renderKitId, proeprties, respectively, of the newly created", "// UIViewRoot.", "ViewHandler", "handler", "=", "application", ".", "getViewHandler", "(", ")", ";", "newViewRoot", ".", "setLocale", "(", "handler", ".", "calculateLocale", "(", "context", ")", ")", ";", "newViewRoot", ".", "setRenderKitId", "(", "handler", ".", "calculateRenderKitId", "(", "context", ")", ")", ";", "}", "else", "{", "// If there is an existing UIViewRoot available on the FacesContext, this method must copy its locale", "// and renderKitId to this new view root", "newViewRoot", ".", "setLocale", "(", "oldViewRoot", ".", "getLocale", "(", ")", ")", ";", "newViewRoot", ".", "setRenderKitId", "(", "oldViewRoot", ".", "getRenderKitId", "(", ")", ")", ";", "}", "// TODO: VALIDATE - The spec is silent on the following line, but I feel bad if I don't set it", "newViewRoot", ".", "setViewId", "(", "viewId", ")", ";", "return", "newViewRoot", ";", "}", "catch", "(", "InvalidViewIdException", "e", ")", "{", "// If no viewId could be identified, or the viewId is exactly equal to the servlet mapping, ", "// send the response error code SC_NOT_FOUND with a suitable message to the client.", "sendSourceNotFound", "(", "context", ",", "e", ".", "getMessage", "(", ")", ")", ";", "// TODO: VALIDATE - Spec is silent on the return value when an error was sent", "return", "null", ";", "}", "}" ]
Process the specification required algorithm that is generic to all PDL. @param context @param viewId
[ "Process", "the", "specification", "required", "algorithm", "that", "is", "generic", "to", "all", "PDL", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/view/ViewDeclarationLanguageBase.java#L41-L87
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jca/src/com/ibm/ws/jca/internal/BootstrapContextImpl.java
BootstrapContextImpl.getDestinationName
private Object getDestinationName(String destinationType, Object destination) throws Exception { String methodName; if ("javax.jms.Queue".equals(destinationType)) methodName = "getQueueName"; else if ("javax.jms.Topic".equals(destinationType)) methodName = "getTopicName"; else throw new InvalidPropertyException("destinationType: " + destinationType); try { return destination.getClass().getMethod(methodName).invoke(destination); } catch (NoSuchMethodException x) { throw new InvalidPropertyException(Tr.formatMessage(tc, "J2CA8505.destination.type.mismatch", destination, destinationType), x); } }
java
private Object getDestinationName(String destinationType, Object destination) throws Exception { String methodName; if ("javax.jms.Queue".equals(destinationType)) methodName = "getQueueName"; else if ("javax.jms.Topic".equals(destinationType)) methodName = "getTopicName"; else throw new InvalidPropertyException("destinationType: " + destinationType); try { return destination.getClass().getMethod(methodName).invoke(destination); } catch (NoSuchMethodException x) { throw new InvalidPropertyException(Tr.formatMessage(tc, "J2CA8505.destination.type.mismatch", destination, destinationType), x); } }
[ "private", "Object", "getDestinationName", "(", "String", "destinationType", ",", "Object", "destination", ")", "throws", "Exception", "{", "String", "methodName", ";", "if", "(", "\"javax.jms.Queue\"", ".", "equals", "(", "destinationType", ")", ")", "methodName", "=", "\"getQueueName\"", ";", "else", "if", "(", "\"javax.jms.Topic\"", ".", "equals", "(", "destinationType", ")", ")", "methodName", "=", "\"getTopicName\"", ";", "else", "throw", "new", "InvalidPropertyException", "(", "\"destinationType: \"", "+", "destinationType", ")", ";", "try", "{", "return", "destination", ".", "getClass", "(", ")", ".", "getMethod", "(", "methodName", ")", ".", "invoke", "(", "destination", ")", ";", "}", "catch", "(", "NoSuchMethodException", "x", ")", "{", "throw", "new", "InvalidPropertyException", "(", "Tr", ".", "formatMessage", "(", "tc", ",", "\"J2CA8505.destination.type.mismatch\"", ",", "destination", ",", "destinationType", ")", ",", "x", ")", ";", "}", "}" ]
Returns the name of the queue or topic. @param destinationType type of destination (javax.jms.Queue or javax.jms.Topic). @param value instance of the above type. @return name of the queue or topic. @throws Exception if unable to obtain the destination name.
[ "Returns", "the", "name", "of", "the", "queue", "or", "topic", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca/src/com/ibm/ws/jca/internal/BootstrapContextImpl.java#L801-L815
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jca/src/com/ibm/ws/jca/internal/BootstrapContextImpl.java
BootstrapContextImpl.getJCAContextProvider
JCAContextProvider getJCAContextProvider(Class<?> workContextClass) { JCAContextProvider provider = null; for (Class<?> cl = workContextClass; provider == null && cl != null; cl = cl.getSuperclass()) provider = contextProviders.getService(cl.getName()); return provider; }
java
JCAContextProvider getJCAContextProvider(Class<?> workContextClass) { JCAContextProvider provider = null; for (Class<?> cl = workContextClass; provider == null && cl != null; cl = cl.getSuperclass()) provider = contextProviders.getService(cl.getName()); return provider; }
[ "JCAContextProvider", "getJCAContextProvider", "(", "Class", "<", "?", ">", "workContextClass", ")", "{", "JCAContextProvider", "provider", "=", "null", ";", "for", "(", "Class", "<", "?", ">", "cl", "=", "workContextClass", ";", "provider", "==", "null", "&&", "cl", "!=", "null", ";", "cl", "=", "cl", ".", "getSuperclass", "(", ")", ")", "provider", "=", "contextProviders", ".", "getService", "(", "cl", ".", "getName", "(", ")", ")", ";", "return", "provider", ";", "}" ]
Returns the JCAContextProvider for the specified work context class. @param workContextClass a WorkContext implementation class or ExecutionContext. @return the JCAContextProvider for the specified work context class.
[ "Returns", "the", "JCAContextProvider", "for", "the", "specified", "work", "context", "class", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca/src/com/ibm/ws/jca/internal/BootstrapContextImpl.java#L823-L829
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jca/src/com/ibm/ws/jca/internal/BootstrapContextImpl.java
BootstrapContextImpl.getJCAContextProviderName
String getJCAContextProviderName(Class<?> workContextClass) { ServiceReference<JCAContextProvider> ref = null; for (Class<?> cl = workContextClass; ref == null && cl != null; cl = cl.getSuperclass()) ref = contextProviders.getReference(cl.getName()); String name = ref == null ? null : (String) ref.getProperty(JCAContextProvider.CONTEXT_NAME); if (name == null && ref != null) name = (String) ref.getProperty("component.name"); return name; }
java
String getJCAContextProviderName(Class<?> workContextClass) { ServiceReference<JCAContextProvider> ref = null; for (Class<?> cl = workContextClass; ref == null && cl != null; cl = cl.getSuperclass()) ref = contextProviders.getReference(cl.getName()); String name = ref == null ? null : (String) ref.getProperty(JCAContextProvider.CONTEXT_NAME); if (name == null && ref != null) name = (String) ref.getProperty("component.name"); return name; }
[ "String", "getJCAContextProviderName", "(", "Class", "<", "?", ">", "workContextClass", ")", "{", "ServiceReference", "<", "JCAContextProvider", ">", "ref", "=", "null", ";", "for", "(", "Class", "<", "?", ">", "cl", "=", "workContextClass", ";", "ref", "==", "null", "&&", "cl", "!=", "null", ";", "cl", "=", "cl", ".", "getSuperclass", "(", ")", ")", "ref", "=", "contextProviders", ".", "getReference", "(", "cl", ".", "getName", "(", ")", ")", ";", "String", "name", "=", "ref", "==", "null", "?", "null", ":", "(", "String", ")", "ref", ".", "getProperty", "(", "JCAContextProvider", ".", "CONTEXT_NAME", ")", ";", "if", "(", "name", "==", "null", "&&", "ref", "!=", "null", ")", "name", "=", "(", "String", ")", "ref", ".", "getProperty", "(", "\"component.name\"", ")", ";", "return", "name", ";", "}" ]
Returns the component name of the JCAContextProvider for the specified work context class. @param workContextClass a WorkContext implementation class or ExecutionContext. @return the component name of the JCAContextProvider.
[ "Returns", "the", "component", "name", "of", "the", "JCAContextProvider", "for", "the", "specified", "work", "context", "class", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca/src/com/ibm/ws/jca/internal/BootstrapContextImpl.java#L837-L846
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jca/src/com/ibm/ws/jca/internal/BootstrapContextImpl.java
BootstrapContextImpl.loadClass
public Class<?> loadClass(final String className) throws ClassNotFoundException, UnableToAdaptException, MalformedURLException { ClassLoader raClassLoader = resourceAdapterSvc.getClassLoader(); if (raClassLoader != null) { return Utils.priv.loadClass(raClassLoader, className); } else { // TODO when SIB has converted from bundle to real rar file, then this can be removed // and if the rar file does not exist, then a Tr.error should be issued try { if (System.getSecurityManager() == null) { for (Bundle bundle : componentContext.getBundleContext().getBundles()) { if (resourceAdapterID.equals("wasJms") && ("com.ibm.ws.messaging.jms.1.1".equals(bundle.getSymbolicName()) || "com.ibm.ws.messaging.jms.2.0".equals(bundle.getSymbolicName()))) return bundle.loadClass(className); else if (resourceAdapterID.equals("wmqJms") && "com.ibm.ws.messaging.jms.wmq".equals(bundle.getSymbolicName())) return bundle.loadClass(className); } throw new ClassNotFoundException(className); } else { try { return AccessController.doPrivileged(new PrivilegedExceptionAction<Class<?>>() { @Override public Class<?> run() throws ClassNotFoundException { for (Bundle bundle : componentContext.getBundleContext().getBundles()) { if (resourceAdapterID.equals("wasJms") && ("com.ibm.ws.messaging.jms.1.1".equals(bundle.getSymbolicName()) || "com.ibm.ws.messaging.jms.2.0".equals(bundle.getSymbolicName()))) return bundle.loadClass(className); else if (resourceAdapterID.equals("wmqJms") && "com.ibm.ws.messaging.jms.wmq".equals(bundle.getSymbolicName())) return bundle.loadClass(className); } throw new ClassNotFoundException(className); } }); } catch (PrivilegedActionException e) { throw (ClassNotFoundException) e.getCause(); } } } catch (ClassNotFoundException cnf) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(this, tc, "Could not find adapter file and bundle does not have the class either. Possible cause is incorrectly specified file path.", cnf); } throw cnf; } } }
java
public Class<?> loadClass(final String className) throws ClassNotFoundException, UnableToAdaptException, MalformedURLException { ClassLoader raClassLoader = resourceAdapterSvc.getClassLoader(); if (raClassLoader != null) { return Utils.priv.loadClass(raClassLoader, className); } else { // TODO when SIB has converted from bundle to real rar file, then this can be removed // and if the rar file does not exist, then a Tr.error should be issued try { if (System.getSecurityManager() == null) { for (Bundle bundle : componentContext.getBundleContext().getBundles()) { if (resourceAdapterID.equals("wasJms") && ("com.ibm.ws.messaging.jms.1.1".equals(bundle.getSymbolicName()) || "com.ibm.ws.messaging.jms.2.0".equals(bundle.getSymbolicName()))) return bundle.loadClass(className); else if (resourceAdapterID.equals("wmqJms") && "com.ibm.ws.messaging.jms.wmq".equals(bundle.getSymbolicName())) return bundle.loadClass(className); } throw new ClassNotFoundException(className); } else { try { return AccessController.doPrivileged(new PrivilegedExceptionAction<Class<?>>() { @Override public Class<?> run() throws ClassNotFoundException { for (Bundle bundle : componentContext.getBundleContext().getBundles()) { if (resourceAdapterID.equals("wasJms") && ("com.ibm.ws.messaging.jms.1.1".equals(bundle.getSymbolicName()) || "com.ibm.ws.messaging.jms.2.0".equals(bundle.getSymbolicName()))) return bundle.loadClass(className); else if (resourceAdapterID.equals("wmqJms") && "com.ibm.ws.messaging.jms.wmq".equals(bundle.getSymbolicName())) return bundle.loadClass(className); } throw new ClassNotFoundException(className); } }); } catch (PrivilegedActionException e) { throw (ClassNotFoundException) e.getCause(); } } } catch (ClassNotFoundException cnf) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(this, tc, "Could not find adapter file and bundle does not have the class either. Possible cause is incorrectly specified file path.", cnf); } throw cnf; } } }
[ "public", "Class", "<", "?", ">", "loadClass", "(", "final", "String", "className", ")", "throws", "ClassNotFoundException", ",", "UnableToAdaptException", ",", "MalformedURLException", "{", "ClassLoader", "raClassLoader", "=", "resourceAdapterSvc", ".", "getClassLoader", "(", ")", ";", "if", "(", "raClassLoader", "!=", "null", ")", "{", "return", "Utils", ".", "priv", ".", "loadClass", "(", "raClassLoader", ",", "className", ")", ";", "}", "else", "{", "// TODO when SIB has converted from bundle to real rar file, then this can be removed", "// and if the rar file does not exist, then a Tr.error should be issued", "try", "{", "if", "(", "System", ".", "getSecurityManager", "(", ")", "==", "null", ")", "{", "for", "(", "Bundle", "bundle", ":", "componentContext", ".", "getBundleContext", "(", ")", ".", "getBundles", "(", ")", ")", "{", "if", "(", "resourceAdapterID", ".", "equals", "(", "\"wasJms\"", ")", "&&", "(", "\"com.ibm.ws.messaging.jms.1.1\"", ".", "equals", "(", "bundle", ".", "getSymbolicName", "(", ")", ")", "||", "\"com.ibm.ws.messaging.jms.2.0\"", ".", "equals", "(", "bundle", ".", "getSymbolicName", "(", ")", ")", ")", ")", "return", "bundle", ".", "loadClass", "(", "className", ")", ";", "else", "if", "(", "resourceAdapterID", ".", "equals", "(", "\"wmqJms\"", ")", "&&", "\"com.ibm.ws.messaging.jms.wmq\"", ".", "equals", "(", "bundle", ".", "getSymbolicName", "(", ")", ")", ")", "return", "bundle", ".", "loadClass", "(", "className", ")", ";", "}", "throw", "new", "ClassNotFoundException", "(", "className", ")", ";", "}", "else", "{", "try", "{", "return", "AccessController", ".", "doPrivileged", "(", "new", "PrivilegedExceptionAction", "<", "Class", "<", "?", ">", ">", "(", ")", "{", "@", "Override", "public", "Class", "<", "?", ">", "run", "(", ")", "throws", "ClassNotFoundException", "{", "for", "(", "Bundle", "bundle", ":", "componentContext", ".", "getBundleContext", "(", ")", ".", "getBundles", "(", ")", ")", "{", "if", "(", "resourceAdapterID", ".", "equals", "(", "\"wasJms\"", ")", "&&", "(", "\"com.ibm.ws.messaging.jms.1.1\"", ".", "equals", "(", "bundle", ".", "getSymbolicName", "(", ")", ")", "||", "\"com.ibm.ws.messaging.jms.2.0\"", ".", "equals", "(", "bundle", ".", "getSymbolicName", "(", ")", ")", ")", ")", "return", "bundle", ".", "loadClass", "(", "className", ")", ";", "else", "if", "(", "resourceAdapterID", ".", "equals", "(", "\"wmqJms\"", ")", "&&", "\"com.ibm.ws.messaging.jms.wmq\"", ".", "equals", "(", "bundle", ".", "getSymbolicName", "(", ")", ")", ")", "return", "bundle", ".", "loadClass", "(", "className", ")", ";", "}", "throw", "new", "ClassNotFoundException", "(", "className", ")", ";", "}", "}", ")", ";", "}", "catch", "(", "PrivilegedActionException", "e", ")", "{", "throw", "(", "ClassNotFoundException", ")", "e", ".", "getCause", "(", ")", ";", "}", "}", "}", "catch", "(", "ClassNotFoundException", "cnf", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "this", ",", "tc", ",", "\"Could not find adapter file and bundle does not have the class either. Possible cause is incorrectly specified file path.\"", ",", "cnf", ")", ";", "}", "throw", "cnf", ";", "}", "}", "}" ]
Load a resource adapter class. If the resource adapter file that is specified in <resourceAdapter> exists, then classes will be loaded from the file. If the file does not exist, then classes will be loaded from the bundle of the component context. @param className name of the class. @return the class. @throws ClassNotFoundException @throws UnableToAdaptException @throws MalformedURLException
[ "Load", "a", "resource", "adapter", "class", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca/src/com/ibm/ws/jca/internal/BootstrapContextImpl.java#L914-L959
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jca/src/com/ibm/ws/jca/internal/BootstrapContextImpl.java
BootstrapContextImpl.setContextProvider
protected void setContextProvider(ServiceReference<JCAContextProvider> ref) { contextProviders.putReference((String) ref.getProperty(JCAContextProvider.TYPE), ref); }
java
protected void setContextProvider(ServiceReference<JCAContextProvider> ref) { contextProviders.putReference((String) ref.getProperty(JCAContextProvider.TYPE), ref); }
[ "protected", "void", "setContextProvider", "(", "ServiceReference", "<", "JCAContextProvider", ">", "ref", ")", "{", "contextProviders", ".", "putReference", "(", "(", "String", ")", "ref", ".", "getProperty", "(", "JCAContextProvider", ".", "TYPE", ")", ",", "ref", ")", ";", "}" ]
Declarative Services method for setting a JCAContextProvider service reference @param ref reference to the service
[ "Declarative", "Services", "method", "for", "setting", "a", "JCAContextProvider", "service", "reference" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca/src/com/ibm/ws/jca/internal/BootstrapContextImpl.java#L987-L989
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jca/src/com/ibm/ws/jca/internal/BootstrapContextImpl.java
BootstrapContextImpl.stopResourceAdapter
private void stopResourceAdapter() { if (resourceAdapter != null) try { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "stop", resourceAdapter); ArrayList<ThreadContext> threadContext = startTask(raThreadContextDescriptor); try { beginContext(raMetaData); try { ClassLoader previousClassLoader = jcasu.beginContextClassLoader(raClassLoader); try { resourceAdapter.stop(); } finally { if (raClassLoader != null) { jcasu.endContextClassLoader(raClassLoader, previousClassLoader); classLoadingSvc.destroyThreadContextClassLoader(raClassLoader); } } } finally { endContext(raMetaData); } } finally { stopTask(raThreadContextDescriptor, threadContext); } // Cancel timers for (Timer timer = timers.poll(); timer != null; timer = timers.poll()) { timer.cancel(); timer.purge(); } // Cancel/release work workManager.stop(); } catch (Throwable x) { // auto FFDC } finally { // decrement the reference count BundleContext bundleContext = FrameworkUtil.getBundle(getClass()).getBundleContext(); if (bundleContext != null) { bundleContext.ungetService(contextSvcRef); } } }
java
private void stopResourceAdapter() { if (resourceAdapter != null) try { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "stop", resourceAdapter); ArrayList<ThreadContext> threadContext = startTask(raThreadContextDescriptor); try { beginContext(raMetaData); try { ClassLoader previousClassLoader = jcasu.beginContextClassLoader(raClassLoader); try { resourceAdapter.stop(); } finally { if (raClassLoader != null) { jcasu.endContextClassLoader(raClassLoader, previousClassLoader); classLoadingSvc.destroyThreadContextClassLoader(raClassLoader); } } } finally { endContext(raMetaData); } } finally { stopTask(raThreadContextDescriptor, threadContext); } // Cancel timers for (Timer timer = timers.poll(); timer != null; timer = timers.poll()) { timer.cancel(); timer.purge(); } // Cancel/release work workManager.stop(); } catch (Throwable x) { // auto FFDC } finally { // decrement the reference count BundleContext bundleContext = FrameworkUtil.getBundle(getClass()).getBundleContext(); if (bundleContext != null) { bundleContext.ungetService(contextSvcRef); } } }
[ "private", "void", "stopResourceAdapter", "(", ")", "{", "if", "(", "resourceAdapter", "!=", "null", ")", "try", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "this", ",", "tc", ",", "\"stop\"", ",", "resourceAdapter", ")", ";", "ArrayList", "<", "ThreadContext", ">", "threadContext", "=", "startTask", "(", "raThreadContextDescriptor", ")", ";", "try", "{", "beginContext", "(", "raMetaData", ")", ";", "try", "{", "ClassLoader", "previousClassLoader", "=", "jcasu", ".", "beginContextClassLoader", "(", "raClassLoader", ")", ";", "try", "{", "resourceAdapter", ".", "stop", "(", ")", ";", "}", "finally", "{", "if", "(", "raClassLoader", "!=", "null", ")", "{", "jcasu", ".", "endContextClassLoader", "(", "raClassLoader", ",", "previousClassLoader", ")", ";", "classLoadingSvc", ".", "destroyThreadContextClassLoader", "(", "raClassLoader", ")", ";", "}", "}", "}", "finally", "{", "endContext", "(", "raMetaData", ")", ";", "}", "}", "finally", "{", "stopTask", "(", "raThreadContextDescriptor", ",", "threadContext", ")", ";", "}", "// Cancel timers", "for", "(", "Timer", "timer", "=", "timers", ".", "poll", "(", ")", ";", "timer", "!=", "null", ";", "timer", "=", "timers", ".", "poll", "(", ")", ")", "{", "timer", ".", "cancel", "(", ")", ";", "timer", ".", "purge", "(", ")", ";", "}", "// Cancel/release work", "workManager", ".", "stop", "(", ")", ";", "}", "catch", "(", "Throwable", "x", ")", "{", "// auto FFDC", "}", "finally", "{", "// decrement the reference count", "BundleContext", "bundleContext", "=", "FrameworkUtil", ".", "getBundle", "(", "getClass", "(", ")", ")", ".", "getBundleContext", "(", ")", ";", "if", "(", "bundleContext", "!=", "null", ")", "{", "bundleContext", ".", "ungetService", "(", "contextSvcRef", ")", ";", "}", "}", "}" ]
Stop the resource adapter if it has started.
[ "Stop", "the", "resource", "adapter", "if", "it", "has", "started", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca/src/com/ibm/ws/jca/internal/BootstrapContextImpl.java#L1067-L1109
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jca/src/com/ibm/ws/jca/internal/BootstrapContextImpl.java
BootstrapContextImpl.captureRaThreadContext
@SuppressWarnings("unchecked") private ThreadContextDescriptor captureRaThreadContext(WSContextService contextSvc) { Map<String, String> execProps = new HashMap<String, String>(); execProps.put(WSContextService.DEFAULT_CONTEXT, WSContextService.ALL_CONTEXT_TYPES); execProps.put(WSContextService.REQUIRE_AVAILABLE_APP, "false"); return contextSvc.captureThreadContext(execProps); }
java
@SuppressWarnings("unchecked") private ThreadContextDescriptor captureRaThreadContext(WSContextService contextSvc) { Map<String, String> execProps = new HashMap<String, String>(); execProps.put(WSContextService.DEFAULT_CONTEXT, WSContextService.ALL_CONTEXT_TYPES); execProps.put(WSContextService.REQUIRE_AVAILABLE_APP, "false"); return contextSvc.captureThreadContext(execProps); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "ThreadContextDescriptor", "captureRaThreadContext", "(", "WSContextService", "contextSvc", ")", "{", "Map", "<", "String", ",", "String", ">", "execProps", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "execProps", ".", "put", "(", "WSContextService", ".", "DEFAULT_CONTEXT", ",", "WSContextService", ".", "ALL_CONTEXT_TYPES", ")", ";", "execProps", ".", "put", "(", "WSContextService", ".", "REQUIRE_AVAILABLE_APP", ",", "\"false\"", ")", ";", "return", "contextSvc", ".", "captureThreadContext", "(", "execProps", ")", ";", "}" ]
Capture current thread context of the context service. @param contextSvc @return ThreadContextDescriptor
[ "Capture", "current", "thread", "context", "of", "the", "context", "service", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca/src/com/ibm/ws/jca/internal/BootstrapContextImpl.java#L1117-L1124
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jca/src/com/ibm/ws/jca/internal/BootstrapContextImpl.java
BootstrapContextImpl.startTask
private ArrayList<ThreadContext> startTask(ThreadContextDescriptor raThreadContextDescriptor) { return raThreadContextDescriptor == null ? null : raThreadContextDescriptor.taskStarting(); }
java
private ArrayList<ThreadContext> startTask(ThreadContextDescriptor raThreadContextDescriptor) { return raThreadContextDescriptor == null ? null : raThreadContextDescriptor.taskStarting(); }
[ "private", "ArrayList", "<", "ThreadContext", ">", "startTask", "(", "ThreadContextDescriptor", "raThreadContextDescriptor", ")", "{", "return", "raThreadContextDescriptor", "==", "null", "?", "null", ":", "raThreadContextDescriptor", ".", "taskStarting", "(", ")", ";", "}" ]
Start task if there is a resource adapter context descriptor. @param raThreadContextDescriptor @return array of thread context, if any
[ "Start", "task", "if", "there", "is", "a", "resource", "adapter", "context", "descriptor", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca/src/com/ibm/ws/jca/internal/BootstrapContextImpl.java#L1132-L1134
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jca/src/com/ibm/ws/jca/internal/BootstrapContextImpl.java
BootstrapContextImpl.stopTask
private void stopTask(ThreadContextDescriptor raThreadContextDescriptor, ArrayList<ThreadContext> threadContext) { if (raThreadContextDescriptor != null) raThreadContextDescriptor.taskStopping(threadContext); }
java
private void stopTask(ThreadContextDescriptor raThreadContextDescriptor, ArrayList<ThreadContext> threadContext) { if (raThreadContextDescriptor != null) raThreadContextDescriptor.taskStopping(threadContext); }
[ "private", "void", "stopTask", "(", "ThreadContextDescriptor", "raThreadContextDescriptor", ",", "ArrayList", "<", "ThreadContext", ">", "threadContext", ")", "{", "if", "(", "raThreadContextDescriptor", "!=", "null", ")", "raThreadContextDescriptor", ".", "taskStopping", "(", "threadContext", ")", ";", "}" ]
Stop the resource adapter context descriptor task if one was started. @param raThreadContextDescriptor @param threadContext
[ "Stop", "the", "resource", "adapter", "context", "descriptor", "task", "if", "one", "was", "started", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca/src/com/ibm/ws/jca/internal/BootstrapContextImpl.java#L1142-L1145
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jca/src/com/ibm/ws/jca/internal/BootstrapContextImpl.java
BootstrapContextImpl.unsetContextProvider
protected void unsetContextProvider(ServiceReference<JCAContextProvider> ref) { contextProviders.removeReference((String) ref.getProperty(JCAContextProvider.TYPE), ref); }
java
protected void unsetContextProvider(ServiceReference<JCAContextProvider> ref) { contextProviders.removeReference((String) ref.getProperty(JCAContextProvider.TYPE), ref); }
[ "protected", "void", "unsetContextProvider", "(", "ServiceReference", "<", "JCAContextProvider", ">", "ref", ")", "{", "contextProviders", ".", "removeReference", "(", "(", "String", ")", "ref", ".", "getProperty", "(", "JCAContextProvider", ".", "TYPE", ")", ",", "ref", ")", ";", "}" ]
Declarative Services method for unsetting a JCAContextProvider service reference @param ref reference to the service
[ "Declarative", "Services", "method", "for", "unsetting", "a", "JCAContextProvider", "service", "reference" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca/src/com/ibm/ws/jca/internal/BootstrapContextImpl.java#L1213-L1215
train
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/WebAuthenticatorProxy.java
WebAuthenticatorProxy.getAuthenticatorForFailOver
private WebAuthenticator getAuthenticatorForFailOver(String authType, WebRequest webRequest) { WebAuthenticator authenticator = null; if (LoginConfiguration.FORM.equals(authType)) { authenticator = createFormLoginAuthenticator(webRequest); } else if (LoginConfiguration.BASIC.equals(authType)) { authenticator = getBasicAuthAuthenticator(); } return authenticator; }
java
private WebAuthenticator getAuthenticatorForFailOver(String authType, WebRequest webRequest) { WebAuthenticator authenticator = null; if (LoginConfiguration.FORM.equals(authType)) { authenticator = createFormLoginAuthenticator(webRequest); } else if (LoginConfiguration.BASIC.equals(authType)) { authenticator = getBasicAuthAuthenticator(); } return authenticator; }
[ "private", "WebAuthenticator", "getAuthenticatorForFailOver", "(", "String", "authType", ",", "WebRequest", "webRequest", ")", "{", "WebAuthenticator", "authenticator", "=", "null", ";", "if", "(", "LoginConfiguration", ".", "FORM", ".", "equals", "(", "authType", ")", ")", "{", "authenticator", "=", "createFormLoginAuthenticator", "(", "webRequest", ")", ";", "}", "else", "if", "(", "LoginConfiguration", ".", "BASIC", ".", "equals", "(", "authType", ")", ")", "{", "authenticator", "=", "getBasicAuthAuthenticator", "(", ")", ";", "}", "return", "authenticator", ";", "}" ]
Get the appropriate Authenticator based on the authType @param authType the auth type, either FORM or BASIC @param the WebRequest @return The WebAuthenticator or {@code null} if the authType is unknown
[ "Get", "the", "appropriate", "Authenticator", "based", "on", "the", "authType" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/WebAuthenticatorProxy.java#L115-L123
train
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/WebAuthenticatorProxy.java
WebAuthenticatorProxy.appHasWebXMLFormLogin
private boolean appHasWebXMLFormLogin(WebRequest webRequest) { return webRequest.getFormLoginConfiguration() != null && webRequest.getFormLoginConfiguration().getLoginPage() != null && webRequest.getFormLoginConfiguration().getErrorPage() != null; }
java
private boolean appHasWebXMLFormLogin(WebRequest webRequest) { return webRequest.getFormLoginConfiguration() != null && webRequest.getFormLoginConfiguration().getLoginPage() != null && webRequest.getFormLoginConfiguration().getErrorPage() != null; }
[ "private", "boolean", "appHasWebXMLFormLogin", "(", "WebRequest", "webRequest", ")", "{", "return", "webRequest", ".", "getFormLoginConfiguration", "(", ")", "!=", "null", "&&", "webRequest", ".", "getFormLoginConfiguration", "(", ")", ".", "getLoginPage", "(", ")", "!=", "null", "&&", "webRequest", ".", "getFormLoginConfiguration", "(", ")", ".", "getErrorPage", "(", ")", "!=", "null", ";", "}" ]
Determines if the application has a FORM login configuration in its web.xml @param webRequest @return {@code true} if the application's web.xml has a valid form login configuration.
[ "Determines", "if", "the", "application", "has", "a", "FORM", "login", "configuration", "in", "its", "web", ".", "xml" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/WebAuthenticatorProxy.java#L132-L136
train
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/WebAuthenticatorProxy.java
WebAuthenticatorProxy.globalWebAppSecurityConfigHasFormLogin
private boolean globalWebAppSecurityConfigHasFormLogin() { WebAppSecurityConfig globalConfig = WebAppSecurityCollaboratorImpl.getGlobalWebAppSecurityConfig(); return globalConfig != null && globalConfig.getLoginFormURL() != null; }
java
private boolean globalWebAppSecurityConfigHasFormLogin() { WebAppSecurityConfig globalConfig = WebAppSecurityCollaboratorImpl.getGlobalWebAppSecurityConfig(); return globalConfig != null && globalConfig.getLoginFormURL() != null; }
[ "private", "boolean", "globalWebAppSecurityConfigHasFormLogin", "(", ")", "{", "WebAppSecurityConfig", "globalConfig", "=", "WebAppSecurityCollaboratorImpl", ".", "getGlobalWebAppSecurityConfig", "(", ")", ";", "return", "globalConfig", "!=", "null", "&&", "globalConfig", ".", "getLoginFormURL", "(", ")", "!=", "null", ";", "}" ]
Determine if the global WebAppSecurityConfig has a form login page. @return {@code true} if the global FORM login page is set
[ "Determine", "if", "the", "global", "WebAppSecurityConfig", "has", "a", "form", "login", "page", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/WebAuthenticatorProxy.java#L143-L147
train
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/WebAuthenticatorProxy.java
WebAuthenticatorProxy.getWebAuthenticator
public WebAuthenticator getWebAuthenticator(WebRequest webRequest) { String authMech = webAppSecurityConfig.getOverrideHttpAuthMethod(); if (authMech != null && authMech.equals("CLIENT_CERT")) { return createCertificateLoginAuthenticator(); } SecurityMetadata securityMetadata = webRequest.getSecurityMetadata(); LoginConfiguration loginConfig = securityMetadata.getLoginConfiguration(); if (loginConfig != null) { String authenticationMethod = loginConfig.getAuthenticationMethod(); if (LoginConfiguration.FORM.equalsIgnoreCase(authenticationMethod)) { return createFormLoginAuthenticator(webRequest); } else if (LoginConfiguration.CLIENT_CERT.equalsIgnoreCase(authenticationMethod)) { return createCertificateLoginAuthenticator(); } } return getBasicAuthAuthenticator(); }
java
public WebAuthenticator getWebAuthenticator(WebRequest webRequest) { String authMech = webAppSecurityConfig.getOverrideHttpAuthMethod(); if (authMech != null && authMech.equals("CLIENT_CERT")) { return createCertificateLoginAuthenticator(); } SecurityMetadata securityMetadata = webRequest.getSecurityMetadata(); LoginConfiguration loginConfig = securityMetadata.getLoginConfiguration(); if (loginConfig != null) { String authenticationMethod = loginConfig.getAuthenticationMethod(); if (LoginConfiguration.FORM.equalsIgnoreCase(authenticationMethod)) { return createFormLoginAuthenticator(webRequest); } else if (LoginConfiguration.CLIENT_CERT.equalsIgnoreCase(authenticationMethod)) { return createCertificateLoginAuthenticator(); } } return getBasicAuthAuthenticator(); }
[ "public", "WebAuthenticator", "getWebAuthenticator", "(", "WebRequest", "webRequest", ")", "{", "String", "authMech", "=", "webAppSecurityConfig", ".", "getOverrideHttpAuthMethod", "(", ")", ";", "if", "(", "authMech", "!=", "null", "&&", "authMech", ".", "equals", "(", "\"CLIENT_CERT\"", ")", ")", "{", "return", "createCertificateLoginAuthenticator", "(", ")", ";", "}", "SecurityMetadata", "securityMetadata", "=", "webRequest", ".", "getSecurityMetadata", "(", ")", ";", "LoginConfiguration", "loginConfig", "=", "securityMetadata", ".", "getLoginConfiguration", "(", ")", ";", "if", "(", "loginConfig", "!=", "null", ")", "{", "String", "authenticationMethod", "=", "loginConfig", ".", "getAuthenticationMethod", "(", ")", ";", "if", "(", "LoginConfiguration", ".", "FORM", ".", "equalsIgnoreCase", "(", "authenticationMethod", ")", ")", "{", "return", "createFormLoginAuthenticator", "(", "webRequest", ")", ";", "}", "else", "if", "(", "LoginConfiguration", ".", "CLIENT_CERT", ".", "equalsIgnoreCase", "(", "authenticationMethod", ")", ")", "{", "return", "createCertificateLoginAuthenticator", "(", ")", ";", "}", "}", "return", "getBasicAuthAuthenticator", "(", ")", ";", "}" ]
Determine the correct WebAuthenticator to use based on the authentication method. If there authentication method is not specified in the web.xml file, then we will use BasicAuth as default. @param webRequest @return The correct WebAuthenticator to handle the webRequest, or {@code null} if it could not be created.
[ "Determine", "the", "correct", "WebAuthenticator", "to", "use", "based", "on", "the", "authentication", "method", ".", "If", "there", "authentication", "method", "is", "not", "specified", "in", "the", "web", ".", "xml", "file", "then", "we", "will", "use", "BasicAuth", "as", "default", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/WebAuthenticatorProxy.java#L192-L209
train
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/WebAuthenticatorProxy.java
WebAuthenticatorProxy.getBasicAuthAuthenticator
public BasicAuthAuthenticator getBasicAuthAuthenticator() { try { return createBasicAuthenticator(); } catch (RegistryException e) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "RegistryException while trying to create BasicAuthAuthenticator", e); } } return null; }
java
public BasicAuthAuthenticator getBasicAuthAuthenticator() { try { return createBasicAuthenticator(); } catch (RegistryException e) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "RegistryException while trying to create BasicAuthAuthenticator", e); } } return null; }
[ "public", "BasicAuthAuthenticator", "getBasicAuthAuthenticator", "(", ")", "{", "try", "{", "return", "createBasicAuthenticator", "(", ")", ";", "}", "catch", "(", "RegistryException", "e", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"RegistryException while trying to create BasicAuthAuthenticator\"", ",", "e", ")", ";", "}", "}", "return", "null", ";", "}" ]
Create an instance of BasicAuthAuthenticator. @return A BasicAuthAuthenticator or {@code null} if the it could not be created.
[ "Create", "an", "instance", "of", "BasicAuthAuthenticator", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/WebAuthenticatorProxy.java#L216-L225
train
OpenLiberty/open-liberty
dev/com.ibm.ws.javaee.ddmodel.wsbnd/src/com/ibm/ws/javaee/ddmodel/wsbnd/impl/HttpPublishingType.java
HttpPublishingType.handleAttribute
@Override public boolean handleAttribute(DDParser parser, String nsURI, String localName, int index) throws ParseException { boolean result = false; if (nsURI != null) { return result; } if (CONTEXT_ROOT_ATTRIBUTE_NAME.equals(localName)) { this.contextRoot = parser.parseStringAttributeValue(index); result = true; } return result; }
java
@Override public boolean handleAttribute(DDParser parser, String nsURI, String localName, int index) throws ParseException { boolean result = false; if (nsURI != null) { return result; } if (CONTEXT_ROOT_ATTRIBUTE_NAME.equals(localName)) { this.contextRoot = parser.parseStringAttributeValue(index); result = true; } return result; }
[ "@", "Override", "public", "boolean", "handleAttribute", "(", "DDParser", "parser", ",", "String", "nsURI", ",", "String", "localName", ",", "int", "index", ")", "throws", "ParseException", "{", "boolean", "result", "=", "false", ";", "if", "(", "nsURI", "!=", "null", ")", "{", "return", "result", ";", "}", "if", "(", "CONTEXT_ROOT_ATTRIBUTE_NAME", ".", "equals", "(", "localName", ")", ")", "{", "this", ".", "contextRoot", "=", "parser", ".", "parseStringAttributeValue", "(", "index", ")", ";", "result", "=", "true", ";", "}", "return", "result", ";", "}" ]
parse the context-root attribute defined in the element.
[ "parse", "the", "context", "-", "root", "attribute", "defined", "in", "the", "element", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.javaee.ddmodel.wsbnd/src/com/ibm/ws/javaee/ddmodel/wsbnd/impl/HttpPublishingType.java#L47-L62
train
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/PersistentTimer.java
PersistentTimer.isPersistent
@Override public boolean isPersistent() { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(tc, "isPersistent: " + this); // Determine if the calling bean is in a state that allows timer service // method access - throws IllegalStateException if not allowed. checkTimerAccess(); // Determine if the timer still exists; configuration may allow stale data checkTimerExists(ALLOW_CACHED_TIMER_IS_PERSISTENT); if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "isPersistent: true"); return true; }
java
@Override public boolean isPersistent() { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(tc, "isPersistent: " + this); // Determine if the calling bean is in a state that allows timer service // method access - throws IllegalStateException if not allowed. checkTimerAccess(); // Determine if the timer still exists; configuration may allow stale data checkTimerExists(ALLOW_CACHED_TIMER_IS_PERSISTENT); if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "isPersistent: true"); return true; }
[ "@", "Override", "public", "boolean", "isPersistent", "(", ")", "{", "final", "boolean", "isTraceOn", "=", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", ";", "if", "(", "isTraceOn", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "tc", ",", "\"isPersistent: \"", "+", "this", ")", ";", "// Determine if the calling bean is in a state that allows timer service", "// method access - throws IllegalStateException if not allowed.", "checkTimerAccess", "(", ")", ";", "// Determine if the timer still exists; configuration may allow stale data", "checkTimerExists", "(", "ALLOW_CACHED_TIMER_IS_PERSISTENT", ")", ";", "if", "(", "isTraceOn", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"isPersistent: true\"", ")", ";", "return", "true", ";", "}" ]
Query whether this timer has persistent semantics. @return true if this timer has persistent guarantees. @throws IllegalStateException If this method is invoked while the instance is in a state that does not allow access to this method. @throws NoSuchObjectLocalException If invoked on a timer that has expired or has been cancelled. @throws EJBException If this method could not complete due to a system-level failure.
[ "Query", "whether", "this", "timer", "has", "persistent", "semantics", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/PersistentTimer.java#L275-L292
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/linkedlist2/Entry.java
Entry.getNext
public Entry getNext() { checkEntryParent(); Entry entry = null; if(!isLast()) { entry = next; } return entry; }
java
public Entry getNext() { checkEntryParent(); Entry entry = null; if(!isLast()) { entry = next; } return entry; }
[ "public", "Entry", "getNext", "(", ")", "{", "checkEntryParent", "(", ")", ";", "Entry", "entry", "=", "null", ";", "if", "(", "!", "isLast", "(", ")", ")", "{", "entry", "=", "next", ";", "}", "return", "entry", ";", "}" ]
Unsynchronized. Get the next entry in the list. @return the next entry in the list
[ "Unsynchronized", ".", "Get", "the", "next", "entry", "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/linkedlist2/Entry.java#L70-L82
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/linkedlist2/Entry.java
Entry.insertAfter
Entry insertAfter(Entry newEntry) { if (tc.isEntryEnabled()) SibTr.entry( tc, "insertAfter", new Object[] { newEntry }); checkEntryParent(); //make sure that the new entry is not already in a list if(newEntry.parentList == null) { //get the next entry in the list Entry nextEntry = getNext(); //link the new entry to the next one newEntry.previous = this; //link the new entry to the this one newEntry.next = nextEntry; newEntry.parentList = parentList; if(nextEntry != null) { //link the next entry to the new one nextEntry.previous = newEntry; } //link this entry to the new one next = newEntry; //if this entry was the last one in the list if(isLast()) { //mark the new one as the last entry parentList.last = newEntry; } if (tc.isEntryEnabled()) SibTr.exit(tc, "insertAfter", newEntry); return newEntry; } //if the new entry was already in a list then throw a runtime exception SIErrorException e = new SIErrorException( nls.getFormattedMessage( "INTERNAL_MESSAGING_ERROR_CWSIP0001", new Object[] { "com.ibm.ws.sib.processor.utils.linkedlist.Entry", "1:154:1.3" }, null)); FFDCFilter.processException( e, "com.ibm.ws.sib.processor.utils.linkedlist.Entry.insertAfter", "1:160:1.3", this); SibTr.exception(tc, e); SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0001", new Object[] { "com.ibm.ws.sib.processor.utils.linkedlist.Entry", "1:167:1.3" }); if (tc.isEntryEnabled()) SibTr.exit(tc, "insertAfter", e); throw e; }
java
Entry insertAfter(Entry newEntry) { if (tc.isEntryEnabled()) SibTr.entry( tc, "insertAfter", new Object[] { newEntry }); checkEntryParent(); //make sure that the new entry is not already in a list if(newEntry.parentList == null) { //get the next entry in the list Entry nextEntry = getNext(); //link the new entry to the next one newEntry.previous = this; //link the new entry to the this one newEntry.next = nextEntry; newEntry.parentList = parentList; if(nextEntry != null) { //link the next entry to the new one nextEntry.previous = newEntry; } //link this entry to the new one next = newEntry; //if this entry was the last one in the list if(isLast()) { //mark the new one as the last entry parentList.last = newEntry; } if (tc.isEntryEnabled()) SibTr.exit(tc, "insertAfter", newEntry); return newEntry; } //if the new entry was already in a list then throw a runtime exception SIErrorException e = new SIErrorException( nls.getFormattedMessage( "INTERNAL_MESSAGING_ERROR_CWSIP0001", new Object[] { "com.ibm.ws.sib.processor.utils.linkedlist.Entry", "1:154:1.3" }, null)); FFDCFilter.processException( e, "com.ibm.ws.sib.processor.utils.linkedlist.Entry.insertAfter", "1:160:1.3", this); SibTr.exception(tc, e); SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0001", new Object[] { "com.ibm.ws.sib.processor.utils.linkedlist.Entry", "1:167:1.3" }); if (tc.isEntryEnabled()) SibTr.exit(tc, "insertAfter", e); throw e; }
[ "Entry", "insertAfter", "(", "Entry", "newEntry", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"insertAfter\"", ",", "new", "Object", "[", "]", "{", "newEntry", "}", ")", ";", "checkEntryParent", "(", ")", ";", "//make sure that the new entry is not already in a list", "if", "(", "newEntry", ".", "parentList", "==", "null", ")", "{", "//get the next entry in the list", "Entry", "nextEntry", "=", "getNext", "(", ")", ";", "//link the new entry to the next one", "newEntry", ".", "previous", "=", "this", ";", "//link the new entry to the this one", "newEntry", ".", "next", "=", "nextEntry", ";", "newEntry", ".", "parentList", "=", "parentList", ";", "if", "(", "nextEntry", "!=", "null", ")", "{", "//link the next entry to the new one", "nextEntry", ".", "previous", "=", "newEntry", ";", "}", "//link this entry to the new one", "next", "=", "newEntry", ";", "//if this entry was the last one in the list", "if", "(", "isLast", "(", ")", ")", "{", "//mark the new one as the last entry", "parentList", ".", "last", "=", "newEntry", ";", "}", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"insertAfter\"", ",", "newEntry", ")", ";", "return", "newEntry", ";", "}", "//if the new entry was already in a list then throw a runtime exception", "SIErrorException", "e", "=", "new", "SIErrorException", "(", "nls", ".", "getFormattedMessage", "(", "\"INTERNAL_MESSAGING_ERROR_CWSIP0001\"", ",", "new", "Object", "[", "]", "{", "\"com.ibm.ws.sib.processor.utils.linkedlist.Entry\"", ",", "\"1:154:1.3\"", "}", ",", "null", ")", ")", ";", "FFDCFilter", ".", "processException", "(", "e", ",", "\"com.ibm.ws.sib.processor.utils.linkedlist.Entry.insertAfter\"", ",", "\"1:160:1.3\"", ",", "this", ")", ";", "SibTr", ".", "exception", "(", "tc", ",", "e", ")", ";", "SibTr", ".", "error", "(", "tc", ",", "\"INTERNAL_MESSAGING_ERROR_CWSIP0001\"", ",", "new", "Object", "[", "]", "{", "\"com.ibm.ws.sib.processor.utils.linkedlist.Entry\"", ",", "\"1:167:1.3\"", "}", ")", ";", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"insertAfter\"", ",", "e", ")", ";", "throw", "e", ";", "}" ]
Unsynchronized. Insert a new entry in after this one. @param newEntry The entry to be inserted after this one
[ "Unsynchronized", ".", "Insert", "a", "new", "entry", "in", "after", "this", "one", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/linkedlist2/Entry.java#L89-L155
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/linkedlist2/Entry.java
Entry.remove
Entry remove() { if (tc.isEntryEnabled()) SibTr.entry(tc, "remove"); checkEntryParent(); Entry removedEntry = null; Entry prevEntry = getPrevious(); if(prevEntry != null) { //link the previous entry to the next one prevEntry.next = next; } Entry nextEntry = getNext(); if(nextEntry != null) { //link the next entry to the previous one nextEntry.previous = prevEntry; } if(isFirst()) { //if this entry was the first in the list, //mark the next one as the first entry parentList.first = nextEntry; } if(isLast()) { //if this entry was the last in the list, //mark the previous one as the last entry parentList.last = prevEntry; } //set all of this entry's fields to null to make it absolutely //sure that it is no longer in the list next = null; previous = null; parentList = null; removedEntry = this; if (tc.isEntryEnabled()) SibTr.exit(tc, "remove", removedEntry); return removedEntry; }
java
Entry remove() { if (tc.isEntryEnabled()) SibTr.entry(tc, "remove"); checkEntryParent(); Entry removedEntry = null; Entry prevEntry = getPrevious(); if(prevEntry != null) { //link the previous entry to the next one prevEntry.next = next; } Entry nextEntry = getNext(); if(nextEntry != null) { //link the next entry to the previous one nextEntry.previous = prevEntry; } if(isFirst()) { //if this entry was the first in the list, //mark the next one as the first entry parentList.first = nextEntry; } if(isLast()) { //if this entry was the last in the list, //mark the previous one as the last entry parentList.last = prevEntry; } //set all of this entry's fields to null to make it absolutely //sure that it is no longer in the list next = null; previous = null; parentList = null; removedEntry = this; if (tc.isEntryEnabled()) SibTr.exit(tc, "remove", removedEntry); return removedEntry; }
[ "Entry", "remove", "(", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"remove\"", ")", ";", "checkEntryParent", "(", ")", ";", "Entry", "removedEntry", "=", "null", ";", "Entry", "prevEntry", "=", "getPrevious", "(", ")", ";", "if", "(", "prevEntry", "!=", "null", ")", "{", "//link the previous entry to the next one", "prevEntry", ".", "next", "=", "next", ";", "}", "Entry", "nextEntry", "=", "getNext", "(", ")", ";", "if", "(", "nextEntry", "!=", "null", ")", "{", "//link the next entry to the previous one", "nextEntry", ".", "previous", "=", "prevEntry", ";", "}", "if", "(", "isFirst", "(", ")", ")", "{", "//if this entry was the first in the list,", "//mark the next one as the first entry", "parentList", ".", "first", "=", "nextEntry", ";", "}", "if", "(", "isLast", "(", ")", ")", "{", "//if this entry was the last in the list,", "//mark the previous one as the last entry", "parentList", ".", "last", "=", "prevEntry", ";", "}", "//set all of this entry's fields to null to make it absolutely", "//sure that it is no longer in the list", "next", "=", "null", ";", "previous", "=", "null", ";", "parentList", "=", "null", ";", "removedEntry", "=", "this", ";", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"remove\"", ",", "removedEntry", ")", ";", "return", "removedEntry", ";", "}" ]
Unsynchronized. Removes this entry from the list.
[ "Unsynchronized", ".", "Removes", "this", "entry", "from", "the", "list", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/linkedlist2/Entry.java#L160-L206
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/linkedlist2/Entry.java
Entry.checkEntryParent
void checkEntryParent() { if(parentList == null) { SIErrorException e = new SIErrorException( nls.getFormattedMessage( "INTERNAL_MESSAGING_ERROR_CWSIP0001", new Object[] { "com.ibm.ws.sib.processor.utils.linkedlist.Entry", "1:239:1.3" }, null)); // FFDC FFDCFilter.processException( e, "com.ibm.ws.sib.processor.utils.linkedlist.Entry.checkEntryParent", "1:246:1.3", this); SibTr.exception(tc, e); SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0001", new Object[] { "com.ibm.ws.sib.processor.utils.linkedlist.Entry", "1:253:1.3" }); if (tc.isEntryEnabled()) SibTr.exit(tc, "checkEntryParent", e); throw e; } }
java
void checkEntryParent() { if(parentList == null) { SIErrorException e = new SIErrorException( nls.getFormattedMessage( "INTERNAL_MESSAGING_ERROR_CWSIP0001", new Object[] { "com.ibm.ws.sib.processor.utils.linkedlist.Entry", "1:239:1.3" }, null)); // FFDC FFDCFilter.processException( e, "com.ibm.ws.sib.processor.utils.linkedlist.Entry.checkEntryParent", "1:246:1.3", this); SibTr.exception(tc, e); SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0001", new Object[] { "com.ibm.ws.sib.processor.utils.linkedlist.Entry", "1:253:1.3" }); if (tc.isEntryEnabled()) SibTr.exit(tc, "checkEntryParent", e); throw e; } }
[ "void", "checkEntryParent", "(", ")", "{", "if", "(", "parentList", "==", "null", ")", "{", "SIErrorException", "e", "=", "new", "SIErrorException", "(", "nls", ".", "getFormattedMessage", "(", "\"INTERNAL_MESSAGING_ERROR_CWSIP0001\"", ",", "new", "Object", "[", "]", "{", "\"com.ibm.ws.sib.processor.utils.linkedlist.Entry\"", ",", "\"1:239:1.3\"", "}", ",", "null", ")", ")", ";", "// FFDC", "FFDCFilter", ".", "processException", "(", "e", ",", "\"com.ibm.ws.sib.processor.utils.linkedlist.Entry.checkEntryParent\"", ",", "\"1:246:1.3\"", ",", "this", ")", ";", "SibTr", ".", "exception", "(", "tc", ",", "e", ")", ";", "SibTr", ".", "error", "(", "tc", ",", "\"INTERNAL_MESSAGING_ERROR_CWSIP0001\"", ",", "new", "Object", "[", "]", "{", "\"com.ibm.ws.sib.processor.utils.linkedlist.Entry\"", ",", "\"1:253:1.3\"", "}", ")", ";", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"checkEntryParent\"", ",", "e", ")", ";", "throw", "e", ";", "}", "}" ]
Unsynchronized. Check that the parent list is not null and therefore the entry is still valid. Otherwise, throw a runtime exception
[ "Unsynchronized", ".", "Check", "that", "the", "parent", "list", "is", "not", "null", "and", "therefore", "the", "entry", "is", "still", "valid", ".", "Otherwise", "throw", "a", "runtime", "exception" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/linkedlist2/Entry.java#L212-L242
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/H2Map.java
H2Map.put
@Override public Object put(Object key, Object value) { return localMap.put(key, value); }
java
@Override public Object put(Object key, Object value) { return localMap.put(key, value); }
[ "@", "Override", "public", "Object", "put", "(", "Object", "key", ",", "Object", "value", ")", "{", "return", "localMap", ".", "put", "(", "key", ",", "value", ")", ";", "}" ]
2. As with the "put", may need methods that use the common map for any of these other methods below, but assume not for now
[ "2", ".", "As", "with", "the", "put", "may", "need", "methods", "that", "use", "the", "common", "map", "for", "any", "of", "these", "other", "methods", "below", "but", "assume", "not", "for", "now" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/H2Map.java#L54-L57
train
OpenLiberty/open-liberty
dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/component/_SharedRendererUtils.java
_SharedRendererUtils.getValueTypeConverter
static Converter getValueTypeConverter(FacesContext facesContext, UISelectMany component) { Converter converter = null; Object valueTypeAttr = component.getAttributes().get(VALUE_TYPE_KEY); if (valueTypeAttr != null) { // treat the valueType attribute exactly like the collectionType attribute Class<?> valueType = getClassFromAttribute(facesContext, valueTypeAttr); if (valueType == null) { throw new FacesException( "The attribute " + VALUE_TYPE_KEY + " of component " + component.getClientId(facesContext) + " does not evaluate to a " + "String, a Class object or a ValueExpression pointing " + "to a String or a Class object."); } // now we have a valid valueType // --> try to get a registered-by-class converter converter = facesContext.getApplication().createConverter(valueType); if (converter == null) { facesContext.getExternalContext().log("Found attribute valueType on component " + _ComponentUtils.getPathToComponent(component) + ", but could not get a by-type converter for type " + valueType.getName()); } } return converter; }
java
static Converter getValueTypeConverter(FacesContext facesContext, UISelectMany component) { Converter converter = null; Object valueTypeAttr = component.getAttributes().get(VALUE_TYPE_KEY); if (valueTypeAttr != null) { // treat the valueType attribute exactly like the collectionType attribute Class<?> valueType = getClassFromAttribute(facesContext, valueTypeAttr); if (valueType == null) { throw new FacesException( "The attribute " + VALUE_TYPE_KEY + " of component " + component.getClientId(facesContext) + " does not evaluate to a " + "String, a Class object or a ValueExpression pointing " + "to a String or a Class object."); } // now we have a valid valueType // --> try to get a registered-by-class converter converter = facesContext.getApplication().createConverter(valueType); if (converter == null) { facesContext.getExternalContext().log("Found attribute valueType on component " + _ComponentUtils.getPathToComponent(component) + ", but could not get a by-type converter for type " + valueType.getName()); } } return converter; }
[ "static", "Converter", "getValueTypeConverter", "(", "FacesContext", "facesContext", ",", "UISelectMany", "component", ")", "{", "Converter", "converter", "=", "null", ";", "Object", "valueTypeAttr", "=", "component", ".", "getAttributes", "(", ")", ".", "get", "(", "VALUE_TYPE_KEY", ")", ";", "if", "(", "valueTypeAttr", "!=", "null", ")", "{", "// treat the valueType attribute exactly like the collectionType attribute", "Class", "<", "?", ">", "valueType", "=", "getClassFromAttribute", "(", "facesContext", ",", "valueTypeAttr", ")", ";", "if", "(", "valueType", "==", "null", ")", "{", "throw", "new", "FacesException", "(", "\"The attribute \"", "+", "VALUE_TYPE_KEY", "+", "\" of component \"", "+", "component", ".", "getClientId", "(", "facesContext", ")", "+", "\" does not evaluate to a \"", "+", "\"String, a Class object or a ValueExpression pointing \"", "+", "\"to a String or a Class object.\"", ")", ";", "}", "// now we have a valid valueType", "// --> try to get a registered-by-class converter", "converter", "=", "facesContext", ".", "getApplication", "(", ")", ".", "createConverter", "(", "valueType", ")", ";", "if", "(", "converter", "==", "null", ")", "{", "facesContext", ".", "getExternalContext", "(", ")", ".", "log", "(", "\"Found attribute valueType on component \"", "+", "_ComponentUtils", ".", "getPathToComponent", "(", "component", ")", "+", "\", but could not get a by-type converter for type \"", "+", "valueType", ".", "getName", "(", ")", ")", ";", "}", "}", "return", "converter", ";", "}" ]
Uses the valueType attribute of the given UISelectMany component to get a by-type converter. @param facesContext @param component @return
[ "Uses", "the", "valueType", "attribute", "of", "the", "given", "UISelectMany", "component", "to", "get", "a", "by", "-", "type", "converter", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/component/_SharedRendererUtils.java#L404-L438
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/MQSITopicSyntaxChecker.java
MQSITopicSyntaxChecker.checkTopicNotNull
private final void checkTopicNotNull(String topic) throws InvalidTopicSyntaxException { if (topic == null) throw new InvalidTopicSyntaxException( NLS.format( "INVALID_TOPIC_ERROR_CWSIH0005", new Object[] { topic })); }
java
private final void checkTopicNotNull(String topic) throws InvalidTopicSyntaxException { if (topic == null) throw new InvalidTopicSyntaxException( NLS.format( "INVALID_TOPIC_ERROR_CWSIH0005", new Object[] { topic })); }
[ "private", "final", "void", "checkTopicNotNull", "(", "String", "topic", ")", "throws", "InvalidTopicSyntaxException", "{", "if", "(", "topic", "==", "null", ")", "throw", "new", "InvalidTopicSyntaxException", "(", "NLS", ".", "format", "(", "\"INVALID_TOPIC_ERROR_CWSIH0005\"", ",", "new", "Object", "[", "]", "{", "topic", "}", ")", ")", ";", "}" ]
null topic check @param topic The topic to be checked. @throws InvalidTopicSyntaxException if the topic is null
[ "null", "topic", "check" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/MQSITopicSyntaxChecker.java#L100-L108
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/cookies/CookieHeaderByteParser.java
CookieHeaderByteParser.matchAndParse
private CookieData matchAndParse(byte[] data, HeaderKeys hdr) { int pos = this.bytePosition; int start = -1; int stop = -1; for (; pos < data.length; pos++) { byte b = data[pos]; // found the delimiter for the name */ if ('=' == b) { break; } // In case of headers like MyNullCookie; // Set-Cookie is comma separated if (';' == b || ',' == b) { if (-1 == start) { // just ignore this empty bit (ie. ";;version=1") continue; } // decrement the position so that the parse cookie value code // will notice the missing value (by seeing semi-colon first) pos--; break; } // ignore white space if (' ' != b && '\t' != b) { if (-1 == start) { start = pos; } stop = pos; } } // save our stopping point (past the delimiter) this.bytePosition = pos + 1; if (-1 == start) { // nothing was found return null; } if (-1 == stop) { // shouldn't be possible stop = pos; } else if (data.length == stop) { stop--; } boolean foundDollar = ('$' == data[start]); if (foundDollar) { // skip past the leading $ symbol start++; } else if ('"' == data[start] && '"' == data[stop]) { // quotes around the values, strip them off start++; stop--; } int len = stop - start + 1; if (0 >= len) { // invalid data return null; } CookieData token = CookieData.match(data, start, len); if (null != token && null != hdr) { // test whether what we believe to be a token is a valid attribute // for this header instance. If not, then treat it as a new cookie // name if (!token.validForHeader(hdr, foundDollar)) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Token not valid for header, " + hdr + " " + token); } token = null; } } if (null == token) { // New cookie name found this.name = new byte[len]; System.arraycopy(data, start, this.name, 0, len); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "name: " + GenericUtils.getEnglishString(this.name)); } } return token; }
java
private CookieData matchAndParse(byte[] data, HeaderKeys hdr) { int pos = this.bytePosition; int start = -1; int stop = -1; for (; pos < data.length; pos++) { byte b = data[pos]; // found the delimiter for the name */ if ('=' == b) { break; } // In case of headers like MyNullCookie; // Set-Cookie is comma separated if (';' == b || ',' == b) { if (-1 == start) { // just ignore this empty bit (ie. ";;version=1") continue; } // decrement the position so that the parse cookie value code // will notice the missing value (by seeing semi-colon first) pos--; break; } // ignore white space if (' ' != b && '\t' != b) { if (-1 == start) { start = pos; } stop = pos; } } // save our stopping point (past the delimiter) this.bytePosition = pos + 1; if (-1 == start) { // nothing was found return null; } if (-1 == stop) { // shouldn't be possible stop = pos; } else if (data.length == stop) { stop--; } boolean foundDollar = ('$' == data[start]); if (foundDollar) { // skip past the leading $ symbol start++; } else if ('"' == data[start] && '"' == data[stop]) { // quotes around the values, strip them off start++; stop--; } int len = stop - start + 1; if (0 >= len) { // invalid data return null; } CookieData token = CookieData.match(data, start, len); if (null != token && null != hdr) { // test whether what we believe to be a token is a valid attribute // for this header instance. If not, then treat it as a new cookie // name if (!token.validForHeader(hdr, foundDollar)) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Token not valid for header, " + hdr + " " + token); } token = null; } } if (null == token) { // New cookie name found this.name = new byte[len]; System.arraycopy(data, start, this.name, 0, len); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "name: " + GenericUtils.getEnglishString(this.name)); } } return token; }
[ "private", "CookieData", "matchAndParse", "(", "byte", "[", "]", "data", ",", "HeaderKeys", "hdr", ")", "{", "int", "pos", "=", "this", ".", "bytePosition", ";", "int", "start", "=", "-", "1", ";", "int", "stop", "=", "-", "1", ";", "for", "(", ";", "pos", "<", "data", ".", "length", ";", "pos", "++", ")", "{", "byte", "b", "=", "data", "[", "pos", "]", ";", "// found the delimiter for the name */", "if", "(", "'", "'", "==", "b", ")", "{", "break", ";", "}", "// In case of headers like MyNullCookie;", "// Set-Cookie is comma separated", "if", "(", "'", "'", "==", "b", "||", "'", "'", "==", "b", ")", "{", "if", "(", "-", "1", "==", "start", ")", "{", "// just ignore this empty bit (ie. \";;version=1\")", "continue", ";", "}", "// decrement the position so that the parse cookie value code", "// will notice the missing value (by seeing semi-colon first)", "pos", "--", ";", "break", ";", "}", "// ignore white space", "if", "(", "'", "'", "!=", "b", "&&", "'", "'", "!=", "b", ")", "{", "if", "(", "-", "1", "==", "start", ")", "{", "start", "=", "pos", ";", "}", "stop", "=", "pos", ";", "}", "}", "// save our stopping point (past the delimiter)", "this", ".", "bytePosition", "=", "pos", "+", "1", ";", "if", "(", "-", "1", "==", "start", ")", "{", "// nothing was found", "return", "null", ";", "}", "if", "(", "-", "1", "==", "stop", ")", "{", "// shouldn't be possible", "stop", "=", "pos", ";", "}", "else", "if", "(", "data", ".", "length", "==", "stop", ")", "{", "stop", "--", ";", "}", "boolean", "foundDollar", "=", "(", "'", "'", "==", "data", "[", "start", "]", ")", ";", "if", "(", "foundDollar", ")", "{", "// skip past the leading $ symbol", "start", "++", ";", "}", "else", "if", "(", "'", "'", "==", "data", "[", "start", "]", "&&", "'", "'", "==", "data", "[", "stop", "]", ")", "{", "// quotes around the values, strip them off", "start", "++", ";", "stop", "--", ";", "}", "int", "len", "=", "stop", "-", "start", "+", "1", ";", "if", "(", "0", ">=", "len", ")", "{", "// invalid data", "return", "null", ";", "}", "CookieData", "token", "=", "CookieData", ".", "match", "(", "data", ",", "start", ",", "len", ")", ";", "if", "(", "null", "!=", "token", "&&", "null", "!=", "hdr", ")", "{", "// test whether what we believe to be a token is a valid attribute", "// for this header instance. If not, then treat it as a new cookie", "// name", "if", "(", "!", "token", ".", "validForHeader", "(", "hdr", ",", "foundDollar", ")", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Token not valid for header, \"", "+", "hdr", "+", "\" \"", "+", "token", ")", ";", "}", "token", "=", "null", ";", "}", "}", "if", "(", "null", "==", "token", ")", "{", "// New cookie name found", "this", ".", "name", "=", "new", "byte", "[", "len", "]", ";", "System", ".", "arraycopy", "(", "data", ",", "start", ",", "this", ".", "name", ",", "0", ",", "len", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"name: \"", "+", "GenericUtils", ".", "getEnglishString", "(", "this", ".", "name", ")", ")", ";", "}", "}", "return", "token", ";", "}" ]
This method matches the cookie attribute header with the pre-established Cookie header types. If a match is established the appropriate Cookie header data type is returned. @param data The header-value byte array passed down by parse @param hdr @return The appropriate CookieData type if a match is found for the header, otherwise it returns null
[ "This", "method", "matches", "the", "cookie", "attribute", "header", "with", "the", "pre", "-", "established", "Cookie", "header", "types", ".", "If", "a", "match", "is", "established", "the", "appropriate", "Cookie", "header", "data", "type", "is", "returned", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/cookies/CookieHeaderByteParser.java#L151-L237
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/cookies/CookieHeaderByteParser.java
CookieHeaderByteParser.parseValue
private void parseValue(byte[] data, CookieData token) { int start = -1; int stop = -1; int pos = this.bytePosition; int num_quotes = 0; // cycle through each byte until we hit a delimiter or end of data for (; pos < data.length; pos++) { byte b = data[pos]; // check for delimiter if (';' == b) { break; } // check for quotes if ('"' == b) { num_quotes++; } // Commas should not be treated as delimiters when they are // part of the Expires attribute if (',' == b) { // Port="80,8080" is valid if (CookieData.cookiePort.equals(token)) { if (2 <= num_quotes) { // this comma is after the quoted port string break; } } else if (!CookieData.cookieExpires.equals(token)) { break; } } // ignore white space if (' ' != b && '\t' != b) { if (-1 == start) { start = pos; } stop = pos; } } // save where we stopped this.bytePosition = pos + 1; // check the output parameters if (-1 == start) { this.value = new byte[0]; return; } if (-1 == stop) { this.value = new byte[0]; return; } // filter out any surrounding quotes if ('"' == data[start] && '"' == data[stop]) { start++; stop--; } // Retrieve the cookie attribute value int len = stop - start + 1; if (0 <= len) { this.value = new byte[len]; if (0 < len) { System.arraycopy(data, start, this.value, 0, len); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "value: " + GenericUtils.nullOutPasswords(this.value, (byte) '&')); } } } }
java
private void parseValue(byte[] data, CookieData token) { int start = -1; int stop = -1; int pos = this.bytePosition; int num_quotes = 0; // cycle through each byte until we hit a delimiter or end of data for (; pos < data.length; pos++) { byte b = data[pos]; // check for delimiter if (';' == b) { break; } // check for quotes if ('"' == b) { num_quotes++; } // Commas should not be treated as delimiters when they are // part of the Expires attribute if (',' == b) { // Port="80,8080" is valid if (CookieData.cookiePort.equals(token)) { if (2 <= num_quotes) { // this comma is after the quoted port string break; } } else if (!CookieData.cookieExpires.equals(token)) { break; } } // ignore white space if (' ' != b && '\t' != b) { if (-1 == start) { start = pos; } stop = pos; } } // save where we stopped this.bytePosition = pos + 1; // check the output parameters if (-1 == start) { this.value = new byte[0]; return; } if (-1 == stop) { this.value = new byte[0]; return; } // filter out any surrounding quotes if ('"' == data[start] && '"' == data[stop]) { start++; stop--; } // Retrieve the cookie attribute value int len = stop - start + 1; if (0 <= len) { this.value = new byte[len]; if (0 < len) { System.arraycopy(data, start, this.value, 0, len); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "value: " + GenericUtils.nullOutPasswords(this.value, (byte) '&')); } } } }
[ "private", "void", "parseValue", "(", "byte", "[", "]", "data", ",", "CookieData", "token", ")", "{", "int", "start", "=", "-", "1", ";", "int", "stop", "=", "-", "1", ";", "int", "pos", "=", "this", ".", "bytePosition", ";", "int", "num_quotes", "=", "0", ";", "// cycle through each byte until we hit a delimiter or end of data", "for", "(", ";", "pos", "<", "data", ".", "length", ";", "pos", "++", ")", "{", "byte", "b", "=", "data", "[", "pos", "]", ";", "// check for delimiter", "if", "(", "'", "'", "==", "b", ")", "{", "break", ";", "}", "// check for quotes", "if", "(", "'", "'", "==", "b", ")", "{", "num_quotes", "++", ";", "}", "// Commas should not be treated as delimiters when they are", "// part of the Expires attribute", "if", "(", "'", "'", "==", "b", ")", "{", "// Port=\"80,8080\" is valid", "if", "(", "CookieData", ".", "cookiePort", ".", "equals", "(", "token", ")", ")", "{", "if", "(", "2", "<=", "num_quotes", ")", "{", "// this comma is after the quoted port string", "break", ";", "}", "}", "else", "if", "(", "!", "CookieData", ".", "cookieExpires", ".", "equals", "(", "token", ")", ")", "{", "break", ";", "}", "}", "// ignore white space", "if", "(", "'", "'", "!=", "b", "&&", "'", "'", "!=", "b", ")", "{", "if", "(", "-", "1", "==", "start", ")", "{", "start", "=", "pos", ";", "}", "stop", "=", "pos", ";", "}", "}", "// save where we stopped", "this", ".", "bytePosition", "=", "pos", "+", "1", ";", "// check the output parameters", "if", "(", "-", "1", "==", "start", ")", "{", "this", ".", "value", "=", "new", "byte", "[", "0", "]", ";", "return", ";", "}", "if", "(", "-", "1", "==", "stop", ")", "{", "this", ".", "value", "=", "new", "byte", "[", "0", "]", ";", "return", ";", "}", "// filter out any surrounding quotes", "if", "(", "'", "'", "==", "data", "[", "start", "]", "&&", "'", "'", "==", "data", "[", "stop", "]", ")", "{", "start", "++", ";", "stop", "--", ";", "}", "// Retrieve the cookie attribute value", "int", "len", "=", "stop", "-", "start", "+", "1", ";", "if", "(", "0", "<=", "len", ")", "{", "this", ".", "value", "=", "new", "byte", "[", "len", "]", ";", "if", "(", "0", "<", "len", ")", "{", "System", ".", "arraycopy", "(", "data", ",", "start", ",", "this", ".", "value", ",", "0", ",", "len", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"value: \"", "+", "GenericUtils", ".", "nullOutPasswords", "(", "this", ".", "value", ",", "(", "byte", ")", "'", "'", ")", ")", ";", "}", "}", "}", "}" ]
This method parses the cookie attribute value. @param data The value byte array passed down by parse method @param token The type of the CookieData attribute
[ "This", "method", "parses", "the", "cookie", "attribute", "value", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/cookies/CookieHeaderByteParser.java#L247-L321
train
OpenLiberty/open-liberty
dev/com.ibm.ws.security.openidconnect.clients.common/src/com/ibm/ws/security/openidconnect/client/jose4j/util/Jose4jUtil.java
Jose4jUtil.parseJwtWithoutValidation
protected static JwtContext parseJwtWithoutValidation(String jwtString) throws Exception { JwtConsumer firstPassJwtConsumer = new JwtConsumerBuilder() .setSkipAllValidators() .setDisableRequireSignature() .setSkipSignatureVerification() .build(); JwtContext jwtContext = firstPassJwtConsumer.process(jwtString); return jwtContext; }
java
protected static JwtContext parseJwtWithoutValidation(String jwtString) throws Exception { JwtConsumer firstPassJwtConsumer = new JwtConsumerBuilder() .setSkipAllValidators() .setDisableRequireSignature() .setSkipSignatureVerification() .build(); JwtContext jwtContext = firstPassJwtConsumer.process(jwtString); return jwtContext; }
[ "protected", "static", "JwtContext", "parseJwtWithoutValidation", "(", "String", "jwtString", ")", "throws", "Exception", "{", "JwtConsumer", "firstPassJwtConsumer", "=", "new", "JwtConsumerBuilder", "(", ")", ".", "setSkipAllValidators", "(", ")", ".", "setDisableRequireSignature", "(", ")", ".", "setSkipSignatureVerification", "(", ")", ".", "build", "(", ")", ";", "JwtContext", "jwtContext", "=", "firstPassJwtConsumer", ".", "process", "(", "jwtString", ")", ";", "return", "jwtContext", ";", "}" ]
Just parse without validation for now
[ "Just", "parse", "without", "validation", "for", "now" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.openidconnect.clients.common/src/com/ibm/ws/security/openidconnect/client/jose4j/util/Jose4jUtil.java#L283-L294
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/admin/JsAdminService.java
JsAdminService.isValidJmxPropertyValue
public static boolean isValidJmxPropertyValue(String s) { if ((s.indexOf(":") >= 0) || (s.indexOf("*") >= 0) || (s.indexOf('"') >= 0) || (s.indexOf("?") >= 0) || (s.indexOf(",") >= 0) || (s.indexOf("=") >= 0)) { return false; } else return true; }
java
public static boolean isValidJmxPropertyValue(String s) { if ((s.indexOf(":") >= 0) || (s.indexOf("*") >= 0) || (s.indexOf('"') >= 0) || (s.indexOf("?") >= 0) || (s.indexOf(",") >= 0) || (s.indexOf("=") >= 0)) { return false; } else return true; }
[ "public", "static", "boolean", "isValidJmxPropertyValue", "(", "String", "s", ")", "{", "if", "(", "(", "s", ".", "indexOf", "(", "\":\"", ")", ">=", "0", ")", "||", "(", "s", ".", "indexOf", "(", "\"*\"", ")", ">=", "0", ")", "||", "(", "s", ".", "indexOf", "(", "'", "'", ")", ">=", "0", ")", "||", "(", "s", ".", "indexOf", "(", "\"?\"", ")", ">=", "0", ")", "||", "(", "s", ".", "indexOf", "(", "\",\"", ")", ">=", "0", ")", "||", "(", "s", ".", "indexOf", "(", "\"=\"", ")", ">=", "0", ")", ")", "{", "return", "false", ";", "}", "else", "return", "true", ";", "}" ]
Does the specified string contain characters valid in a JMX key property? @param s the string to be checked @return boolean if true, indicates the string is valid, otherwise false
[ "Does", "the", "specified", "string", "contain", "characters", "valid", "in", "a", "JMX", "key", "property?" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/admin/JsAdminService.java#L38-L48
train
OpenLiberty/open-liberty
dev/com.ibm.ws.microprofile.faulttolerance.2.0/src/com/ibm/ws/microprofile/faulttolerance20/impl/MethodResult.java
MethodResult.success
public static <R> MethodResult<R> success(R result) { return new MethodResult<>(result, null, false); }
java
public static <R> MethodResult<R> success(R result) { return new MethodResult<>(result, null, false); }
[ "public", "static", "<", "R", ">", "MethodResult", "<", "R", ">", "success", "(", "R", "result", ")", "{", "return", "new", "MethodResult", "<>", "(", "result", ",", "null", ",", "false", ")", ";", "}" ]
Create a MethodResult for a method which returned a value @param result the value returned by the method @return the new MethodResult
[ "Create", "a", "MethodResult", "for", "a", "method", "which", "returned", "a", "value" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.faulttolerance.2.0/src/com/ibm/ws/microprofile/faulttolerance20/impl/MethodResult.java#L34-L36
train
OpenLiberty/open-liberty
dev/com.ibm.ws.microprofile.faulttolerance.2.0/src/com/ibm/ws/microprofile/faulttolerance20/impl/MethodResult.java
MethodResult.failure
public static <R> MethodResult<R> failure(Throwable failure) { return new MethodResult<>(null, failure, false); }
java
public static <R> MethodResult<R> failure(Throwable failure) { return new MethodResult<>(null, failure, false); }
[ "public", "static", "<", "R", ">", "MethodResult", "<", "R", ">", "failure", "(", "Throwable", "failure", ")", "{", "return", "new", "MethodResult", "<>", "(", "null", ",", "failure", ",", "false", ")", ";", "}" ]
Create a MethodResult for a method which threw an exception @param failure the exception thrown by the method @return the new MethodResult
[ "Create", "a", "MethodResult", "for", "a", "method", "which", "threw", "an", "exception" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.faulttolerance.2.0/src/com/ibm/ws/microprofile/faulttolerance20/impl/MethodResult.java#L44-L46
train
OpenLiberty/open-liberty
dev/com.ibm.ws.microprofile.faulttolerance.2.0/src/com/ibm/ws/microprofile/faulttolerance20/impl/MethodResult.java
MethodResult.internalFailure
public static <R> MethodResult<R> internalFailure(Throwable failure) { return new MethodResult<R>(null, failure, true); }
java
public static <R> MethodResult<R> internalFailure(Throwable failure) { return new MethodResult<R>(null, failure, true); }
[ "public", "static", "<", "R", ">", "MethodResult", "<", "R", ">", "internalFailure", "(", "Throwable", "failure", ")", "{", "return", "new", "MethodResult", "<", "R", ">", "(", "null", ",", "failure", ",", "true", ")", ";", "}" ]
Create a MethodResult for an internal exception which occurred while trying to run a method @param failure the internal exception @return the new MethodResult
[ "Create", "a", "MethodResult", "for", "an", "internal", "exception", "which", "occurred", "while", "trying", "to", "run", "a", "method" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.faulttolerance.2.0/src/com/ibm/ws/microprofile/faulttolerance20/impl/MethodResult.java#L54-L56
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/WeakValueHashMap.java
WeakValueHashMap.clearUnreferencedEntries
private final void clearUnreferencedEntries() { for (WeakEntry entry = (WeakEntry) queue.poll(); entry != null; entry = (WeakEntry) queue.poll()) { WeakEntry removedEntry = (WeakEntry) super.remove(entry.key); // The entry for this key may have been replaced with another one after it was dereferenced. // Make sure we removed the correct entry. if (removedEntry != entry) { super.put(entry.key, removedEntry); } } // for... }
java
private final void clearUnreferencedEntries() { for (WeakEntry entry = (WeakEntry) queue.poll(); entry != null; entry = (WeakEntry) queue.poll()) { WeakEntry removedEntry = (WeakEntry) super.remove(entry.key); // The entry for this key may have been replaced with another one after it was dereferenced. // Make sure we removed the correct entry. if (removedEntry != entry) { super.put(entry.key, removedEntry); } } // for... }
[ "private", "final", "void", "clearUnreferencedEntries", "(", ")", "{", "for", "(", "WeakEntry", "entry", "=", "(", "WeakEntry", ")", "queue", ".", "poll", "(", ")", ";", "entry", "!=", "null", ";", "entry", "=", "(", "WeakEntry", ")", "queue", ".", "poll", "(", ")", ")", "{", "WeakEntry", "removedEntry", "=", "(", "WeakEntry", ")", "super", ".", "remove", "(", "entry", ".", "key", ")", ";", "// The entry for this key may have been replaced with another one after it was dereferenced.", "// Make sure we removed the correct entry.", "if", "(", "removedEntry", "!=", "entry", ")", "{", "super", ".", "put", "(", "entry", ".", "key", ",", "removedEntry", ")", ";", "}", "}", "// for...", "}" ]
Remove the unreferenced Entries from the map.
[ "Remove", "the", "unreferenced", "Entries", "from", "the", "map", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/WeakValueHashMap.java#L34-L44
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConsumerSessionImpl.java
ConsumerSessionImpl.attachBifurcatedConsumer
protected void attachBifurcatedConsumer(BifurcatedConsumerSessionImpl consumer) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "attachBifurcatedConsumer", consumer); // Create a bifurcated list if required if (_bifurcatedConsumers == null) { synchronized (this) { if (_bifurcatedConsumers == null) _bifurcatedConsumers = new LinkedList<BifurcatedConsumerSessionImpl>(); } } synchronized (_bifurcatedConsumers) { _bifurcatedConsumers.add(consumer); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "attachBifurcatedConsumer"); }
java
protected void attachBifurcatedConsumer(BifurcatedConsumerSessionImpl consumer) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "attachBifurcatedConsumer", consumer); // Create a bifurcated list if required if (_bifurcatedConsumers == null) { synchronized (this) { if (_bifurcatedConsumers == null) _bifurcatedConsumers = new LinkedList<BifurcatedConsumerSessionImpl>(); } } synchronized (_bifurcatedConsumers) { _bifurcatedConsumers.add(consumer); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "attachBifurcatedConsumer"); }
[ "protected", "void", "attachBifurcatedConsumer", "(", "BifurcatedConsumerSessionImpl", "consumer", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"attachBifurcatedConsumer\"", ",", "consumer", ")", ";", "// Create a bifurcated list if required", "if", "(", "_bifurcatedConsumers", "==", "null", ")", "{", "synchronized", "(", "this", ")", "{", "if", "(", "_bifurcatedConsumers", "==", "null", ")", "_bifurcatedConsumers", "=", "new", "LinkedList", "<", "BifurcatedConsumerSessionImpl", ">", "(", ")", ";", "}", "}", "synchronized", "(", "_bifurcatedConsumers", ")", "{", "_bifurcatedConsumers", ".", "add", "(", "consumer", ")", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"attachBifurcatedConsumer\"", ")", ";", "}" ]
Adds the bifurcated consumer to the list of associated consumers. @param consumer
[ "Adds", "the", "bifurcated", "consumer", "to", "the", "list", "of", "associated", "consumers", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConsumerSessionImpl.java#L349-L371
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConsumerSessionImpl.java
ConsumerSessionImpl.removeBifurcatedConsumer
protected void removeBifurcatedConsumer(BifurcatedConsumerSessionImpl consumer) throws SIResourceException, SISessionDroppedException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "removeBifurcatedConsumer", consumer); synchronized (_bifurcatedConsumers) { _bifurcatedConsumers.remove(consumer); } // Cleanup after the bifurcated consumer (unlock any messages it owns) _localConsumerPoint.cleanupBifurcatedConsumer(consumer); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "removeBifurcatedConsumer"); }
java
protected void removeBifurcatedConsumer(BifurcatedConsumerSessionImpl consumer) throws SIResourceException, SISessionDroppedException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "removeBifurcatedConsumer", consumer); synchronized (_bifurcatedConsumers) { _bifurcatedConsumers.remove(consumer); } // Cleanup after the bifurcated consumer (unlock any messages it owns) _localConsumerPoint.cleanupBifurcatedConsumer(consumer); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "removeBifurcatedConsumer"); }
[ "protected", "void", "removeBifurcatedConsumer", "(", "BifurcatedConsumerSessionImpl", "consumer", ")", "throws", "SIResourceException", ",", "SISessionDroppedException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"removeBifurcatedConsumer\"", ",", "consumer", ")", ";", "synchronized", "(", "_bifurcatedConsumers", ")", "{", "_bifurcatedConsumers", ".", "remove", "(", "consumer", ")", ";", "}", "// Cleanup after the bifurcated consumer (unlock any messages it owns)", "_localConsumerPoint", ".", "cleanupBifurcatedConsumer", "(", "consumer", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"removeBifurcatedConsumer\"", ")", ";", "}" ]
Removes the bifurcated consumer to the list of associated consumers. @param consumer @throws SISessionDroppedException
[ "Removes", "the", "bifurcated", "consumer", "to", "the", "list", "of", "associated", "consumers", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConsumerSessionImpl.java#L379-L394
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConsumerSessionImpl.java
ConsumerSessionImpl._close
void _close() throws SIResourceException, SIConnectionLostException, SIErrorException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "_close"); try { //close the LCP _localConsumerPoint.close(); } catch (SINotPossibleInCurrentConfigurationException e) { // No FFDC code needed //Do nothing ... probably means that the Destination is being deleted //and so the LCP will be closed anyway if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "_close", e); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "_close"); }
java
void _close() throws SIResourceException, SIConnectionLostException, SIErrorException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "_close"); try { //close the LCP _localConsumerPoint.close(); } catch (SINotPossibleInCurrentConfigurationException e) { // No FFDC code needed //Do nothing ... probably means that the Destination is being deleted //and so the LCP will be closed anyway if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "_close", e); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "_close"); }
[ "void", "_close", "(", ")", "throws", "SIResourceException", ",", "SIConnectionLostException", ",", "SIErrorException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"_close\"", ")", ";", "try", "{", "//close the LCP", "_localConsumerPoint", ".", "close", "(", ")", ";", "}", "catch", "(", "SINotPossibleInCurrentConfigurationException", "e", ")", "{", "// No FFDC code needed", "//Do nothing ... probably means that the Destination is being deleted", "//and so the LCP will be closed anyway", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "SibTr", ".", "debug", "(", "tc", ",", "\"_close\"", ",", "e", ")", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"_close\"", ")", ";", "}" ]
Performs any operations required to close this consumer session, but it does not modify any references which the connection might have.
[ "Performs", "any", "operations", "required", "to", "close", "this", "consumer", "session", "but", "it", "does", "not", "modify", "any", "references", "which", "the", "connection", "might", "have", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConsumerSessionImpl.java#L444-L467
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConsumerSessionImpl.java
ConsumerSessionImpl.checkNotClosed
void checkNotClosed() throws SISessionUnavailableException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "checkNotClosed"); try { synchronized (_localConsumerPoint) { _localConsumerPoint.checkNotClosed(); } } catch (SISessionUnavailableException e) { // No FFDC code needed SibTr.exception(tc, e); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "checkNotClosed", e); throw e; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "checkNotClosed"); }
java
void checkNotClosed() throws SISessionUnavailableException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "checkNotClosed"); try { synchronized (_localConsumerPoint) { _localConsumerPoint.checkNotClosed(); } } catch (SISessionUnavailableException e) { // No FFDC code needed SibTr.exception(tc, e); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "checkNotClosed", e); throw e; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "checkNotClosed"); }
[ "void", "checkNotClosed", "(", ")", "throws", "SISessionUnavailableException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"checkNotClosed\"", ")", ";", "try", "{", "synchronized", "(", "_localConsumerPoint", ")", "{", "_localConsumerPoint", ".", "checkNotClosed", "(", ")", ";", "}", "}", "catch", "(", "SISessionUnavailableException", "e", ")", "{", "// No FFDC code needed", "SibTr", ".", "exception", "(", "tc", ",", "e", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"checkNotClosed\"", ",", "e", ")", ";", "throw", "e", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"checkNotClosed\"", ")", ";", "}" ]
Check that this consumer session is not closed. @throws SIObjectClosedException
[ "Check", "that", "this", "consumer", "session", "is", "not", "closed", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConsumerSessionImpl.java#L474-L498
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConsumerSessionImpl.java
ConsumerSessionImpl.getConnectionInternal
protected SICoreConnection getConnectionInternal() { if (TraceComponent.isAnyTracingEnabled() && CoreSPIConsumerSession.tc.isEntryEnabled()) { SibTr.entry(CoreSPIConsumerSession.tc, "getConnectionInternal", this); SibTr.exit(CoreSPIConsumerSession.tc, "getConnectionInternal", _connection); } //Return the connection used to create this consumer session return _connection; }
java
protected SICoreConnection getConnectionInternal() { if (TraceComponent.isAnyTracingEnabled() && CoreSPIConsumerSession.tc.isEntryEnabled()) { SibTr.entry(CoreSPIConsumerSession.tc, "getConnectionInternal", this); SibTr.exit(CoreSPIConsumerSession.tc, "getConnectionInternal", _connection); } //Return the connection used to create this consumer session return _connection; }
[ "protected", "SICoreConnection", "getConnectionInternal", "(", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "CoreSPIConsumerSession", ".", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "entry", "(", "CoreSPIConsumerSession", ".", "tc", ",", "\"getConnectionInternal\"", ",", "this", ")", ";", "SibTr", ".", "exit", "(", "CoreSPIConsumerSession", ".", "tc", ",", "\"getConnectionInternal\"", ",", "_connection", ")", ";", "}", "//Return the connection used to create this consumer session", "return", "_connection", ";", "}" ]
Internal getter method which bypasses the not closed check. @return
[ "Internal", "getter", "method", "which", "bypasses", "the", "not", "closed", "check", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConsumerSessionImpl.java#L664-L673
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConsumerSessionImpl.java
ConsumerSessionImpl.getIdInternal
public long getIdInternal() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, "getIdInternal"); SibTr.exit(tc, "getIdInternal", new Long(_consumerId)); } return _consumerId; }
java
public long getIdInternal() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, "getIdInternal"); SibTr.exit(tc, "getIdInternal", new Long(_consumerId)); } return _consumerId; }
[ "public", "long", "getIdInternal", "(", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "entry", "(", "tc", ",", "\"getIdInternal\"", ")", ";", "SibTr", ".", "exit", "(", "tc", ",", "\"getIdInternal\"", ",", "new", "Long", "(", "_consumerId", ")", ")", ";", "}", "return", "_consumerId", ";", "}" ]
Gets the id for the consumer without any checking. @return the id for this consumer session
[ "Gets", "the", "id", "for", "the", "consumer", "without", "any", "checking", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConsumerSessionImpl.java#L895-L903
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConsumerSessionImpl.java
ConsumerSessionImpl.setId
void setId(long id) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "setId", new Long(id)); _consumerId = id; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "setId"); }
java
void setId(long id) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "setId", new Long(id)); _consumerId = id; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "setId"); }
[ "void", "setId", "(", "long", "id", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"setId\"", ",", "new", "Long", "(", "id", ")", ")", ";", "_consumerId", "=", "id", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"setId\"", ")", ";", "}" ]
Sets the id for this consumer. @param id
[ "Sets", "the", "id", "for", "this", "consumer", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConsumerSessionImpl.java#L945-L954
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/impl/Matching.java
Matching.createFactoryInstance
private static void createFactoryInstance() { if (tc.isEntryEnabled()) tc.entry(cclass, "createFactoryInstance"); try { Class cls = Class.forName(MATCHING_CLASS_NAME); instance = (Matching) cls.newInstance(); } catch (Exception e) { // No FFDC Code Needed. // FFDC driven by wrapper class. FFDC.processException(cclass, "com.ibm.ws.sib.matchspace.Matching.createFactoryInstance", e, "1:94:1.18"); //TODO: trace.error // tc.error(cclass, "UNABLE_TO_CREATE_MATCHING_INSTANCE_CWSIH0007E", e); createException = e; } if (tc.isEntryEnabled()) tc.exit(cclass, "createFactoryInstance"); }
java
private static void createFactoryInstance() { if (tc.isEntryEnabled()) tc.entry(cclass, "createFactoryInstance"); try { Class cls = Class.forName(MATCHING_CLASS_NAME); instance = (Matching) cls.newInstance(); } catch (Exception e) { // No FFDC Code Needed. // FFDC driven by wrapper class. FFDC.processException(cclass, "com.ibm.ws.sib.matchspace.Matching.createFactoryInstance", e, "1:94:1.18"); //TODO: trace.error // tc.error(cclass, "UNABLE_TO_CREATE_MATCHING_INSTANCE_CWSIH0007E", e); createException = e; } if (tc.isEntryEnabled()) tc.exit(cclass, "createFactoryInstance"); }
[ "private", "static", "void", "createFactoryInstance", "(", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "tc", ".", "entry", "(", "cclass", ",", "\"createFactoryInstance\"", ")", ";", "try", "{", "Class", "cls", "=", "Class", ".", "forName", "(", "MATCHING_CLASS_NAME", ")", ";", "instance", "=", "(", "Matching", ")", "cls", ".", "newInstance", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "// No FFDC Code Needed.", "// FFDC driven by wrapper class.", "FFDC", ".", "processException", "(", "cclass", ",", "\"com.ibm.ws.sib.matchspace.Matching.createFactoryInstance\"", ",", "e", ",", "\"1:94:1.18\"", ")", ";", "//TODO: trace.error ", "// tc.error(cclass, \"UNABLE_TO_CREATE_MATCHING_INSTANCE_CWSIH0007E\", e);", "createException", "=", "e", ";", "}", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "tc", ".", "exit", "(", "cclass", ",", "\"createFactoryInstance\"", ")", ";", "}" ]
Create the Matching instance.
[ "Create", "the", "Matching", "instance", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/impl/Matching.java#L62-L88
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/impl/Matching.java
Matching.getInstance
public static Matching getInstance() throws Exception { if (tc.isEntryEnabled()) tc.entry(cclass, "getInstance"); if (instance == null) throw createException; if (tc.isEntryEnabled()) tc.exit(cclass, "getInstance", "instance=" + instance); return instance; }
java
public static Matching getInstance() throws Exception { if (tc.isEntryEnabled()) tc.entry(cclass, "getInstance"); if (instance == null) throw createException; if (tc.isEntryEnabled()) tc.exit(cclass, "getInstance", "instance=" + instance); return instance; }
[ "public", "static", "Matching", "getInstance", "(", ")", "throws", "Exception", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "tc", ".", "entry", "(", "cclass", ",", "\"getInstance\"", ")", ";", "if", "(", "instance", "==", "null", ")", "throw", "createException", ";", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "tc", ".", "exit", "(", "cclass", ",", "\"getInstance\"", ",", "\"instance=\"", "+", "instance", ")", ";", "return", "instance", ";", "}" ]
Obtain a reference to the singleton Matching instance @return The singleton instance of the factory class
[ "Obtain", "a", "reference", "to", "the", "singleton", "Matching", "instance" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/impl/Matching.java#L96-L108
train
OpenLiberty/open-liberty
dev/com.ibm.ws.threading/src/com/ibm/ws/threading/internal/PolicyTaskFutureImpl.java
PolicyTaskFutureImpl.abort
final boolean abort(boolean removeFromQueue, Throwable cause) { if (removeFromQueue && executor.queue.remove(this)) executor.maxQueueSizeConstraint.release(); if (nsAcceptEnd == nsAcceptBegin - 1) // currently unset nsRunEnd = nsQueueEnd = nsAcceptEnd = System.nanoTime(); boolean aborted = result.compareAndSet(state, cause); if (aborted) try { state.releaseShared(ABORTED); if (nsQueueEnd == nsAcceptBegin - 2) // currently unset nsRunEnd = nsQueueEnd = System.nanoTime(); if (callback != null) callback.onEnd(task, this, null, true, 0, cause); } finally { if (latch != null) latch.countDown(); if (cancellableStage != null) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "completion stage to complete exceptionally: " + cancellableStage); cancellableStage.completeExceptionally(cause); } } else { // Prevent premature return from abort that would allow subsequent getState() to indicate // that the task is still in SUBMITTED state. while (state.get() < RUNNING) Thread.yield(); } return aborted; }
java
final boolean abort(boolean removeFromQueue, Throwable cause) { if (removeFromQueue && executor.queue.remove(this)) executor.maxQueueSizeConstraint.release(); if (nsAcceptEnd == nsAcceptBegin - 1) // currently unset nsRunEnd = nsQueueEnd = nsAcceptEnd = System.nanoTime(); boolean aborted = result.compareAndSet(state, cause); if (aborted) try { state.releaseShared(ABORTED); if (nsQueueEnd == nsAcceptBegin - 2) // currently unset nsRunEnd = nsQueueEnd = System.nanoTime(); if (callback != null) callback.onEnd(task, this, null, true, 0, cause); } finally { if (latch != null) latch.countDown(); if (cancellableStage != null) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "completion stage to complete exceptionally: " + cancellableStage); cancellableStage.completeExceptionally(cause); } } else { // Prevent premature return from abort that would allow subsequent getState() to indicate // that the task is still in SUBMITTED state. while (state.get() < RUNNING) Thread.yield(); } return aborted; }
[ "final", "boolean", "abort", "(", "boolean", "removeFromQueue", ",", "Throwable", "cause", ")", "{", "if", "(", "removeFromQueue", "&&", "executor", ".", "queue", ".", "remove", "(", "this", ")", ")", "executor", ".", "maxQueueSizeConstraint", ".", "release", "(", ")", ";", "if", "(", "nsAcceptEnd", "==", "nsAcceptBegin", "-", "1", ")", "// currently unset", "nsRunEnd", "=", "nsQueueEnd", "=", "nsAcceptEnd", "=", "System", ".", "nanoTime", "(", ")", ";", "boolean", "aborted", "=", "result", ".", "compareAndSet", "(", "state", ",", "cause", ")", ";", "if", "(", "aborted", ")", "try", "{", "state", ".", "releaseShared", "(", "ABORTED", ")", ";", "if", "(", "nsQueueEnd", "==", "nsAcceptBegin", "-", "2", ")", "// currently unset", "nsRunEnd", "=", "nsQueueEnd", "=", "System", ".", "nanoTime", "(", ")", ";", "if", "(", "callback", "!=", "null", ")", "callback", ".", "onEnd", "(", "task", ",", "this", ",", "null", ",", "true", ",", "0", ",", "cause", ")", ";", "}", "finally", "{", "if", "(", "latch", "!=", "null", ")", "latch", ".", "countDown", "(", ")", ";", "if", "(", "cancellableStage", "!=", "null", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "this", ",", "tc", ",", "\"completion stage to complete exceptionally: \"", "+", "cancellableStage", ")", ";", "cancellableStage", ".", "completeExceptionally", "(", "cause", ")", ";", "}", "}", "else", "{", "// Prevent premature return from abort that would allow subsequent getState() to indicate", "// that the task is still in SUBMITTED state.", "while", "(", "state", ".", "get", "(", ")", "<", "RUNNING", ")", "Thread", ".", "yield", "(", ")", ";", "}", "return", "aborted", ";", "}" ]
Invoked to abort a task. @param removeFromQueue indicates whether we should first remove the task from the executor's queue. @param cause the cause of the abort. @return true if the future transitioned to ABORTED state.
[ "Invoked", "to", "abort", "a", "task", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.threading/src/com/ibm/ws/threading/internal/PolicyTaskFutureImpl.java#L394-L423
train
OpenLiberty/open-liberty
dev/com.ibm.ws.threading/src/com/ibm/ws/threading/internal/PolicyTaskFutureImpl.java
PolicyTaskFutureImpl.accept
@Trivial final void accept(boolean runOnSubmitter) { long time; nsAcceptEnd = time = System.nanoTime(); if (runOnSubmitter) nsQueueEnd = time; state.setSubmitted(); }
java
@Trivial final void accept(boolean runOnSubmitter) { long time; nsAcceptEnd = time = System.nanoTime(); if (runOnSubmitter) nsQueueEnd = time; state.setSubmitted(); }
[ "@", "Trivial", "final", "void", "accept", "(", "boolean", "runOnSubmitter", ")", "{", "long", "time", ";", "nsAcceptEnd", "=", "time", "=", "System", ".", "nanoTime", "(", ")", ";", "if", "(", "runOnSubmitter", ")", "nsQueueEnd", "=", "time", ";", "state", ".", "setSubmitted", "(", ")", ";", "}" ]
Invoked to indicate the task was successfully submitted. @param runOnSubmitter true if accepted to run immediately on the submitter's thread. False if accepted to the queue.
[ "Invoked", "to", "indicate", "the", "task", "was", "successfully", "submitted", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.threading/src/com/ibm/ws/threading/internal/PolicyTaskFutureImpl.java#L430-L437
train
OpenLiberty/open-liberty
dev/com.ibm.ws.microprofile.config.1.4/src/com/ibm/ws/microprofile/config14/impl/PropertyResolverUtil.java
PropertyResolverUtil.resolve
public static String resolve(WebSphereConfig14 config, String raw) { String resolved = raw; StringCharacterIterator itr = new StringCharacterIterator(resolved); int startCount = 0; //how many times have we encountered the start token (EVAL_START_TOKEN) without it being matched by the end token (EVAL_END_TOKEN) int startIndex = -1; //the index of the first start token encountered //loop through the characters in the raw string until there are no more char c = itr.first(); while (c != CharacterIterator.DONE) { //if we enounter the first char in the start token, look for the second one immediately after it if (c == Config14Constants.EVAL_START_TOKEN.charAt(0)) { c = itr.next(); //if we find the second char of the start token as well then record it if (c == Config14Constants.EVAL_START_TOKEN.charAt(1)) { //increase the start token counter startCount++; //record the index of the first start token only if (startIndex == -1) { startIndex = itr.getIndex() - 1; } } else { itr.previous(); } } else if (c == Config14Constants.EVAL_END_TOKEN.charAt(0)) { //if we encounter an end token which is matched by a start token if (startCount > 0) { //decrement the start token counter startCount--; //if all start tokens have been matched with end tokens then we can do some processing if (startCount == 0) { //record the index of the end token int endIndex = itr.getIndex(); //extract the string inbetween the start and the end tokens String propertyName = resolved.substring(startIndex + 2, endIndex); //recursively resolve the property name string to account for nested variables String resolvedPropertyName = resolve(config, propertyName); //once we have the fully resolved property name, find the string value for that property String resolvedValue = (String) config.getValue(resolvedPropertyName, //property name String.class, //conversion type false, //optional null, //default string true); //evaluate variables //extract the part of the raw string which went before and after the variable String prefix = resolved.substring(0, startIndex); String suffix = resolved.substring(endIndex + 1); //stitch it all back together resolved = prefix + resolvedValue + suffix; //work out where processing should resume from (after the variable) int index = prefix.length() + resolvedValue.length() - 1; //reset the iterator itr.setText(resolved); itr.setIndex(index); //clear the start index startIndex = -1; } } } c = itr.next(); //if we get to the end and a start was not matched, skip it and resume just after if ((c == CharacterIterator.DONE) && (startIndex > -1) && (startIndex < raw.length())) { //reset the iterator itr.setIndex(startIndex + 2); //clear the start index startIndex = -1; startCount = 0; //resume c = itr.current(); } } return resolved; }
java
public static String resolve(WebSphereConfig14 config, String raw) { String resolved = raw; StringCharacterIterator itr = new StringCharacterIterator(resolved); int startCount = 0; //how many times have we encountered the start token (EVAL_START_TOKEN) without it being matched by the end token (EVAL_END_TOKEN) int startIndex = -1; //the index of the first start token encountered //loop through the characters in the raw string until there are no more char c = itr.first(); while (c != CharacterIterator.DONE) { //if we enounter the first char in the start token, look for the second one immediately after it if (c == Config14Constants.EVAL_START_TOKEN.charAt(0)) { c = itr.next(); //if we find the second char of the start token as well then record it if (c == Config14Constants.EVAL_START_TOKEN.charAt(1)) { //increase the start token counter startCount++; //record the index of the first start token only if (startIndex == -1) { startIndex = itr.getIndex() - 1; } } else { itr.previous(); } } else if (c == Config14Constants.EVAL_END_TOKEN.charAt(0)) { //if we encounter an end token which is matched by a start token if (startCount > 0) { //decrement the start token counter startCount--; //if all start tokens have been matched with end tokens then we can do some processing if (startCount == 0) { //record the index of the end token int endIndex = itr.getIndex(); //extract the string inbetween the start and the end tokens String propertyName = resolved.substring(startIndex + 2, endIndex); //recursively resolve the property name string to account for nested variables String resolvedPropertyName = resolve(config, propertyName); //once we have the fully resolved property name, find the string value for that property String resolvedValue = (String) config.getValue(resolvedPropertyName, //property name String.class, //conversion type false, //optional null, //default string true); //evaluate variables //extract the part of the raw string which went before and after the variable String prefix = resolved.substring(0, startIndex); String suffix = resolved.substring(endIndex + 1); //stitch it all back together resolved = prefix + resolvedValue + suffix; //work out where processing should resume from (after the variable) int index = prefix.length() + resolvedValue.length() - 1; //reset the iterator itr.setText(resolved); itr.setIndex(index); //clear the start index startIndex = -1; } } } c = itr.next(); //if we get to the end and a start was not matched, skip it and resume just after if ((c == CharacterIterator.DONE) && (startIndex > -1) && (startIndex < raw.length())) { //reset the iterator itr.setIndex(startIndex + 2); //clear the start index startIndex = -1; startCount = 0; //resume c = itr.current(); } } return resolved; }
[ "public", "static", "String", "resolve", "(", "WebSphereConfig14", "config", ",", "String", "raw", ")", "{", "String", "resolved", "=", "raw", ";", "StringCharacterIterator", "itr", "=", "new", "StringCharacterIterator", "(", "resolved", ")", ";", "int", "startCount", "=", "0", ";", "//how many times have we encountered the start token (EVAL_START_TOKEN) without it being matched by the end token (EVAL_END_TOKEN)", "int", "startIndex", "=", "-", "1", ";", "//the index of the first start token encountered", "//loop through the characters in the raw string until there are no more", "char", "c", "=", "itr", ".", "first", "(", ")", ";", "while", "(", "c", "!=", "CharacterIterator", ".", "DONE", ")", "{", "//if we enounter the first char in the start token, look for the second one immediately after it", "if", "(", "c", "==", "Config14Constants", ".", "EVAL_START_TOKEN", ".", "charAt", "(", "0", ")", ")", "{", "c", "=", "itr", ".", "next", "(", ")", ";", "//if we find the second char of the start token as well then record it", "if", "(", "c", "==", "Config14Constants", ".", "EVAL_START_TOKEN", ".", "charAt", "(", "1", ")", ")", "{", "//increase the start token counter", "startCount", "++", ";", "//record the index of the first start token only", "if", "(", "startIndex", "==", "-", "1", ")", "{", "startIndex", "=", "itr", ".", "getIndex", "(", ")", "-", "1", ";", "}", "}", "else", "{", "itr", ".", "previous", "(", ")", ";", "}", "}", "else", "if", "(", "c", "==", "Config14Constants", ".", "EVAL_END_TOKEN", ".", "charAt", "(", "0", ")", ")", "{", "//if we encounter an end token which is matched by a start token", "if", "(", "startCount", ">", "0", ")", "{", "//decrement the start token counter", "startCount", "--", ";", "//if all start tokens have been matched with end tokens then we can do some processing", "if", "(", "startCount", "==", "0", ")", "{", "//record the index of the end token", "int", "endIndex", "=", "itr", ".", "getIndex", "(", ")", ";", "//extract the string inbetween the start and the end tokens", "String", "propertyName", "=", "resolved", ".", "substring", "(", "startIndex", "+", "2", ",", "endIndex", ")", ";", "//recursively resolve the property name string to account for nested variables", "String", "resolvedPropertyName", "=", "resolve", "(", "config", ",", "propertyName", ")", ";", "//once we have the fully resolved property name, find the string value for that property", "String", "resolvedValue", "=", "(", "String", ")", "config", ".", "getValue", "(", "resolvedPropertyName", ",", "//property name", "String", ".", "class", ",", "//conversion type", "false", ",", "//optional", "null", ",", "//default string", "true", ")", ";", "//evaluate variables", "//extract the part of the raw string which went before and after the variable", "String", "prefix", "=", "resolved", ".", "substring", "(", "0", ",", "startIndex", ")", ";", "String", "suffix", "=", "resolved", ".", "substring", "(", "endIndex", "+", "1", ")", ";", "//stitch it all back together", "resolved", "=", "prefix", "+", "resolvedValue", "+", "suffix", ";", "//work out where processing should resume from (after the variable)", "int", "index", "=", "prefix", ".", "length", "(", ")", "+", "resolvedValue", ".", "length", "(", ")", "-", "1", ";", "//reset the iterator", "itr", ".", "setText", "(", "resolved", ")", ";", "itr", ".", "setIndex", "(", "index", ")", ";", "//clear the start index", "startIndex", "=", "-", "1", ";", "}", "}", "}", "c", "=", "itr", ".", "next", "(", ")", ";", "//if we get to the end and a start was not matched, skip it and resume just after", "if", "(", "(", "c", "==", "CharacterIterator", ".", "DONE", ")", "&&", "(", "startIndex", ">", "-", "1", ")", "&&", "(", "startIndex", "<", "raw", ".", "length", "(", ")", ")", ")", "{", "//reset the iterator", "itr", ".", "setIndex", "(", "startIndex", "+", "2", ")", ";", "//clear the start index", "startIndex", "=", "-", "1", ";", "startCount", "=", "0", ";", "//resume", "c", "=", "itr", ".", "current", "(", ")", ";", "}", "}", "return", "resolved", ";", "}" ]
This method takes a raw value which may contain nested properties and resolves those properties into their actual values. e.g. given the following properties in the config greeting = hello text = my name is ${name} name = bob if the raw string was "${greeting}, ${text}" then the resulting string would be "hello, my name is bob" @param config the config instance to be used to look up nested properties @param raw the raw string to be resolved @return the fully resolved string
[ "This", "method", "takes", "a", "raw", "value", "which", "may", "contain", "nested", "properties", "and", "resolves", "those", "properties", "into", "their", "actual", "values", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.config.1.4/src/com/ibm/ws/microprofile/config14/impl/PropertyResolverUtil.java#L36-L112
train