View Javadoc

1   /*
2    * Copyright (c) 1998-2002 The Jgroup Team.
3    *
4    * This program is free software; you can redistribute it and/or modify
5    * it under the terms of the GNU Lesser General Public License version 2 as
6    * published by the Free Software Foundation.
7    *
8    * This program is distributed in the hope that it will be useful,
9    * but WITHOUT ANY WARRANTY; without even the implied warranty of
10   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11   * GNU Lesser General Public License for more details.
12   *
13   * You should have received a copy of the GNU Lesser General Public License
14   * along with this program; if not, write to the Free Software
15   * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
16   *
17   */
18  
19  package jgroup.core;
20  
21  import org.apache.log4j.Logger;
22  
23  /**
24   *  Base class for the exceptions thrown by Jgroup.
25   *
26   *  @author Alberto Montresor
27   *  @since Jgroup 0.1
28   */
29  public class JgroupException
30    extends Exception
31  {
32  
33    private static final long serialVersionUID = 19163829929627863L;
34  
35  
36    ////////////////////////////////////////////////////////////////////////////////////////////
37    // Logger
38    ////////////////////////////////////////////////////////////////////////////////////////////
39  
40    /** Obtain logger for this class */
41    private static final Logger log = Logger.getLogger(JgroupException.class);
42  
43  
44    /**
45     *  Constructs a <code>JgroupExeception</code> with the specified
46     *  message.
47     *
48     *  @param message
49     *    Detailed message describing the problem.
50     */
51    public JgroupException(String message)
52    {
53      super(message);
54      synchronized (this) {
55        log.warn(message);
56      }
57    }
58  
59    /**
60     *  Constructs a <code>JgroupExeception</code> with the specified
61     *  message and cause exception.
62     *
63     *  @param message
64     *    Detailed message describing the problem.
65     *  @param cause
66     *    The cause exception.
67     */
68    public JgroupException(String message, Throwable cause)
69    {
70      super(message, cause);
71      synchronized (this) {
72        log.warn(message, cause);
73      }
74    }
75  
76  } // END JgroupException