org.mmbase.util
Class CommandServer
java.lang.Object
org.mmbase.util.CommandServer
public class CommandServer
- extends Object
Java command server. Especially targeted at executing imagemagick 'convert' in a system call.
It can work in two ways. The first way is as a stand-alone server. You start it up with a
port-number argument then (or with a host-name and port-number argument, if you don't want it to listen on localhost). A server socket will be
created and communication can happen via tcp.
~$ /usr/bin/java -jar mmbase-commandserver.jar michiel.omroep.nl 1679
Started ServerSocket[addr=michiel.omroep.nl/145.58.67.10,port=0,localport=1679]
If no arguments are provided, it will listen on stdin and return the result on stdout. This means
that it can be installed as a inetd daemon (in UNIX systems). This boils down to placing something like
commandserver 1679/tcp
In /etc/services. And
commandserver stream tcp nowait nobody /usr/bin/java java -jar /home/michiel/mmbase/head/applications/commandserver/build/mmbase-commandserver.jar
in /etc/inetd.conf. The result is the same (you can communicate with TCP), but avoids the hassle of having to keep the process alive.
The input for this server are 2 serialized String[] arrays (which will be the arguments for
Runtime.exec(String[], String[])), followed by the stdin for the command. It will return stdout of the process.
You can use CommandExecutor to connecto to the commandserver.
- Since:
- MMBase-1.8.2
- Version:
- $Id: CommandServer.java 37706 2009-08-12 09:37:14Z michiel $
- Author:
- Michiel Meeuwissen
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
number
static int number
factory
static ThreadFactory factory
threads
static final Executor threads
CommandServer
public CommandServer()
main
public static void main(String[] args)
throws IOException,
InterruptedException
- Throws:
IOException
InterruptedException
MMBase 2.0-SNAPSHOT - null