public interface SharedHttpClient
extends java.lang.AutoCloseable
Modifier and Type | Field and Description |
---|---|
static int |
SHUTDOWN_USE_COUNT
At how many uses should the real shutdown happen.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addUse()
Attempts to mark a new use of this shared resources and returns whether or not the addition was successful
|
void |
close() |
java.util.Set<SharedResourceUser> |
getCurrentUsers()
Returns a set of the current users of the client.
|
int |
getOpenCount()
Returns the number of open uses of the client
|
boolean |
isClosed()
Returns whether or not this shared resource is closed.
|
void |
registerUser(SharedResourceUser user)
Registers a user of the resource.
|
void |
removeUser(SharedResourceUser user)
Registers a user of the resource.
|
static final int SHUTDOWN_USE_COUNT
boolean addUse()
boolean isClosed()
addUse()
method which atomically checks for availability and adds a new use. Otherwise you might check and get it's useable but then have it be closed by the time you call the next method on itint getOpenCount()
void registerUser(@NotNull SharedResourceUser user)
user
- The user to registervoid removeUser(@NotNull SharedResourceUser user)
user
- The user to remove@NotNull java.util.Set<SharedResourceUser> getCurrentUsers()
void close() throws java.lang.Exception
close
in interface java.lang.AutoCloseable
java.lang.Exception