System.out schizophrenia

hi,

i am running a scala app from the run menu of IDEA and get weird behaviour regarding console output. for instance this snippet:


  private val stopAndDisposeListener = new Proc.Listener {
      def updated( u: Proc.Update ) {
         if( !u.state.playing || u.state.bypassed ) {
            // XXX workaround: CCSTM still has the previous txn visible,
            // hence we need to wait a bit longer :-(
EventQueue.invokeLater { new Runnable { def run {
println( "FINAL-DISPOSE " + u.proc )
            ProcTxn.atomic { implicit tx => u.proc.dispose }
}}}
         }
      }
   }


   private def stopAndDispose( rp: RunningProc )( implicit tx: ProcTxn ) {
      val p     = rp.proc
      val state = p.state
println( "STOP-AND-DISPOSE " + p + " -> " + state + " / " + tx.transit )
      if( !state.playing || state.bypassed || (tx.transit == Instant) ) {
println( ".......INSTANT" )
         p.dispose
      } else {
         p.addListener( stopAndDisposeListener )
         p.anatomy match {
            case ProcFilter => {
println( ".......BYPASS" )
               p.bypass
            }
            case _ => {
println( ".......STOP" )
               p.stop
            }
         }
      }
   }


will output parts of the text in my own console which is a Swing view in my application (i did a System.setOut to direct everything into that one), and other parts into IDEA's console. so basically this one:

STOP-AND-DISPOSE proc(tp_chicago) -> State(true,true,false,false) / XFade(80.004,13.177715976773365)
.......STOP

shows up in IDEA, and this one

FINAL-DISPOSE proc(tp_2aside)

in my swing view. so i'm loosing the complete sequence of history of the console output which i need for debugging. the only difference between the occurences of println i can spot is that the FINAL-DISPOSE is certainly printed on the AWT thread, while the one probably isn't.

i can't make any sense of this... maybe someone has a clue. i will need to run my app in standalone mode for now.

best, -sciss-

1 comment
Comment actions Permalink

I can't reproduce the issue, I tried to redirect System.out (together with threads and EDT) and everithing seems to be OK.

It will be more convenient if you isolate the problem from your project code.
Could you, please, provide a (plain) code snippet that exhibit misbehaviour when run?

0

Please sign in to leave a comment.