code
stringlengths
73
34.1k
label
stringclasses
1 value
private Object executeBatch(Object implObject, Method method, Object[] args) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, SQLException { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(tc, "executeBatch", new Object[] { this, args[0] }); if (childWrapper != null) { closeAndRemoveResultSet(); } if (childWrappers != null && !childWrappers.isEmpty()) { closeAndRemoveResultSets(); } enforceStatementProperties(); Object results = method.invoke(implObject, args); if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "executeBatch", results instanceof int[] ? Arrays.toString((int[]) results) : results); return results; }
java
private Object getReturnResultSet(Object implObject, Method method) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, SQLException { final boolean trace = TraceComponent.isAnyTracingEnabled(); if (trace && tc.isEntryEnabled()) Tr.entry(tc, "getReturnResultSet", this); WSJdbcResultSet rsetWrapper = null; ResultSet rsetImpl = (ResultSet) method.invoke(implObject); if (rsetImpl != null) { // If the childWrapper is null, and the childWrappers is null or // empty, set the result set to childWrapper; // Otherwise, add the result set to childWrappers if (childWrapper == null && (childWrappers == null || childWrappers.isEmpty())) { childWrapper = rsetWrapper = mcf.jdbcRuntime.newResultSet(rsetImpl, this); if (trace && tc.isDebugEnabled()) Tr.debug(tc, "Set the result set to child wrapper"); } else { if (childWrappers == null) childWrappers = new ArrayList<Wrapper>(5); rsetWrapper = mcf.jdbcRuntime.newResultSet(rsetImpl, this); childWrappers.add(rsetWrapper); if (trace && tc.isDebugEnabled()) Tr.debug(tc, "Add the result set to child wrappers list."); } } if (trace && tc.isEntryEnabled()) Tr.exit(tc, "getReturnResultSet", rsetWrapper); return rsetWrapper; }
java
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if (!haveStatementPropertiesChanged && VENDOR_PROPERTY_SETTERS.contains(method.getName())) { haveStatementPropertiesChanged = true; } // The SQLJ programming model indicates that getSection should be callable on a // closed PreparedStatement. Therefore we manually cache the section and return it if(sqljSection != null && "getSection".equals(method.getName())) { return sqljSection; } return super.invoke(proxy, method, args); }
java
public void nextRangeMaximumAvailable() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "nextRangeMaximumAvailable"); synchronized (_globalUniqueLock) { _globalUniqueThreshold = _globalUniqueLimit + _midrange; _globalUniqueLimit = _globalUniqueLimit + _range; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "nextRangeMaximumAvailable"); }
java
public byte[] transform(ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) throws IllegalClassFormatException { // Don't modify our own package if (className.startsWith(Transformer.class.getPackage().getName().replaceAll("\\.", "/"))) { return null; } // Don't modify the java.util.logging classes if (className.startsWith("java/util/logging/")) { return null; } boolean include = false; for (String s : includesList) { if (className.startsWith(s) || s.equals("/")) { include = true; break; } } for (String s : excludesList) { if (className.startsWith(s) || s.equals("/")) { include = false; break; } } if (include == false) { return null; } String internalPackageName = className.replaceAll("/[^/]+$", ""); PackageInfo packageInfo = getPackageInfo(internalPackageName); if (packageInfo == null && loader != null) { String packageInfoResourceName = internalPackageName + "/package-info.class"; InputStream is = loader.getResourceAsStream(packageInfoResourceName); packageInfo = processPackageInfo(is); addPackageInfo(packageInfo); } try { return transform(new ByteArrayInputStream(classfileBuffer)); } catch (Throwable t) { t.printStackTrace(); return null; } }
java
public String resolveString(String value, boolean ignoreWarnings) throws ConfigEvaluatorException { value = variableEvaluator.resolveVariables(value, this, ignoreWarnings); return value; }
java
@SuppressWarnings("unchecked") public void init() throws ServletException { // Method re-written for PQ47469 String servlets = getRequiredInitParameter(PARAM_SERVLET_PATHS); StringTokenizer sTokenizer = new StringTokenizer(servlets); Vector servletChainPath = new Vector(); while (sTokenizer.hasMoreTokens() == true) { String path = sTokenizer.nextToken().trim(); if (path.length() > 0) { servletChainPath.addElement(path); } } int chainLength = servletChainPath.size(); if (chainLength > 0) { this.chainPath = new String[chainLength]; for (int index = 0; index < chainLength; ++index) { this.chainPath[index] = (String)servletChainPath.elementAt(index); } } }
java
public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // Method re-written for PQ47469 ServletChain chain = new ServletChain(); try { String path = null; for (int index = 0; index < this.chainPath.length; ++index) { path = this.chainPath[index]; RequestDispatcher rDispatcher = getServletContext().getRequestDispatcher(path); chain.addRequestDispatcher(rDispatcher); } chain.forward(new HttpServletRequestWrapper(request), new HttpServletResponseWrapper(response)); } finally { if (chain != null) { chain.clear(); } } }
java
String getRequiredInitParameter(String name) throws ServletException { String value = getInitParameter(name); if (value == null) { throw new ServletException(MessageFormat.format(nls.getString("Missing.required.initialization.parameter","Missing required initialization parameter: {0}"), new Object[]{name})); } return value; }
java
private void initializePermissions() { // Set the default restrictable permissions int count = 0; if (tc.isDebugEnabled()) { if (isServer) { Tr.debug(tc, "running on server "); } else { Tr.debug(tc, "running on client "); } } if (isServer) { count = DEFAULT_SERVER_RESTRICTABLE_PERMISSIONS.length; originationFile = SERVER_XML; } else { count = DEFAULT_CLIENT_RESTRICTABLE_PERMISSIONS.length; originationFile = CLIENT_XML; } for (int i = 0; i < count; i++) { if (isServer) { restrictablePermissions.add(DEFAULT_SERVER_RESTRICTABLE_PERMISSIONS[i]); } else { restrictablePermissions.add(DEFAULT_CLIENT_RESTRICTABLE_PERMISSIONS[i]); } } // Iterate through the configured Permissions. if (permissions != null && !permissions.isEmpty()) { Iterable<JavaPermissionsConfiguration> javaPermissions = permissions.services(); if (javaPermissions != null) { for (JavaPermissionsConfiguration permission : javaPermissions) { String permissionClass = String.valueOf(permission.get(JavaPermissionsConfiguration.PERMISSION)); String target = String.valueOf(permission.get(JavaPermissionsConfiguration.TARGET_NAME)); String action = String.valueOf(permission.get(JavaPermissionsConfiguration.ACTIONS)); String credential = String.valueOf(permission.get(JavaPermissionsConfiguration.SIGNED_BY)); String principalType = String.valueOf(permission.get(JavaPermissionsConfiguration.PRINCIPAL_TYPE)); String principalName = String.valueOf(permission.get(JavaPermissionsConfiguration.PRINCIPAL_NAME)); String codebase = normalize(String.valueOf(permission.get(JavaPermissionsConfiguration.CODE_BASE))); // Create the permission object Permission perm = createPermissionObject(permissionClass, target, action, credential, principalType, principalName, originationFile); boolean isRestriction = false; // Is this a restriciton or a grant? if (permission.get(JavaPermissionsConfiguration.RESTRICTION) != null) { isRestriction = ((Boolean) permission.get(JavaPermissionsConfiguration.RESTRICTION)).booleanValue(); } if (isRestriction) { // If this is a restriction if (perm != null) { restrictablePermissions.add(perm); } } else { // If this is not a restriction, then set is a grant if (perm != null) { // if codebase is present, then set the permission on the shared lib classloader if (codebase != null && !codebase.equalsIgnoreCase("null")) { setCodeBasePermission(codebase, perm); } else { grantedPermissions.add(perm); } } } } if (tc.isDebugEnabled()) { Tr.debug(tc, "restrictablePermissions : " + restrictablePermissions); Tr.debug(tc, "grantedPermissions : " + grantedPermissions); } } } setSharedLibraryPermission(); }
java
@Override public PermissionCollection getCombinedPermissions(PermissionCollection staticPolicyPermissionCollection, CodeSource codesource) { Permissions effectivePermissions = new Permissions(); List<Permission> staticPolicyPermissions = Collections.list(staticPolicyPermissionCollection.elements()); String codeBase = codesource.getLocation().getPath(); // TODO: This should be using the CodeSource itself to compare with existing code sources ArrayList<Permission> permissions = getEffectivePermissions(staticPolicyPermissions, codeBase); for (Permission permission : permissions) { effectivePermissions.add(permission); } return effectivePermissions; }
java
private boolean isRestricted(Permission permission) { for (Permission restrictedPermission : restrictablePermissions) { if (restrictedPermission.implies(permission)) { return true; } } return false; }
java
public void addPermissionsXMLPermission(CodeSource codeSource, Permission permission) { ArrayList<Permission> permissions = null; String codeBase = codeSource.getLocation().getPath(); if (!isRestricted(permission)) { if (permissionXMLPermissionMap.containsKey(codeBase)) { permissions = permissionXMLPermissionMap.get(codeBase); permissions.add(permission); } else { permissions = new ArrayList<Permission>(); permissions.add(permission); permissionXMLPermissionMap.put(codeBase, permissions); } } }
java
public NonDelayedClassInfo getClassInfo() { String useName = getName(); NonDelayedClassInfo useClassInfo = this.classInfo; if (useClassInfo != null) { if (!useClassInfo.isJavaClass() && !(useClassInfo.isAnnotationPresent() || useClassInfo.isFieldAnnotationPresent() || useClassInfo.isMethodAnnotationPresent())) { getInfoStore().recordAccess(useClassInfo); } return useClassInfo; } useClassInfo = getInfoStore().resolveClassInfo(useName); String[] useLogParms = getLogParms(); if (useLogParms != null) { useLogParms[EXTRA_DATA_OFFSET_0] = useName; } if (useClassInfo == null) { // defect 84235: If an error caused this, the warning was reported at a lower level. Since this is // going to be 'handled', we should not generate another warning message. //Tr.warning(tc, "ANNO_CLASSINFO_CLASS_NOTFOUND", getHashText(), useName); // CWWKC0025W if (useLogParms != null) { Tr.debug(tc, MessageFormat.format("[ {0} ] - Class not found [ {1} ]", (Object[]) useLogParms)); } useClassInfo = new NonDelayedClassInfo(useName, getInfoStore()); this.isArtificial = true; // START: TFB: Defect 59284: More required updates: // // The newly created class info was not properly added as a class info, // leading to an NPE in the cache list management (in ClassInfoCache.makeFirst). getInfoStore().getClassInfoCache().addClassInfo(useClassInfo); // END: TFB: Defect 59284: More required updates: } // START: TFB: Defect 59284: Don't throw an exception for a failed load. // // Tracing enablement for defect 59284 showed an error of the sequence // of assigning the result class info hash text into the logging parameters. // // Prior to the assignment steps, 'this.classInfo' is null. // // A NullPointerException results, respective only of trace enablement // and irrespective of the d59284 changes. // // Move the logging code to after the 'this.classInfo' assignment. // if (useLogParms != null) { // useLogParms[EXTRA_DATA_OFFSET_1] = this.classInfo.getHashText(); // } useClassInfo.setDelayedClassInfo(this); this.classInfo = useClassInfo; if (useLogParms != null) { useLogParms[EXTRA_DATA_OFFSET_1] = this.classInfo.getHashText(); // D59284 if (this.isArtificial) { Tr.debug(tc, MessageFormat.format("[ {0} ] RETURN [ {1} ] as [ {2} ] ** ARTFICIAL **", (Object[]) useLogParms)); } else { Tr.debug(tc, MessageFormat.format("[ {0} ] RETURN [ {1} ] as [ {2} ] ", (Object[]) useLogParms)); } } // END: TFB: Defect 59284: Don't throw an exception for a failed load. return useClassInfo; }
java
protected void intialiseNonPersistent(MultiMEProxyHandler proxyHandler, Neighbours neighbours) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "intialiseNonPersistent"); iProxyHandler = proxyHandler; iNeighbours = neighbours; iDestinationManager = iProxyHandler.getMessageProcessor().getDestinationManager(); iRemoteQueue = SIMPUtils.createJsSystemDestinationAddress( SIMPConstants.PROXY_SYSTEM_DESTINATION_PREFIX, iMEUuid, iBusId); if (iMEUuid == null) iMEUuid = iRemoteQueue.getME(); iProxies = new Hashtable(); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "intialiseNonPersistent"); }
java
public final SIBUuid8 getUUID() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, "getUUID"); SibTr.exit(tc, "getUUID", iMEUuid); } return iMEUuid; }
java
public final String getBusId() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, "getBusId"); SibTr.exit(tc, "getBusId", iBusId); } return iBusId; }
java
BusGroup getBus() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, "getBus"); SibTr.exit(tc, "getBus", iBusGroup); } return iBusGroup; }
java
void setBus(BusGroup busGroup) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "setBus"); iBusGroup = busGroup; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "setBus"); }
java
private synchronized void createProducerSession() throws SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createProducerSession"); if (iProducerSession == null) { try { iProducerSession = (ProducerSessionImpl) iProxyHandler .getMessageProcessor() .getSystemConnection() .createSystemProducerSession(iRemoteQueue, null, null, null, null); } catch (SIException e) { // No exceptions should occur as the destination should always exists // as it is created at start time. FFDCFilter.processException( e, "com.ibm.ws.sib.processor.proxyhandler.Neighbour.createProducerSession", "1:434:1.107", this); SibTr.exception(tc, e); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createProducerSession", "SIResourceException"); // this is already NLS'd //175907 throw new SIResourceException(e); } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createProducerSession"); }
java
MESubscription proxyRegistered(SIBUuid12 topicSpaceUuid, String localTopicSpaceName, String topic, String foreignTSName, Transaction transaction, boolean foreignSecuredProxy, String MESubUserId) throws SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "proxyRegistered", new Object[] { topicSpaceUuid, localTopicSpaceName, topic, foreignTSName, transaction, new Boolean(foreignSecuredProxy), MESubUserId}); // Generate a key for the topicSpace/topic final String key = BusGroup.subscriptionKey(topicSpaceUuid, topic); // Get the subscription from the Hashtable. MESubscription sub = (MESubscription) iProxies.get(key); if (sub != null) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Unmarking subscription " + sub); // unmark the subscription as it has been found sub.unmark(); // Check whether we need to update the recovered subscription boolean attrChanged = checkForeignSecurityAttributesChanged(sub, foreignSecuredProxy, MESubUserId); // If the attributes have changed then we need to persist the update if(attrChanged) { try { sub.requestUpdate(transaction); } catch (MessageStoreException e) { FFDCFilter.processException( e, "com.ibm.ws.sib.processor.proxyhandler.Neighbour.proxyRegistered", "1:522:1.107", this); SibTr.exception(tc, e); SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002", new Object[] { "com.ibm.ws.sib.processor.proxyhandler.Neighbour", "1:529:1.107", e }); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "proxyRegistered", "SIResourceException"); throw new SIResourceException( nls.getFormattedMessage( "INTERNAL_MESSAGING_ERROR_CWSIP0002", new Object[] { "com.ibm.ws.sib.processor.proxyhandler.Neighbour", "1:539:1.107", e }, null), e); } } // Set the subscription to null to indicate that this // is an old subscription sub = null; } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Subscription being created"); // Create a new MESubscription as one wasn't found sub = new MESubscription(topicSpaceUuid, localTopicSpaceName, topic, foreignTSName, foreignSecuredProxy, MESubUserId); // Add this subscription to the item Stream try { addItem(sub, transaction); } catch (MessageStoreException e) { FFDCFilter.processException( e, "com.ibm.ws.sib.processor.proxyhandler.Neighbour.proxyRegistered", "1:574:1.107", this); SibTr.exception(tc, e); SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002", new Object[] { "com.ibm.ws.sib.processor.proxyhandler.Neighbour", "1:581:1.107", e }); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "proxyRegistered", "SIResourceException"); throw new SIResourceException( nls.getFormattedMessage( "INTERNAL_MESSAGING_ERROR_CWSIP0002", new Object[] { "com.ibm.ws.sib.processor.proxyhandler.Neighbour", "1:591:1.107", e }, null), e); } // Put the subscription in the hashtable. iProxies.put(key, sub); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "proxyRegistered", sub); return sub; }
java
protected void removeSubscription(SIBUuid12 topicSpace, String topic) { // Generate a key for the topicSpace/topic final String key = BusGroup.subscriptionKey(topicSpace, topic); iProxies.remove(key); }
java
MESubscription proxyDeregistered(SIBUuid12 topicSpace, String topic, Transaction transaction) throws SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "proxyDeregistered", new Object[] { topicSpace, topic, transaction }); // Generate a key for the topicSpace/topic final String key = BusGroup.subscriptionKey(topicSpace, topic); // Get the subscrition from the Hashtable. final MESubscription sub = (MESubscription) iProxies.get(key); if (sub != null) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug( tc, "Subscription " + sub + " being removed"); // Remove the subscription from the Neighbour item Stream. try { sub.remove(transaction, sub.getLockID()); } catch (MessageStoreException e) { FFDCFilter.processException( e, "com.ibm.ws.sib.processor.proxyhandler.Neighbour.proxyDeregistered", "1:669:1.107", this); SibTr.exception(tc, e); SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002", new Object[] { "com.ibm.ws.sib.processor.proxyhandler.Neighbour", "1:676:1.107", e }); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "proxyDeregistered", "SIResourceException"); throw new SIResourceException( nls.getFormattedMessage( "INTERNAL_MESSAGING_ERROR_CWSIP0002", new Object[] { "com.ibm.ws.sib.processor.proxyhandler.Neighbour", "1:686:1.107", e }, null), e); } // Remove the proxy from the list iProxies.remove(key); } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "No Subscription to be removed"); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "proxyDeregistered", sub); return sub; }
java
protected void addSubscription(SIBUuid12 topicSpace, String topic, MESubscription subscription) { // Generate a key for the topicSpace/topic final String key = BusGroup.subscriptionKey(topicSpace, topic); iProxies.put(key, subscription); }
java
protected MESubscription getSubscription(SIBUuid12 topicSpace, String topic) { return (MESubscription)iProxies.get(BusGroup.subscriptionKey(topicSpace, topic)); }
java
void markAllProxies() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "markAllProxies"); final Enumeration enu = iProxies.elements(); // Cycle through each of the proxies while (enu.hasMoreElements()) { final MESubscription sub = (MESubscription) enu.nextElement(); // Mark the subscription. sub.mark(); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "markAllProxies"); }
java
void sweepMarkedProxies( List topicSpaces, List topics, Transaction transaction, boolean okToForward) throws SIResourceException, SIException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry( tc, "sweepMarkedProxies", new Object[] { topicSpaces, topics, transaction, new Boolean(okToForward)}); // Get the list of proxies for this Neighbour final Enumeration enu = iProxies.elements(); // Cycle through each of the proxies while (enu.hasMoreElements()) { final MESubscription sub = (MESubscription) enu.nextElement(); // If the subscription is marked, then remove it if (sub.isMarked()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug( tc, "Subscription " + sub + " being removed"); // Remove the proxy from the list. proxyDeregistered(sub.getTopicSpaceUuid(), sub.getTopic(), transaction); // Remove this Subscription from the // match space and the item stream on which they are // stored. final boolean proxyDeleted = iNeighbours.deleteProxy( iDestinationManager.getDestinationInternal(sub.getTopicSpaceUuid(), false), sub, this, sub.getTopicSpaceUuid(), sub.getTopic(), true, false); // Generate the key to remove the subscription from. final String key = BusGroup.subscriptionKey(sub.getTopicSpaceUuid(), sub.getTopic()); // Remove the proxy from the list iProxies.remove(key); // Add the details to the list of topics/topicSpaces to be deleted if (okToForward && proxyDeleted) { topics.add(sub.getTopic()); topicSpaces.add(sub.getTopicSpaceUuid()); } } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "sweepMarkedProxies"); }
java
void sendToNeighbour(JsMessage message, Transaction transaction) throws SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "sendToNeighbour", new Object[] { message, transaction }); if (iProducerSession == null) createProducerSession(); try { iProducerSession.send((SIBusMessage) message, (SITransaction) transaction); } catch (SIException e) { // No FFDC code needed SibTr.exception(tc, e); SibTr.warning(tc, "PUBSUB_CONSISTENCY_ERROR_CWSIP0383", new Object[]{JsAdminUtils.getMENameByUuidForMessage(iMEUuid.toString()), e}); SIResourceException ee = null; if (! (e instanceof SIResourceException)) ee = new SIResourceException(e); else ee = (SIResourceException)e; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "sendToNeighbour", ee); throw ee; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "sendToNeighbour"); }
java
protected void recoverSubscriptions(MultiMEProxyHandler proxyHandler) throws MessageStoreException, SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "recoverSubscriptions", proxyHandler); iProxyHandler = proxyHandler; iProxies = new Hashtable(); NonLockingCursor cursor = null; try { cursor = newNonLockingItemCursor(new ClassEqualsFilter(MESubscription.class)); AbstractItem item = null; while ((item = cursor.next()) != null) { MESubscription sub = null; sub = (MESubscription)item; // Generate a key for the topicSpace/topic final String key = BusGroup.subscriptionKey(sub.getTopicSpaceUuid(), sub.getTopic()); // Add the Neighbour into the list of recovered Neighbours iProxies.put(key, sub); // Having created the Proxy, need to readd the proxy to the matchspace or just reference it. iNeighbours.createProxy(this, iDestinationManager.getDestinationInternal(sub.getTopicSpaceUuid(), false), sub, sub.getTopicSpaceUuid(), sub.getTopic(), true); // When recovering subscriptions, we need to call the event post commit // code to either add a reference, or put in the MatchSpace. sub.eventPostCommitAdd(null); } } finally { if (cursor != null) cursor.finished(); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "recoverSubscriptions"); }
java
protected void deleteDestination() throws SIConnectionLostException, SIResourceException, SIErrorException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "deleteDestination"); // If the producer session hasn't been closed, close it now synchronized(this) { if (iProducerSession != null) iProducerSession.close(); } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Removing destination " + iRemoteQueue.getDestinationName()); try { iDestinationManager.deleteSystemDestination(iRemoteQueue); } catch (SINotPossibleInCurrentConfigurationException e) { // No FFDC code needed if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Destination " + iRemoteQueue + " already deleted"); } // If the alarm hasn't been cancelled, do it now. synchronized (this) { if (!iAlarmCancelled) { if (iAlarm != null) iAlarm.cancel(); iAlarmCancelled = true; } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "deleteDestination"); }
java
protected void addPubSubOutputHandler(PubSubOutputHandler handler) { if (iPubSubOutputHandlers == null) iPubSubOutputHandlers = new HashSet(); // Add the PubSubOutputHandler to the list that this neighbour // knows about. This is so a recovered neighbour can add the list of // output handlers back into the matchspace. iPubSubOutputHandlers.add(handler); }
java
void setRequestedProxySubscriptions() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "setRequestedProxySubscriptions"); MPAlarmManager manager = iProxyHandler.getMessageProcessor().getAlarmManager(); iAlarm = manager.create(REQUEST_TIMER, this); synchronized (this) { iRequestSent = true; iAlarmCancelled = false; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "setRequestedProxySubscriptions"); }
java
void setRequestedProxySubscriptionsResponded() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "setRequestedProxySubscriptionsResponded"); synchronized (this) { iRequestSent = false; if (!iAlarmCancelled) iAlarm.cancel(); iAlarmCancelled = true; } String meName = JsAdminUtils.getMENameByUuidForMessage(iMEUuid.toString()); if (meName == null) meName = iMEUuid.toString(); SibTr.push(iProxyHandler.getMessageProcessor().getMessagingEngine()); SibTr.info(tc, "NEIGHBOUR_REPLY_RECIEVED_INFO_CWSIP0382", new Object[]{meName}); SibTr.pop(); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "setRequestedProxySubscriptionsResponded"); }
java
boolean wasProxyRequestSent() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, "wasProxyRequestSent"); SibTr.exit(tc, "wasProxyRequestSent", new Boolean(iRequestSent)); } return iRequestSent; }
java
protected void deleteSystemDestinations() throws SIConnectionLostException, SIResourceException, SIErrorException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "deleteSystemDestinations"); // If the producer session hasn't been closed, close it now synchronized(this) { if (iProducerSession != null) iProducerSession.close(); } //Get all the system destinations tht need to be deleted List systemDestinations = iDestinationManager.getAllSystemDestinations(iMEUuid); Iterator itr = systemDestinations.iterator(); while (itr.hasNext() ) { JsDestinationAddress destAddress = (JsDestinationAddress)itr.next(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Removing destination " + destAddress.getDestinationName()); try { iDestinationManager.deleteSystemDestination(destAddress); } catch (SINotPossibleInCurrentConfigurationException e) { // No FFDC code needed if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Destination " + destAddress + " already deleted"); } } // If the alarm hasn't been cancelled, do it now. synchronized (this) { if (!iAlarmCancelled) { if (iAlarm != null) iAlarm.cancel(); iAlarmCancelled = true; } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "deleteSystemDestinations"); }
java
private boolean checkForeignSecurityAttributesChanged(MESubscription sub, boolean foreignSecuredProxy, String MESubUserId) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "checkForeignSecurityAttributesChanged", new Object[] { sub, new Boolean(foreignSecuredProxy), MESubUserId }); boolean attrChanged = false; if(foreignSecuredProxy) { if(sub.isForeignSecuredProxy()) { // Need to check the userids if(MESubUserId != null) { if(sub.getMESubUserId() != null) { // Neither string is null, check whether they // are equal if(!MESubUserId.equals(sub.getMESubUserId())) { sub.setMESubUserId(MESubUserId); attrChanged = true; } } else { // Stored subscription was null sub.setMESubUserId(MESubUserId); attrChanged = true; } } else // MESubUserid is null { if(sub.getMESubUserId() != null) { sub.setMESubUserId(null); attrChanged = true; } } } else { // The stored subscription was not foreign secured sub.setForeignSecuredProxy(true); sub.setMESubUserId(MESubUserId); attrChanged = true; } } else // the new proxy sub is not foreign secured { if(sub.isForeignSecuredProxy()) { // The stored subscription was foreign secured sub.setForeignSecuredProxy(false); sub.setMESubUserId(null); attrChanged = true; } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "checkForeignSecurityAttributesChanged", new Boolean(attrChanged)); return attrChanged; }
java
synchronized void resetListFailed() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "resetListFailed"); iRequestFailed = true; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "resetListFailed"); }
java
@Override public boolean isDeclaredAnnotationWithin(Collection<String> annotationNames) { if (declaredAnnotations != null) { for (AnnotationInfo annotation : declaredAnnotations) { if (annotationNames.contains(annotation.getAnnotationClassName())) { return true; } } } return false; }
java
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException { ObjectInputStream.GetField getField = s.readFields(); version = getField.get("version", 1); resourceAdapterKey = (String) getField.get("resourceAdapterKey", null); }
java
private void writeObject(ObjectOutputStream s) throws IOException { ObjectOutputStream.PutField putField = s.putFields(); putField.put("version", version); putField.put("resourceAdapterKey", resourceAdapterKey); s.writeFields(); }
java
static void notifyTimeout() { if (tc.isEntryEnabled()) Tr.entry(tc, "notifyTimeout"); synchronized(SUSPEND_LOCK) { // Check if there are any outstanding suspends if (_tokenManager.isResumable()) { if (tc.isEventEnabled()) Tr.event(tc, "Resuming recovery log service following a suspension timeout"); _isSuspended = false; Tr.info(tc, "CWRLS0023_RESUME_RLS"); // Notify all waiting threads that // normal service is resumed SUSPEND_LOCK.notifyAll(); } } if (tc.isEntryEnabled()) Tr.exit(tc, "notifyTimeout"); }
java
protected synchronized final Transaction getExternalTransaction() { final String methodName = "getExternalTransaction"; if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.entry(this, cclass, methodName); Transaction transaction = null; // For return. if (transactionReference != null) transaction = (Transaction) transactionReference.get(); if (transaction == null) { transaction = new Transaction(this); // Make a WeakReference that becomes Enqueued as a result of the external Transaction becoming unreferenced. transactionReference = new TransactionReference(this, transaction); } // if (transaction == null). if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.exit(this, cclass, methodName, new Object[] { transaction }); return transaction; }
java
protected synchronized void requestCallback(Token token, Transaction transaction) throws ObjectManagerException { final String methodName = "requestCallback"; if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.entry(this, cclass, methodName, new Object[] { token, transaction }); // To defend against two application threads completing the same transaction and trying to // continue with it at the same time we check that the Transaction still refers to this one, // now that we are synchronized on the InternalTransaction. if (transaction.internalTransaction != this) { if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.exit(this, cclass, methodName, new Object[] { "via InvalidTransactionException", transaction.internalTransaction }); // Same behaviour as if the transaction was completed and replaced by // objectManagerState.dummyInternalTransaction. throw new InvalidStateException(this, InternalTransaction.stateTerminated, InternalTransaction.stateNames[InternalTransaction.stateTerminated]); } // if (transaction.internalTransaction != this) // Make the state change, to see if we can accept requestCallBack requests. // We only accept the request if we will make a callback. setState(nextStateForRequestCallback); // The object is now listed for prePrepare etc. callback. callbackTokens.add(token); if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.exit(this, cclass, methodName); }
java
protected synchronized void addFromCheckpoint(ManagedObject managedObject, Transaction transaction) throws ObjectManagerException { final String methodName = "addFromCheckpoint"; if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.entry(this, cclass, methodName, new Object[] { managedObject, transaction }); // Make the ManagedObject ready for an addition. // Nothing went wrong during forward processing! managedObject.preAdd(transaction); // Only persistent objects are recovered from a checkpoint. setState(nextStateForInvolvePersistentObjectFromCheckpoint); // The object is now included in the transaction. includedManagedObjects.put(managedObject.owningToken, managedObject); // The ManagedObject was read from the ObjectStore, give it a low log // and ManagedObject sequence number so that any later operation will supercede this one. // The loggedSerialisedBytes will be unchanged, possibly null for this Token. // If there already a logSequenceNumber known for this token it must have been put // there after the checkpoint start and has already been superceded. if (!logSequenceNumbers.containsKey(managedObject.owningToken)) { logSequenceNumbers.put(managedObject.owningToken, new Long(0)); managedObjectSequenceNumbers.put(managedObject.owningToken, new Long(0)); } // if (!logSequenceNumbers.containsKey(managedObject.owningToken)). // Redrive the postAdd method for the object. managedObject.postAdd(transaction, true); if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.exit(this, cclass, methodName); }
java
protected synchronized void replaceFromCheckpoint(ManagedObject managedObject, byte[] serializedBytes, Transaction transaction) throws ObjectManagerException { final String methodName = "replaceFromCheckpoint"; if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.entry(this, cclass, methodName, new Object[] { managedObject, new Integer(serializedBytes.length), transaction }); // Make the ManagedObject ready for a replace operation. // Nothing went wrong during forward processing! managedObject.preReplace(transaction); // Only persistent objects are recovered from a checkpoint. setState(nextStateForInvolvePersistentObjectFromCheckpoint); // The object is now included in the transaction. includedManagedObjects.put(managedObject.owningToken, managedObject); // The ManagedObject was read from the log, give it a low log // and ManagedObject sequence number so that any later operation will supercede this one. // The loggedSerialisedBytes will be unchanged, possibly null for this Token. // If there already a logSequenceNumber known for this token it must have been put // there after the checkpoint start and has already been superceded. if (!logSequenceNumbers.containsKey(managedObject.owningToken)) { logSequenceNumbers.put(managedObject.owningToken, new Long(0)); managedObjectSequenceNumbers.put(managedObject.owningToken, new Long(0)); // Remember what we originally logged in case we commit this version of the ManagedObject. // Replacements are not written to the ObjectStore for a checkpoint becauise that would // remove any before image which we would need if the object backed out. loggedSerializedBytes.put(managedObject.owningToken , serializedBytes ); } // if (!logSequenceNumbers.containsKey(token)). // Redrive the postReplace method for the object. managedObject.postReplace(transaction, true); if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.exit(this, cclass, methodName); }
java
protected synchronized void prepare(Transaction transaction) throws ObjectManagerException { if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.entry(this, cclass , "prepare" , "transaction=" + transaction + "(Trasnaction)" ); // To defend against two application threads completing the same transaction and trying to // continue with it at the same time we check that the Transaction still refers to this one, // now that we are synchronized on the InternalTransaction. if (transaction.internalTransaction != this) { if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.exit(this, cclass, "prepare", new Object[] { "via InvalidTransactionException", transaction.internalTransaction } ); // Same behaviour as if the transaction was completed and replaced by // objectManagerState.dummyInternalTransaction. throw new InvalidStateException(this, InternalTransaction.stateTerminated, InternalTransaction.stateNames[InternalTransaction.stateTerminated]); } // if (transaction.internalTransaction != this). prePrepare(transaction); // Give ManagedObjects a chance to get ready. // Is there any logging to do? if (state == statePrePreparedPersistent) { // Logging work to do. TransactionPrepareLogRecord transactionPrepareLogRecord = new TransactionPrepareLogRecord(this); objectManagerState.logOutput.writeNext(transactionPrepareLogRecord , 0 , true , true); } // If logging work to do. // ManagedObjects do nothing at prepare time. // // Drive prepare method of objects included in this transaction. // for (java.util.Iterator managedObjectIterator = includedManagedObjects.iterator(); // managedObjectIterator.hasNext(); // ) { // ManagedObject managedObject = (ManagedObject)managedObjectIterator.next(); // managedObject.prepare(transaction); // } // for... includedManagedObjects. setState(nextStateForPrepare); if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.exit(this, cclass , "prepare" ); }
java
protected void commit(boolean reUse, Transaction transaction) throws ObjectManagerException { if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.entry(this, cclass , "commit" , new Object[] { new Boolean(reUse), transaction } ); boolean persistentWorkDone = false; ManagedObject[] lockedManagedObjects; int numberOfLockedManagedObjects = 0; synchronized (this) { // To defend against two application threads completing the same transaction and trying to // continue with it at the same time we check that the Transaction still refers to this one, // now that we are synchronized on the InternalTransaction. if (transaction.internalTransaction != this) { if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.exit(this, cclass, "commit", new Object[] { "via InvalidTransactionException", transaction.internalTransaction } ); // Same behaviour as if the transaction was completed and replaced by // objectManagerState.dummyInternalTransaction. throw new InvalidStateException(this, InternalTransaction.stateTerminated, InternalTransaction.stateNames[InternalTransaction.stateTerminated]); } // if (transaction.internalTransaction != this). if (state == stateInactive || state == stateActiveNonPersistent || state == stateActivePersistent) { // Only call prePrepare if we have not already prepared the transaction. prePrepare(transaction); } // If already prepared. testState(nextStateForStartCommit); setState(nextStateForStartCommit); preCommit(transaction); // Tell ManagedObjects the outcome. // Is there any logging to do? We only need to write log records if the // transaction involves persistent objects. if (state == stateCommitingPersistent) { persistentWorkDone = true; TransactionCommitLogRecord transactionCommitLogRecord = new TransactionCommitLogRecord(this); objectManagerState.logOutput.writeNext(transactionCommitLogRecord, -logSpaceReserved, true, true); logSpaceReserved = 0; } // If logging work to do. // Drive the commit method for the included objects. // The synchronized block prevents us from taking a checkpoint until all of the // ManagedObjects have had their opportunity to update the ObjecStore. If a // checkpoint is currently active we will update the current checkpoint set in // the ObjecStore, if not we will update the next set of updates. lockedManagedObjects = new ManagedObject[includedManagedObjects.size()]; boolean requiresCurrentPersistentCheckpoint = requiresPersistentCheckpoint || (objectManagerState.checkpointStarting == ObjectManagerState.CHECKPOINT_STARTING_PERSISTENT); for (java.util.Iterator managedObjectIterator = includedManagedObjects.values() .iterator(); managedObjectIterator.hasNext();) { ManagedObject managedObject = (ManagedObject) managedObjectIterator.next(); // The logged serializedBytes will be null if the ManagedObject was deleted by this transaction // or if it was added from a transactionCheckpointLogRecord at restart, because the // Object Store will already have copy of this ManagedObject. ObjectManagerByteArrayOutputStream serializedBytes = (ObjectManagerByteArrayOutputStream) loggedSerializedBytes.get(managedObject.owningToken); long managedObjectSequenceNumber = ((Long) managedObjectSequenceNumbers.get(managedObject.owningToken)).longValue(); // If the Object was not locked by this transaction it must have been an optimistic update. if (managedObject.lockedBy(transaction)) { managedObject.commit(transaction, serializedBytes, managedObjectSequenceNumber, requiresCurrentPersistentCheckpoint); lockedManagedObjects[numberOfLockedManagedObjects++] = managedObject; } else { managedObject.optimisticReplaceCommit(transaction, serializedBytes, managedObjectSequenceNumber, requiresCurrentPersistentCheckpoint); } } // for... includedManagedObjects. setState(nextStateForCommit); transactionLock.unLock(objectManagerState); postCommit(transaction); // Tell ManagedObjects the outcome is complete. // Tidy up the transaction. complete(reUse, transaction); } // synchronized (this). // We don't want to clear the transaction lock held by the managedObject otherwise // ManagedObject.wasLocked() will not be able to give the past locked state. The // Unlock point wa noted above so now notify the ManagedObject and give a new // waiter a chance to acquire the lock. If a new transaction acquires the lock then // ManagedObject.wasLocked will return its result for the new transaction and // wasLocked() will then be true for an even later time. Do this after we have release the // synchronize lock on InternalTransaction so that we avoid deadlock with ManagedObjects // that invoke synchronized InternalTransaction methods. for (int i = 0; i < numberOfLockedManagedObjects; i++) { synchronized (lockedManagedObjects[i]) { lockedManagedObjects[i].notify(); } // synchronized (lockedManagedObjects[i]). } // for... lockedManagedObjects. // Tell the ObjectManager that we are done, once the transaction is unlocked // in case it is needed for checkpoint. objectManagerState.transactionCompleted(this, persistentWorkDone); // See if we need to delay while a checkpoint completes. Applications amy ask to reUSe // the same transaction, if so we introduce the delay here. Internal transactions are never // reUsed so we don't need to wory about blocking them. This call must be made when we // are not synchronized on the transaction because it might block waiting for a checkpoint // to complete if the log is full. if (reUse) objectManagerState.transactionPacing(); if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.exit(this, cclass , "commit" ); }
java
protected void backout(boolean reUse, Transaction transaction) throws ObjectManagerException { final String methodName = "backout"; if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.entry(this, cclass, methodName, new Object[] { new Boolean(reUse), transaction }); boolean persistentWorkDone = false; ManagedObject[] lockedManagedObjects; int numberOfLockedManagedObjects = 0; synchronized (this) { // To defend against two application threads completing the same transaction and trying to // continue with it at the same time we check that the Transaction still refers to this one, // now that we are synchronized on the InternalTransaction. if (transaction.internalTransaction != this) { if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.exit(this, cclass, methodName, new Object[] { "via InvalidTransactionException", transaction.internalTransaction } ); // Same behaviour as if the transaction was completed and replaced by // objectManagerState.dummyInternalTransaction. throw new InvalidStateException(this, InternalTransaction.stateTerminated, InternalTransaction.stateNames[InternalTransaction.stateTerminated]); } // if (transaction.internalTransaction != this). // Only call prePrepare if we have not already prepared the transaction. if (state == stateInactive || state == stateActiveNonPersistent || state == stateActivePersistent) { prePrepare(transaction); } // If already prepared. testState(nextStateForStartBackout); setState(nextStateForStartBackout); preBackout(transaction); // Tell ManagedObjects the outcome. // Is there any logging to do? if (state == stateBackingOutPersistent) { persistentWorkDone = true; TransactionBackoutLogRecord transactionBackoutLogRecord = new TransactionBackoutLogRecord(this); objectManagerState.logOutput.writeNext(transactionBackoutLogRecord, -logSpaceReserved, true, true); logSpaceReserved = 0; } // If logging work to do. // Drive the backout method for the included objects. // The synchronized block prevents us from taking a checkpoint until all of the // ManagedObjects have had their opportunity to update the ObjectStore. If a // checkpoint is currently active we will update the current checkpoint set in // the ObjectStore, if not we will update the next set of updates. lockedManagedObjects = new ManagedObject[includedManagedObjects.size()]; boolean requiresCurrentPersistentCheckpoint = requiresPersistentCheckpoint || (objectManagerState.checkpointStarting == ObjectManagerState.CHECKPOINT_STARTING_PERSISTENT); for (java.util.Iterator managedObjectIterator = includedManagedObjects.values().iterator(); managedObjectIterator.hasNext();) { ManagedObject managedObject = (ManagedObject) managedObjectIterator.next(); long managedObjectSequenceNumber = ((Long) managedObjectSequenceNumbers.get(managedObject.owningToken)).longValue(); if (managedObject.lockedBy(transaction)) { managedObject.backout(transaction, managedObjectSequenceNumber, requiresCurrentPersistentCheckpoint); lockedManagedObjects[numberOfLockedManagedObjects++] = managedObject; } else { ObjectManagerByteArrayOutputStream serializedBytes = (ObjectManagerByteArrayOutputStream) loggedSerializedBytes.get(managedObject.owningToken); managedObject.optimisticReplaceBackout(transaction, serializedBytes, managedObjectSequenceNumber, requiresCurrentPersistentCheckpoint); } // if(managedObject.lockedBy(transaction)). } // for... includedManagedObjects. setState(nextStateForBackout); transactionLock.unLock(objectManagerState); postBackout(transaction); // Tell ManagedObjects the outcome is complete. // Tidy up the transaction. complete(reUse, transaction); } // synchronized (this). // We don't want to clear the transaction lock held by the managedObject otherwise // ManagedObject.wasLocked() will not be able to give the past locked state. The // Unlock point wa noted above so now notify the ManagedObject and give a new // waiter a chance to acquire the lock. If a new transaction acquires the lock then // ManagedObject.wasLocked will return its result for the new transaction and // wasLocked() will then be true for an even later time. Do this after we have release the // synchronize lock on InternalTransaction so that we avoid deadlock with ManagedObjects // that invoke synchronized InternalTransaction methods. for (int i = 0; i < numberOfLockedManagedObjects; i++) { synchronized (lockedManagedObjects[i]) { lockedManagedObjects[i].notify(); } // synchronized (lockedManagedObjects[i]). } // for... lockedManagedObjects. // Tell the ObjectManager that we are done, once the transaction is unlocked // in case it is needed for checkpoint. objectManagerState.transactionCompleted(this, persistentWorkDone); // See if we need to delay while a checkpoint completes. Applications amy ask to reUSe // the same transaction, if so we introduce the delay here. Internal transactions are never // reUsed so we don't need to wory about blocking them. This call must be made when we // are not synchronized on the transaction because it might block waiting for a checkpoint // to complete if the log is full. if (reUse) objectManagerState.transactionPacing(); if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.exit(this, cclass, methodName); }
java
void preBackout(Transaction transaction) throws ObjectManagerException { final String methodName = "preBackout"; if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.entry(this, cclass, methodName, new Object[] { transaction }); // Allow any last minute changes before we backout. for (java.util.Iterator tokenIterator = callbackTokens.iterator(); tokenIterator.hasNext();) { Token token = (Token) tokenIterator.next(); ManagedObject managedObject = token.getManagedObject(); // Drive the preBackout method for the object. managedObject.preBackout(transaction); } // for... callbackTokens. if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.exit(this, cclass, methodName); }
java
private final void complete(boolean reUse, Transaction transaction) throws ObjectManagerException { final String methodName = "complete"; if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.entry(this, cclass, methodName, new Object[] { new Boolean(reUse), transaction }); // No longer any need to include this transaction in a Checkpoint. requiresPersistentCheckpoint = false; // Clear any remaining state. logicalUnitOfWork.XID = null; transactionLock = new TransactionLock(this); includedManagedObjects.clear(); callbackTokens.clear(); allPersistentTokensToNotify.clear(); loggedSerializedBytes.clear(); logSequenceNumbers.clear(); managedObjectSequenceNumbers.clear(); useCount++; if (reUse) { // Reset the transaction for further use. // Note that we do not clear the transactionReference because the caller is still holding it. // If the caller releases his reference then the reference will be found by ObjectManagerState // and this InternalTransaction may be reused for another external Transaction. } else { // Do not chain. // Make sure the external Transaction cannot reach this internal one. transaction.internalTransaction = objectManagerState.dummyInternalTransaction; // This may not be sufficient to prevent its being used if the external Transaction already has passed // the point where it has picked up the referenece to the Internaltransaction. Hence we terminate the // InternalTransaction if it is preemptively backed out. See ObjectManagerstate.performCheckpoint() // where transactions are backed out without holding the internal transaction synchronize lock. if (transactionReference != null) transactionReference.clear(); // Inhibt an enqueue of the transactionReference. // If a reference is enqueued we are already in inactive state for this // transactionReferenceSequence so no action will occur. // Tell the ObjectManager that we no longer exist as an active transaction. objectManagerState.deRegisterTransaction(this); } // if (reUse). if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.exit(this, cclass, methodName); }
java
protected synchronized void terminate(int reason) throws ObjectManagerException { final String methodName = "terminate"; if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.entry(this, cclass, methodName, new Object[] { new Integer(reason) }); if (transactionReference != null) { Transaction transaction = (Transaction) transactionReference.get(); /** * PM00131 - transaction is coming from a WeakReference, check it isn't null. * If we've lost the reference, there isn't any point making a new one * just to set a reason code on it. Nobody will have a reference to the * new object with which to retrieve the code. **/ if (transaction != null) transaction.setTerminationReason(reason); } setState(nextStateForTerminate); // Any attempt by any therad to do anything with this Transaction // from now on will result in a StateErrorException. if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.exit(this, cclass, methodName); }
java
protected synchronized void shutdown() throws ObjectManagerException { if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.entry(this, cclass , "shutDown" ); setState(nextStateForShutdown); // Any attempt by any therad to do anything with this Transaction // from now on will result in a InvalidStateException. if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.exit(this, cclass , "shutdown" ); }
java
protected final void setRequiresCheckpoint() { final String methodName = "setRequiresCheckpoint"; if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.entry(this, cclass, methodName, new Object[] { new Boolean(requiresPersistentCheckpoint) }); // The states for which a checkpoint log Record must be written to the log unless this transactions ends first. // Has any logging been done? If The transaction enters one of thse states after this // call then all of its state will be in the log after CheckpointStart. final boolean checkpointRequired[] = { false , false , false , true // ActivePersistent. , false , false , true // PrePreparedPersistent. , false , false , true // PreparedPersistent. , false , false , true // CommitingPersistent. Not needed because of synchronize in commit. , false , false , true // BackingOutPersistent. Not needed because of synchronize in commit. , false }; requiresPersistentCheckpoint = checkpointRequired[state]; if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.exit(this, cclass, methodName, new Object[] { new Boolean(requiresPersistentCheckpoint) }); }
java
protected synchronized void checkpoint(long forcedLogSequenceNumber) throws ObjectManagerException { if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.entry(this, cclass , "checkpoint" , new Object[] { new Long(forcedLogSequenceNumber), new Boolean(requiresPersistentCheckpoint) }); // TODO If we have a STRATEGY_SAVE_ON_CHECKPOINT store then these objects need to be included here. // TODO currently STRATEGY_KEEP_UNTIL_NEXT_OPEN are not saved during a checkpoint. // TODO We will also need to track, nonPersistent,Serialized,and Persistent state in order to figure // TODO out whether or not to include the transaction in the checkpoint. // Was data logging required when we started the checkpoint // and is it still needed for recovery? if (requiresPersistentCheckpoint) { // Build subset lists of persistent tokens to recover. java.util.List persistentTokensToAdd = new java.util.ArrayList(); java.util.List persistentTokensToReplace = new java.util.ArrayList(); java.util.List persistentSerializedBytesToReplace = new java.util.ArrayList(); java.util.List persistentTokensToOptimisticReplace = new java.util.ArrayList(); java.util.List persistentTokensToDelete = new java.util.ArrayList(); // Drive checkpoint for each included MangedObject. for (java.util.Iterator managedObjectIterator = includedManagedObjects.values().iterator(); managedObjectIterator.hasNext();) { ManagedObject managedObject = (ManagedObject) managedObjectIterator.next(); if (managedObject.owningToken.getObjectStore() .getPersistence()) { // Has the last logged update been Forced to disk? // If not the normal log record will be after the start of the chekpoint and it will // cause normal recovery for that ManagedObject. long logSequenceNumber = ((Long) logSequenceNumbers.get(managedObject.owningToken)).longValue(); if (forcedLogSequenceNumber >= logSequenceNumber) { // The loggedSerializedBytes we currently have will have had any corrections made at preBackoutTime // incorporated into them, so they are now the correct ones to write to the ObjectStore. ObjectManagerByteArrayOutputStream serializedBytes = (ObjectManagerByteArrayOutputStream) loggedSerializedBytes.get(managedObject.owningToken); long managedObjectSequenceNumber = ((Long) managedObjectSequenceNumbers.get(managedObject.owningToken)).longValue(); managedObject.checkpoint(this, serializedBytes, managedObjectSequenceNumber); // Build the lists of objects to log. if (managedObject.lockedBy(this)) { // Locking update? switch (managedObject.getState()) { case ManagedObject.stateAdded: persistentTokensToAdd.add(managedObject.owningToken); break; case ManagedObject.stateReplaced: persistentTokensToReplace.add(managedObject.owningToken); // We have to rewrite the replaced serialized bytes in the log as part of the checkpoint. persistentSerializedBytesToReplace.add(serializedBytes); break; case ManagedObject.stateToBeDeleted: persistentTokensToDelete.add(managedObject.owningToken); break; } // switch. } else { // OptimisticReplace update. // A bit pointless as we dont do anything at recovery time. persistentTokensToOptimisticReplace.add(managedObject.owningToken); } // if (lockedBy(transaction)). } // if (forcedLogSequenceNumber >= logSequenceNumber). } // if (managedObject.owningToken.getObjectStore().getPersistence()). } // for ... includedMansagedObjects. // The state indicates if the transaction is prepared, commiting or backing out. TransactionCheckpointLogRecord transactionCheckpointLogRecord = new TransactionCheckpointLogRecord(this, persistentTokensToAdd, persistentTokensToReplace, persistentSerializedBytesToReplace, persistentTokensToOptimisticReplace, persistentTokensToDelete, allPersistentTokensToNotify); // TODO Could correct any overestimate of the reserved log file space here. // We previously reserved some log space for this logRecord to be sure it will fit in the log. // We do not release it here because w reserved an extra page which we might not be able to get back after the // checkpoint has completed. Instead we just supress the check on the space used in the log. objectManagerState.logOutput.writeNext(transactionCheckpointLogRecord, 0, false , false); requiresPersistentCheckpoint = false; } // if (requiresPersistentCheckpoint). if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.exit(this, cclass , "checkpoint" ); }
java
@Override public void afterCompletion(int status) { if (status == Status.STATUS_COMMITTED) { Boolean previous = persistentExecutor.inMemoryTaskIds.put(taskId, Boolean.TRUE); if (previous == null) { long delay = expectedExecTime - new Date().getTime(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "Schedule " + taskId + " for " + delay + "ms from now"); persistentExecutor.scheduledExecutor.schedule(this, delay, TimeUnit.MILLISECONDS); } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "Found task " + taskId + " already scheduled"); } } }
java
@FFDCIgnore(Throwable.class) @Sensitive private byte[] serializeResult(Object result, ClassLoader loader) throws IOException { try { return persistentExecutor.serialize(result); } catch (Throwable x) { return persistentExecutor.serialize(new TaskFailure(x, loader, persistentExecutor, TaskFailure.NONSER_RESULT, result.getClass().getName())); } }
java
protected Converter createConverter(FaceletContext ctx) throws FacesException, ELException, FaceletException { return ctx.getFacesContext().getApplication().createConverter(NumberConverter.CONVERTER_ID); }
java
public void queueDataReceivedInvocation(Connection connection, ReceiveListener listener, WsByteBuffer data, int segmentType, int requestNumber, int priority, boolean allocatedFromBufferPool, boolean partOfExchange, Conversation conversation) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "queueDataReceivedInvocation", new Object[] {connection, listener, data, ""+segmentType, ""+requestNumber, ""+priority, ""+allocatedFromBufferPool, ""+partOfExchange, conversation}); int dataSize = 0; if (dispatcherEnabled) dataSize = data.position(); // D240062 AbstractInvocation invocation = allocateDataReceivedInvocation(connection, listener, data, dataSize, segmentType, requestNumber, priority, allocatedFromBufferPool, partOfExchange, conversation); queueInvocationCommon(invocation, (ConversationImpl)conversation); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "queueDataReceivedInvocation"); }
java
public static ReceiveListenerDispatcher getInstance(Conversation.ConversationType convType, boolean isOnClientSide) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getInstance", new Object[] {""+convType, ""+isOnClientSide}); ReceiveListenerDispatcher retInstance; // A conversation has type CLIENT if it is an Outbound or Inbound connection from a JetStream // client. The client side RLD is different from the server side RLD, so we need the // isOnClientSide flag to distinguish them. // A conversation has type ME if it is an Outbound or Inbound connection from another ME. if (convType == Conversation.CLIENT) { if (isOnClientSide) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Returning client instance"); synchronized(ReceiveListenerDispatcher.class) { if (clientInstance == null) { clientInstance = new ReceiveListenerDispatcher(true, true); // Client side of ME-Client conversation } } retInstance = clientInstance; } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Returning server instance"); synchronized(ReceiveListenerDispatcher.class) { if (serverInstance == null) { serverInstance = new ReceiveListenerDispatcher(false, true); // ME side of ME-Client conversation } } retInstance = serverInstance; } } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Returning ME-ME instance"); synchronized(ReceiveListenerDispatcher.class) { if (meInstance == null) { meInstance = new ReceiveListenerDispatcher(false, false); // ME-ME conversation } } retInstance = meInstance; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getInstance", retInstance); return retInstance; }
java
public static boolean isCommandLine() { String output = AccessController.doPrivileged(new PrivilegedAction<String>() { @Override public String run() { return System.getProperty("wlp.process.type"); } }); boolean value = true; if (output != null && ("server".equals(output) || "client".equals(output))) { value = false; } if (logger.isLoggable(Level.FINE)) { logger.fine("value: " + value); } return value; }
java
public static String getInstallRoot() { return AccessController.doPrivileged(new PrivilegedAction<String>() { @Override public String run() { String output = System.getProperty("wlp.install.dir"); if (output == null) { output = System.getenv("WLP_INSTALL_DIR"); } if (output == null) { // if neither of these is set. use the location where the class is loaded. URL url = CLASS_NAME.getProtectionDomain().getCodeSource().getLocation(); try { output = new File(url.toString().substring("file:".length())).getParentFile().getParentFile().getCanonicalPath(); } catch (IOException e) { // this condition should not happen, but if that's the case, use current directory. output = "."; if (logger.isLoggable(Level.FINE)) { logger.fine("The install root was not detected. " + e.getMessage()); } } } if (logger.isLoggable(Level.FINE)) { logger.fine("The install root is " + output); } return output; } }); }
java
public static ResourceBundle getResourceBundle(File location, String name, Locale locale) { File[] files = new File[] { new File(location, name + "_" + locale.toString() + RESOURCE_FILE_EXT), new File(location, name + "_" + locale.getLanguage() + RESOURCE_FILE_EXT), new File(location, name + RESOURCE_FILE_EXT) }; for (File file : files) { if (exists(file)) { try { return new PropertyResourceBundle(new FileReader(file)); } catch (IOException e) { if (logger.isLoggable(Level.FINE)) { logger.fine("The resource file was not loaded. The exception is " + e.getMessage()); } } } } return null; }
java
public static List<CustomManifest> findCustomEncryption(String extension) throws IOException { List<File> dirs = listRootAndExtensionDirectories(); return findCustomEncryption(dirs, TOOL_EXTENSION_DIR + extension); }
java
protected static List<CustomManifest> findCustomEncryption(List<File> rootDirs, String path) throws IOException { List<CustomManifest> list = new ArrayList<CustomManifest>(); for (File dir : rootDirs) { dir = new File(dir, path); if (exists(dir)) { File[] files = listFiles(dir); if (files != null) { for (File file : files) { if (isFile(file) && file.getName().toLowerCase().endsWith(JAR_FILE_EXT)) { if (logger.isLoggable(Level.FINE)) { logger.fine("The extension manifest file : " + file); } try { CustomManifest cm = new CustomManifest(file); list.add(cm); } catch (IllegalArgumentException iae) { if (logger.isLoggable(Level.INFO)) { logger.info(MessageUtils.getMessage("PASSWORDUTIL_ERROR_IN_EXTENSION_MANIFEST_FILE", file, iae.getMessage())); } } } } } } } return list; }
java
@Override public NetworkTransportFactory getNetworkTransportFactory() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getNetworkTransportFactory"); NetworkTransportFactory factory = new RichClientTransportFactory(framework); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getNetworkTransportFactory", factory); return factory; }
java
@Override public Map getOutboundConnectionProperties(String outboundTransportName) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getOutboundConnectionProperties", outboundTransportName); ChainData chainData = framework.getChain(outboundTransportName); // Obtain properties for outbound channel ChannelData[] channelList = chainData.getChannelList(); Map properties = null; if (channelList.length > 0) { properties = channelList[0].getPropertyBag(); } else { throw new SIErrorException( nls.getFormattedMessage("OUTCONNTRACKER_INTERNAL_SICJ0064", null, "OUTCONNTRACKER_INTERNAL_SICJ0064")); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getOutboundConnectionProperties", properties); return properties; }
java
@Override public Map getOutboundConnectionProperties(Object ep) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getOutboundConnectionProperties", ep); Map properties = null; if (ep instanceof CFEndPoint) { OutboundChannelDefinition[] channelDefinitions = (OutboundChannelDefinition[]) ((CFEndPoint) ep).getOutboundChannelDefs().toArray(); if (channelDefinitions.length < 1) throw new SIErrorException(nls.getFormattedMessage("OUTCONNTRACKER_INTERNAL_SICJ0064", null, "OUTCONNTRACKER_INTERNAL_SICJ0064")); properties = channelDefinitions[0].getOutboundChannelProperties(); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getOutboundConnectionProperties", properties); return properties; }
java
@Override public InetAddress getHostAddress(Object endPoint) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getHostAddress", endPoint); InetAddress address = null; if (endPoint instanceof CFEndPoint) { address = ((CFEndPoint) endPoint).getAddress(); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getHostAddress", address); return address; }
java
@Override public int getHostPort(Object endPoint) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getHostPort", endPoint); int port = 0; if (endPoint instanceof CFEndPoint) { port = ((CFEndPoint) endPoint).getPort(); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getHostPort", Integer.valueOf(port)); return port; }
java
@Override public boolean areEndPointsEqual(Object ep1, Object ep2) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "areEndPointsEqual", new Object[] { ep1, ep2 }); boolean isEqual = false; if (ep1 instanceof CFEndPoint && ep2 instanceof CFEndPoint) { CFEndPoint cfEp1 = (CFEndPoint) ep1; CFEndPoint cfEp2 = (CFEndPoint) ep2; // The CFW does not provide an equals method for its endpoints. // We need to manually equals the important bits up isEqual = isEqual(cfEp1.getAddress(), cfEp2.getAddress()) && isEqual(cfEp1.getName(), cfEp2.getName()) && cfEp1.getPort() == cfEp2.getPort() && cfEp1.isLocal() == cfEp2.isLocal() && cfEp1.isSSLEnabled() == cfEp2.isSSLEnabled(); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "areEndPointsEqual", Boolean.valueOf(isEqual)); return isEqual; }
java
@Override public int getEndPointHashCode(Object ep) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getEndPointHashCode", ep); int hashCode = 0; if (ep instanceof CFEndPoint) { CFEndPoint cfEndPoint = (CFEndPoint) ep; if (cfEndPoint.getAddress() != null) hashCode = hashCode ^ cfEndPoint.getAddress().hashCode(); if (cfEndPoint.getName() != null) hashCode = hashCode ^ cfEndPoint.getName().hashCode(); } if (hashCode == 0) hashCode = hashCode ^ ep.hashCode(); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getEndPointHashCode", Integer.valueOf(hashCode)); return hashCode; }
java
private CFEndPoint cloneEndpoint(final CFEndPoint originalEndPoint) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "cloneEndpoint", originalEndPoint); CFEndPoint endPoint; ByteArrayOutputStream baos = null; ObjectOutputStream out = null; ObjectInputStream in = null; try { baos = new ByteArrayOutputStream(); out = new ObjectOutputStream(baos); out.writeObject(originalEndPoint); out.flush(); ClassLoader cl = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() { @Override public ClassLoader run() { return Thread.currentThread().getContextClassLoader(); } }); in = new DeserializationObjectInputStream(new ByteArrayInputStream(baos.toByteArray()), cl); endPoint = (CFEndPoint) in.readObject(); } catch (IOException e) { FFDCFilter.processException(e, CLASS_NAME + ".cloneEndpoint", JFapChannelConstants.RICHCLIENTFRAMEWORK_CLONE_01, this); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Caught IOException copying endpoint", e); //Use input parameter. endPoint = originalEndPoint; } catch (ClassNotFoundException e) { FFDCFilter.processException(e, CLASS_NAME + ".cloneEndpoint", JFapChannelConstants.RICHCLIENTFRAMEWORK_CLONE_02, this); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Caught ClassNotFoundException copying endpoint", e); //Use input parameter. endPoint = originalEndPoint; } finally { //Tidy up resources. try { if (out != null) { out.close(); } if (in != null) { in.close(); } } catch (IOException e) { //No FFDC code needed. //Absorb any exceptions as we no longer care. } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "cloneEndpoint", endPoint); return endPoint; }
java
private Throwable getCause(Throwable t) { Throwable cause = t.getCause(); if (t.getCause() != null) { return cause; } else { return t; } }
java
public String traceLogFormat(LogRecord logRecord, Object id, String formattedMsg, String formattedVerboseMsg) { final String txt; if (formattedVerboseMsg == null) { // If we don't already have a formatted message... (for Audit or Info or Warning.. ) // we have to build something instead (while avoiding a useless resource bundle lookup) txt = formatVerboseMessage(logRecord, formattedMsg, false); } else { txt = formattedVerboseMsg; } return createFormattedString(logRecord, id, txt); }
java
private Object formatVerboseObj(Object obj) { // Make sure that we don't truncate any stack traces during verbose logging if (obj instanceof TruncatableThrowable) { TruncatableThrowable truncatable = (TruncatableThrowable) obj; final Throwable wrappedException = truncatable.getWrappedException(); return DataFormatHelper.throwableToString(wrappedException); } else if (obj instanceof Throwable) { return DataFormatHelper.throwableToString((Throwable) obj); } return null; }
java
protected String formatStreamOutput(GenericData genData) { String txt = null; String loglevel = null; KeyValuePair kvp = null; KeyValuePair[] pairs = genData.getPairs(); for (KeyValuePair p : pairs) { if (p != null && !p.isList()) { kvp = p; if (kvp.getKey().equals("message")) { txt = kvp.getStringValue(); } else if (kvp.getKey().equals("loglevel")) { loglevel = kvp.getStringValue(); } } } String message = BaseTraceService.filterStackTraces(txt); if (message != null) { if (loglevel.equals("SystemErr")) { message = "[err] " + message; } } return message; }
java
private void createTimeout(IAbstractAsyncFuture future, long delay, boolean isRead) { if (AsyncProperties.disableTimeouts) { return; } // create the timeout time, while not holding the lock long timeoutTime = (System.currentTimeMillis() + delay + Timer.timeoutRoundup) & Timer.timeoutResolution; synchronized (future.getCompletedSemaphore()) { // make sure it didn't complete while we were getting here if (!future.isCompleted()) { timer.createTimeoutRequest(timeoutTime, this.callback, future); } } }
java
public void refresh() { this.productProperties = new Properties(); FileInputStream fis = null; try { fis = new FileInputStream(new File(this.installDir, PRODUCT_PROPERTIES_PATH)); this.productProperties.load(fis); } catch (Exception e) { } finally { InstallUtils.close(fis); } featureDefs = null; installFeatureDefs = null; mfp = null; }
java
public static RequestMetadata getRequestMetadata() { RequestMetadata metadata = threadLocal.get(); if (metadata == null) metadata = getNoMetadata(); return metadata; }
java
public void initialize(int[] bufferEntrySizes, int[] bufferEntryDepths) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "initialize"); } // order both lists from smallest to largest, based only on Entry Sizes int len = bufferEntrySizes.length; int[] bSizes = new int[len]; int[] bDepths = new int[len]; int sizeCompare; int depth; int sizeSort; int j; for (int i = 0; i < len; i++) { sizeCompare = bufferEntrySizes[i]; depth = bufferEntryDepths[i]; // go backwards, for speed, since first Array List is // probably already ordered small to large for (j = i - 1; j >= 0; j--) { sizeSort = bSizes[j]; if (sizeCompare > sizeSort) { // add the bigger one after the smaller one bSizes[j + 1] = sizeCompare; bDepths[j + 1] = depth; break; } // move current one down, since it is bigger bSizes[j + 1] = sizeSort; bDepths[j + 1] = bDepths[j]; } if (j < 0) { // smallest so far, add it at the front of the list bSizes[0] = sizeCompare; bDepths[0] = depth; } } boolean tracking = trackingBuffers(); this.pools = new WsByteBufferPool[len]; this.poolsDirect = new WsByteBufferPool[len]; this.poolSizes = new int[len]; for (int i = 0; i < len; i++) { // make backing pool 10 times larger than local pools this.pools[i] = new WsByteBufferPool(bSizes[i], bDepths[i] * 10, tracking, false); this.poolsDirect[i] = new WsByteBufferPool(bSizes[i], bDepths[i] * 10, tracking, true); this.poolSizes[i] = bSizes[i]; } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Number of pools created: " + this.poolSizes.length); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "initialize"); } }
java
public void setLeakDetectionSettings(int interval, String output) throws IOException { this.leakDetectionInterval = interval; this.leakDetectionOutput = TrConfigurator.getLogLocation() + File.separator + output; if ((interval > -1) && (output != null)) { // clear file FileWriter outFile = new FileWriter(this.leakDetectionOutput, false); outFile.close(); } }
java
@Override public WsByteBuffer allocateFileChannelBuffer(FileChannel fc) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "allocateFileChannelBuffer"); } return new FCWsByteBufferImpl(fc); }
java
protected WsByteBufferImpl allocateBufferDirect(WsByteBufferImpl buffer, int size, boolean overrideRefCount) { DirectByteBufferHelper directByteBufferHelper = this.directByteBufferHelper.get(); ByteBuffer byteBuffer; if (directByteBufferHelper != null) { byteBuffer = directByteBufferHelper.allocateDirectByteBuffer(size); } else { byteBuffer = ByteBuffer.allocateDirect(size); } buffer.setByteBufferNonSafe(byteBuffer); return buffer; }
java
protected void releasing(ByteBuffer buffer) { if (buffer != null && buffer.isDirect()) { DirectByteBufferHelper directByteBufferHelper = this.directByteBufferHelper.get(); if (directByteBufferHelper != null) { directByteBufferHelper.releaseDirectByteBuffer(buffer); } } }
java
public String debug() { String data = null; StringBuffer sb = new StringBuffer(); sb.append("ConsumerProperties"); sb.append("\n"); sb.append("------------------"); sb.append("\n"); sb.append("Destination: "); sb.append(getJmsDestination()); sb.append("\n"); sb.append("DestType: "); sb.append(getDestinationType()); sb.append("\n"); sb.append("Selector: "); sb.append(getSelector()); sb.append("\n"); sb.append("NoLocal: "); sb.append(noLocal()); sb.append("\n"); sb.append("Reliablity: "); sb.append(getReliability()); sb.append("\n"); sb.append("ClientID: "); sb.append(getClientID()); sb.append("\n"); sb.append("SubName: "); sb.append(getSubName()); sb.append("\n"); sb.append("DurableSubHome: "); sb.append(getDurableSubscriptionHome()); sb.append("\n"); sb.append("ReadAhead: "); sb.append(readAhead()); sb.append("\n"); sb.append("UnrecoverableReliability: "); sb.append(getUnrecovReliability()); sb.append("\n"); sb.append("Supports Multiple: "); sb.append(supportsMultipleConsumers()); sb.append("\n"); if (dest instanceof Queue) { sb.append("GatherMessages: "); sb.append(isGatherMessages()); sb.append("\n"); } data = sb.toString(); return data; }
java
private Pattern loadAcceptPattern(ExternalContext context) { assert context != null; String mappings = context.getInitParameter(ViewHandler.FACELETS_VIEW_MAPPINGS_PARAM_NAME); if (mappings == null) { return null; } // Make sure the mappings contain something mappings = mappings.trim(); if (mappings.length() == 0) { return null; } return Pattern.compile(toRegex(mappings)); }
java
private String toRegex(String mappings) { assert mappings != null; // Get rid of spaces mappings = mappings.replaceAll("\\s", ""); // Escape '.' mappings = mappings.replaceAll("\\.", "\\\\."); // Change '*' to '.*' to represent any match mappings = mappings.replaceAll("\\*", ".*"); // Split the mappings by changing ';' to '|' mappings = mappings.replaceAll(";", "|"); return mappings; }
java
protected void prepareConduitSelector(Message message, URI currentURI, boolean proxy) { try { cfg.prepareConduitSelector(message); } catch (Fault ex) { LOG.warning("Failure to prepare a message from conduit selector"); } message.getExchange().put(ConduitSelector.class, cfg.getConduitSelector()); message.getExchange().put(Service.class, cfg.getConduitSelector().getEndpoint().getService()); String address = (String) message.get(Message.ENDPOINT_ADDRESS); // custom conduits may override the initial/current address if (address.startsWith(HTTP_SCHEME) && !address.equals(currentURI.toString())) { URI baseAddress = URI.create(address); currentURI = calculateNewRequestURI(baseAddress, currentURI, proxy); message.put(Message.ENDPOINT_ADDRESS, currentURI.toString()); message.put(Message.REQUEST_URI, currentURI.toString()); } message.put(Message.BASE_PATH, getBaseURI().toString()); }
java
@Override public boolean isCorruptOrIndoubt() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "isCorruptOrIndoubt"); boolean isCorruptOrIndoubt = _targetDestinationHandler.isCorruptOrIndoubt(); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "isCorruptOrIndoubt", Boolean.valueOf(isCorruptOrIndoubt)); return isCorruptOrIndoubt; }
java
public void delete() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "delete"); //Tell the target of the alias to remove the backwards reference to it _targetDestinationHandler.removeTargettingAlias(this); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "delete"); }
java
protected void setLayoutToPrimary(int segmentLength, int priority, boolean isPooled, boolean isExchange, int packetNumber, int segmentType, SendListener sendListener) { if (tc.isEntryEnabled()) SibTr.entry(this, tc, "setLayoutToPrimary", new Object[] {""+segmentLength, ""+priority, ""+isPooled, ""+isExchange, ""+packetNumber, ""+segmentType, sendListener}); primaryHeaderFields.segmentLength = segmentLength; primaryHeaderFields.priority = priority; primaryHeaderFields.isPooled = isPooled; primaryHeaderFields.isExchange = isExchange; primaryHeaderFields.packetNumber = packetNumber; primaryHeaderFields.segmentType = segmentType; this.sendListener = sendListener; transmissionRemaining = segmentLength; layout = JFapChannelConstants.XMIT_PRIMARY_ONLY; if (tc.isEntryEnabled()) SibTr.exit(this, tc, "setLayoutToPrimary"); }
java
protected void setLayoutToConversation(int segmentLength, int priority, boolean isPooled, boolean isExchange, int packetNumber, int segmentType, int conversationId, int requestNumber, Conversation conversation, SendListener sendListener) { if (tc.isEntryEnabled()) SibTr.entry(this, tc, "setLayoutToConversation", new Object[]{""+segmentLength, ""+priority, ""+isPooled, ""+isExchange, ""+packetNumber, ""+segmentType, ""+conversationId, ""+requestNumber, conversation, sendListener}); setLayoutToPrimary(segmentLength, priority, isPooled, isExchange, packetNumber, segmentType, sendListener); conversationHeaderFields.conversationId = conversationId; conversationHeaderFields.requestNumber = requestNumber; this.conversation = conversation; transmissionRemaining = segmentLength; layout = JFapChannelConstants.XMIT_CONVERSATION; if (tc.isEntryEnabled()) SibTr.exit(this, tc, "setLayoutToConversation"); }
java
protected void setLayoutToStartSegment(int segmentLength, int priority, boolean isPooled, boolean isExchange, int packetNumber, int segmentType, int conversationId, int requestNumber, long totalLength) { if (tc.isEntryEnabled()) SibTr.entry(this, tc, "setLayoutToStartSegment", new Object[]{""+segmentLength, ""+priority, ""+isPooled, ""+isExchange, ""+packetNumber, ""+segmentType, ""+conversationId, ""+requestNumber, ""+totalLength}); setLayoutToConversation(segmentLength, priority, isPooled, isExchange, packetNumber, segmentType, conversationId, requestNumber, null, null); segmentedTransmissionHeaderFields.totalLength = totalLength; segmentedTransmissionHeaderFields.segmentType = segmentType; transmissionRemaining = segmentLength; primaryHeaderFields.segmentType = JFapChannelConstants.SEGMENT_SEGMENTED_FLOW_START; layout = JFapChannelConstants.XMIT_SEGMENT_START; if (tc.isEntryEnabled()) SibTr.exit(this, tc, "setLayoutToStartSegment"); }
java
protected void setLayoutToMiddleSegment(int segmentLength, int priority, boolean isPooled, boolean isExchange, int packetNumber, int conversationId, int requestNumber) { if (tc.isEntryEnabled()) SibTr.entry(this, tc, "setLayoutToMiddleSegment", new Object[]{""+segmentLength, ""+priority, ""+isPooled, ""+isExchange, ""+packetNumber, ""+conversationId, ""+requestNumber}); setLayoutToConversation(segmentLength, priority, isPooled, isExchange, packetNumber, JFapChannelConstants.SEGMENT_SEGMENTED_FLOW_MIDDLE, conversationId, requestNumber, null, null); layout = JFapChannelConstants.XMIT_SEGMENT_MIDDLE; transmissionRemaining = segmentLength; if (tc.isEntryEnabled()) SibTr.exit(this, tc, "setLayoutToMiddleSegment"); }
java
protected void setLayoutToEndSegment(int segmentLength, int priority, boolean isPooled, boolean isExchange, int packetNumber, int conversationId, int requestNumber, Conversation conversation, SendListener sendListener) { if (tc.isEntryEnabled()) SibTr.entry(this, tc, "setLayoutToSegmentEnd", new Object[]{""+segmentLength, ""+priority, ""+isPooled, ""+isExchange, ""+packetNumber, ""+conversationId, ""+requestNumber, conversation, sendListener}); setLayoutToConversation(segmentLength, priority, isPooled, isExchange, packetNumber, JFapChannelConstants.SEGMENT_SEGMENTED_FLOW_END, conversationId, requestNumber, conversation, sendListener); layout = JFapChannelConstants.XMIT_SEGMENT_END; transmissionRemaining = segmentLength; }
java
protected boolean isPooledBuffers() { if (tc.isEntryEnabled()) SibTr.entry(this, tc, "isPooledBuffers"); if (tc.isEntryEnabled()) SibTr.exit(this, tc, "isPooledBuffers", ""+primaryHeaderFields.isPooled); return primaryHeaderFields.isPooled; }
java
protected boolean isUserRequest() { if (tc.isEntryEnabled()) SibTr.entry(this, tc, "isUserRequest"); if (tc.isEntryEnabled()) SibTr.exit(this, tc, "isUserRequest", ""+isUserRequest); return isUserRequest; }
java
protected boolean isTerminal() { if (tc.isEntryEnabled()) SibTr.entry(this, tc, "isTermainl"); if (tc.isEntryEnabled()) SibTr.exit(this, tc, "isTermainl", ""+isTerminal); return isTerminal; }
java
private boolean buildHeader(HeaderFields headerFields, WsByteBuffer xmitBuffer) { if (tc.isEntryEnabled()) SibTr.entry(this, tc, "buildHeader", new Object[] {headerFields, xmitBuffer}); if (tc.isDebugEnabled()) JFapUtils.debugTraceWsByteBufferInfo(this, tc, xmitBuffer, "xmitBuffer"); boolean headerFinished = false; WsByteBuffer headerBuffer = null; if (headerScratchSpace.position() == 0) { if (tc.isDebugEnabled()) JFapUtils.debugTraceWsByteBufferInfo(this, tc, headerScratchSpace, "headerScratchSpace"); // No data in the scratch space buffer - so we must decide if we can // build this header in place. if (xmitBuffer.remaining() >= headerFields.sizeof()) { // Enough space in the transmission buffer to build the header in // place. headerBuffer = xmitBuffer; headerFields.writeToBuffer(xmitBuffer); headerFinished = true; } else { // Insufficient room in the transmission buffer to build the header // in place. headerBuffer = headerScratchSpace; headerFields.writeToBuffer(headerScratchSpace); headerScratchSpace.flip(); } // build header into buffer. } else { // We have already built a header into the scratch space and are // in the process of copying it into the transmission buffer. headerBuffer = headerScratchSpace; } if (!headerFinished) { // We have not finished on this header yet. Try copying it into // the transmission buffer. int headerLeftToCopy = headerBuffer.remaining(); int amountCopied = JFapUtils.copyWsByteBuffer(headerBuffer, xmitBuffer, headerLeftToCopy); headerFinished = amountCopied == headerLeftToCopy; } // If we finished the header - clean out anything we might have put // into the scratch space. if (headerFinished) { headerScratchSpace.clear(); transmissionRemaining -= headerFields.sizeof(); } else exhausedXmitBuffer = true; if (tc.isEntryEnabled()) SibTr.exit(this, tc, "buildHeader", ""+headerFinished); return headerFinished; }
java
private boolean buildPayload(WsByteBuffer xmitBuffer) { if (tc.isEntryEnabled()) SibTr.entry(this, tc, "buildPayload", xmitBuffer); if (tc.isDebugEnabled()) JFapUtils.debugTraceWsByteBufferInfo(this, tc, xmitBuffer, "xmitBuffer"); boolean payloadFinished = false; int amountCopied, amountToCopy; if (xmitDataBuffers.length == 0) { if (tc.isDebugEnabled()) SibTr.debug(this, tc, "payload finished"); payloadFinished = true; } else { do { amountToCopy = xmitDataBuffers[currentXmitDataBufferIndex].remaining(); if (amountToCopy > transmissionRemaining) amountToCopy = transmissionRemaining; amountCopied = JFapUtils.copyWsByteBuffer(xmitDataBuffers[currentXmitDataBufferIndex], xmitBuffer, amountToCopy); if (tc.isDebugEnabled()) SibTr.debug(this, tc, "amountToCopy="+amountToCopy+" amountCopied="+amountCopied+" currentXmitDataBufferIndex="+currentXmitDataBufferIndex); transmissionRemaining -= amountCopied; if (amountCopied == amountToCopy) { ++currentXmitDataBufferIndex; payloadFinished = (currentXmitDataBufferIndex == xmitDataBuffers.length); } if ((amountCopied < amountToCopy) || (transmissionRemaining < 1)) { exhausedXmitBuffer = true; } } while((amountCopied == amountToCopy) && (!payloadFinished) && (!exhausedXmitBuffer)); } if (tc.isEntryEnabled()) SibTr.exit(this, tc, "buildPayload", ""+payloadFinished); return payloadFinished; }
java