/* * Copyright (C) 2008 Manish Pandya, [manish at meetamanish dot com] * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * */ package org.hooliguns.ninja.telnet; import java.util.concurrent.LinkedBlockingQueue; /** * A blocking FIFO queue that holds commands for the Ninja attached. * * @author Manish Pandya (July 1 2008) * */ public class CommandQueue extends LinkedBlockingQueue { /** * The unique serial number for this version. */ private static final long serialVersionUID = 7907721832787800727L; /** * Constructs a blocking FIFO queue with default size. */ public CommandQueue() { super(); } /* * (non-Javadoc) * * @see java.util.concurrent.LinkedBlockingQueue#toString() */ @Override public String toString() { StringBuffer sb = new StringBuffer(); Object[] cmds = toArray(); for (int i = 0; i < cmds.length; i++) { sb.append(cmds[i]); } return sb.toString(); } }