Skip to content

Commit

Permalink
Updating logging and access, adding comment to explain fail-fast stra…
Browse files Browse the repository at this point in the history
…tegy
  • Loading branch information
escowles committed Jul 29, 2014
1 parent 629cf3b commit a9fda13
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Expand Up @@ -144,14 +144,17 @@ public class FedoraNodes extends AbstractResource {
**/
private void init( final UriInfo uriInfo ) {
if ( !baseURLSet ) {
// set to true the first time this is run. if there is an exception the first time, there
// will likely be an exception every time. since this is run on each repository update,
// we should fail fast rather than retrying over and over.
baseURLSet = true;
try {
final URI baseURL = uriInfo.getBaseUri();
LOGGER.warn("FedoraNodes.init(): baseURL = " + baseURL.toString());
LOGGER.debug("FedoraNodes.init(): baseURL = " + baseURL.toString());
final ObservationManager obs = session.getWorkspace().getObservationManager();
final String json = "{\"baseURL\":\"" + baseURL.toString() + "\"}";
obs.setUserData(json);
LOGGER.warn("FedoraNodes.init(): done");
LOGGER.trace("FedoraNodes.init(): done");
} catch ( Exception ex ) {
LOGGER.warn("Error setting baseURL", ex);
}
Expand Down
Expand Up @@ -63,9 +63,10 @@ public class DefaultMessageFactory implements JMSEventMessageFactory {
private String baseURL;

/**
* Get baseURL.
* Set baseURL.
* @param event Fedora event object containing user data with baseURL specified.
*/
public void setBaseURL(final FedoraEvent event) {
private void setBaseURL(final FedoraEvent event) {
try {
final JsonObject json = new JsonParser().parse(event.getUserData()).getAsJsonObject();
this.baseURL = json.get("baseURL").getAsString();
Expand Down

0 comments on commit a9fda13

Please sign in to comment.