View Javadoc
1   /*
2    * #%L
3    * DurabilityException.java - mongodb-async-driver - Allanbank Consulting, Inc.
4    * %%
5    * Copyright (C) 2011 - 2014 Allanbank Consulting, Inc.
6    * %%
7    * Licensed under the Apache License, Version 2.0 (the "License");
8    * you may not use this file except in compliance with the License.
9    * You may obtain a copy of the License at
10   * 
11   *      http://www.apache.org/licenses/LICENSE-2.0
12   * 
13   * Unless required by applicable law or agreed to in writing, software
14   * distributed under the License is distributed on an "AS IS" BASIS,
15   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   * See the License for the specific language governing permissions and
17   * limitations under the License.
18   * #L%
19   */
20  package com.allanbank.mongodb.error;
21  
22  import com.allanbank.mongodb.Durability;
23  import com.allanbank.mongodb.client.Message;
24  import com.allanbank.mongodb.client.message.Reply;
25  
26  /**
27   * Exception raised when a write encounters a durability violation.
28   * <p>
29   * This can be due to using a {@link Durability#journalDurable(int) journal}
30   * durability without journaling enabled on the server or the durability
31   * requirements are not met within the specified wait time.
32   * </p>
33   * 
34   * @api.yes This class is part of the driver's API. Public and protected members
35   *          will be deprecated for at least 1 non-bugfix release (version
36   *          numbers are &lt;major&gt;.&lt;minor&gt;.&lt;bugfix&gt;) before being
37   *          removed or modified.
38   * @copyright 2011-2013, Allanbank Consulting, Inc., All Rights Reserved
39   */
40  public class DurabilityException extends ReplyException {
41  
42      /** The serialization version for the class. */
43      private static final long serialVersionUID = -3588171889388956082L;
44  
45      /**
46       * Create a new DurabilityException.
47       * 
48       * @param okValue
49       *            The value of the "ok" field in the reply document.
50       * @param errorNumber
51       *            The value of the "errNo" field in the reply document.
52       * @param errorMessage
53       *            The value of the 'errmsg" field in the reply document.
54       * @param message
55       *            The message that triggered the message.
56       * @param reply
57       *            The reply with the error.
58       */
59      public DurabilityException(final int okValue, final int errorNumber,
60              final String errorMessage, final Message message, final Reply reply) {
61          super(okValue, errorNumber, errorMessage, message, reply);
62      }
63  
64      /**
65       * Create a new DurabilityException.
66       * 
67       * @param okValue
68       *            The value of the "ok" field in the reply document.
69       * @param errorNumber
70       *            The value of the "errNo" field in the reply document.
71       * @param errorMessage
72       *            The value of the 'errmsg" field in the reply document.
73       * @param reply
74       *            The reply with the error.
75       */
76      public DurabilityException(final int okValue, final int errorNumber,
77              final String errorMessage, final Reply reply) {
78          this(okValue, errorNumber, errorMessage, null, reply);
79      }
80  
81  }