diff --git a/config/lex-context-config.xml b/config/lex-context-config.xml
index ac552db..497d9f0 100644
--- a/config/lex-context-config.xml
+++ b/config/lex-context-config.xml
@@ -41,11 +41,11 @@
maxIdle
- 2
+ 7
maxActive
- 4
+ 15
@@ -89,11 +89,11 @@
maxIdle
- 2
+ 7
maxActive
- 4
+ 15
diff --git a/src/java/org/thdl/lex/DisplayHelper.java b/src/java/org/thdl/lex/DisplayHelper.java
index 5635a40..8d58e65 100644
--- a/src/java/org/thdl/lex/DisplayHelper.java
+++ b/src/java/org/thdl/lex/DisplayHelper.java
@@ -243,7 +243,12 @@ public class DisplayHelper
*/
public String getFormattedDate()
{
- return DATE_FORMAT.format( getDate() );
+ String date = null;
+ if ( null != getDate() )
+ {
+ date = DATE_FORMAT.format( getDate() );
+ }
+ return date;
}
// helpers
diff --git a/src/java/org/thdl/lex/Global.java b/src/java/org/thdl/lex/Global.java
index 5171143..b2a5a4f 100644
--- a/src/java/org/thdl/lex/Global.java
+++ b/src/java/org/thdl/lex/Global.java
@@ -17,6 +17,8 @@ public class Global
private static long lastRefresh;
private int entryCount;
private List recentTerms;
+ private final GlobalRefresher REFRESHER = new GlobalRefresher();
+ private final Thread REFRESHER_THREAD = new Thread( REFRESHER );
/**
@@ -110,7 +112,7 @@ public class Global
*/
public void setRecentTerms( List recentTerms )
{
- this.recentTerms = recentTerms;
+ this.recentTerms = Collections.synchronizedList( recentTerms );
setLastRefresh( System.currentTimeMillis() );
}
@@ -182,8 +184,17 @@ public class Global
*/
public void doRefresh() throws LexRepositoryException
{
- GlobalRefresher gr = new GlobalRefresher();
- new Thread( gr ).start();
+ LexLogger.info( "Checking if GlobalRefresher is busy..." );
+ if ( REFRESHER.getFinished() )
+ {
+ LexLogger.info( "GlobalRefresher is not busy. Starting refresh..." );
+ REFRESHER.setFinished( false );
+ REFRESHER_THREAD.start();
+ }
+ else
+ {
+ LexLogger.info( "GlobalRefresher was busy. Refresh not started..." );
+ }
}
@@ -214,6 +225,31 @@ public class Global
*/
class GlobalRefresher implements Runnable
{
+ private boolean finished;
+
+
+ /**
+ * Sets the finished attribute of the GlobalRefresher object
+ *
+ * @param finished The new finished value
+ */
+ private void setFinished( boolean finished )
+ {
+ this.finished = finished;
+ }
+
+
+ /**
+ * Gets the finished attribute of the GlobalRefresher object
+ *
+ * @return The finished value
+ */
+ private boolean getFinished()
+ {
+ return finished;
+ }
+
+
/**
* Main processing method for the GlobalRefresher object
*/
@@ -222,7 +258,18 @@ public class Global
int limit = getRecentTermsCount();
try
{
+ LexLogger.info( "GlobalRefresher is starting a refresh..." );
setRecentTerms( LexComponentRepository.getRecentTerms( limit ) );
+ /*
+ ILexComponent ilc = null;
+ for ( Iterator it = getRecentTerms().iterator(); it.hasNext(); ilc = (ILexComponent) it.next() )
+ {
+ ilc.getMeta();
+ }
+ */
+ LexComponentRepository.cleanup();
+ LexLogger.info( "GlobalRefresher finished a refresh..." );
+ setFinished( true );
}
catch ( Exception e )
{
@@ -231,14 +278,17 @@ public class Global
String stackTrace = writer.getBuffer().toString();
LexLogger.error( "GlobalRefresher Thread caught an Exception: " + stackTrace );
}
-
+ setFinished( true );
}
/**
*Constructor for the GlobalRefresher object
*/
- GlobalRefresher() { }
+ GlobalRefresher()
+ {
+ setFinished( true );
+ }
}
}
diff --git a/src/java/org/thdl/lex/LexComponentRepository.java b/src/java/org/thdl/lex/LexComponentRepository.java
index 6b70a90..bf85f56 100644
--- a/src/java/org/thdl/lex/LexComponentRepository.java
+++ b/src/java/org/thdl/lex/LexComponentRepository.java
@@ -369,8 +369,10 @@ public class LexComponentRepository
String queryString = " FROM org.thdl.lex.component.ITerm ORDER BY modifiedOn DESC LIMIT " + limit;
try
{
+ beginTransaction();
query = getSession().createQuery( queryString );
results = query.list();
+ endTransaction( false );
}
catch ( HibernateException he )
{
diff --git a/src/java/org/thdl/lex/LexLogger.java b/src/java/org/thdl/lex/LexLogger.java
index a1de3b5..a27078c 100644
--- a/src/java/org/thdl/lex/LexLogger.java
+++ b/src/java/org/thdl/lex/LexLogger.java
@@ -18,6 +18,7 @@ import org.thdl.lex.component.*;
public class LexLogger
{
private final static Logger LOGGER = Logger.getLogger( "org.thdl.lex" );
+ private final static List EXCLUDED_PARAMS = Arrays.asList( new String[]{"org.apache.catalina.jsp_classpath", "javax.servlet.context.tempdir", "org.apache.catalina.WELCOME_FILES"} );
/**
@@ -87,7 +88,10 @@ public class LexLogger
while ( enum.hasMoreElements() )
{
String att = (String) enum.nextElement();
- LOGGER.debug( "Context Attribute " + att + " = " + context.getAttribute( att ) );
+ if ( !EXCLUDED_PARAMS.contains( att ) )
+ {
+ LOGGER.debug( "Context Attribute " + att + " = " + context.getAttribute( att ) );
+ }
}
debugComponent( context.getAttribute( LexConstants.GLOBAL_CONTEXT_ATTR ) );
}
diff --git a/src/java/org/thdl/lex/commands/DisplayCommand.java b/src/java/org/thdl/lex/commands/DisplayCommand.java
index e5e7b0c..17866ac 100644
--- a/src/java/org/thdl/lex/commands/DisplayCommand.java
+++ b/src/java/org/thdl/lex/commands/DisplayCommand.java
@@ -76,6 +76,10 @@ public class DisplayCommand extends LexCommand implements Command
{
LexComponentRepository.loadTermByPk( term );
query.setEntry( term );
+ if ( query.getResults().keySet().size() < 1 )
+ {
+ query.getResults().put( term.getMetaId(), term.getTerm() );
+ }
}
displayHelper.populate( req.getParameterMap() );
diff --git a/src/jsp/jsp/displayTerm.jsf b/src/jsp/jsp/displayTerm.jsf
index d1f096b..4913e4a 100644
--- a/src/jsp/jsp/displayTerm.jsf
+++ b/src/jsp/jsp/displayTerm.jsf
@@ -7,24 +7,24 @@
-
+
-
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
+