Class ClajRoutines

java.lang.Object
com.xpdustry.claj.server.ClajRoutines

public class ClajRoutines extends Object
Class holding caches and CLaJ routines, such as cleaning AddressRater, closing afk rooms, pending request, etc.
  • Field Details

    • afk

      public final arc.struct.LongMap<arc.util.Timer.Task> afk
      Used to calculate whether a room is afk or not.
    • rates

      public final arc.struct.ObjectMap<InetAddress, ClajRoutines.AddressRater> rates
      List of join, info and list request rates by ip.
    • pendingInfoRequests

      public final arc.struct.LongMap<arc.struct.Seq<ClajConnection>> pendingInfoRequests
      List of client who requested the state of a room that was outdated.
    • pendingInfoTasks

      public final arc.struct.LongMap<arc.util.Timer.Task> pendingInfoTasks
      Use cleaner task instead of storing the pendingInfoRequests invert, to avoid having to many caches.
    • listCache

      public final arc.struct.ObjectMap<com.xpdustry.claj.common.status.ClajType, ClajRoutines.CachedRoomList> listCache
      Cache for room list requests.
  • Constructor Details

    • ClajRoutines

      public ClajRoutines()
  • Method Details

    • clearCaches

      public void clearCaches(arc.func.Cons2<ClajConnection, Long> infoRejection)
    • clearRoomCache

      public void clearRoomCache(ClajRoom room, boolean removeList)
    • clearRoomListCache

      public void clearRoomListCache(com.xpdustry.claj.common.status.ClajType type)
    • clearClientCache

      public void clearClientCache(ClajConnection con)
    • scheludeRoomAfk

      public void scheludeRoomAfk(ClajRoom room, Runnable afkClose)
    • cancelRoomAfk

      public void cancelRoomAfk(ClajRoom room)
    • requestRoomState

      public boolean requestRoomState(ClajRoom room, arc.func.Cons<ClajRoom> sendState)
    • cancelRoomInfoTask

      public void cancelRoomInfoTask(ClajRoom room)
    • getPendingRoomRequests

      public arc.struct.Seq<ClajConnection> getPendingRoomRequests(ClajRoom room)
    • getPendingRoomRequestsForSend

      public arc.struct.Seq<ClajConnection> getPendingRoomRequestsForSend(ClajRoom room)
    • requestRoomList

      public int requestRoomList(ClajConnection con, com.xpdustry.claj.common.status.ClajType type, arc.struct.LongMap<ClajRoom> fallbackRooms, arc.func.Cons<Boolean> rejected)
    • updateRoom

      public void updateRoom(ClajRoom room, boolean stateChanged)
    • sendRoomList

      public boolean sendRoomList(com.xpdustry.claj.common.status.ClajType type, boolean force)
    • refreshRoomList

      public boolean refreshRoomList(com.xpdustry.claj.common.status.ClajType type, boolean force, arc.struct.LongMap<ClajRoom> rooms)
    • refreshRoomList

      public void refreshRoomList(com.xpdustry.claj.common.status.ClajType type, arc.struct.LongMap<ClajRoom> rooms)
    • getListCache

      protected ClajRoutines.CachedRoomList getListCache(com.xpdustry.claj.common.status.ClajType type, arc.struct.LongMap<ClajRoom> fallbackRooms)
    • getAddressRate

      public ClajRoutines.AddressRater getAddressRate(ClajConnection con)
    • removeAddressRate

      public void removeAddressRate(ClajConnection con)