[java-identity-provider COMMIT] /trunk/idp-core/src/main/java/net/shibboleth/idp/service/AbstractService.java
noreply at shibboleth.net
noreply at shibboleth.net
Mon Mar 25 22:12:25 EDT 2013
Author: scantor
Date: Mon Mar 25 22:12:25 2013
New Revision: 4360
URL: http://svn.shibboleth.net/view/java-identity-provider?rev=4360&view=rev
Log:
Turn start/stop into usable Spring init/destroy methods.
Modified:
trunk/idp-core/src/main/java/net/shibboleth/idp/service/AbstractService.java
Modified: trunk/idp-core/src/main/java/net/shibboleth/idp/service/AbstractService.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-core/src/main/java/net/shibboleth/idp/service/AbstractService.java?rev=4360&r1=4359&r2=4360&view=diff
==============================================================================
--- trunk/idp-core/src/main/java/net/shibboleth/idp/service/AbstractService.java (original)
+++ trunk/idp-core/src/main/java/net/shibboleth/idp/service/AbstractService.java Mon Mar 25 22:12:25 2013
@@ -29,6 +29,7 @@
import net.shibboleth.idp.log.PerformanceEvent;
import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
import net.shibboleth.utilities.java.support.component.AbstractIdentifiableInitializableComponent;
+import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
import net.shibboleth.utilities.java.support.component.ComponentValidationException;
import net.shibboleth.utilities.java.support.component.ValidatableComponent;
import net.shibboleth.utilities.java.support.logic.Constraint;
@@ -96,12 +97,15 @@
public final void start() throws ServiceException {
final PerformanceEvent perfEvent = new PerformanceEvent(getId() + START_PERF_EVENT_ID_SUFFIX);
perfEvent.startTime();
-
+
final Lock serviceWriteLock = getServiceLock().writeLock();
final HashMap context = new HashMap();
try {
serviceWriteLock.lock();
+
+ initialize();
+ validate();
if (startStates.contains(getCurrentState())) {
return;
@@ -118,6 +122,14 @@
setCurrentState(STATE_STOPPED);
perfEvent.stopTime(false);
throw e;
+ } catch (ComponentInitializationException e) {
+ setCurrentState(STATE_STOPPED);
+ perfEvent.stopTime(false);
+ throw new ServiceException("Exception during component initialization", e);
+ } catch (ComponentValidationException e) {
+ setCurrentState(STATE_STOPPED);
+ perfEvent.stopTime(false);
+ throw new ServiceException("Exception during component validation", e);
} finally {
serviceWriteLock.unlock();
EventLogger.log(perfEvent);
More information about the commits
mailing list