class ForkServer
extends java.lang.Object
implements java.lang.Runnable, java.util.zip.Checksum
Modifier and Type | Field and Description |
---|---|
private boolean |
active |
static byte |
CALL |
static byte |
DONE |
static byte |
ERROR |
private java.io.DataInputStream |
input
Input stream for reading from the parent process
|
private java.io.DataOutputStream |
output
Output stream for writing to the parent process
|
static byte |
PING |
static byte |
READY |
static byte |
RESOURCE |
Constructor and Description |
---|
ForkServer(java.io.InputStream input,
java.io.OutputStream output)
Sets up a forked server instance using the given stdin/out
communication channel.
|
Modifier and Type | Method and Description |
---|---|
private void |
call(java.lang.ClassLoader loader,
java.lang.Object object) |
private java.lang.reflect.Method |
getMethod(java.lang.Object object,
java.lang.String name) |
long |
getValue() |
static void |
main(java.lang.String[] args)
Starts a forked server process using the standard input and output
streams for communication with the parent process.
|
void |
processRequests() |
private java.lang.Object |
readObject(java.lang.ClassLoader loader)
Deserializes an object from the given stream.
|
void |
reset() |
void |
run() |
void |
update(byte[] b,
int off,
int len) |
void |
update(int b) |
public static final byte ERROR
public static final byte DONE
public static final byte CALL
public static final byte PING
public static final byte RESOURCE
public static final byte READY
private final java.io.DataInputStream input
private final java.io.DataOutputStream output
private volatile boolean active
public ForkServer(java.io.InputStream input, java.io.OutputStream output) throws java.io.IOException
input
- input stream for reading from the parent processoutput
- output stream for writing to the parent processjava.io.IOException
- if the server instance could not be createdpublic static void main(java.lang.String[] args) throws java.lang.Exception
args
- command line arguments, ignoredjava.lang.Exception
- if the server could not be startedpublic void run()
run
in interface java.lang.Runnable
public void processRequests()
private void call(java.lang.ClassLoader loader, java.lang.Object object) throws java.lang.Exception
java.lang.Exception
private java.lang.reflect.Method getMethod(java.lang.Object object, java.lang.String name)
private java.lang.Object readObject(java.lang.ClassLoader loader) throws java.io.IOException, java.lang.ClassNotFoundException
input
- input stream from which the serialized object is readloader
- class loader to be used for loading referenced classesjava.io.IOException
- if the object could not be deserializedjava.lang.ClassNotFoundException
- if a referenced class is not foundpublic void update(int b)
update
in interface java.util.zip.Checksum
public void update(byte[] b, int off, int len)
update
in interface java.util.zip.Checksum
public long getValue()
getValue
in interface java.util.zip.Checksum
public void reset()
reset
in interface java.util.zip.Checksum