ch.elca.el4j.tests.services.persistence.generic.dao
Class ImpatientClass

java.lang.Object
  extended by ch.elca.el4j.tests.services.persistence.generic.dao.ImpatientClass
All Implemented Interfaces:
ModuleApplicationListener, EventListener, ApplicationContextAware

public class ImpatientClass
extends Object
implements ApplicationContextAware, ModuleApplicationListener

This impatient class tries to access the daoRegistry before the Spring context is initialized.

Author:
Stefan Wismer (SWI)
File-location:
ImpatientClass
Last check-in date:
2009-08-04 14:35:53 +0200 (Di, 04. Aug 2009) by swismer for revision 3875

Field Summary
private  ModuleApplicationContext m_applicationContext
          The Spring application context.
private  boolean m_contextIsReady
          Is context ready?
private  DaoRegistry m_daoRegistry
          The dao registry.
private  Thread m_impatientThread
          The thread that tries to access the daoRegistry too early.
private  boolean m_successful
          Was test successful?
 
Constructor Summary
ImpatientClass()
           
 
Method Summary
 DaoRegistry getDaoRegistry()
           
 boolean join()
          Wait until impatient thread finally has accessed the DAO registry.
 void onContextRefreshed()
          
 void setApplicationContext(ApplicationContext applicationContext)
          
 void setDaoRegistry(DaoRegistry daoRegistry)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_applicationContext

private ModuleApplicationContext m_applicationContext
The Spring application context.


m_daoRegistry

private DaoRegistry m_daoRegistry
The dao registry.


m_impatientThread

private Thread m_impatientThread
The thread that tries to access the daoRegistry too early.


m_contextIsReady

private volatile boolean m_contextIsReady
Is context ready?


m_successful

private boolean m_successful
Was test successful?

Constructor Detail

ImpatientClass

public ImpatientClass()
Method Detail

setApplicationContext

public void setApplicationContext(ApplicationContext applicationContext)
                           throws BeansException

Specified by:
setApplicationContext in interface ApplicationContextAware
Throws:
BeansException

onContextRefreshed

public void onContextRefreshed()

Specified by:
onContextRefreshed in interface ModuleApplicationListener

getDaoRegistry

public DaoRegistry getDaoRegistry()
Returns:
the DAO registry

setDaoRegistry

public void setDaoRegistry(DaoRegistry daoRegistry)
Parameters:
daoRegistry - the DAO registry

join

public boolean join()
Wait until impatient thread finally has accessed the DAO registry.

Returns:
true if test was successful.


Copyright © 2005-2011 ELCA. All Rights Reserved.