Class Stack


  • public class Stack
    extends java.lang.Object
    Provides some nice command-line stack operations. This nail must have the aliases "push" and "pop" associated with it in order to work properly. If the "push" command is used, each argument on the command line is pushed onto the stack (in order) and the program returns immediately. If the "pop" command is used, the top item on the stack is displayed to the client's stdout. If the stack is empty, the client will block until another process calls push. If the nailgun server is shutdown while pop is blocking, pop will cause the client to exit with exit code 1. This is thread-safe: you can have multiple clients waiting on "pop" and only one of them (determined by the VM and the magic of synchronization) will receive any one pushed item.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static boolean done  
      private static java.util.Stack sharedStack  
    • Constructor Summary

      Constructors 
      Constructor Description
      Stack()  
    • Field Detail

      • sharedStack

        private static java.util.Stack sharedStack
      • done

        private static boolean done
    • Constructor Detail

      • Stack

        public Stack()
    • Method Detail

      • nailShutdown

        public static void nailShutdown​(NGServer server)
      • nailMain

        public static void nailMain​(NGContext context)
                             throws java.lang.InterruptedException
        Throws:
        java.lang.InterruptedException