Class ClajPingerManager
java.lang.Object
com.xpdustry.claj.api.ClajPingerManager
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intprotected final ClajPinger[]protected final ClajProviderprotected final arc.struct.Queue<arc.func.Cons2<ClajPinger, Runnable>> protected final boolean[]protected final Thread[]protected final int -
Constructor Summary
ConstructorsConstructorDescriptionClajPingerManager(ClajProvider provider) ClajPingerManager(ClajProvider provider, int workers) -
Method Summary
Modifier and TypeMethodDescriptionvoidcancel()Cancel the queue and current tasks.intvoiddispose()Dispose all pingers.ensurePingerCreated(int index) ensurePingerPingerStarted(int index) findFree()Search for a pinger that's not working.intget()get(int index) getOrNull(int index) getPingerName(int index) booleanbooleanisBusy(int index) voidjoinRoom(ClajLink link, short password, Runnable success, arc.func.Cons<com.xpdustry.claj.common.status.RejectReason> reject, arc.func.Cons<Exception> failed) voidjoinRoom(ClajLink link, Runnable success, arc.func.Cons<com.xpdustry.claj.common.status.RejectReason> reject, arc.func.Cons<Exception> failed) intpingers()voidpingHost(String ip, int port, arc.func.Cons<com.xpdustry.claj.common.status.ServerState> success, arc.func.Cons<Exception> failed) This queues new tasks if a ping is already in progress.provider()<T> voidrequestRoomInfo(ClajLink link, arc.func.Cons<ClajRoom<T>> info, Runnable notFound, arc.func.Cons<Exception> failed) <T> voidserverRooms(String ip, int port, arc.func.Cons<arc.struct.Seq<ClajRoom<T>>> rooms, arc.func.Cons<Exception> failed) voidstop()Stop all pingers and cancel the queue.protected voidsubmit(int index, arc.func.Cons2<ClajPinger, Runnable> task) protected voidsubmit(arc.func.Cons2<ClajPinger, Runnable> task) Queue the task if all pingers are busy.
-
Field Details
-
workers
protected final int workers -
provider
-
created
protected int created -
pingers
-
threads
-
reserved
protected final boolean[] reserved -
queue
-
-
Constructor Details
-
ClajPingerManager
-
ClajPingerManager
-
-
Method Details
-
getPingerName
-
hasCreatedPingers
public boolean hasCreatedPingers() -
createdPingers
public int createdPingers() -
pingers
public int pingers() -
provider
-
ensurePingerCreated
-
ensurePingerPingerStarted
-
get
- Returns:
- the first pinger.
-
get
-
getOrNull
-
findFree
Search for a pinger that's not working. -
findFreeI
public int findFreeI() -
isBusy
public boolean isBusy(int index) -
dispose
public void dispose()Dispose all pingers. -
stop
public void stop()Stop all pingers and cancel the queue. -
cancel
public void cancel()Cancel the queue and current tasks. -
submit
Queue the task if all pingers are busy. -
submit
-
joinRoom
-
joinRoom
-
pingHost
-
serverRooms
-
requestRoomInfo
-