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