KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > client > am > DisconnectException


1 /*
2
3    Derby - Class org.apache.derby.client.am.DisconnectException
4
5    Licensed to the Apache Software Foundation (ASF) under one or more
6    contributor license agreements. See the NOTICE file distributed with
7    this work for additional information regarding copyright ownership.
8    The ASF licenses this file to You under the Apache License, Version 2.0
9    (the "License"); you may not use this file except in compliance with
10    the License. You may obtain a copy of the License at
11
12       http://www.apache.org/licenses/LICENSE-2.0
13
14    Unless required by applicable law or agreed to in writing, software
15    distributed under the License is distributed on an "AS IS" BASIS,
16    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17    See the License for the specific language governing permissions and
18    limitations under the License.
19
20 */

21
22 package org.apache.derby.client.am;
23
24 import org.apache.derby.shared.common.reference.SQLState;
25
26 public class DisconnectException extends SqlException {
27     public DisconnectException(Agent agent, ClientMessageId msgid,
28         Object JavaDoc[] args, SqlCode sqlcode, Throwable JavaDoc t) {
29         super(agent != null ? agent.logWriter_ : null, msgid,
30             args, sqlcode, t);
31         
32         // make the call to close the streams and socket.
33
if (agent != null) {
34             agent.disconnectEvent();
35         }
36     }
37     
38     public DisconnectException(Agent agent, ClientMessageId msgid,
39         Object JavaDoc[] args, SqlCode sqlcode) {
40         this(agent, msgid, args, sqlcode, (Throwable JavaDoc)null);
41     }
42
43     public DisconnectException(Agent agent, ClientMessageId msgid, SqlCode sqlcode) {
44         this(agent, msgid, (Object JavaDoc[]) null, sqlcode);
45     }
46
47         
48     public DisconnectException(Agent agent, ClientMessageId msgid,
49         Object JavaDoc[] args) {
50         this(agent, msgid, args, SqlCode.disconnectError);
51     }
52     
53     public DisconnectException(Agent agent, ClientMessageId msgid,
54         Object JavaDoc[] args, Throwable JavaDoc t) {
55         this(agent, msgid, args, SqlCode.disconnectError, (Throwable JavaDoc)t);
56     }
57     
58     public DisconnectException(Agent agent, ClientMessageId msgid,
59         Object JavaDoc arg1, Throwable JavaDoc t) {
60         this(agent, msgid, new Object JavaDoc[] { arg1 }, t);
61     }
62
63     public DisconnectException(Agent agent, ClientMessageId msgid) {
64         this(agent, msgid, (Object JavaDoc[])null);
65     }
66     
67     public DisconnectException(Agent agent, ClientMessageId msgid, Object JavaDoc arg1) {
68         this(agent, msgid, new Object JavaDoc[] { arg1 });
69     }
70         
71     public DisconnectException(Agent agent, ClientMessageId msgid, Object JavaDoc arg1,
72         Object JavaDoc arg2) {
73         this(agent, msgid, new Object JavaDoc[] { arg1, arg2 });
74     }
75     
76     public DisconnectException(Agent agent, SqlException e) {
77         super(agent.logWriter_,
78             new ClientMessageId(SQLState.DRDA_CONNECTION_TERMINATED),
79             e.getMessage(), e);
80     }
81 }
82
Popular Tags