Class Stack


  • public class Stack
    extends 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.
    Author:
    Marty Lamb