Class ClajProxyManager
java.lang.Object
com.xpdustry.claj.api.ClajProxyManager
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionClajProxyManager(ClajProvider provider) ClajProxyManager(ClajProvider provider, int workers) -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidCloses the first proxy's room.voidcloseRoom(int index) intcreateRoom(int index, String host, int port, arc.func.Cons<ClajLink> created, arc.func.Cons<com.xpdustry.claj.common.status.CloseReason> closed, arc.func.Cons<Throwable> failed) createRoom(String host, int port, arc.func.Cons<ClajLink> created, arc.func.Cons<com.xpdustry.claj.common.status.CloseReason> closed, arc.func.Cons<Throwable> failed) This will try to find an available proxy.voiddispose()Dispose all proxies.ensureCreated(int index) ensureStarted(int index) findFree()Search for a proxy with no created room.intget()get(int index) getOrNull(int index) getProxyName(int index) booleanbooleanSearch whether a proxy have an open room.booleanisBusy(int index) booleanChecks the first proxy.booleanisRoomClosed(int index) booleanChecks the first proxy.booleanisRoomCreated(int index) provider()intproxies()voidstop()Close all rooms and stop all proxies.
-
Field Details
-
workers
protected final int workers -
provider
-
created
protected int created -
proxies
-
threads
-
reserved
protected final boolean[] reserved
-
-
Constructor Details
-
ClajProxyManager
-
ClajProxyManager
-
-
Method Details
-
getProxyName
-
hasCreatedProxies
public boolean hasCreatedProxies() -
createdProxies
public int createdProxies() -
proxies
public int proxies() -
provider
-
ensureCreated
-
ensureStarted
-
get
- Returns:
- the first proxy.
-
get
-
getOrNull
-
findFree
Search for a proxy with no created room. -
findFreeI
public int findFreeI() -
isBusy
public boolean isBusy(int index) -
isRoomCreated
public boolean isRoomCreated()Checks the first proxy. -
isRoomCreated
public boolean isRoomCreated(int index) -
isRoomClosed
public boolean isRoomClosed()Checks the first proxy. -
isRoomClosed
public boolean isRoomClosed(int index) -
hasOpenRoom
public boolean hasOpenRoom()Search whether a proxy have an open room. -
closeRoom
public void closeRoom()Closes the first proxy's room. -
closeRoom
public void closeRoom(int index) -
closeAllRooms
public void closeAllRooms() -
dispose
public void dispose()Dispose all proxies. -
stop
public void stop()Close all rooms and stop all proxies. -
createRoom
public ClajProxy createRoom(String host, int port, arc.func.Cons<ClajLink> created, arc.func.Cons<com.xpdustry.claj.common.status.CloseReason> closed, arc.func.Cons<Throwable> failed) This will try to find an available proxy.- Returns:
- the proxy on which the room was opened. (does not guarantee that the room is already open or will be.)
-
createRoom
-