public class ResourceManager
extends java.lang.Object
Constructor and Description |
---|
ResourceManager(int size)
The ResourceManager constructor
|
Modifier and Type | Method and Description |
---|---|
boolean |
activeFound()
Checks if any of the logical resources being managed are in active use
|
void |
getResource()
If the number of resources available for use is nonzero, the method decreases the number of resources by one.
|
void |
releaseResource()
Releases a resource.
|
void |
sleep(int i)
Allows usage of Thread.sleep() without try/catch
|
public ResourceManager(int size)
i
- - the number of resources to managepublic void getResource()
public void releaseResource()
public boolean activeFound()
true
- if one or more resource is in use false
- if none of the resources are in usepublic void sleep(int i)