1 4 package com.tc.object.tx; 5 6 import com.tc.exception.ExceptionWrapper; 7 import com.tc.exception.ExceptionWrapperImpl; 8 9 public class ReadOnlyException extends RuntimeException { 10 11 private static final ExceptionWrapper wrapper = new ExceptionWrapperImpl(); 12 public static final long INVALID_VMID = -1; 13 14 public ReadOnlyException() { 15 super(); 16 } 17 18 public ReadOnlyException(String message) { 19 super(wrapper.wrap(message)); 20 } 21 22 public ReadOnlyException(String message, String threadName, long vmId) { 23 this(ReadOnlyException.createDisplayableString(message, threadName, vmId)); 24 } 25 26 public ReadOnlyException(String message, String threadName, long vmId, String details) { 27 this(ReadOnlyException.createDisplayableString(message, threadName, vmId) + "\n " + details); 28 } 29 30 private static String createDisplayableString(String message, String threadName, long vmId) { 31 if (vmId == INVALID_VMID) { 32 return message + "\n\n Caused by Thread: " + threadName; 33 } 34 return message + "\n\n Caused by Thread: " + threadName + " in VM(" + vmId + ")"; 35 } 36 } | Popular Tags |