|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.buildforge.services.client.dbo.Semaphore
public class Semaphore
Semaphores are used in a classic, concurrent sense in the Build Forge
system. They are binary semaphores (maximum count of 1) that enforce
mutual exclusion both within a single build across multiple threaded
Step
s and across multiple builds. Most interaction with
Semaphores is done via the dot commands '.semget' and '.semput' within
the bounds of a Project
, but programmatic manipulation outside
the runtime of a Project may be accomplished via this class.
Field Summary | |
---|---|
static java.lang.Class<Semaphore> |
CLASS
|
Constructor Summary | |
---|---|
Semaphore(APIClientConnection conn)
Defines a new Semaphore |
Method Summary | |
---|---|
boolean |
acquire()
Attempts to exclusively acquire the desired Semaphore |
Semaphore |
create()
Creates a new Semaphore in the database |
void |
delete()
Removes this Semaphore from the database |
static java.util.List<Semaphore> |
findAll(APIClientConnection conn)
Retrieves all Semaphores in the database |
static Semaphore |
findById(APIClientConnection conn,
java.lang.String semaphoreName)
Retrieves a single Semaphore by identifier (name) |
boolean |
getActive()
Returns whether this Semaphore has already been acquired. |
int |
getBuildId()
Returns the identifier of the Build that last acquired the semaphore |
java.lang.String |
getName()
Returns the name of this Semaphore |
java.lang.String |
getRequestor()
Returns the name of the project and step which owns or last owned the semaphore |
int |
getTimestamp()
The timestamp of when the semaphore was last acquired, in seconds since epoch |
java.lang.String |
getUserId()
Returns the identifier of the user that owns this Semaphore |
void |
release()
Releases the exclusive lock on the supplied Semaphore |
void |
setActive(boolean active)
Marks this Semaphore as acquired ( true ) or available (false ) |
void |
setBuildId(int buildId)
Sets the identifier for the Build that last acquired this Semaphore |
void |
setName(java.lang.String name)
Sets the name of this Semaphore |
void |
setRequestor(java.lang.String requestor)
Sets the name of the project and step which owns or last owned the semaphore |
void |
setTimestamp(int timestamp)
Sets the timestamp of when the semaphore was last acquired, in seconds since epoch |
void |
setUserId(java.lang.String uid)
Sets the identifier of the user that owns this Semaphore |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.Class<Semaphore> CLASS
Constructor Detail |
---|
public Semaphore(APIClientConnection conn)
conn
- Method Detail |
---|
public static java.util.List<Semaphore> findAll(APIClientConnection conn) throws java.io.IOException, ServiceException
conn
-
java.io.IOException
ServiceException
public static Semaphore findById(APIClientConnection conn, java.lang.String semaphoreName) throws java.io.IOException, ServiceException
conn
- semaphoreName
-
java.io.IOException
ServiceException
public Semaphore create() throws java.io.IOException, ServiceException
java.io.IOException
ServiceException
public void delete() throws java.io.IOException, ServiceException
java.io.IOException
ServiceException
public boolean acquire() throws java.io.IOException, ServiceException
true
if the Semaphore was acquired, java.io.IOException
ServiceException
public void release() throws java.io.IOException, ServiceException
java.io.IOException
ServiceException
public boolean getActive()
true
if it has already been acquired, false
if notpublic int getBuildId()
Build
that last acquired the semaphore
public java.lang.String getName()
public java.lang.String getRequestor()
public int getTimestamp()
public java.lang.String getUserId()
public void setActive(boolean active)
true
) or available (false
)
active
- true
for acquired or false
for availablepublic void setBuildId(int buildId)
buildId
- public void setName(java.lang.String name)
name
- public void setRequestor(java.lang.String requestor)
requestor
- public void setTimestamp(int timestamp)
public void setUserId(java.lang.String uid)
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |