/** * Sets the unique id for a stand alone ejb module. It traverses through * all the ejbs in this stand alone module and sets the unique id for * each of them. The traversal order is done in ascending element order. * * <p> Note: This method will not be called for application. * * @param id unique id for stand alone module */ public void setUniqueId(long id) { this.uniqueId = id; // First sort the beans in alphabetical order. EjbDescriptor[] descs = ejbs.toArray(new EjbDescriptor[ejbs.size()]); // The sorting algorithm used by this api is a modified mergesort. // This algorithm offers guaranteed n*log(n) performance, and // can approach linear performance on nearly sorted lists. Arrays.sort(descs, new Comparator<EjbDescriptor>() { public int compare(EjbDescriptor o1, EjbDescriptor o2) { return o2.getName().compareTo(o1.getName()); } } ); for (int i=0; i<descs.length; i++) { // 2^16 beans max per stand alone module descs[i].setUniqueId( (id | i) ); } }
/** * Sets the unique id for this application. It traverses through all * the ejbs in the application and sets the unique id for each of them. * The traversal is done in ascending element order. * * NOTE : assumption is that the id has already been left shifted 16 * bits to allow space for the component ids. * * @param id unique id for this application */ public void setUniqueId(long id) { _logger.log(Level.FINE, "[Application] " + getName() + " , uid: " + id); this.uniqueId = id; EjbDescriptor[] descs = getSortedEjbDescriptors(); for (int i = 0; i < descs.length; i++) { // Maximum of 2^16 beans max per application descs[i].setUniqueId((id | i)); if (_logger.isLoggable(Level.FINE)) { String module = descs[i].getEjbBundleDescriptor().getModuleDescriptor().getArchiveUri(); _logger.log(Level.FINE, "Ejb " + module + ":" + descs[i].getName() + " id = " + descs[i].getUniqueId()); } } uniqueIdSet = true; }
/** * Sets the unique id for this application. It traverses through all * the ejbs in the application and sets the unique id for each of them. * The traversal is done in ascending element order. * * NOTE : assumption is that the id has already been left shifted 16 * bits to allow space for the component ids. * * @param id unique id for this application */ public void setUniqueId(long id) { _logger.log(Level.FINE, "[Application] " + getName() + " , uid: " + id); this.uniqueId = id; EjbDescriptor[] descs = getSortedEjbDescriptors(); for (int i = 0; i < descs.length; i++) { // Maximum of 2^16 beans max per application descs[i].setUniqueId((id | i)); if (_logger.isLoggable(Level.FINE)) { String module = descs[i].getEjbBundleDescriptor().getModuleDescriptor().getArchiveUri(); _logger.log(Level.FINE, "Ejb " + module + ":" + descs[i].getName() + " id = " + descs[i].getUniqueId()); } } uniqueIdSet = true; }