Revision 6260
Added by Chris Jones over 13 years ago
src/edu/ucsb/nceas/metacat/dataone/MNodeService.java | ||
---|---|---|
72 | 72 |
import edu.ucsb.nceas.metacat.IdentifierManager; |
73 | 73 |
import edu.ucsb.nceas.metacat.McdbDocNotFoundException; |
74 | 74 |
import edu.ucsb.nceas.metacat.client.InsufficientKarmaException; |
75 |
import edu.ucsb.nceas.metacat.database.DBConnection; |
|
76 |
import edu.ucsb.nceas.metacat.database.DBConnectionPool; |
|
75 | 77 |
import edu.ucsb.nceas.metacat.properties.PropertyService; |
76 | 78 |
import edu.ucsb.nceas.utilities.PropertyNotFoundException; |
77 | 79 |
|
... | ... | |
631 | 633 |
throws NotImplemented, ServiceFailure, NotAuthorized, InvalidRequest, |
632 | 634 |
InsufficientResources, UnsupportedType { |
633 | 635 |
|
634 |
return true; |
|
636 |
// test if we can get a database connection |
|
637 |
boolean alive = false; |
|
638 |
int serialNumber = -1; |
|
639 |
DBConnection dbConn = null; |
|
640 |
try { |
|
641 |
dbConn = DBConnectionPool |
|
642 |
.getDBConnection("MNodeService.ping"); |
|
643 |
serialNumber = dbConn.getCheckOutSerialNumber(); |
|
644 |
alive = true; |
|
645 |
|
|
646 |
} catch (SQLException e) { |
|
647 |
return alive; |
|
648 |
|
|
649 |
} finally { |
|
650 |
// Return the database connection |
|
651 |
DBConnectionPool.returnDBConnection(dbConn, serialNumber); |
|
652 |
|
|
653 |
} |
|
654 |
|
|
655 |
return alive; |
|
635 | 656 |
} |
636 | 657 |
|
637 | 658 |
/** |
Also available in: Unified diff
Implement MNCore.ping() by testing for a successful database connection.