01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tc.object.tx;
05:
06: import com.tc.exception.ExceptionWrapper;
07: import com.tc.exception.ExceptionWrapperImpl;
08:
09: /**
10: * Thrown when there is an attempt to access a shared object outside the scope of
11: * a shared lock.
12: * @author steve
13: */
14: public class UnlockedSharedObjectException extends RuntimeException {
15:
16: private static final ExceptionWrapper wrapper = new ExceptionWrapperImpl();
17:
18: private UnlockedSharedObjectException(String message) {
19: super (wrapper.wrap(message));
20: }
21:
22: public UnlockedSharedObjectException(String message,
23: String threadName, long vmId) {
24: this (UnlockedSharedObjectException.createDisplayableString(
25: message, threadName, vmId));
26: }
27:
28: public UnlockedSharedObjectException(String message,
29: String threadName, long vmId, String details) {
30: this (UnlockedSharedObjectException.createDisplayableString(
31: message, threadName, vmId)
32: + "\n " + details);
33: }
34:
35: private static String createDisplayableString(String message,
36: String threadName, long vmId) {
37: return message + "\n\n Caused by Thread: " + threadName
38: + " in VM(" + vmId + ")";
39: }
40: }
|