org.opensolaris.os.dtrace
Interface ConsumerListener

All Superinterfaces:
java.util.EventListener
All Known Implementing Classes:
ConsumerAdapter

public interface ConsumerListener
extends java.util.EventListener

Listener for data generated by a single DTrace Consumer.


Method Summary
 void consumerStarted(ConsumerEvent e)
          Called once when the source Consumer is successfully started in response to Consumer.go().
 void consumerStopped(ConsumerEvent e)
          Called once when the source Consumer is stopped, indicating that this listener should expect no further events.
 void dataDropped(DropEvent e)
          Called when traced data is dropped because of inadequate buffer space.
 void dataReceived(DataEvent e)
          Called whenever a DTrace probe fires (that is, once for each instance of ProbeData generated by DTrace).
 void errorEncountered(ErrorEvent e)
          Called when an error is encountered in the native DTrace library while tracing probe data.
 void intervalBegan(ConsumerEvent e)
          Called when the source Consumer wakes up to process its buffer of traced probe data.
 void intervalEnded(ConsumerEvent e)
          Called when the source Consumer finishes processing its buffer of traced probe data and is about to sleep until the next interval.
 void processStateChanged(ProcessEvent e)
          Called when the state of a target process changes.
 

Method Detail

dataReceived

void dataReceived(DataEvent e)
                  throws ConsumerException
Called whenever a DTrace probe fires (that is, once for each instance of ProbeData generated by DTrace). Identifies the probe and provides data generated by the probe's actions. To terminate the consumer in the event of unexpected data, throw a ConsumerException from this method.

Throws:
ConsumerException - if the implementation should terminate the running consumer

dataDropped

void dataDropped(DropEvent e)
                 throws ConsumerException
Called when traced data is dropped because of inadequate buffer space. To terminate the consumer in the event of a drop, throw a ConsumerException from this method.

Throws:
ConsumerException - if the implementation should terminate the running consumer

errorEncountered

void errorEncountered(ErrorEvent e)
                      throws ConsumerException
Called when an error is encountered in the native DTrace library while tracing probe data. To terminate the consumer, throw a ConsumerException from this method.

Throws:
ConsumerException - if the implementation should terminate the running consumer

processStateChanged

void processStateChanged(ProcessEvent e)
                         throws ConsumerException
Called when the state of a target process changes. To terminate the consumer in the event of unexpected process state, throw a ConsumerException from this method.

Throws:
ConsumerException - if the implementation should terminate the running consumer
See Also:
Consumer.createProcess(String command), Consumer.grabProcess(int pid)

consumerStarted

void consumerStarted(ConsumerEvent e)
Called once when the source Consumer is successfully started in response to Consumer.go().

See Also:
consumerStopped(ConsumerEvent e)

consumerStopped

void consumerStopped(ConsumerEvent e)
Called once when the source Consumer is stopped, indicating that this listener should expect no further events. Guaranteed to be called whether the consumer was stopped by request (by calling Consumer.stop() or Consumer.abort()), terminated normally as a result of the DTrace exit() action (see exit() in the Special Actions section of the Actions and Subroutines chapter of the Solaris Dynamic Tracing Guide) or after the completion of all target processes, or terminated abnormally because of an exception. It is necessary to call Consumer.close() to release any system resources still held by the stopped consumer.

See Also:
consumerStarted(ConsumerEvent e)

intervalBegan

void intervalBegan(ConsumerEvent e)
Called when the source Consumer wakes up to process its buffer of traced probe data.

See Also:
intervalEnded(ConsumerEvent e)

intervalEnded

void intervalEnded(ConsumerEvent e)
Called when the source Consumer finishes processing its buffer of traced probe data and is about to sleep until the next interval. The rate of consumption may be controlled with the switchrate and aggrate options (see Consumer.setOption(String option, String value)).

See Also:
intervalBegan(ConsumerEvent e)