edu.rice.cs.plt.debug
Class RMILogSink

java.lang.Object
  extended by edu.rice.cs.plt.debug.RMILogSink
All Implemented Interfaces:
LogSink, Closeable

public class RMILogSink
extends Object
implements LogSink, Closeable

A log sink that passes messages to a separate JVM for recording or display. Clients provide a serializable LogSink factory; when the first message is logged, a separate process is started and the factory object is passed to it, allowing for the creation of an RMI-based LogSink server on the remote JVM. If any exception occurs when the remote LogSink is started, it is thrown by the invoked log method.


Nested Class Summary
 
Nested classes/interfaces inherited from interface edu.rice.cs.plt.debug.LogSink
LogSink.EndMessage, LogSink.ErrorMessage, LogSink.Message, LogSink.MessageVisitor<T>, LogSink.StackMessage, LogSink.StandardMessage, LogSink.StartMessage, LogSink.ValueMessage
 
Constructor Summary
RMILogSink(Thunk<? extends LogSink> factory)
          Create a LogSink server in a new process using JVMBuilder.DEFAULT.
RMILogSink(Thunk<? extends LogSink> factory, boolean closeOnExit)
          Create a LogSink server in a new process using JVMBuilder.DEFAULT.
RMILogSink(Thunk<? extends LogSink> factory, JVMBuilder jvm)
          Create a LogSink server in a new process using JVMBuilder.DEFAULT.
RMILogSink(Thunk<? extends LogSink> factory, JVMBuilder jvm, boolean closeOnExit)
          Create a LogSink server in a new process using JVMBuilder.DEFAULT.
 
Method Summary
 void close()
          Quit the remote process.
 void log(LogSink.StandardMessage m)
           
 void logEnd(LogSink.EndMessage m)
           
 void logError(LogSink.ErrorMessage m)
           
 void logStack(LogSink.StackMessage m)
           
 void logStart(LogSink.StartMessage m)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RMILogSink

public RMILogSink(Thunk<? extends LogSink> factory)
Create a LogSink server in a new process using JVMBuilder.DEFAULT. closeOnExit is true.

Parameters:
factory - A serializable LogSink factory, to be invoked in the new process

RMILogSink

public RMILogSink(Thunk<? extends LogSink> factory,
                  boolean closeOnExit)
Create a LogSink server in a new process using JVMBuilder.DEFAULT.

Parameters:
factory - A serializable LogSink factory, to be invoked in the new process
closeOnExit - Whether this sink should be registered to be closed on system exit.

RMILogSink

public RMILogSink(Thunk<? extends LogSink> factory,
                  JVMBuilder jvm)
Create a LogSink server in a new process using JVMBuilder.DEFAULT. closeOnExit is true.

Parameters:
factory - A serializable LogSink factory, to be invoked in the new process
jvm - A factory for producing the remote JVM. The class path must include the factory's class, RMILogSink, ConcurrentUtil, and their dependencies.

RMILogSink

public RMILogSink(Thunk<? extends LogSink> factory,
                  JVMBuilder jvm,
                  boolean closeOnExit)
Create a LogSink server in a new process using JVMBuilder.DEFAULT.

Parameters:
factory - A serializable LogSink factory, to be invoked in the new process
jvm - A factory for producing the remote JVM. The class path must include the factory's class, RMILogSink, ConcurrentUtil, and their dependencies.
closeOnExit - Whether this sink should be registered to be closed on system exit.
Method Detail

close

public void close()
           throws IOException
Quit the remote process.

Specified by:
close in interface Closeable
Throws:
IOException

log

public void log(LogSink.StandardMessage m)
Specified by:
log in interface LogSink

logStart

public void logStart(LogSink.StartMessage m)
Specified by:
logStart in interface LogSink

logEnd

public void logEnd(LogSink.EndMessage m)
Specified by:
logEnd in interface LogSink

logError

public void logError(LogSink.ErrorMessage m)
Specified by:
logError in interface LogSink

logStack

public void logStack(LogSink.StackMessage m)
Specified by:
logStack in interface LogSink