package chat.user; import java.util.UUID; import io.netty.channel.Channel; public class Session { private Client client; private Status status; private Token token; private String secret; private Channel channel; private long lastActiveTime; public Session(Client client) throws Exception { this.client = client; this.secret = UUID.randomUUID().toString(); this.token = new Token(client.getUserId(), secret); } public void closeChannel() { try { channel.closeFuture(); } catch (Exception e) { } } public void setChannel(Channel channel) { this.channel = channel; } public Token getToken() { return token; } public String getSecret() { return secret; } public User getUser() { return client.getUser(); } public Client getClient() { return client; } public Status getStatus() { return status; } public Channel getChannel() { return channel; } public long getLastActiveTime() { return lastActiveTime; } public void refreshLastActiveTime() { lastActiveTime = System.currentTimeMillis(); } public long getMessageHead() { // TODO Auto-generated method stub return lastActiveTime; } public long getFriendHead() { // TODO Auto-generated method stub return lastActiveTime; } public long getFriendRqHead() { // TODO Auto-generated method stub return lastActiveTime; } public long getSettingHead() { // TODO Auto-generated method stub return lastActiveTime; } }