Skip to content
Snippets Groups Projects
Commit 99b7f3cd authored by felmer's avatar felmer
Browse files

LMS-2329 implemented by using org.eclipse.jetty.util.component.LifeCycle.Listener

SVN: 22514
parent d0ae8b25
No related branches found
No related tags found
No related merge requests found
...@@ -56,5 +56,6 @@ ...@@ -56,5 +56,6 @@
<classpathentry kind="lib" path="/libraries/commons-dbcp/commons-dbcp.jar" sourcepath="/libraries/commons-dbcp/src.zip"/> <classpathentry kind="lib" path="/libraries/commons-dbcp/commons-dbcp.jar" sourcepath="/libraries/commons-dbcp/src.zip"/>
<classpathentry kind="lib" path="/libraries/jline/jline.jar" sourcepath="/libraries/jline/src.zip"/> <classpathentry kind="lib" path="/libraries/jline/jline.jar" sourcepath="/libraries/jline/src.zip"/>
<classpathentry kind="lib" path="/libraries/gwt-debug-panel/gwt-debug-panel.jar" sourcepath="/gwt-debug-panel-read-only"/> <classpathentry kind="lib" path="/libraries/gwt-debug-panel/gwt-debug-panel.jar" sourcepath="/gwt-debug-panel-read-only"/>
<classpathentry kind="lib" path="/libraries/jetty7/lib/common/jetty-util.jar"/>
<classpathentry kind="output" path="targets/www/WEB-INF/classes"/> <classpathentry kind="output" path="targets/www/WEB-INF/classes"/>
</classpath> </classpath>
...@@ -35,6 +35,8 @@ ...@@ -35,6 +35,8 @@
<property name="query.api.doc.zip" value="${dist}/doc.zip" /> <property name="query.api.doc.zip" value="${dist}/doc.zip" />
<property name="query.api.src.zip" value="${dist}/src.zip" /> <property name="query.api.src.zip" value="${dist}/src.zip" />
<property name="query.api.dist.file" value="${dist}/${query.api}.zip" /> <property name="query.api.dist.file" value="${dist}/${query.api}.zip" />
<property name="jetty.openbis.jar.file.name" value="jetty-openbis.jar"/>
<property name="jetty.openbis.jar.file" value="${dist}/${jetty.openbis.jar.file.name}"/>
<property name="webapp.file.name" value="openBIS.war" /> <property name="webapp.file.name" value="openBIS.war" />
<property name="webapp.file" value="${server.dist}/${webapp.file.name}" /> <property name="webapp.file" value="${server.dist}/${webapp.file.name}" />
...@@ -553,6 +555,11 @@ ...@@ -553,6 +555,11 @@
<include name="*.INFO" /> <include name="*.INFO" />
</zipfileset> </zipfileset>
</jar> </jar>
<jar destfile="${jetty.openbis.jar.file}">
<zipfileset src="${jar.file}">
<include name="ch/systemsx/cisd/openbis/**/LifeCycleListener*.class" />
</zipfileset>
</jar>
</target> </target>
<!-- <!--
...@@ -595,6 +602,9 @@ ...@@ -595,6 +602,9 @@
<lib dir="${dist}"> <lib dir="${dist}">
<include name="${jar.file.name}" /> <include name="${jar.file.name}" />
</lib> </lib>
<lib dir="${dist}">
<include name="${jetty.openbis.jar.file.name}" />
</lib>
<lib dir="${lib}/cisd-base"> <lib dir="${lib}/cisd-base">
<include name="cisd-base.jar" /> <include name="cisd-base.jar" />
</lib> </lib>
......
...@@ -57,6 +57,10 @@ ...@@ -57,6 +57,10 @@
</New> </New>
</Arg> </Arg>
</Call> </Call>
<Call name="addLifeCycleListener">
<Arg><New class="ch.systemsx.cisd.openbis.generic.server.util.LifeCycleListener"/></Arg>
</Call>
<!-- =========================================================== --> <!-- =========================================================== -->
<!-- extra options --> <!-- extra options -->
......
...@@ -5,4 +5,4 @@ $JVM -DSTOP.PORT=$JETTY_STOP_PORT \ ...@@ -5,4 +5,4 @@ $JVM -DSTOP.PORT=$JETTY_STOP_PORT \
-DSTOP.KEY=$JETTY_STOP_KEY \ -DSTOP.KEY=$JETTY_STOP_KEY \
$JAVA_OPTS $JAVA_MEM_OPTS \ $JAVA_OPTS $JAVA_MEM_OPTS \
-Dpython.path=$JETTY_LIB_PATH \ -Dpython.path=$JETTY_LIB_PATH \
-jar start.jar etc/jetty.xml >> logs/jetty.out 2>&1 & -jar start.jar etc/jetty.xml lib=webapps/openbis/WEB-INF/lib >> logs/jetty.out 2>&1 &
/*
* Copyright 2011 ETH Zuerich, CISD
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ch.systemsx.cisd.openbis.generic.server.util;
import org.eclipse.jetty.util.component.LifeCycle;
/**
* Stops a component (e.g. Web Server) if it goes into state "Failure".
*
* @author Franz-Josef Elmer
*/
public class LifeCycleListener implements LifeCycle.Listener
{
public void lifeCycleFailure(LifeCycle lifeCycle, Throwable throwable)
{
System.err.println("Failed component " + lifeCycle + ": " + throwable);
try
{
lifeCycle.stop();
} catch (Exception ex)
{
System.err.println("Couldn't stop component " + lifeCycle);
ex.printStackTrace(System.err);
}
}
public void lifeCycleStarted(LifeCycle lifeCycle)
{
}
public void lifeCycleStarting(LifeCycle lifeCycle)
{
}
public void lifeCycleStopped(LifeCycle lifeCycle)
{
}
public void lifeCycleStopping(LifeCycle lifeCycle)
{
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment