Package org.menacheri.jetserver.app

Examples of org.menacheri.jetserver.app.PlayerSession


    }
  }

  public PlayerSession lookupSession(final String reconnectKey)
  {
    PlayerSession playerSession = (PlayerSession)reconnectRegistry.getSession(reconnectKey);
    if(null != playerSession)
    {
      synchronized(playerSession){
        // if its an already active session then do not allow a
        // reconnect. So the only state in which a client is allowed to
        // reconnect is if it is "NOT_CONNECTED"
        if(playerSession.getStatus() == Session.Status.NOT_CONNECTED)
        {
          playerSession.setStatus(Session.Status.CONNECTING);
        }
        else
        {
          playerSession = null;
        }
View Full Code Here


  public void handleGameRoomJoin(Player player, Channel channel, String refKey)
  {
    GameRoom gameRoom = lookupService.gameRoomLookup(refKey);
    if (null != gameRoom)
    {
      PlayerSession playerSession = gameRoom.createPlayerSession(player);
      gameRoom.onLogin(playerSession);
      String reconnectKey = (String)idGeneratorService
          .generateFor(playerSession.getClass());
      playerSession.setAttribute(JetConfig.RECONNECT_KEY, reconnectKey);
      playerSession.setAttribute(JetConfig.RECONNECT_REGISTRY, reconnectRegistry);
      LOG.trace("Sending GAME_ROOM_JOIN_SUCCESS to channel {}",
          channel.getId());
      ChannelFuture future = channel.write(eventToFrame(
          Events.GAME_ROOM_JOIN_SUCCESS, reconnectKey));
      connectToGameRoom(gameRoom, playerSession, future);
View Full Code Here

    }
    for (GameRoom gameRoom : gameRoomList)
    {
      for (int j = 1; j <= SESSIONS_PER_GAME_ROOM; j++)
      {
        PlayerSession playerSession = gameRoom.createPlayerSession(null);
        gameRoom.connectSession(playerSession);
        playerSession.addHandler(new SessionHandler(playerSession));
        sessionList.add(playerSession);
      }
    }
  }
View Full Code Here

TOP

Related Classes of org.menacheri.jetserver.app.PlayerSession

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.