01: /*
02: * JacORB - a free Java ORB
03: *
04: * Copyright (C) 1997-2004 Gerald Brose.
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Library General Public
08: * License as published by the Free Software Foundation; either
09: * version 2 of the License, or (at your option) any later version.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Library General Public License for more details.
15: *
16: * You should have received a copy of the GNU Library General Public
17: * License along with this library; if not, write to the Free
18: * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19: */
20:
21: package org.jacorb.orb.iiop;
22:
23: import java.io.IOException;
24: import java.net.*;
25:
26: import org.jacorb.orb.listener.SSLListenerUtil;
27:
28: /**
29: * @author Nicolas Noffke
30: * @author Andre Spiegel
31: * @version $Id: IIOPConnection.java,v 1.15 2006/08/11 16:37:03 iliyan.jeliazkov Exp $
32: */
33: public abstract class IIOPConnection extends
34: org.jacorb.orb.etf.StreamConnectionBase {
35: protected Socket socket;
36:
37: protected boolean use_ssl;
38:
39: public IIOPConnection() {
40: super ();
41: }
42:
43: public boolean isSSL() {
44: return use_ssl;
45: }
46:
47: protected synchronized void setTimeout(int timeout) {
48: if (socket != null) {
49: try {
50: if (logger.isInfoEnabled()) {
51: logger.info("Socket timeout set to " + timeout
52: + " ms");
53: }
54: socket.setSoTimeout(timeout);
55: } catch (SocketException se) {
56: if (logger.isInfoEnabled()) {
57: logger.info("SocketException", se);
58: }
59: }
60: }
61: }
62:
63: protected final org.omg.CORBA.COMM_FAILURE to_COMM_FAILURE(
64: IOException exception, Socket socket) {
65: SSLListenerUtil.processException(orb, this , socket, exception);
66:
67: return to_COMM_FAILURE(exception);
68: }
69:
70: protected synchronized int getTimeout() {
71: try {
72: return socket.getSoTimeout();
73: } catch (SocketException ex) {
74: throw to_COMM_FAILURE(ex, socket);
75: }
76: }
77:
78: public Socket getSocket() {
79: return socket;
80: }
81: }
|