public interface GuardedDataset
public void doGetDAS(HttpServletRequest request,
HttpServletResponse response,
ReqState rs)
throws IOException, ServletException {
response.setContentType("text/plain");
response.setHeader("XDODS-Server", getServerVersion() );
response.setHeader("Content-Description", "dods-dds");
OutputStream Out = new BufferedOutputStream(response.getOutputStream());
GuardedDataset ds = null;
try {
ds = getDataset(rs);
DAS myDAS = ds.getDAS(); // server would lock here
myDAS.print(Out);
response.setStatus(response.SC_OK);
}
catch (DAP2Exception de){
dap2ExceptionHandler(de,response);
}
catch (ParseException pe) {
parseExceptionHandler(pe,response);
}
finally { // release lock if needed
if (ds != null) ds.release();
}
}
Its important that the DDS or DAS not be used after release() is called.
See opendap.servers.netcdf.NcDataset for example of implementing a locking
GuardedDataset.
If a server is not keeping state, it can simply pass the DDS and DAS without locking,
and implement a dummy release() method.Modifier and Type | Method and Description |
---|---|
void |
close() |
DAS |
getDAS()
Get the DAS for this Dataset.
|
ServerDDS |
getDDS()
Get the DDS for this Dataset.
|
void |
release()
Release the lock, if any, on this dataset.
|
ServerDDS getDDS() throws DAP2Exception, ParseException
DAP2Exception
ParseException
DAS getDAS() throws DAP2Exception, ParseException
DAP2Exception
ParseException
void release()
void close()