1 package net.walend.somnifugi; 2 3 8 9 public class SomniInterruptedException 10 extends SomniException 11 { 12 private static final long serialVersionUID = 0L; 13 14 private SomniMessage lostMessage = null; 15 private SomniDestination destination = null; 16 17 protected SomniInterruptedException(String message) 18 { 19 super(message); 20 } 21 22 protected SomniInterruptedException(Throwable nester) 23 { 24 super(nester); 25 } 26 27 protected SomniInterruptedException(String message, Throwable nester) 28 { 29 super(message,nester); 30 } 31 32 protected SomniInterruptedException(Throwable nester,SomniMessage lostMessage,SomniDestination destination) 33 { 34 super(nester); 35 this.lostMessage = lostMessage; 36 this.destination = destination; 37 } 38 39 public String getMessage() 40 { 41 if(destination==null) 42 { 43 return super.getMessage(); 44 } 45 else 46 { 47 StringBuffer buffy = new StringBuffer (); 48 49 buffy.append(super.getMessage()); 50 buffy.append(" while "); 51 buffy.append(destination.getName()); 52 buffy.append(" was trying to send "); 53 buffy.append(lostMessage.toString()); 54 55 return buffy.toString(); 56 } 57 } 58 59 public SomniMessage getLostMessage() 60 { 61 return lostMessage; 62 } 63 64 public SomniDestination getDestination() 65 { 66 return destination; 67 } 68 } 69 70 92 93 94 95 | Popular Tags |