1 /***
2 * Copyright 2003-2010 Terracotta, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 package net.sf.ehcache.constructs.nonstop;
18
19 import java.util.concurrent.TimeoutException;
20
21 /***
22 * Subclass of {@link TimeoutException}. This class is used to indicate a failure in NonStopCacheExecutorService.execute(..) when the task
23 * was not submitted to the executor service at all.
24 *
25 * @author Abhishek Sanoujam
26 *
27 */
28 public class TaskNotSubmittedTimeoutException extends TimeoutException {
29
30 private final int submitAttemptCount;
31
32 /***
33 * Default constructor
34 */
35 public TaskNotSubmittedTimeoutException() {
36 this("", 0);
37 }
38
39 /***
40 * Constructor accepting a message
41 *
42 * @param message
43 */
44 public TaskNotSubmittedTimeoutException(String message) {
45 this(message, 0);
46 }
47
48 /***
49 * Constructor accepting number of attempts made when this exception happened
50 *
51 * @param submitAttemptCount
52 */
53 public TaskNotSubmittedTimeoutException(int submitAttemptCount) {
54 this("", submitAttemptCount);
55 }
56
57 /***
58 * Constructor accepting message and number of attempts made
59 *
60 * @param submitAttemptCount
61 */
62 public TaskNotSubmittedTimeoutException(String message, int submitAttemptCount) {
63 super(message);
64 this.submitAttemptCount = submitAttemptCount;
65 }
66
67 /***
68 * Getter for submit attempts made.
69 *
70 * @return number of submit attempts made
71 */
72 public int getSubmitAttemptCount() {
73 return submitAttemptCount;
74 }
75
76 }