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()
SharedHttpClient
addUse
in interface SharedHttpClient
public boolean isClosed()
SharedHttpClient
SharedHttpClient.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 SharedHttpClient
public int getOpenCount()
SharedHttpClient
getOpenCount
in interface SharedHttpClient
public void close() throws java.io.IOException
close
in interface SharedHttpClient
close
in interface java.lang.AutoCloseable
java.io.IOException
public void registerUser(@NotNull SharedResourceUser user)
SharedHttpClient
registerUser
in interface SharedHttpClient
user
- The user to registerpublic void removeUser(@NotNull SharedResourceUser user)
SharedHttpClient
removeUser
in interface SharedHttpClient
user
- The user to remove@NotNull public java.util.Set<SharedResourceUser> getCurrentUsers()
SharedHttpClient
getCurrentUsers
in interface SharedHttpClient
protected 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