| 1 package sellwin.domain; 2 3 7 8 import java.io.*; 9 import java.net.*; 10 import java.util.*; 11 12 17 public class ChatConnInfo { 18 19 public String sender; 20 21 public String getSender() { return sender; } 22 23 24 public ObjectOutputStream oos; 25 public ObjectOutputStream getOOS() { return oos; } 26 27 28 public java.util.Date connectedSince; 29 public java.util.Date getConnectedSince() { return connectedSince; } 30 31 34 public ChatConnInfo(String sender, ObjectOutputStream oos, java.util.Date dt) { 35 this.sender = sender; 36 this.oos = oos; 37 connectedSince = dt; 38 } 39 40 46 public boolean stillConnected() { 47 java.util.Date rightNow = new java.util.Date (); 48 long TIME_MAX = 1000 * 60 * 2; long rightNowMillis = rightNow.getTime(); 50 long connectedMillis = connectedSince.getTime(); 51 long diff = rightNowMillis - connectedMillis; 52 if (diff > TIME_MAX) 53 return false; 54 else 55 return true; 56 } 57 } 58 | Popular Tags |