Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1)

E13403-04

oracle.ide.log
Class LogPrintWriter

java.lang.Object
  extended by java.io.Writer
      extended by java.io.PrintWriter
          extended by oracle.ide.log.LogPrintWriter
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable, java.lang.Appendable

public class LogPrintWriter
extends java.io.PrintWriter

This class provides a PrintWriter interface to a LogPage.


Field Summary
 
Fields inherited from class java.io.PrintWriter
out
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
LogPrintWriter(LogPage logPage)
          Constructs a LogPrintWriter that is wired into the specified LogPage.
 
Method Summary
 void close()
           
 LogPage getLogPage()
          Directly returns the underlying LogPage for this LogPrintWriter.
 LogPage getWrappedLogPage()
          The need for a wrapped LogPage instance arises from the fact that: A typical LogPage implementation uses a thread to forward messages to the UI components (to avoid deadlocks in the IDE caused by the automatic showing of the log window or changing log pages in the log window), and Each LogPrintWriter uses a thread to forward messages to the underlying LogPage.
 void printQuietly(java.lang.String msg)
          Prints the supplied string to the log page as silently as possible, that is, it does not force the log window to be displayed and does not highlight the tab to indicate it's content has changed.
 
Methods inherited from class java.io.PrintWriter
append, append, append, checkError, clearError, flush, format, format, print, print, print, print, print, print, print, print, print, printf, printf, println, println, println, println, println, println, println, println, println, println, setError, write, write, write, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LogPrintWriter

public LogPrintWriter(LogPage logPage)
Constructs a LogPrintWriter that is wired into the specified LogPage.

If the close() method is called, the thread that is forwarding messages to the LogPage will be terminated. This disconnects the LogPrintWriter from the LogPage.

Note that the close() method will be called automatically when the LogPrintWriter is garbage collected, so an explicit call to close() is not required.

If creation of a pipe to the specified LogPage fails for some reason, the LogPrintWriter will be configured to forward all messages to System.out instead.

Method Detail

close

public void close()
Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.PrintWriter

getLogPage

public LogPage getLogPage()
Directly returns the underlying LogPage for this LogPrintWriter.


getWrappedLogPage

public LogPage getWrappedLogPage()
The need for a wrapped LogPage instance arises from the fact that:
  1. A typical LogPage implementation uses a thread to forward messages to the UI components (to avoid deadlocks in the IDE caused by the automatic showing of the log window or changing log pages in the log window), and
  2. Each LogPrintWriter uses a thread to forward messages to the underlying LogPage.
Because thread scheduling in the JVM is nondeterministic, the simultaneous use of a LogPage and a corresponding LogPrintWriter instance can lead to an undesirable reordering of messages. In order to preserve the temporal ordering of messages, all messages must be queued through the same LogPrintWriter instance. The wrapped instance of LogPage returned by this method is there configured to delegate logging to this LogPrintWriter instance.

The main disadvantage of using getWrappedLogPage() is that the returned LogPage cannot be downcast to a specific LogPage implementation to use special implementation-specific APIs.


printQuietly

public void printQuietly(java.lang.String msg)
Prints the supplied string to the log page as silently as possible, that is, it does not force the log window to be displayed and does not highlight the tab to indicate it's content has changed. If the log page being written to does not extend AbstractLogPage then the log window may be opened or the tab highlighted.

Parameters:
msg - the message to add to the display

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1)

E13403-04

Copyright © 1997, 2010, Oracle. All rights reserved.