ProjectHandler, SessionHandler and SSDPHandler is now singletons
This commit is contained in:
parent
825eb124cb
commit
ecda338715
9 changed files with 116 additions and 66 deletions
|
|
@ -14,11 +14,23 @@ import com.coder.server.message.CoderMessage;
|
|||
|
||||
public class SessionHandler{
|
||||
public static final Logger logger = LogUtil.getLogger();
|
||||
private static SessionHandler instance = null;
|
||||
|
||||
private Session session;
|
||||
private HashSet<SessionEventHandler> sessionEventHandlers = new HashSet<SessionEventHandler>();
|
||||
private HashSet<ProjectMessageListener> messageListeners = new HashSet<ProjectMessageListener>();
|
||||
|
||||
private SessionHandler(){
|
||||
|
||||
}
|
||||
|
||||
public static SessionHandler getInstance(){
|
||||
if(instance == null){
|
||||
instance = new SessionHandler();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
public boolean setupConnection(String url, int port){
|
||||
if(session != null && session.isConnected()){
|
||||
session.close();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue