public abstract class SharedHttpClientBase extends java.lang.Object implements SharedHttpClient
SHUTDOWN_USE_COUNT| Modifier | Constructor and Description |
|---|---|
protected |
SharedHttpClientBase() |
| 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() |
protected abstract void |
closeUnderlyingResources()
Method called to close any resources when no more references are held to this object.
|
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.
|
java.lang.String |
toString() |
public boolean addUse()
SharedHttpClientaddUse in interface SharedHttpClientpublic boolean isClosed()
SharedHttpClientSharedHttpClient.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 itisClosed in interface SharedHttpClientpublic int getOpenCount()
SharedHttpClientgetOpenCount in interface SharedHttpClientpublic void close()
throws java.io.IOException
close in interface SharedHttpClientclose in interface java.lang.AutoCloseablejava.io.IOExceptionpublic void registerUser(@NotNull SharedResourceUser user)
SharedHttpClientregisterUser in interface SharedHttpClientuser - The user to registerpublic void removeUser(@NotNull SharedResourceUser user)
SharedHttpClientremoveUser in interface SharedHttpClientuser - The user to remove@NotNull public java.util.Set<SharedResourceUser> getCurrentUsers()
SharedHttpClientgetCurrentUsers in interface SharedHttpClientprotected abstract void closeUnderlyingResources()
throws java.io.IOException
java.io.IOException - On error closing the resourcespublic java.lang.String toString()
toString in class java.lang.Object