01: /*
02:
03: Derby - Class org.apache.derby.client.am.DisconnectException
04:
05: Licensed to the Apache Software Foundation (ASF) under one or more
06: contributor license agreements. See the NOTICE file distributed with
07: this work for additional information regarding copyright ownership.
08: The ASF licenses this file to You under the Apache License, Version 2.0
09: (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[] args, SqlCode sqlcode, Throwable t) {
29: super (agent != null ? agent.logWriter_ : null, msgid, args,
30: 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[] args, SqlCode sqlcode) {
40: this (agent, msgid, args, sqlcode, (Throwable) null);
41: }
42:
43: public DisconnectException(Agent agent, ClientMessageId msgid,
44: SqlCode sqlcode) {
45: this (agent, msgid, (Object[]) null, sqlcode);
46: }
47:
48: public DisconnectException(Agent agent, ClientMessageId msgid,
49: Object[] args) {
50: this (agent, msgid, args, SqlCode.disconnectError);
51: }
52:
53: public DisconnectException(Agent agent, ClientMessageId msgid,
54: Object[] args, Throwable t) {
55: this (agent, msgid, args, SqlCode.disconnectError, (Throwable) t);
56: }
57:
58: public DisconnectException(Agent agent, ClientMessageId msgid,
59: Object arg1, Throwable t) {
60: this (agent, msgid, new Object[] { arg1 }, t);
61: }
62:
63: public DisconnectException(Agent agent, ClientMessageId msgid) {
64: this (agent, msgid, (Object[]) null);
65: }
66:
67: public DisconnectException(Agent agent, ClientMessageId msgid,
68: Object arg1) {
69: this (agent, msgid, new Object[] { arg1 });
70: }
71:
72: public DisconnectException(Agent agent, ClientMessageId msgid,
73: Object arg1, Object arg2) {
74: this (agent, msgid, new Object[] { arg1, arg2 });
75: }
76:
77: public DisconnectException(Agent agent, SqlException e) {
78: super (agent.logWriter_, new ClientMessageId(
79: SQLState.DRDA_CONNECTION_TERMINATED), e.getMessage(), e);
80: }
81: }
|