Java Reference
In-Depth Information
/**
* Modifies a DVD database entry specified by a DVD object.
*
* @param dvd The DVD to modify.
* @return A boolean indicating the success or failure of the modify
* operation.
* @throws IOException Thrown if an <code>IOException</code> is
* encountered in the <code>db</code> class.
* <br>
* For more information, see {@link DVDDatabase}.
*/
public boolean modifyDVD(DVD dvd) throws IOException {
DvdCommand cmdObj = new DvdCommand(SocketCommand.MODIFY, dvd);
return getResultFor(cmdObj).getBoolean();
}
/**
* Lock the requested DVD. This method blocks until the lock succeeds,
* or for a maximum of 5 seconds, whichever comes first.
*
* @param UPC The UPC of the DVD to reserve
* @throws InterruptedException Indicates the thread is interrupted.
* @throws IOException on any network problem
*/
public boolean reserveDVD(String upc) throws IOException,
InterruptedException {
DVD dvd = new DVD();
dvd.setUPC(upc);
DvdCommand cmdObj = new DvdCommand(SocketCommand.RESERVE, dvd);
return getResultFor(cmdObj).getBoolean();
}
/**
* Unlock the requested record. Ignored if the caller does not have
* a current lock on the requested record.
*
* @param UPC The UPC of the DVD to release
* @throws IOException on any network problem
*/
public void releaseDVD(String upc) throws IOException {
DVD dvd = new DVD();
dvd.setUPC(upc);
DvdCommand cmdObj = new DvdCommand(SocketCommand.RELEASE, dvd);
getResultFor(cmdObj).getBoolean();
}
Search WWH ::




Custom Search