KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > object > tx > ReadOnlyException


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

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 JavaDoc {
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 JavaDoc message) {
19     super(wrapper.wrap(message));
20   }
21   
22   public ReadOnlyException(String JavaDoc message, String JavaDoc threadName, long vmId) {
23     this(ReadOnlyException.createDisplayableString(message, threadName, vmId));
24   }
25   
26   public ReadOnlyException(String JavaDoc message, String JavaDoc threadName, long vmId, String JavaDoc details) {
27     this(ReadOnlyException.createDisplayableString(message, threadName, vmId) + "\n " + details);
28   }
29   
30   private static String JavaDoc createDisplayableString(String JavaDoc message, String JavaDoc 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