1 20 21 package org.jacorb.orb.giop; 22 23 import java.io.*; 24 25 import org.jacorb.orb.iiop.*; 26 import org.apache.avalon.framework.configuration.*; 27 28 32 33 public class ClientGIOPConnection 34 extends GIOPConnection 35 implements Configurable 36 { 37 private boolean ignore_pending_messages_on_timeout = false; 38 39 public ClientGIOPConnection( org.omg.ETF.Profile profile, 40 org.omg.ETF.Connection transport, 41 RequestListener request_listener, 42 ReplyListener reply_listener, 43 StatisticsProvider statistics_provider ) 44 { 45 super( profile, transport, request_listener, reply_listener, statistics_provider ); 46 } 47 48 49 public void configure(Configuration configuration) 50 throws ConfigurationException 51 { 52 super.configure(configuration); 53 54 ignore_pending_messages_on_timeout = 55 configuration.getAttribute("jacorb.connection.client.timeout_ignores_pending_messages","off").equals("on"); 56 } 57 58 59 protected void readTimedOut() 60 { 61 synchronized( pendingUndecidedSync ) 62 { 63 if (ignore_pending_messages_on_timeout) 64 { 65 this.streamClosed(); 66 } 67 else if (! hasPendingMessages()) 68 { 69 closeAllowReopen(); 70 } 71 } 72 } 73 74 protected void streamClosed() 75 { 76 closeAllowReopen(); 77 78 if( connection_listener != null ) 79 { 80 connection_listener.streamClosed(); 81 } 82 } 83 84 public void closeAllowReopen() 85 { 86 try 87 { 88 synchronized (connect_sync) 89 { 90 getWriteLock(); 91 transport.close(); 92 } 96 } 97 finally 98 { 99 releaseWriteLock(); 100 } 101 } 102 103 } | Popular Tags |