Package org.tanukisoftware.wrapper.test
Class DeadlockPrintStream
- java.lang.Object
-
- java.io.OutputStream
-
- java.io.FilterOutputStream
-
- java.io.PrintStream
-
- org.tanukisoftware.wrapper.test.DeadlockPrintStream
-
- All Implemented Interfaces:
java.io.Closeable,java.io.Flushable,java.lang.Appendable,java.lang.AutoCloseable
public class DeadlockPrintStream extends java.io.PrintStreamA print stream which can be put into a state in which all calls to write to it will result in the calling threads deadlocking in the call. Obviously, this class will not be useful to many as it is for tests.
-
-
Constructor Summary
Constructors Constructor Description DeadlockPrintStream(java.io.PrintStream out)Creates a new DeadlockPrintStream wrapped around another PrintStream.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidflush()voidsetDeadlock(boolean deadlock)Sets or clears the deadlock flag.voidwrite(byte[] b)voidwrite(byte[] b, int off, int len)voidwrite(int b)
-
-
-
Method Detail
-
write
public void write(int b)
- Overrides:
writein classjava.io.PrintStream
-
write
public void write(byte[] b) throws java.io.IOException- Overrides:
writein classjava.io.FilterOutputStream- Throws:
java.io.IOException
-
write
public void write(byte[] b, int off, int len)- Overrides:
writein classjava.io.PrintStream
-
flush
public void flush()
- Specified by:
flushin interfacejava.io.Flushable- Overrides:
flushin classjava.io.PrintStream
-
close
public void close()
- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.PrintStream
-
setDeadlock
public void setDeadlock(boolean deadlock)
Sets or clears the deadlock flag. If set, calls to any other method of this class will result in the calling thread being deadlocked. They will be released if the flag is cleared with this method.- Parameters:
deadlock- True to set the flag, false to clear it.
-
-