]> git.argeo.org Git - gpl/argeo-slc.git/blob - runtime/org.argeo.slc.core/src/test/java/org/argeo/slc/core/execution/ExceptionIfInitCalledTwice.java
Introduce relative resource sets
[gpl/argeo-slc.git] / runtime / org.argeo.slc.core / src / test / java / org / argeo / slc / core / execution / ExceptionIfInitCalledTwice.java
1 package org.argeo.slc.core.execution;
2
3 import org.apache.commons.logging.Log;
4 import org.apache.commons.logging.LogFactory;
5 import org.argeo.slc.SlcException;
6 import org.springframework.beans.factory.InitializingBean;
7
8 public class ExceptionIfInitCalledTwice implements Runnable, InitializingBean {
9 private final static Log log = LogFactory
10 .getLog(ExceptionIfInitCalledTwice.class);
11
12 private Boolean calledOnce = false;
13
14 public void run() {
15 log.info(getClass().getSimpleName() + " ran properly");
16 }
17
18 public void afterPropertiesSet() throws Exception {
19 log.info(getClass().getSimpleName() + " init method called");
20
21 if (calledOnce)
22 throw new SlcException(getClass().getSimpleName()
23 + "init method called twice.");
24 else
25 calledOnce = true;
26 }
27 }