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.close(); 40 } 41 catch(IOException e) 42 { 43 Log.ignore(e); 44 } 45 } 46 47 public String toString() 48 { 49 return super.toString()+"@"+_endp.getLocalAddr()+":"+_endp.getLocalPort()+"<->"+_endp.getRemoteAddr()+":"+_endp.getRemotePort(); 50 } 51 }