code
stringlengths
73
34.1k
label
stringclasses
1 value
public static final void logMessage(Level level, String key, Object... args) { if (WsLevel.AUDIT.equals(level)) Tr.audit(tc, key, args); else if (WsLevel.ERROR.equals(level)) Tr.error(tc, key, args); else if (Level.INFO.equals(level)) Tr.info(tc, key, args); else if (Level.WARNING.equals(level)) Tr.warning(tc, key, args); else throw new UnsupportedOperationException(level.toString()); }
java
public static String getSessionID(HttpServletRequest req) { String sessionID = null; final HttpServletRequest f_req = req; try { sessionID = AccessController.doPrivileged(new PrivilegedExceptionAction<String>() { @Override public String run() throws Exception { HttpSession session = f_req.getSession(); if (session != null) { return session.getId(); } else { return null; } } }); } catch (PrivilegedActionException e) { if ((e.getException()) instanceof com.ibm.websphere.servlet.session.UnauthorizedSessionRequestException) { if (!req.isRequestedSessionIdFromCookie()) { sessionID = AccessController.doPrivileged(new PrivilegedAction<String>() { @Override public String run() { return f_req.getSession().getId(); } }); } else { sessionID = AccessController.doPrivileged(new PrivilegedAction<String>() { @Override public String run() { return f_req.getRequestedSessionId(); } }); } } } catch (com.ibm.websphere.servlet.session.UnauthorizedSessionRequestException e) { try { if (!req.isRequestedSessionIdFromCookie()) { sessionID = AccessController.doPrivileged(new PrivilegedAction<String>() { @Override public String run() { return f_req.getSession().getId(); } }); } else { sessionID = AccessController.doPrivileged(new PrivilegedAction<String>() { @Override public String run() { return f_req.getRequestedSessionId(); } }); } } catch (java.lang.NullPointerException ee) { sessionID = "UnauthorizedSessionRequest"; } catch (com.ibm.websphere.servlet.session.UnauthorizedSessionRequestException ue) { sessionID = "UnauthorizedSessionRequest"; } } return sessionID; }
java
public static String getRequestScheme(HttpServletRequest req) { String scheme; if (req.getScheme() != null) scheme = req.getScheme().toUpperCase(); else scheme = AuditEvent.REASON_TYPE_HTTP; return scheme; }
java
public static String getRequestMethod(HttpServletRequest req) { String method; if (req.getMethod() != null) method = req.getMethod().toUpperCase(); else method = AuditEvent.TARGET_METHOD_GET; return method; }
java
@Override public Object get() { Object oObject = null; synchronized (this) { // Check if any are free in the free hashtable if (lastEntry > -1) { // Free array has entries, get the last one. // remove last one for best performance oObject = free[lastEntry]; free[lastEntry] = null; if (lastEntry == firstEntry) { // none left in pool lastEntry = -1; firstEntry = -1; } else if (lastEntry > 0) { lastEntry = lastEntry - 1; } else { // last entry = 0, reset to end of list lastEntry = poolSize - 1; } } } if (oObject == null && factory != null) { oObject = factory.create(); } return oObject; }
java
@Override public Object put(Object object) { Object returnVal = null; long currentTime = CHFWBundle.getApproxTime(); synchronized (this) { // get next free position, or oldest position if none free lastEntry++; // If last entry is past end of array, go back to the beginning if (lastEntry == poolSize) { lastEntry = 0; } returnVal = free[lastEntry]; // get whatever was in that slot for return // value free[lastEntry] = object; timeFreed[lastEntry] = currentTime; // if we overlaid the first/oldest entry, reset the first entry position if (lastEntry == firstEntry) { firstEntry++; if (firstEntry == poolSize) { firstEntry = 0; } } if (firstEntry == -1) { // if pool was empty before, this is first entry now firstEntry = lastEntry; // should always be at '0', this may // overwrite the oldest entry, in which case // the oldest one will be garbage collected } if (returnVal != null && destroyer != null) { // @PK36998A destroyer.destroy(returnVal); } // check timestamp of oldest entry, and delete if older than 60 seconds // we should do a batch cleanup of all pools based on a timer rather than // waiting for a buffer to be released to trigger it, maybe in the next // release if (cleanUpOld) { while (firstEntry != lastEntry) { if (currentTime > (timeFreed[firstEntry] + 60000L)) { if (destroyer != null && free[firstEntry] != null) { // @PK36998A destroyer.destroy(free[firstEntry]); } free[firstEntry] = null; firstEntry++; if (firstEntry == poolSize) { firstEntry = 0; } } else break; } } } return returnVal; }
java
protected void putBatch(Object[] objectArray) { int index = 0; synchronized (this) { while (index < objectArray.length && objectArray[index] != null) { put(objectArray[index]); index++; } } return; }
java
public JsJmsMessage createJmsMessage() throws MessageCreateFailedException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createJmsMessage"); JsJmsMessage msg = null; try { msg = new JsJmsMessageImpl(MfpConstants.CONSTRUCTOR_NO_OP); } catch (MessageDecodeFailedException e) { /* No need to FFDC this as JsMsgObject will already have done so */ // No FFDC code needed throw new MessageCreateFailedException(e); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createJmsMessage"); return msg; }
java
public JsJmsBytesMessage createJmsBytesMessage() throws MessageCreateFailedException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createJmsBytesMessage"); JsJmsBytesMessage msg = null; try { msg = new JsJmsBytesMessageImpl(MfpConstants.CONSTRUCTOR_NO_OP); } catch (MessageDecodeFailedException e) { /* No need to FFDC this as JsMsgObject will already have done so */ // No FFDC code needed throw new MessageCreateFailedException(e); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createJmsBytesMessage"); return msg; }
java
public JsJmsMapMessage createJmsMapMessage() throws MessageCreateFailedException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createJmsMapMessage"); JsJmsMapMessage msg = null; try { msg = new JsJmsMapMessageImpl(MfpConstants.CONSTRUCTOR_NO_OP); } catch (MessageDecodeFailedException e) { /* No need to FFDC this as JsMsgObject will already have done so */ // No FFDC code needed throw new MessageCreateFailedException(e); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createJmsMapMessage"); return msg; }
java
public JsJmsObjectMessage createJmsObjectMessage() throws MessageCreateFailedException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createJmsObjectMessage"); JsJmsObjectMessage msg = null; try { msg = new JsJmsObjectMessageImpl(MfpConstants.CONSTRUCTOR_NO_OP); } catch (MessageDecodeFailedException e) { /* No need to FFDC this as JsMsgObject will already have done so */ // No FFDC code needed throw new MessageCreateFailedException(e); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createJmsObjectMessage"); return msg; }
java
public JsJmsStreamMessage createJmsStreamMessage() throws MessageCreateFailedException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createJmsStreamMessage"); JsJmsStreamMessage msg = null; try { msg = new JsJmsStreamMessageImpl(MfpConstants.CONSTRUCTOR_NO_OP); } catch (MessageDecodeFailedException e) { /* No need to FFDC this as JsMsgObject will already have done so */ // No FFDC code needed throw new MessageCreateFailedException(e); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createJmsStreamMessage"); return msg; }
java
public JsJmsTextMessage createJmsTextMessage() throws MessageCreateFailedException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createJmsTextMessage"); JsJmsTextMessage msg = null; try { msg = new JsJmsTextMessageImpl(MfpConstants.CONSTRUCTOR_NO_OP); } catch (MessageDecodeFailedException e) { /* No need to FFDC this as JsMsgObject will already have done so */ // No FFDC code needed throw new MessageCreateFailedException(e); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createJmsTextMessage"); return msg; }
java
private void saveDecryptedPositions() { for (int i = 0; i < decryptedNetPosInfo.length; i++) { decryptedNetPosInfo[i] = 0; } if (null != getBuffers()) { WsByteBuffer[] buffers = getBuffers(); if (buffers.length > decryptedNetPosInfo.length) { decryptedNetPosInfo = new int[buffers.length]; } for (int i = 0; i < buffers.length && null != buffers[i]; i++) { decryptedNetPosInfo[i] = buffers[i].position(); } } }
java
@Override public VirtualConnection read(long numBytes, TCPReadCompletedCallback userCallback, boolean forceQueue, int timeout) { // Call the async read with a flag showing this was not done from a queued request. return read(numBytes, userCallback, forceQueue, timeout, false); }
java
private void handleAsyncComplete(boolean forceQueue, TCPReadCompletedCallback inCallback) { boolean fireHere = true; if (forceQueue) { // Complete must be returned on a separate thread. // Reuse queuedWork object (performance), but reset the error parameters. queuedWork.setCompleteParameters(getConnLink().getVirtualConnection(), this, inCallback); EventEngine events = SSLChannelProvider.getEventService(); if (null == events) { Exception e = new Exception("missing event service"); FFDCFilter.processException(e, getClass().getName(), "471", this); // fall-thru below and use callback here regardless } else { // fire an event to continue this queued work Event event = events.createEvent(SSLEventHandler.TOPIC_QUEUED_WORK); event.setProperty(SSLEventHandler.KEY_RUNNABLE, this.queuedWork); events.postEvent(event); fireHere = false; } } if (fireHere) { // Call the callback right here. inCallback.complete(getConnLink().getVirtualConnection(), this); } }
java
private void handleAsyncError(boolean forceQueue, IOException exception, TCPReadCompletedCallback inCallback) { boolean fireHere = true; if (forceQueue) { // Error must be returned on a separate thread. // Reuse queuedWork object (performance), but reset the error parameters. queuedWork.setErrorParameters(getConnLink().getVirtualConnection(), this, inCallback, exception); EventEngine events = SSLChannelProvider.getEventService(); if (null == events) { Exception e = new Exception("missing event service"); FFDCFilter.processException(e, getClass().getName(), "503", this); // fall-thru below and use callback here regardless } else { // fire an event to continue this queued work Event event = events.createEvent(SSLEventHandler.TOPIC_QUEUED_WORK); event.setProperty(SSLEventHandler.KEY_RUNNABLE, this.queuedWork); events.postEvent(event); fireHere = false; } } if (fireHere) { // Call the callback right here. inCallback.error(getConnLink().getVirtualConnection(), this, exception); } }
java
public long readUnconsumedDecData() { long totalBytesRead = 0L; // Determine if data is left over from a former read request. if (unconsumedDecData != null) { // Left over data exists. Is there enough to satisfy the request? if (getBuffer() == null) { // Caller needs us to allocate the buffer to return. if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Caller needs buffer, unconsumed data: " + SSLUtils.getBufferTraceInfo(unconsumedDecData)); } // Note, data of unconsumedDecData buffer array should be starting // at position 0 in the first buffer. totalBytesRead = SSLUtils.lengthOf(unconsumedDecData, 0); // First release any existing buffers in decryptedNetBuffers array. cleanupDecBuffers(); callerRequiredAllocation = true; // Note, it is the responsibility of the calling channel to release this buffer. decryptedNetBuffers = unconsumedDecData; // Set left over buffers to null to note that they are no longer in use. unconsumedDecData = null; if ((decryptedNetLimitInfo == null) || (decryptedNetLimitInfo.length != decryptedNetBuffers.length)) { decryptedNetLimitInfo = new int[decryptedNetBuffers.length]; } SSLUtils.getBufferLimits(decryptedNetBuffers, decryptedNetLimitInfo); } else { // Caller provided buffers for read. We need to copy the left over // data to those buffers. if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Caller provided buffers, unconsumed data: " + SSLUtils.getBufferTraceInfo(unconsumedDecData)); } // First release any existing buffers in decryptedNetBuffers array. cleanupDecBuffers(); // The unconsumedDecData buffers have the data to copy to the user buffers. // The copyDataToCallerBuffers method copies from decryptedNetBuffers, so assign it. decryptedNetBuffers = unconsumedDecData; // Copy the outputbuffer to the buffers provided by the caller. totalBytesRead = copyDataToCallerBuffers(); // Null out the reference to the overflow buffers. decryptedNetBuffers = null; } } return totalBytesRead; }
java
protected void getNetworkBuffer(long requestedSize) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "getNetworkBuffer: size=" + requestedSize); } // Reset the netBuffer mark. this.netBufferMark = 0; int allocationSize = getConnLink().getPacketBufferSize(); if (allocationSize < requestedSize) { allocationSize = (int) requestedSize; } if (null == this.netBuffer) { // Need to allocate a buffer to give to the device channel to read into. this.netBuffer = SSLUtils.allocateByteBuffer(allocationSize, true); } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Found existing netbuffer, " + SSLUtils.getBufferTraceInfo(netBuffer)); } int cap = netBuffer.capacity(); int pos = netBuffer.position(); int lim = netBuffer.limit(); if (pos == lim) { // 431269 - nothing is currently in this buffer, see if we can reuse it if (cap >= allocationSize) { this.netBuffer.clear(); } else { this.netBuffer.release(); this.netBuffer = SSLUtils.allocateByteBuffer(allocationSize, true); } } else { // if we have less than the allocation size amount of data + empty, // then make a new buffer to start clean inside of... if ((cap - pos) < allocationSize) { // allocate a new buffer, copy the existing data over WsByteBuffer buffer = SSLUtils.allocateByteBuffer(allocationSize, true); SSLUtils.copyBuffer(this.netBuffer, buffer, lim - pos); this.netBuffer.release(); this.netBuffer = buffer; } else { this.netBufferMark = pos; this.netBuffer.position(lim); this.netBuffer.limit(cap); } } } // Inform the device side channel to read into the new buffers. deviceReadContext.setBuffer(this.netBuffer); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "netBuffer: " + SSLUtils.getBufferTraceInfo(this.netBuffer)); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "getNetworkBuffer"); } }
java
private void cleanupDecBuffers() { // if we have decrypted buffers and they are either JIT created or made // during decryption/expansion (user buffers too small) then release them // here and dereference if (null != this.decryptedNetBuffers && (callerRequiredAllocation || decryptedNetBufferReleaseRequired)) { WsByteBufferUtils.releaseBufferArray(this.decryptedNetBuffers); this.decryptedNetBuffers = null; } }
java
public void close() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "close, vc=" + getVCHash()); } synchronized (closeSync) { if (closeCalled) { return; } closeCalled = true; if (null != this.netBuffer) { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Releasing netBuffer during close " + SSLUtils.getBufferTraceInfo(netBuffer)); } this.netBuffer.release(); this.netBuffer = null; } cleanupDecBuffers(); if (unconsumedDecData != null) { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Releasing unconsumed decrypted buffers, " + SSLUtils.getBufferTraceInfo(unconsumedDecData)); } WsByteBufferUtils.releaseBufferArray(unconsumedDecData); unconsumedDecData = null; } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "close"); } }
java
private SSLEngineResult doHandshake(boolean async) throws IOException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "doHandshake"); } SSLEngineResult sslResult; // Line up all the buffers needed for the SSL handshake. Temporary so // use indirect allocation for speed. int appSize = getConnLink().getAppBufferSize(); int packetSize = getConnLink().getPacketBufferSize(); WsByteBuffer localNetBuffer = SSLUtils.allocateByteBuffer(packetSize, true); WsByteBuffer decryptedNetBuffer = SSLUtils.allocateByteBuffer(appSize, false); WsByteBuffer encryptedAppBuffer = SSLUtils.allocateByteBuffer(packetSize, true); // Callback to be used if the request is async. MyHandshakeCompletedCallback handshakeCallback = null; if (async) { handshakeCallback = new MyHandshakeCompletedCallback(this, callback, localNetBuffer, decryptedNetBuffer, encryptedAppBuffer); } try { // Do the SSL handshake. Note, if synchronous the handshakeCallback is null. sslResult = SSLUtils.handleHandshake( getConnLink(), localNetBuffer, decryptedNetBuffer, encryptedAppBuffer, null, handshakeCallback, false); } catch (IOException e) { // Release buffers used in the handshake. localNetBuffer.release(); localNetBuffer = null; decryptedNetBuffer.release(); decryptedNetBuffer = null; encryptedAppBuffer.release(); encryptedAppBuffer = null; throw e; } if (sslResult != null) { // Handshake was done synchronously. // Release buffers used in the handshake. localNetBuffer.release(); localNetBuffer = null; decryptedNetBuffer.release(); decryptedNetBuffer = null; encryptedAppBuffer.release(); encryptedAppBuffer = null; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "doHandshake"); } return sslResult; }
java
protected ContextualStorage getContextualStorage(boolean createIfNotExist, String clientWindowFlowId) { //FacesContext facesContext = FacesContext.getCurrentInstance(); //String clientWindowFlowId = getCurrentClientWindowFlowId(facesContext); if (clientWindowFlowId == null) { throw new ContextNotActiveException("FlowScopedContextImpl: no current active flow"); } if (createIfNotExist) { return getFlowScopeBeanHolder().getContextualStorage(beanManager, clientWindowFlowId); } else { return getFlowScopeBeanHolder().getContextualStorageNoCreate(beanManager, clientWindowFlowId); } }
java
protected void proxyReadHandshake() { // setup the read buffer - use JIT on the first read attempt. If it // works, then any subsequent reads will use that same buffer. connLink.getReadInterface().setJITAllocateSize(1024); // reader.setBuffer(WsByteBufferPoolManagerImpl.getRef().allocate(1024)); if (connLink.isAsyncConnect()) { // handshake - read the proxy response this.proxyReadCB = new ProxyReadCallback(); readProxyResponse(connLink.getVirtualConnection()); } else { int rc = STATUS_NOT_DONE; while (rc == STATUS_NOT_DONE) { readProxyResponse(connLink.getVirtualConnection()); rc = checkResponse(connLink.getReadInterface()); } if (rc == STATUS_ERROR) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "could not complete proxy handshake, read request failed"); } releaseProxyReadBuffer(); // if (null == this.syncError) { if (connLink.isSyncError() == false) { // create a new connect exception connLink.connectFailed(new IOException("Invalid Proxy Server Response ")); } } } }
java
protected int checkResponse(TCPReadRequestContext rsc) { // Parse the proxy server response // WsByteBuffer[] buffers = rsc.getBuffers(); // check if the correct response was received if (null == buffers) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Could not complete proxy handshake, null buffers"); } return STATUS_ERROR; } int status = validateProxyResponse(buffers); if (STATUS_DONE == status) { releaseProxyReadBuffer(); } return status; }
java
protected void releaseProxyWriteBuffer() { WsByteBuffer buffer = connLink.getWriteInterface().getBuffer(); if (null != buffer) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Releasing proxy write buffer: " + buffer); } buffer.release(); connLink.getWriteInterface().setBuffer(null); } }
java
protected void releaseProxyReadBuffer() { WsByteBuffer buffer = connLink.getReadInterface().getBuffer(); if (null != buffer) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Releasing proxy read buffer: " + buffer); } buffer.release(); connLink.getReadInterface().setBuffer(null); } }
java
protected boolean containsHTTP200(byte[] data) { boolean rc = true; // byte comparison to check for HTTP and 200 in the response // this code is not pretty, it is designed to be fast // code assumes that HTTP/1.0 200 will be contained in one buffer // if (data.length < 12 || data[0] != 'H' || data[1] != 'T' || data[2] != 'T' || data[3] != 'P' || data[9] != '2' || data[10] != '0' || data[11] != '0') { rc = false; } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "containsHTTP200: " + rc); } return rc; }
java
protected void readProxyResponse(VirtualConnection inVC) { int size = 1; if (!this.isProxyResponseValid) { // we need at least 12 bytes for the first line size = 12; } if (connLink.isAsyncConnect()) { VirtualConnection vcRC = connLink.getReadInterface().read(size, this.proxyReadCB, false, TCPRequestContext.USE_CHANNEL_TIMEOUT); if (null != vcRC) { this.proxyReadCB.complete(vcRC, connLink.getReadInterface()); } } else { try { connLink.getReadInterface().read(size, TCPRequestContext.USE_CHANNEL_TIMEOUT); } catch (IOException x) { // no FFDC required if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "could not complete proxy handshake, read request failed"); } releaseProxyReadBuffer(); connLink.connectFailed(x); } } }
java
public synchronized void setDefaultDestLimits() throws MessageStoreException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "setDefaultDestLimits"); // Defaults are based on those defined to the ME, the low is 80% of the high // Use setDestLimits() to set the initial limits/watermarks (510343) long destHighMsgs = mp.getHighMessageThreshold(); setDestLimits(destHighMsgs, (destHighMsgs * 8) / 10); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "setDefaultDestLimits"); }
java
public long getDestHighMsgs() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, "getDestHighMsgs"); SibTr.exit(tc, "getDestHighMsgs", Long.valueOf(_destHighMsgs)); } return _destHighMsgs; }
java
public long getDestLowMsgs() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, "getDestLowMsgs"); SibTr.exit(tc, "getDestLowMsgs", Long.valueOf(_destLowMsgs)); } return _destLowMsgs; }
java
public void fireDepthThresholdReachedEvent(ControlAdapter cAdapter, boolean reachedHigh, long numMsgs, long msgLimit) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "fireDepthThresholdReachedEvent", new Object[] { cAdapter, new Boolean(reachedHigh), new Long(numMsgs) }); // Retrieve appropriate information String destinationName = destinationHandler.getName(); String meName = mp.getMessagingEngineName(); // If we've been told to output the event message to the log, do it... if (mp.getCustomProperties().getOutputDestinationThresholdEventsToLog()) { if (reachedHigh) SibTr.info(tc, "NOTIFY_DEPTH_THRESHOLD_REACHED_CWSIP0553", new Object[] { destinationName, meName, msgLimit }); else SibTr.info(tc, "NOTIFY_DEPTH_THRESHOLD_REACHED_CWSIP0554", new Object[] { destinationName, meName, msgLimit }); } // If we're actually issuing events, do that too... if (_isEventNotificationEnabled) { if (cAdapter != null) { // Build the message for the Notification String message = null; if (reachedHigh) message = nls.getFormattedMessage("NOTIFY_DEPTH_THRESHOLD_REACHED_CWSIP0553", new Object[] { destinationName, meName, msgLimit }, null); else message = nls.getFormattedMessage("NOTIFY_DEPTH_THRESHOLD_REACHED_CWSIP0554", new Object[] { destinationName, meName, msgLimit }, null); // Build the properties for the Notification Properties props = new Properties(); props.put(SibNotificationConstants.KEY_DESTINATION_NAME, destinationName); props.put(SibNotificationConstants.KEY_DESTINATION_UUID, destinationHandler.getUuid().toString()); if (reachedHigh) props.put(SibNotificationConstants.KEY_DEPTH_THRESHOLD_REACHED, SibNotificationConstants.DEPTH_THRESHOLD_REACHED_HIGH); else props.put(SibNotificationConstants.KEY_DEPTH_THRESHOLD_REACHED, SibNotificationConstants.DEPTH_THRESHOLD_REACHED_LOW); // Number of Messages props.put(SibNotificationConstants.KEY_MESSAGES, String.valueOf(numMsgs)); // Now create the Event object to pass to the control adapter MPRuntimeEvent MPevent = new MPRuntimeEvent(SibNotificationConstants.TYPE_SIB_MESSAGEPOINT_DEPTH_THRESHOLD_REACHED, message, props); // Fire the event if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "fireDepthThresholdReachedEvent", "Drive runtimeEventOccurred against Control adapter: " + cAdapter); cAdapter.runtimeEventOccurred(MPevent); } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "fireDepthThresholdReachedEvent", "Control adapter is null, cannot fire event"); } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "fireDepthThresholdReachedEvent"); }
java
private void reschedule() { // set up a daily roll Calendar cal = Calendar.getInstance(); long today = cal.getTimeInMillis(); // adjust to somewhere after midnight of the next day cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0); cal.add(Calendar.DATE, 1); long tomorrow = cal.getTimeInMillis(); if (executorService != null) { future = executorService.schedule(this, tomorrow - today, TimeUnit.MILLISECONDS); } }
java
@Override public void run() { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) // F743-425.CodRev Tr.entry(tc, "run: " + ivTimer.ivTaskId); // F743-425.CodRev if (serverStopping) { if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "Server shutting down; aborting"); return; } if (ivRetries == 0) // This is the first try { // F743-7591 - Calculate the next expiration before calling the timeout // method. This ensures that Timer.getNextTimeout will properly throw // NoMoreTimeoutsException. ivTimer.calculateNextExpiration(); } // Log a warning if this timer is starting late ivTimer.checkLateTimerThreshold(); try // F743-425.CodRev { // Call the timeout method; last chance effort to abort if cancelled if (!ivTimer.isIvDestroyed()) { doWork(); } else { if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "Timer has been cancelled; aborting"); return; } ivRetries = 0; // re-schedule the alarm to go off again if it needs to, // and if timer had not been canceled ivTimer.scheduleNext(); // RTC107334 } catch (Throwable ex) // F743-425.CodRev { // Do not FFDC... that has already been done when the method failed // All exceptions from timeout methods are system exceptions... // indicating the timeout method failed, and should be retried. d667153 if (isTraceOn && tc.isDebugEnabled()) { Tr.debug(tc, "NP Timer failed : " + ex.getClass().getName() + ":" + ex.getMessage(), ex); } if ((ivRetryLimit != -1) && // not configured to retry indefinitely (ivRetries >= ivRetryLimit)) // and retry limit reached { // Note: ivRetryLimit==0 means no retries at all ivTimer.calculateNextExpiration(); ivTimer.scheduleNext(); ivRetries = 0; Tr.warning(tc, "NP_TIMER_RETRY_LIMIT_REACHED_CNTR0179W", ivRetryLimit); if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "Timer retry limit has been reached; aborting"); return; } ivRetries++; // begin 597753 if (ivRetries == 1) { // do first retry immediately, by re-entering this method run(); } else { // re-schedule the alarm to go off after the retry interval // (if timer had not been canceled) ivTimer.scheduleRetry(ivRetryInterval); // RTC107334 } } if (isTraceOn && tc.isEntryEnabled()) // F743-425.CodRev Tr.exit(tc, "run"); // F743-425.CodRev }
java
public static Document parseDocument(DocumentBuilder builder, File file) throws IOException, SAXException { final DocumentBuilder docBuilder = builder; final File parsingFile = file; try { return (Document) AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws SAXException, IOException { Thread currThread = Thread.currentThread(); ClassLoader oldLoader = currThread.getContextClassLoader(); currThread.setContextClassLoader(ParserFactory.class.getClassLoader()); try { return docBuilder.parse(parsingFile); } finally { currThread.setContextClassLoader(oldLoader); } } }); } catch (PrivilegedActionException pae) { Throwable t = pae.getCause(); if (t instanceof SAXException) { throw (SAXException) t; } else if (t instanceof IOException) { throw (IOException) t; } } return null; }
java
protected boolean checkBuffer() throws IOException { if (!enableMultiReadofPostData) { if (null != this.buffer) { if (this.buffer.hasRemaining()) { return true; } this.buffer.release(); this.buffer = null; } try { this.buffer = this.isc.getRequestBodyBuffer(); if (null != this.buffer) { // record the new amount of data read from the channel this.bytesRead += this.buffer.remaining(); // Tr.debug(tc, "Buffer=" + WsByteBufferUtils.asString(this.buffer)); return true; } return false; } catch (IOException e) { this.error = e; throw e; } } else { return checkMultiReadBuffer(); } }
java
private boolean checkMultiReadBuffer() throws IOException { //first check existing buffer if (null != this.buffer) { if (this.buffer.hasRemaining()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "checkMultiReadBuffer, remaining ->" + this); } return true; } if (firstReadCompleteforMulti) { // multiRead enabled and subsequent read if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "checkMultiReadBuffer, buffer is completely read, ready this buffer for the subsequent read ->" + this); } postDataBuffer.get(postDataIndex).flip(); // make position 0 , to read it again from start postDataIndex++; } else { this.buffer.release(); } this.buffer = null; } // no buffer read from store or first read of buffer if (firstReadCompleteforMulti) { // first read from what we have stored, if need more than go to channel if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "checkMultiReadBuffer ,index ->" + postDataIndex + " ,storage.size ->" + postDataBuffer.size()); } if (postDataBuffer.size() <= postDataIndex) { //get remaining from channel now as read needs more than the stored readRemainingFromChannel(); } if (postDataBuffer.size() > postDataIndex) { this.buffer = postDataBuffer.get(postDataIndex); } if (null != this.buffer) { // record the new amount of data read from the store this.bytesReadFromStore += this.buffer.remaining(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "checkMultiReadBuffer ->" + this); } return true; } } else { // multiRead enabled and first read if (getBufferFromChannel()) { // store the channel buffer postDataBuffer.add(postDataIndex, this.buffer.duplicate()); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "checkMultiReadBuffer, buffer ->" + postDataBuffer.get(postDataIndex) + " ,buffersize ->" + postDataBuffer.size() + " ,index ->" + postDataIndex); } postDataIndex++; // record the new amount of data read from the channel this.bytesRead += this.buffer.remaining(); return true; } } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "checkMultiReadBuffer: no more buffer ->" + this); } return false; }
java
public static EsaSubsystemFeatureDefinitionImpl constructInstance(File esa) throws ZipException, IOException { // Find the manifest - case isn't guaranteed so do a search ZipFile zip = new ZipFile(esa); Enumeration<? extends ZipEntry> zipEntries = zip.entries(); ZipEntry subsystemEntry = null; while (zipEntries.hasMoreElements()) { ZipEntry nextEntry = zipEntries.nextElement(); if ("OSGI-INF/SUBSYSTEM.MF".equalsIgnoreCase(nextEntry.getName())) { subsystemEntry = nextEntry; } } return new EsaSubsystemFeatureDefinitionImpl(zip.getInputStream(subsystemEntry), zip); }
java
static String formatTime() { Date date = new Date(); DateFormat formatter = BaseTraceFormatter.useIsoDateFormat ? new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ") : DateFormatProvider.getDateFormat(); StringBuffer answer = new StringBuffer(); answer.append('['); formatter.format(date, answer, new FieldPosition(0)); answer.append(']'); return answer.toString(); }
java
private static String[] getCallStackFromStackTraceElement(StackTraceElement[] exceptionCallStack) { if (exceptionCallStack == null) return null; String[] answer = new String[exceptionCallStack.length]; for (int i = 0; i < exceptionCallStack.length; i++) { answer[exceptionCallStack.length - 1 - i] = exceptionCallStack[i].getClassName(); } return answer; }
java
private static String getPackageName(String className) { int end = className.lastIndexOf('.'); return (end > 0) ? className.substring(0, end) : ""; }
java
public String validateCookieName(String cookieName, boolean quiet) { if (cookieName == null || cookieName.length() == 0) { if (!quiet) { Tr.error(tc, "COOKIE_NAME_CANT_BE_EMPTY"); } return CFG_DEFAULT_COOKIENAME; } String cookieNameUc = cookieName.toUpperCase(); boolean valid = true; for (int i = 0; i < cookieName.length(); i++) { String eval = cookieNameUc.substring(i, i + 1); if (!validCookieChars.contains(eval)) { if (!quiet) { Tr.error(tc, "COOKIE_NAME_INVALID", new Object[] { cookieName, eval }); } valid = false; } } if (!valid) { return CFG_DEFAULT_COOKIENAME; } else { return cookieName; } }
java
public void distributeBefore() { if (tc.isEntryEnabled()) Tr.entry(tc, "distributeBefore", this); boolean setRollback = false; try { coreDistributeBefore(); } catch (Throwable exc) { // No FFDC Code Needed. Tr.error(tc, "WTRN0074_SYNCHRONIZATION_EXCEPTION", new Object[] {"before_completion", exc}); // PK19059 starts here _tran.setOriginalException(exc); // PK19059 ends here setRollback = true; } // Finally issue the RRS syncs - z/OS always issues these even if RBO has occurred // during previous syncs. Need to check with Matt if we need to do these even if the // overall transaction is set to RBO as we bypass distributeBefore in this case. final List RRSsyncs = _syncs[SYNC_TIER_RRS]; if (RRSsyncs != null) { for (int j = 0; j < RRSsyncs.size(); j++ ) // d162354 array could grow { final Synchronization sync = (Synchronization)RRSsyncs.get(j); if (tc.isEventEnabled()) Tr.event(tc, "driving RRS before sync[" + j + "]", Util.identity(sync)); try { sync.beforeCompletion(); } catch (Throwable exc) { // No FFDC Code Needed. Tr.error(tc, "WTRN0074_SYNCHRONIZATION_EXCEPTION", new Object[] {"before_completion", exc}); setRollback = true; } } // If RRS syncs, one may be DB2 type 2, so issue thread switch // NativeJDBCDriverHelper.threadSwitch(); /* @367977A*/ } //---------------------------------------------------------- // If we've encountered an error, try to set rollback only //---------------------------------------------------------- if (setRollback && _tran != null) { try { _tran.setRollbackOnly(); } catch (Exception ex) { if (tc.isDebugEnabled()) Tr.debug(tc, "setRollbackOnly raised exception", ex); } } if (tc.isEntryEnabled()) Tr.exit(tc, "distributeBefore"); }
java
public void distributeAfter(int status) { if (tc.isEntryEnabled()) Tr.entry(tc, "distributeAfter", new Object[] { this, status}); // Issue the RRS syncs first - these need to be as close to the completion as possible final List RRSsyncs = _syncs[SYNC_TIER_RRS]; if (RRSsyncs != null) { final int RRSstatus = (status == Status.STATUS_UNKNOWN ? Status.STATUS_COMMITTED : status); // @281425A for (int j = RRSsyncs.size(); --j >= 0;) { final Synchronization sync = (Synchronization)RRSsyncs.get(j); try { if (tc.isEntryEnabled()) Tr.event(tc, "driving RRS after sync[" + j + "]", Util.identity(sync)); sync.afterCompletion(RRSstatus); // @281425C } catch (Throwable exc) { // No FFDC Code Needed. // Discard any exceptions at this point. Tr.error(tc, "WTRN0074_SYNCHRONIZATION_EXCEPTION", new Object[] {"after_completion", exc}); } } } coreDistributeAfter(status); if (tc.isEntryEnabled()) Tr.exit(tc, "distributeAfter"); }
java
public static UDPBufferFactory getRef() { if (null == ofInstance) { synchronized (UDPBufferFactory.class) { if (null == ofInstance) { ofInstance = new UDPBufferFactory(); } } } return ofInstance; }
java
public static UDPBufferImpl getUDPBuffer(WsByteBuffer buffer, SocketAddress address) { UDPBufferImpl udpBuffer = getRef().getUDPBufferImpl(); udpBuffer.set(buffer, address); return udpBuffer; }
java
protected UDPBufferImpl getUDPBufferImpl() { UDPBufferImpl ret = (UDPBufferImpl) udpBufferObjectPool.get(); if (ret == null) { ret = new UDPBufferImpl(this); } return ret; }
java
public String logDirectory() { if (tc.isEntryEnabled()) Tr.entry(tc, "logDirectory", this); if (tc.isEntryEnabled()) Tr.exit(tc, "logDirectory", _logDirectory); return _logDirectory; }
java
public String logDirectoryStem() { if (tc.isEntryEnabled()) Tr.entry(tc, "logDirectoryStem", this); if (tc.isEntryEnabled()) Tr.exit(tc, "logDirectoryStem", _logDirectoryStem); return _logDirectoryStem; }
java
public int logFileSize() { if (tc.isEntryEnabled()) Tr.entry(tc, "logFileSize", this); if (tc.isEntryEnabled()) Tr.exit(tc, "logFileSize", new Integer(_logFileSize)); return _logFileSize; }
java
public int maxLogFileSize() { if (tc.isEntryEnabled()) Tr.entry(tc, "maxLogFileSize", this); if (tc.isEntryEnabled()) Tr.exit(tc, "maxLogFileSize", new Integer(_maxLogFileSize)); return _maxLogFileSize; }
java
void unregister() { trackerLock.lock(); try { if (tracker != null) { // simply closing the tracker causes the services to be unregistered tracker.close(); tracker = null; } } finally { trackerLock.unlock(); } }
java
void update() { final BundleContext context = componentContext.getBundleContext(); // determine the service filter to use for discovering the Library service this bell is for String libraryRef = library.id(); // it is unclear if only looking at the id would work here. // other examples in classloading use both id and service.pid to look up so doing the same here. String libraryStatusFilter = String.format("(&(objectClass=%s)(|(id=%s)(service.pid=%s)))", Library.class.getName(), libraryRef, libraryRef); Filter filter; try { filter = context.createFilter(libraryStatusFilter); } catch (InvalidSyntaxException e) { // should not happen, but blow up if it does throw new RuntimeException(e); } final Set<String> serviceNames = getServiceNames((String[]) config.get(SERVICE_ATT)); // create a tracker that will register the services once the library becomes available ServiceTracker<Library, List<ServiceRegistration<?>>> newTracker = null; newTracker = new ServiceTracker<Library, List<ServiceRegistration<?>>>(context, filter, new ServiceTrackerCustomizer<Library, List<ServiceRegistration<?>>>() { @Override public List<ServiceRegistration<?>> addingService(ServiceReference<Library> libraryRef) { Library library = context.getService(libraryRef); // Got the library now register the services. // The list of registrations is returned so we don't have to store them ourselves. return registerLibraryServices(library, serviceNames); } @Override public void modifiedService(ServiceReference<Library> libraryRef, List<ServiceRegistration<?>> metaInfServices) { // don't care } @Override @FFDCIgnore(IllegalStateException.class) public void removedService(ServiceReference<Library> libraryRef, List<ServiceRegistration<?>> metaInfServices) { // THe library is going away; need to unregister the services for (ServiceRegistration<?> registration : metaInfServices) { try { registration.unregister(); } catch (IllegalStateException e) { // ignore; already unregistered } } context.ungetService(libraryRef); } }); trackerLock.lock(); try { if (tracker != null) { // close the existing tracker so we unregister existing services tracker.close(); } // store and open the new tracker so we can register the configured services. tracker = newTracker; tracker.open(); } finally { trackerLock.unlock(); } }
java
public static <T extends Constructible> T createObject(Class<T> clazz) { return OASFactoryResolver.instance().createObject(clazz); }
java
private void printErrorMessage(String key, Object... substitutions) { Tr.error(tc, key, substitutions); errorMsgIssued = true; }
java
@Trivial protected Object evaluateElExpression(String expression, boolean mask) { final String methodName = "evaluateElExpression"; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, methodName, new Object[] { (expression == null) ? null : mask ? OBFUSCATED_STRING : expression, mask }); } EvalPrivilegedAction evalPrivilegedAction = new EvalPrivilegedAction(expression, mask); Object result = AccessController.doPrivileged(evalPrivilegedAction); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, methodName, (result == null) ? null : mask ? OBFUSCATED_STRING : result); } return result; }
java
@Trivial static boolean isImmediateExpression(String expression, boolean mask) { final String methodName = "isImmediateExpression"; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, methodName, new Object[] { (expression == null) ? null : mask ? OBFUSCATED_STRING : expression, mask }); } boolean result = expression.startsWith("${") && expression.endsWith("}"); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, methodName, result); } return result; }
java
@Trivial static String removeBrackets(String expression, boolean mask) { final String methodName = "removeBrackets"; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, methodName, new Object[] { (expression == null) ? null : mask ? OBFUSCATED_STRING : expression, mask }); } expression = expression.trim(); if ((expression.startsWith("${") || expression.startsWith("#{")) && expression.endsWith("}")) { expression = expression.substring(2, expression.length() - 1); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, methodName, (expression == null) ? null : mask ? OBFUSCATED_STRING : expression); } return expression; }
java
@SuppressWarnings("unchecked") private ThreadLocalProxyCopyOnWriteArraySet<ThreadLocalProxy<?>> getProxySet() { Object property = null; property = bus.getProperty(PROXY_SET); if (property == null) { ThreadLocalProxyCopyOnWriteArraySet<ThreadLocalProxy<?>> proxyMap = new ThreadLocalProxyCopyOnWriteArraySet<ThreadLocalProxy<?>>(); bus.setProperty(PROXY_SET, proxyMap); property = proxyMap; } return (ThreadLocalProxyCopyOnWriteArraySet<ThreadLocalProxy<?>>) property; }
java
private void skipClasslessStackFrames() { // skip over any stack trace elements that are unmatched in the classes array if (classes.isEmpty()) return; while (elements.size() > 0 && !!!elements.peek().getClassName().equals(classes.peek().getName())) { elements.pop(); } }
java
public static boolean unregisterExtension(String key) { if (key == null) { throw new IllegalArgumentException( "Parameter 'key' can not be null"); } w.lock(); try { return extensionMap.remove(key) != null; } finally { w.unlock(); } }
java
public static void getExtensions(Map<String, String> map) throws IllegalArgumentException { if (map == null) { throw new IllegalArgumentException( "Parameter 'map' can not be null."); } if (recursion.get() == Boolean.TRUE) { return; } recursion.set(Boolean.TRUE); LinkedList<String> cleanup = new LinkedList<String>(); r.lock(); try { for (Map.Entry<String, WeakReference<Extension>> entry : extensionMap .entrySet()) { Extension extension = entry.getValue().get(); if (extension == null) { cleanup.add(entry.getKey()); } else { String value = extension.getValue(); if (value != null) { map.put(entry.getKey(), value); } } } } finally { r.unlock(); recursion.remove(); } if (cleanup.size() > 0) { w.lock(); try { for (String key : cleanup) { WeakReference<Extension> extension = extensionMap .remove(key); if (extension != null && extension.get() != null) { // Special case! Somebody has put new extension for this // key after we released // read lock and before we took write lock. We need to // put it back. extensionMap.put(key, extension); } } } finally { w.unlock(); } } if (extensions.get() != null) { for (Entry<String, String> entry : extensions.get().entrySet()) { map.put(entry.getKey(), entry.getValue()); } } }
java
@FFDCIgnore(Exception.class) private void logProviderInfo(String providerName, ClassLoader loader) { try { if (PROVIDER_ECLIPSELINK.equals(providerName)) { // org.eclipse.persistence.Version.getVersion(): 2.6.4.v20160829-44060b6 Class<?> Version = loadClass(loader, "org.eclipse.persistence.Version"); String version = (String) Version.getMethod("getVersionString").invoke(Version.newInstance()); Tr.info(tc, "JPA_THIRD_PARTY_PROV_INFO_CWWJP0053I", "EclipseLink", version); } else if (PROVIDER_HIBERNATE.equals(providerName)) { // org.hibernate.Version.getVersionString(): 5.2.6.Final Class<?> Version = loadClass(loader, "org.hibernate.Version"); String version = (String) Version.getMethod("getVersionString").invoke(null); Tr.info(tc, "JPA_THIRD_PARTY_PROV_INFO_CWWJP0053I", "Hibernate", version); } else if (PROVIDER_OPENJPA.equals(providerName)) { // OpenJPAVersion.appendOpenJPABanner(sb): OpenJPA #.#.#\n version id: openjpa-#.#.#-r# \n Apache svn revision: # StringBuilder version = new StringBuilder(); Class<?> OpenJPAVersion = loadClass(loader, "org.apache.openjpa.conf.OpenJPAVersion"); OpenJPAVersion.getMethod("appendOpenJPABanner", StringBuilder.class).invoke(OpenJPAVersion.newInstance(), version); Tr.info(tc, "JPA_THIRD_PARTY_PROV_INFO_CWWJP0053I", "OpenJPA", version); } else { Tr.info(tc, "JPA_THIRD_PARTY_PROV_NAME_CWWJP0052I", providerName); } } catch (Exception x) { Tr.info(tc, "JPA_THIRD_PARTY_PROV_NAME_CWWJP0052I", providerName); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "unable to determine provider info", x); } }
java
protected void checkStartStatus(BundleStartStatus startStatus) throws InvalidBundleContextException { final String m = "checkInstallStatus"; if (startStatus.startExceptions()) { Map<Bundle, Throwable> startExceptions = startStatus.getStartExceptions(); for (Entry<Bundle, Throwable> entry : startExceptions.entrySet()) { Bundle b = entry.getKey(); FFDCFilter.processException(entry.getValue(), ME, m, this, new Object[] { b.getLocation() }); } throw new LaunchException("Exceptions occurred while starting platform bundles", BootstrapConstants.messages.getString("error.platformBundleException")); } if (!startStatus.contextIsValid()) throw new InvalidBundleContextException(); }
java
protected BundleInstallStatus installBundles(BootstrapConfig config) throws InvalidBundleContextException { BundleInstallStatus installStatus = new BundleInstallStatus(); KernelResolver resolver = config.getKernelResolver(); ContentBasedLocalBundleRepository repo = BundleRepositoryRegistry.getInstallBundleRepository(); List<KernelBundleElement> bundleList = resolver.getKernelBundles(); if (bundleList == null || bundleList.size() <= 0) return installStatus; boolean libertyBoot = Boolean.parseBoolean(config.get(BootstrapConstants.LIBERTY_BOOT_PROPERTY)); for (final KernelBundleElement element : bundleList) { if (libertyBoot) { // For boot bundles the LibertyBootRuntime must be used to install the bundles installLibertBootBundle(element, installStatus); } else { installKernelBundle(element, installStatus, repo); } } return installStatus; }
java
public synchronized boolean isHealthy() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "isHealthy"); boolean retval = _running && !_stopRequested && (_threadWriteErrorsOutstanding == 0); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "isHealthy", Boolean.valueOf(retval)); return retval; }
java
private String getLogDir() { StringBuffer output = new StringBuffer(); WsLocationAdmin locationAdmin = locationAdminRef.getService(); output.append(locationAdmin.resolveString("${server.output.dir}").replace('\\', '/')).append("/logs"); return output.toString(); }
java
private String mapToJSONString(Map<String, Object> eventMap) { JSONObject jsonEvent = new JSONObject(); String jsonString = null; map2JSON(jsonEvent, eventMap); try { if (!compact) { jsonString = jsonEvent.serialize(true).replaceAll("\\\\/", "/"); } else { jsonString = jsonEvent.toString(); } } catch (IOException e) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Unexpected error converting AuditEvent to JSON String", e); } } return jsonString; }
java
private JSONArray array2JSON(JSONArray ja, Object[] array) { for (int i = 0; i < array.length; i++) { // array entry is a Map if (array[i] instanceof Map) { //if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { // Tr.debug(tc, "array entry is a Map, calling map2JSON", array[i]); //} ja.add(map2JSON(new JSONObject(), (Map<String, Object>) array[i])); } // array entry is an array else if (array[i].getClass().isArray()) { //if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { // Tr.debug(tc, "array entry is a array, calling array2JSON", array[i]); //} ja.add(array2JSON(new JSONArray(), (Object[]) array[i])); } // else array entry is a "simple" value else { //if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { // Tr.debug(tc, "array entry is a simple value, adding to ja", array[i]); //} ja.add(array[i]); } } return ja; }
java
public void writeBootstrapProperty(LibertyServer server, String propKey, String propValue) throws Exception { String bootProps = getBootstrapPropertiesFilePath(server); appendBootstrapPropertyToFile(bootProps, propKey, propValue); }
java
public void writeBootstrapProperties(LibertyServer server, Map<String, String> miscParms) throws Exception { String thisMethod = "writeBootstrapProperties"; loggingUtils.printMethodName(thisMethod); if (miscParms == null) { return; } String bootPropFilePath = getBootstrapPropertiesFilePath(server); for (Map.Entry<String, String> entry : miscParms.entrySet()) { appendBootstrapPropertyToFile(bootPropFilePath, entry.getKey(), entry.getValue()); } }
java
public static WSATRecoveryCoordinator fromLogData(byte[] bytes) throws SystemException { if (tc.isEntryEnabled()) Tr.entry(tc, "fromLogData", bytes); WSATRecoveryCoordinator wsatRC = null; final ByteArrayInputStream bais = new ByteArrayInputStream(bytes); try { final ObjectInputStream ois = new ObjectInputStream(bais); final Object obj = ois.readObject(); wsatRC = (WSATRecoveryCoordinator) obj; } catch (Throwable e) { FFDCFilter.processException(e, "com.ibm.ws.Transaction.wstx.WSATRecoveryCoordinator.fromLogData", "67"); final Throwable se = new SystemException().initCause(e); if (tc.isEntryEnabled()) Tr.exit(tc, "fromLogData", se); throw (SystemException) se; } if (tc.isEntryEnabled()) Tr.exit(tc, "fromLogData", wsatRC); return wsatRC; }
java
private boolean handleAdditionalAnnotation(List<Parameter> parameters, Annotation annotation, final Type type, Set<Type> typesToSkip, javax.ws.rs.Consumes classConsumes, javax.ws.rs.Consumes methodConsumes, Components components, boolean includeRequestBody) { boolean processed = false; if (BeanParam.class.isAssignableFrom(annotation.getClass())) { // Use Jackson's logic for processing Beans final BeanDescription beanDesc = mapper.getSerializationConfig().introspect(constructType(type)); final List<BeanPropertyDefinition> properties = beanDesc.findProperties(); for (final BeanPropertyDefinition propDef : properties) { final AnnotatedField field = propDef.getField(); final AnnotatedMethod setter = propDef.getSetter(); final AnnotatedMethod getter = propDef.getGetter(); final List<Annotation> paramAnnotations = new ArrayList<Annotation>(); final Iterator<OpenAPIExtension> extensions = OpenAPIExtensions.chain(); Type paramType = null; // Gather the field's details if (field != null) { paramType = field.getType(); for (final Annotation fieldAnnotation : field.annotations()) { if (!paramAnnotations.contains(fieldAnnotation)) { paramAnnotations.add(fieldAnnotation); } } } // Gather the setter's details but only the ones we need if (setter != null) { // Do not set the param class/type from the setter if the values are already identified if (paramType == null) { // paramType will stay null if there is no parameter paramType = setter.getParameterType(0); } for (final Annotation fieldAnnotation : setter.annotations()) { if (!paramAnnotations.contains(fieldAnnotation)) { paramAnnotations.add(fieldAnnotation); } } } // Gather the getter's details but only the ones we need if (getter != null) { // Do not set the param class/type from the getter if the values are already identified if (paramType == null) { paramType = getter.getType(); } for (final Annotation fieldAnnotation : getter.annotations()) { if (!paramAnnotations.contains(fieldAnnotation)) { paramAnnotations.add(fieldAnnotation); } } } if (paramType == null) { continue; } // Re-process all Bean fields and let the default swagger-jaxrs/swagger-jersey-jaxrs processors do their thing List<Parameter> extracted = extensions.next().extractParameters( paramAnnotations, paramType, typesToSkip, components, classConsumes, methodConsumes, includeRequestBody, extensions).parameters; for (Parameter p : extracted) { if (ParameterProcessor.applyAnnotations( p, paramType, paramAnnotations, components, classConsumes == null ? new String[0] : classConsumes.value(), methodConsumes == null ? new String[0] : methodConsumes.value()) != null) { parameters.add(p); } } processed = true; } } return processed; }
java
protected String replaceAllProperties(String str, final Properties submittedProps, final Properties xmlProperties) { int startIndex = 0; NextProperty nextProp = this.findNextProperty(str, startIndex); while (nextProp != null) { // get the start index past this property for the next property in // the string //startIndex = this.getEndIndexOfNextProperty(str, startIndex); startIndex = nextProp.endIndex; // resolve the property String nextPropValue = this.resolvePropertyValue(nextProp.propName, nextProp.propType, submittedProps, xmlProperties); //if the property didn't resolve use the default value if it exists if (nextPropValue.equals(UNRESOLVED_PROP_VALUE)){ if (nextProp.defaultValueExpression != null) { nextPropValue = this.replaceAllProperties(nextProp.defaultValueExpression, submittedProps, xmlProperties); } } // After we get this value the lenght of the string might change so // we need to reset the start index int lengthDifference = 0; switch(nextProp.propType) { case JOB_PARAMETERS: lengthDifference = nextPropValue.length() - (nextProp.propName.length() + "#{jobParameters['']}".length()); // this can be a negative value startIndex = startIndex + lengthDifference; // move start index for next property str = str.replace("#{jobParameters['" + nextProp.propName + "']}" + nextProp.getDefaultValExprWithDelimitersIfExists(), nextPropValue); break; case JOB_PROPERTIES: lengthDifference = nextPropValue.length() - (nextProp.propName.length() + "#{jobProperties['']}".length()); // this can be a negative value startIndex = startIndex + lengthDifference; // move start index for next property str = str.replace("#{jobProperties['" + nextProp.propName + "']}" + nextProp.getDefaultValExprWithDelimitersIfExists(), nextPropValue); break; case SYSTEM_PROPERTIES: lengthDifference = nextPropValue.length() - (nextProp.propName.length() + "#{systemProperties['']}".length()); // this can be a negative value startIndex = startIndex + lengthDifference; // move start index for next property str = str.replace("#{systemProperties['" + nextProp.propName + "']}" + nextProp.getDefaultValExprWithDelimitersIfExists(), nextPropValue); break; case PARTITION_PROPERTIES: lengthDifference = nextPropValue.length() - (nextProp.propName.length() + "#{partitionPlan['']}".length()); // this can be a negative value startIndex = startIndex + lengthDifference; // move start index for next property str = str.replace("#{partitionPlan['" + nextProp.propName + "']}" + nextProp.getDefaultValExprWithDelimitersIfExists(), nextPropValue); break; } // find the next property nextProp = this.findNextProperty(str, startIndex); } return str; }
java
private String resolvePropertyValue(final String name, PROPERTY_TYPE propType, final Properties submittedProperties, final Properties xmlProperties) { String value = null; switch(propType) { case JOB_PARAMETERS: if (submittedProperties != null) { value = submittedProperties.getProperty(name); } if (value != null){ return value; } break; case JOB_PROPERTIES: if (xmlProperties != null){ value = xmlProperties.getProperty(name); } if (value != null) { return value; } break; case SYSTEM_PROPERTIES: value = System.getProperty(name); if (value != null) { return value; } break; case PARTITION_PROPERTIES: //We are reusing the submitted props to carry the partition props if (submittedProperties != null) { value = submittedProperties.getProperty(name); } if (value != null) { return value; } break; } return UNRESOLVED_PROP_VALUE; }
java
private Properties inheritProperties(final Properties parentProps, final Properties childProps) { if (parentProps == null) { return childProps; } if (childProps == null) { return parentProps; } for (final String parentKey : parentProps.stringPropertyNames()) { // Add the parent property to the child if the child does not // already define it if (!childProps.containsKey(parentKey)) { childProps.setProperty(parentKey, parentProps .getProperty(parentKey)); } } return childProps; }
java
public boolean isCommitted() { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { // 306998.15 Tr.debug(tc, "isCommitted: " + committed); } return committed; }
java
public void write(int c) throws IOException { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { // 306998.15 Tr.debug(tc, "write --> " + c); } if (!_hasWritten && obs != null) { _hasWritten = true; obs.alertFirstWrite(); } if (limit > -1) { if (total >= limit) { throw new WriteBeyondContentLengthException(); } } if (count == buf.length) { response.setFlushMode(false); flushChars(); response.setFlushMode(true); } buf[count++] = (char) c; total++; }
java
protected void flushChars() throws IOException { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { // 306998.15 Tr.debug(tc, "flushChars"); } if (!committed) { if (!_hasFlushed && obs != null) { _hasFlushed = true; obs.alertFirstFlush(); } } committed = true; if (count > 0) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "flushChars, Count = " + count); } writeOut(buf, 0, count); // out.flush(); moved to writeOut 277717 SVT:Mixed information shown on // the Admin Console WAS.webcontainer count = 0; } else {// PK22392 start if (response.getFlushMode()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "flushChars, Count 0 still flush mode is true , forceful flush"); } response.flushBufferedContent(); }// PK22392 END else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "flushChars, flush mode is false"); } } } }
java
private void addAddressToList(String newAddress, boolean validateOnly) { int start = 0; char delimiter = '.'; String sub; int radix = 10; // Address initially set to all zeroes int addressToAdd[] = new int[IP_ADDR_NUMBERS]; for (int i = 0; i < IP_ADDR_NUMBERS; i++) { addressToAdd[i] = 0; } int slot = IP_ADDR_NUMBERS - 1; // assume the address is IP4, but change to IP6 if there is a colon if (newAddress.indexOf('.') == -1) { // if no ".", then assume IPv6 Address delimiter = ':'; radix = 16; } String addr = newAddress; while (true) { // fill address from back to front start = addr.lastIndexOf(delimiter); if (start != -1) { sub = addr.substring(start + 1); if (sub.trim().equals("*")) { addressToAdd[slot] = -1; // 0xFFFFFFFF is the wildcard. } else { addressToAdd[slot] = Integer.parseInt(sub, radix); } } else { if (addr.trim().equals("*")) { addressToAdd[slot] = -1; // 0xFFFFFFFF is the wildcard. } else { addressToAdd[slot] = Integer.parseInt(addr, radix); } break; } slot = slot - 1; addr = addr.substring(0, start); } if (!validateOnly) { putInList(addressToAdd); } }
java
public boolean findInList(byte[] address) { int len = address.length; int a[] = new int[len]; for (int i = 0; i < len; i++) { // convert possible negative byte value to positive int a[i] = address[i] & 0x00FF; } return findInList(a); }
java
public boolean findInList6(byte[] address) { int len = address.length; int a[] = new int[len / 2]; // IPv6, need to combine every two bytes to the ints int j = 0; int highOrder = 0; int lowOrder = 0; for (int i = 0; i < len; i += 2) { // convert possible negative byte value to positive int highOrder = address[i] & 0x00FF; lowOrder = address[i + 1] & 0x00FF; a[j] = highOrder * 256 + lowOrder; j++; } return findInList(a); }
java
public boolean findInList(int[] address) { int len = address.length; if (len < IP_ADDR_NUMBERS) { int j = IP_ADDR_NUMBERS - 1; // for performace, hard code the size here int a[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; // int a[] = new int[IP_ADDR_NUMBERS]; // for (int i = 0; i < IP_ADDR_NUMBERS; i++) // { // a[i] = 0; // } for (int i = len; i > 0; i--, j--) { a[j] = address[i - 1]; } return findInList(a, 0, firstCell, 7); } return findInList(address, 0, firstCell, (address.length - 1)); }
java
private boolean findInList(int[] address, int index, FilterCell cell, int endIndex) { if (cell.getWildcardCell() != null) { // first look at wildcard slot if (index == endIndex) { // at the end, so we found a match, unwind returning true return true; } // go to next level of this tree path FilterCell newcell = cell.getWildcardCell(); // recursively search this path if (findInList(address, index + 1, newcell, endIndex)) { return true; } // the wildcard path didn't work, so see if there is a non-wildcard path FilterCell nextCell = cell.findNextCell(address[index]); if (nextCell != null) { // see if we are at the end of a valid path if (index == endIndex) { // this path found a match, unwind returning true return true; } // ok so far, recursively search this path return findInList(address, index + 1, nextCell, endIndex); } // this path did not find a match. return false; } // no wildcard here, try the non-wildcard path FilterCell nextCell = cell.findNextCell(address[index]); if (nextCell != null) { if (index == endIndex) { // this path found a match, unwind returning true return true; } // ok so far, recursively search this path return findInList(address, index + 1, nextCell, endIndex); } // this path did not find a match. return false; }
java
public boolean isInstrumentableMethod(int access, String methodName, String descriptor) { if ((access & Opcodes.ACC_SYNTHETIC) != 0) { return false; } if ((access & Opcodes.ACC_NATIVE) != 0) { return false; } if ((access & Opcodes.ACC_ABSTRACT) != 0) { return false; } if (methodName.equals("toString") && descriptor.equals("()Ljava/lang/String;")) { return false; } if (methodName.equals("hashCode") && descriptor.equals("()I")) { return false; } return true; }
java
@Mode(TestMode.LITE) @Test public void MPJwtBadMPConfigAsSystemProperties_GoodMpJwtConfigSpecifiedInServerXml() throws Exception { resourceServer.reconfigureServerUsingExpandedConfiguration(_testName, "rs_server_AltConfigNotInApp_goodServerXmlConfig.xml"); standardTestFlow(resourceServer, MpJwtFatConstants.NO_MP_CONFIG_IN_APP_ROOT_CONTEXT, MpJwtFatConstants.NO_MP_CONFIG_IN_APP_APP, MpJwtFatConstants.MPJWT_APP_CLASS_NO_MP_CONFIG_IN_APP); }
java
@Override @FFDCIgnore(JobExecutionNotRunningException.class) public void stop() { StopLock stopLock = getStopLock(); // Store in local variable to facilitate Ctrl+Shift+G search in Eclipse synchronized (stopLock) { if (isStepStartingOrStarted()) { updateStepBatchStatus(BatchStatus.STOPPING); // It's possible we may try to stop a partitioned step before any // sub steps have been started. // Note: in multi-jvm mode parallelBatchWorkUnits will be empty (sub-jobs may not be // running locally, so no easy way to stop them). // TODO: could queue stopPartition thru JMS i suppose...). for (BatchPartitionWorkUnit subJob : parallelBatchWorkUnits) { try { getBatchKernelService().stopWorkUnit(subJob); } catch (JobExecutionNotRunningException e) { logger.fine("Caught exception trying to stop work unit: " + subJob + ", which was not running."); // We want to stop all running sub steps. // We do not want to throw an exception if a sub step has already been completed. } catch (Exception e) { // Blow up if it happens to force the issue. throw new IllegalStateException(e); } } } else { // Might not be set up yet to have a state. logger.fine("Ignoring stop, since step not in a state which has a valid status (might not be far enough along to have a state yet)"); } } }
java
private void setExecutionTypeIfNotSet(ExecutionType executionType) { if (this.executionType == null) { logger.finer("Setting initial execution type value"); this.executionType = executionType; } else { logger.finer("Not setting execution type value since it's already set"); } }
java
private void validatePlanNumberOfPartitions(PartitionPlanDescriptor currentPlan) { int numPreviousPartitions = getTopLevelStepInstance().getPartitionPlanSize(); int numCurrentPartitions = currentPlan.getNumPartitionsInPlan(); if (logger.isLoggable(Level.FINE)) { logger.fine("For step: " + getStepName() + ", previous num partitions = " + numPreviousPartitions + ", and current num partitions = " + numCurrentPartitions); } if (executionType == ExecutionType.RESTART_NORMAL) { if (numPreviousPartitions == EntityConstants.PARTITION_PLAN_SIZE_UNINITIALIZED) { logger.fine("For step: " + getStepName() + ", previous num partitions has not been initialized, so don't validate the current plan size against it"); } else if (numCurrentPartitions != numPreviousPartitions) { throw new IllegalArgumentException("Partition not configured for override, and previous execution used " + numPreviousPartitions + " number of partitions, while current plan uses a different number: " + numCurrentPartitions); } } if (numCurrentPartitions < 1) { throw new IllegalArgumentException("Partition plan size is calculated as " + numCurrentPartitions + ", but at least one partition is needed."); } }
java
private boolean isStoppingStoppedOrFailed() { BatchStatus jobBatchStatus = runtimeWorkUnitExecution.getBatchStatus(); if (jobBatchStatus.equals(BatchStatus.STOPPING) || jobBatchStatus.equals(BatchStatus.STOPPED) || jobBatchStatus.equals(BatchStatus.FAILED)) { return true; } return false; }
java
private void partitionFinished(PartitionReplyMsg msg) { JoblogUtil.logToJobLogAndTraceOnly(Level.FINE, "partition.ended", new Object[] { msg.getPartitionPlanConfig().getPartitionNumber(), msg.getBatchStatus(), msg.getExitStatus(), msg.getPartitionPlanConfig().getStepName(), msg.getPartitionPlanConfig().getTopLevelNameInstanceExecutionInfo().getInstanceId(), msg.getPartitionPlanConfig().getTopLevelNameInstanceExecutionInfo().getExecutionId() }, logger); finishedWork.add(msg); }
java
private void waitForNextPartitionToFinish(List<Throwable> analyzerExceptions, List<Integer> finishedPartitions) throws JobStoppingException { //Use this counter to count the number of cycles we recieve jms reply message boolean isStoppingStoppedOrFailed = false; PartitionReplyMsg msg = null; do { //TODO - We won't worry about local dispatch until we're prepated to code up // the structure necessary to break free from waiting on the BlockingQueue if (isMultiJvm) { if (isStoppingStoppedOrFailed()) { isStoppingStoppedOrFailed = true; } } //This will only be triggered when stop issued if (isStoppingStoppedOrFailed) { //TODO - Crude, and the JVM doesn't have to follow this too closely. // The idea is to give the partitions some time complete so we can report with // a more tidy final status. // Another idea would be to start a timer or do the first wait with a receive. // try { Thread.sleep(PartitionReplyTimeoutConstants.BATCH_REPLY_MSG_SLEEP_AFTER_STOP); } catch (InterruptedException e) { // do nothing } while (true) { //Get the message from the replyToQueue msg = waitForPartitionReplyMsgNoWait(); //If no messages left, break the loop if (msg != null) { try { processPartitionReplyMsg(msg); } catch (Throwable t) { // FFDC. // Remember the exception for rollback later. analyzerExceptions.add(t); } //check if last message received, and process it. receivedLastMessageForPartition(msg, finishedPartitions); } else { throw new JobStoppingException(); } } } else { //This is executed when stop has not been issued msg = waitForPartitionReplyMsg(); //If waitForPartitionReplyMsg times out after 15 seconds, go back to the top and check //if stop has been issued or not if (msg == null) { continue; } } //This should never be executed while msg == null cause it the loop would have been broken or continued try { processPartitionReplyMsg(msg); } catch (Throwable t) { // FFDC. // Remember the exception for rollback later. analyzerExceptions.add(t); } } while (msg == null || !receivedLastMessageForPartition(msg, finishedPartitions)); }
java
@FFDCIgnore(JobStoppingException.class) private void executeAndWaitForCompletion(PartitionPlanDescriptor currentPlan) throws JobRestartException { if (isStoppingStoppedOrFailed()) { logger.fine("Job already in " + runtimeWorkUnitExecution.getWorkUnitJobContext().getBatchStatus().toString() + " state, exiting from executeAndWaitForCompletion() before beginning execution"); return; } List<Integer> partitionsToExecute = getPartitionNumbersToExecute(currentPlan); logger.fine("Partitions to execute in this run: " + partitionsToExecute + ". Total number of partitions in step: " + currentPlan.getNumPartitionsInPlan()); List<Integer> startedPartitions = new ArrayList<Integer>(); List<Integer> finishedPartitions = new ArrayList<Integer>(); List<Throwable> analyzerExceptions = new ArrayList<Throwable>(); // Keep looping until all partitions have finished. while (finishedPartitions.size() < partitionsToExecute.size()) { startPartitions(partitionsToExecute, startedPartitions, finishedPartitions, currentPlan); // Check that there are still un-finished partitions running. // If not, break out of the loop. if (finishedPartitions.size() >= partitionsToExecute.size()) { break; } //Break this loop when nextPartitionFinished is -1 try { waitForNextPartitionToFinish(analyzerExceptions, finishedPartitions); } catch (JobStoppingException e) { // break the loop break; } } if (!analyzerExceptions.isEmpty()) { rollbackPartitionedStep(); throw new BatchContainerRuntimeException("Exception previously thrown by Analyzer, rolling back step.", analyzerExceptions.get(0)); } }
java
private void checkFinishedPartitions() { List<String> failingPartitionSeen = new ArrayList<String>(); boolean stoppedPartitionSeen = false; for (PartitionReplyMsg replyMsg : finishedWork) { BatchStatus batchStatus = replyMsg.getBatchStatus(); if (logger.isLoggable(Level.FINE)) { logger.fine("For partitioned step: " + getStepName() + ", the partition # " + replyMsg.getPartitionPlanConfig().getPartitionNumber() + " ended with status '" + batchStatus); } // Keep looping, just to see the log messages perhaps. if (batchStatus.equals(BatchStatus.FAILED)) { String msg = "For partitioned step: " + getStepName() + ", the partition # " + replyMsg.getPartitionPlanConfig().getPartitionNumber() + " ended with status '" + batchStatus; failingPartitionSeen.add(msg); } // This code seems to suggest it might be valid for a partition to end up in STOPPED state without // the "top-level" step having been aware of this. It's unclear from the spec if this is even possible // or a desirable spec interpretation. Nevertheless, we'll code it as such noting the ambiguity. // // However, in the RI at least, we won't bother updating the step level BatchStatus, since to date we // would only transition the status in such a way independently. if (batchStatus.equals(BatchStatus.STOPPED)) { stoppedPartitionSeen = true; } } if (!failingPartitionSeen.isEmpty()) { markStepForFailure(); rollbackPartitionedStep(); throw new BatchContainerRuntimeException("One or more partitions failed: " + failingPartitionSeen); } else if (isStoppingStoppedOrFailed()) { rollbackPartitionedStep(); } else if (stoppedPartitionSeen) { // At this point, the top-level job is still running. // If we see a stopped partition, we mark the step/job failed markStepForFailure(); rollbackPartitionedStep(); } else { // Call before completion if (this.partitionReducerProxy != null) { this.partitionReducerProxy.beforePartitionedStepCompletion(); } } }
java
@Override protected void invokePreStepArtifacts() { if (stepListeners != null) { for (StepListenerProxy listenerProxy : stepListeners) { // Call beforeStep on all the step listeners listenerProxy.beforeStep(); } } // Invoke the reducer before all parallel steps start (must occur // before mapper as well) if (this.partitionReducerProxy != null) { this.partitionReducerProxy.beginPartitionedStep(); } }
java
private static String getClassNameandPath (String className, Path path) { if (path == null) { return getClassNameandPath(className, "/"); } else { return getClassNameandPath(className, path.value()); } }
java
private static boolean checkMethodDispatcher(ClassResourceInfo cr) { if (cr.getMethodDispatcher().getOperationResourceInfos().isEmpty()) { LOG.warning(new org.apache.cxf.common.i18n.Message("NO_RESOURCE_OP_EXC", BUNDLE, cr.getServiceClass().getName()).toString()); return false; } return true; }
java
public void run() { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isDebugEnabled()) Tr.entry(tc, "run"); int numPools; synchronized (this) { if (ivIsCanceled) { return; } ivIsRunning = true; numPools = pools.size(); if (numPools > 0) { if (numPools > poolArray.length) { poolArray = new PoolImplBase[numPools]; } pools.toArray(poolArray); } } try { for (int i = 0; i < poolArray.length && poolArray[i] != null; ++i) // 147140 { if (poolArray[i].inactive) { poolArray[i].periodicDrain(); } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "setting inactive: " + poolArray[i]); poolArray[i].inactive = true; } // Allow pools to be GC'ed promptly after being removed. PM54417 poolArray[i] = null; } } finally { synchronized (this) { ivIsRunning = false; if (ivIsCanceled) { notify(); } else if (!pools.isEmpty()) { startAlarm(); } else { ivScheduledFuture = null; } } } if (isTraceOn && tc.isDebugEnabled()) Tr.exit(tc, "run"); }
java
private Object addBatch(Object implObject, Method method, Object[] args) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, SQLException { Object sqljPstmt = args[0]; final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isDebugEnabled()) Tr.debug(tc, "addBatch", new Object[] { this, AdapterUtil.toString(sqljPstmt) }); // Get underlying instance of SQLJPreparedStatement from dynamic proxy // to avoid java.lang.ClassCastException in addBatch() if (sqljPstmt != null && Proxy.isProxyClass(sqljPstmt.getClass())) { InvocationHandler handler = Proxy.getInvocationHandler(sqljPstmt); if (handler instanceof WSJdbcWrapper) args = new Object[] { ((WSJdbcWrapper) handler).getJDBCImplObject() }; } return method.invoke(implObject, args); }
java