Advertisement
Guest User

Untitled

a guest
Jul 2nd, 2015
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.77 KB | None | 0 0
  1. package org.jboss.as.server;
  2.  
  3. import java.util.concurrent.ConcurrentSkipListSet;
  4. import org.jboss.as.server.deployment.DeploymentPhaseContext;
  5. import org.jboss.as.server.deployment.DeploymentUnit;
  6. import org.jboss.as.server.deployment.DeploymentUnitProcessingException;
  7. import org.jboss.as.server.deployment.DeploymentUnitProcessor;
  8. import org.jboss.as.server.deployment.Phase;
  9. import org.jboss.as.server.deployment.SubDeploymentProcessor;
  10. import org.jboss.as.server.deployment.annotation.AnnotationIndexProcessor;
  11. import org.jboss.as.server.deployment.module.DeploymentRootExplodedMountProcessor;
  12. import org.jboss.as.server.deployment.module.DeploymentRootMountProcessor;
  13. import org.jboss.as.server.deployment.module.ManifestAttachmentProcessor;
  14. import org.jboss.as.server.deployment.module.ModuleIdentifierProcessor;
  15.  
  16. public class InfiniteLoop {
  17.  
  18. public static void main(String[] args) {
  19. ConcurrentSkipListSet<RegisteredProcessor> set = new ConcurrentSkipListSet<RegisteredProcessor>();
  20.  
  21. set.add(new RegisteredProcessor(Phase.STRUCTURE_SERVICE_MODULE_LOADER, new DeploymentUnitProcessor() {
  22. public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
  23. }
  24.  
  25. public void undeploy(DeploymentUnit context) {
  26. }
  27. }));
  28. set.add(new RegisteredProcessor(Phase.STRUCTURE_EXPLODED_MOUNT, new DeploymentRootExplodedMountProcessor()));
  29. set.add(new RegisteredProcessor(Phase.STRUCTURE_MOUNT, new DeploymentRootMountProcessor()));
  30. set.add(new RegisteredProcessor(Phase.STRUCTURE_MANIFEST, new ManifestAttachmentProcessor()));
  31. set.add(new RegisteredProcessor(Phase.STRUCTURE_ADDITIONAL_MANIFEST, new ManifestAttachmentProcessor()));
  32. set.add(new RegisteredProcessor(Phase.STRUCTURE_SUB_DEPLOYMENT, new SubDeploymentProcessor()));
  33. set.add(new RegisteredProcessor(Phase.STRUCTURE_MODULE_IDENTIFIERS, new ModuleIdentifierProcessor()));
  34. set.add(new RegisteredProcessor(Phase.STRUCTURE_ANNOTATION_INDEX, new AnnotationIndexProcessor()));
  35.  
  36. System.out.println("Items in set:" + set.size());
  37. }
  38.  
  39. static final class RegisteredProcessor implements Comparable<RegisteredProcessor> {
  40. private final int priority;
  41. private final DeploymentUnitProcessor processor;
  42.  
  43. private static int i = 1;
  44.  
  45. RegisteredProcessor(final int priority, final DeploymentUnitProcessor processor) {
  46. this.priority = priority;
  47. this.processor = processor;
  48. }
  49.  
  50. public int compareTo(final RegisteredProcessor o) {
  51. final int rel = Integer.signum(priority - o.priority);
  52. // BUG below
  53. return rel == 0 ? Integer.signum(processor.getClass().getName().compareTo(o.getClass().getName())) : rel;
  54. }
  55. }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement