1 package org.eclipse.jetty.io; 2 3 import java.io.IOException; 4 5 import org.eclipse.jetty.util.log.Log; 6 7 8 public abstract class AbstractConnection implements Connection 9 { 10 private final long _timeStamp; 11 protected final EndPoint _endp; 12 13 public AbstractConnection(EndPoint endp) 14 { 15 _endp=endp; 16 _timeStamp = System.currentTimeMillis(); 17 } 18 19 public AbstractConnection(EndPoint endp,long timestamp) 20 { 21 _endp=endp; 22 _timeStamp = timestamp; 23 } 24 25 public long getTimeStamp() 26 { 27 return _timeStamp; 28 } 29 30 public EndPoint getEndPoint() 31 { 32 return _endp; 33 } 34 35 public void idleExpired() 36 { 37 try 38 { 39 _endp.shutdownOutput(); 40 } 41 catch(IOException e) 42 { 43 Log.ignore(e); 44 45 try 46 { 47 _endp.close(); 48 } 49 catch(IOException e2) 50 { 51 Log.ignore(e2); 52 53 } 54 } 55 } 56 57 public String toString() 58 { 59 return super.toString()+"@"+_endp.getLocalAddr()+":"+_endp.getLocalPort()+"<->"+_endp.getRemoteAddr()+":"+_endp.getRemotePort(); 60 } 61 }