Advertisement
Guest User

Untitled

a guest
Sep 19th, 2014
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.71 KB | None | 0 0
  1. def onPartReceived(partSize: Int) = {
  2.     this.synchronized {
  3.       currentSize += partSize
  4.  
  5.       val newIndex = currentSize / bytesPerLine - 1
  6.       try {
  7.         if (newIndex >= index) {
  8.           for (i <- index to newIndex) {
  9.             bus post ErrorEvent("art.size = %d, index = %d, newIndex = %d", art.size, index, newIndex)
  10.             bus post InfoEvent(art(index))
  11.             index += 1
  12.           }
  13.         }
  14.       } catch {
  15.         case e: IndexOutOfBoundsException => bus post ErrorEvent("Array Out Of: art.size = %d, index = %d, newIndex = %d",    art.size, index, newIndex)
  16.         case e: Throwable => bus post ErrorEvent("Exception %s, cause %s", e.getMessage, e.toString)
  17.       }
  18.  
  19.  
  20.     }
  21.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement