/** * TODO Add method documentation */ private String getIdAsString() { String id = Long.toHexString(getId()).toUpperCase(); // Somewhat inefficient, but it won't happen that often // because an ID is often a big integer. while (id.length() < 8) { id = '0' + id; // padding } id = "0x" + id; return id; }
/** * Get the Id as a String */ private String getIdAsString() { String id = Long.toHexString(getId()).toUpperCase(); if (id.length() <= 8) { return "0x00000000".substring(0, 10 - id.length()) + id; } else { return "0x" + id; } }
/** * Get the Id as a String */ private String getIdAsString() { String id = Long.toHexString(getId()).toUpperCase(); if (id.length() <= 8) { return "0x00000000".substring(0, 10 - id.length()) + id; } else { return "0x" + id; } }
/** * Find the processor associated to a session. If it hasen't be stored into * the session's attributes, pick a new processor and stores it. */ @SuppressWarnings("unchecked") private IoProcessor<S> getProcessor(S session) { IoProcessor<S> processor = (IoProcessor<S>) session.getAttribute(PROCESSOR); if (processor == null) { if (disposed || disposing) { throw new IllegalStateException("A disposed processor cannot be accessed."); } processor = pool[Math.abs((int) session.getId()) % pool.length]; if (processor == null) { throw new IllegalStateException("A disposed processor cannot be accessed."); } session.setAttributeIfAbsent(PROCESSOR, processor); } return processor; } }
/** * Find the processor associated to a session. If it hasen't be stored into * the session's attributes, pick a new processor and stores it. */ @SuppressWarnings("unchecked") private IoProcessor<S> getProcessor(S session) { IoProcessor<S> processor = (IoProcessor<S>) session.getAttribute(PROCESSOR); if (processor == null) { if (disposed || disposing) { throw new IllegalStateException("A disposed processor cannot be accessed."); } processor = pool[Math.abs((int) session.getId()) % pool.length]; if (processor == null) { throw new IllegalStateException("A disposed processor cannot be accessed."); } session.setAttributeIfAbsent(PROCESSOR, processor); } return processor; } }