@Override public void run() { try { getInstance().shutdownAll( null ); } catch ( Exception e ) { // ignore, the exception should already have been reported } } } );
/** * Tracks modification times of files in the given class directory. * * @param directory the File directory to track modification times for. */ private void addClassDirectory( File directory ) { for ( File file : directory.listFiles() ) { if ( file.isDirectory() ) { //remember also directory last modification time addFile( file ); addClassDirectory( file ); } else if ( file.isFile() ) { addFile( file ); } } }
/** * Retrieve the lazily initialized instance of the registry. * * @return singleton instance of the registry */ public static EmbeddedRegistry getInstance() { if ( instance == null ) { instance = new EmbeddedRegistry(); Runtime.getRuntime().addShutdownHook( new Thread() { @Override public void run() { try { getInstance().shutdownAll( null ); } catch ( Exception e ) { // ignore, the exception should already have been reported } } } ); } return instance; }
new ClassLoaderEntriesCalculatorRequest().setDependencies( dependencies ).setLog( getLog() ).setMavenProject( project ).setAddWarDependenciesInClassloader( addWarDependenciesInClassloader ).setUseTestClassPath( useTestClasspath ); ClassLoaderEntriesCalculatorResult classLoaderEntriesCalculatorResult = classLoaderEntriesCalculator.calculateClassPathEntries( request ); List<String> classLoaderEntries = classLoaderEntriesCalculatorResult.getClassPathEntries(); final List<File> tmpDirectories = classLoaderEntriesCalculatorResult.getTmpDirectories(); throw new MojoExecutionException( e.getMessage(), e );
/** * Gets the webapp loader to run this web application under. * * @return the webapp loader to use * @throws IOException if the webapp loader could not be created * @throws MojoExecutionException in case of an error creating the webapp loader */ protected WebappLoader createWebappLoader() throws IOException, MojoExecutionException { if ( useSeparateTomcatClassLoader ) { return ( isContextReloadable() ) ? new ExternalRepositoriesReloadableWebappLoader( getTomcatClassLoader(), getLog() ) : new WebappLoader( getTomcatClassLoader() ); } return ( isContextReloadable() ) ? new ExternalRepositoriesReloadableWebappLoader( Thread.currentThread().getContextClassLoader(), getLog() ) : new WebappLoader( Thread.currentThread().getContextClassLoader() ); }
private void deleteDirectory( File directory, Log log ) throws TomcatRunException { try { FileUtils.deleteDirectory( directory ); } catch ( IOException e ) { log.error( "fail to delete directory file " + directory + ", reason:" + e.getMessage(), e ); throw new TomcatRunException( e.getMessage(), e ); } }
error( log, e, "no stop/destroy method in class " + embedded.getClass().getName() ); error( log, e, "Error while shutting down embedded Tomcat." ); error( log, e, "IllegalAccessException for stop/destroy method in class " + embedded.getClass().getName() ); error( log, e, "Error while shutting down embedded Tomcat." ); error( log, e, "IllegalAccessException for stop/destroy method in class " + embedded.getClass().getName() ); error( log, e, "Error while shutting down embedded Tomcat." );
new ClassLoaderEntriesCalculatorRequest().setDependencies( dependencies ).setLog( getLog() ).setMavenProject( project ).setAddWarDependenciesInClassloader( addWarDependenciesInClassloader ).setUseTestClassPath( useTestClasspath ); ClassLoaderEntriesCalculatorResult classLoaderEntriesCalculatorResult = classLoaderEntriesCalculator.calculateClassPathEntries( request ); List<String> classLoaderEntries = classLoaderEntriesCalculatorResult.getClassPathEntries(); final List<File> tmpDirectories = classLoaderEntriesCalculatorResult.getTmpDirectories(); throw new MojoExecutionException( e.getMessage(), e );
@Override public void run() { try { getInstance().shutdownAll( null ); } catch ( Exception e ) { // ignore, the exception should already have been reported } } } );
/** * Tracks modification times of files in the given class directory. * * @param directory the File directory to track modification times for. */ private void addClassDirectory( File directory ) { for ( File file : directory.listFiles() ) { if ( file.isDirectory() ) { //remember also directory last modification time addFile( file ); addClassDirectory( file ); } else if ( file.isFile() ) { addFile( file ); } } }
webappLoader = new ExternalRepositoriesReloadableWebappLoader( getTomcatClassLoader(), getLog() ); new ExternalRepositoriesReloadableWebappLoader( Thread.currentThread().getContextClassLoader(), getLog() );
private void deleteDirectory( File directory, Log log ) throws TomcatRunException { try { FileUtils.deleteDirectory( directory ); } catch ( IOException e ) { log.error( "fail to delete directory file " + directory + ", reason:" + e.getMessage(), e ); throw new TomcatRunException( e.getMessage(), e ); } }
/** * Retrieve the lazily initialized instance of the registry. * * @return singleton instance of the registry */ public static EmbeddedRegistry getInstance() { if ( instance == null ) { instance = new EmbeddedRegistry(); Runtime.getRuntime().addShutdownHook( new Thread() { @Override public void run() { try { getInstance().shutdownAll( null ); } catch ( Exception e ) { // ignore, the exception should already have been reported } } } ); } return instance; }
/** * Shuts down all embedded tomcats which got started up to now. * * @throws MojoExecutionException if shutting down one or all servers failed */ public void execute() throws MojoExecutionException { if ( skip ) { getLog().info( "skip execution" ); return; } try { EmbeddedRegistry.getInstance().shutdownAll( getLog() ); } catch ( Exception e ) { if ( !skipErrorOnShutdown ) { throw new MojoExecutionException( messagesProvider.getMessage( "ShutdownMojo.shutdownError" ), e ); } } } }
/** * {@inheritDoc} */ @Override public void addRepository( String repository ) { super.addRepository( repository ); try { File file = new File( new URL( repository ).getPath().replaceAll( "%20", " " ) ); if ( file.isDirectory() ) { addClassDirectory( file ); } else if ( file.isFile() && file.getName().endsWith( ".jar" ) ) { addFile( file ); } } catch ( MalformedURLException muex ) { throw new RuntimeException( muex ); } }
/** * Shuts down all embedded tomcats which got started up to now. * * @throws org.apache.maven.plugin.MojoExecutionException * if shutting down one or all servers failed */ public void execute() throws MojoExecutionException { if ( skip ) { getLog().info( "skip execution" ); return; } try { EmbeddedRegistry.getInstance().shutdownAll( getLog() ); } catch ( Exception e ) { if ( !skipErrorOnShutdown ) { throw new MojoExecutionException( messagesProvider.getMessage( "ShutdownMojo.shutdownError" ), e ); } } } }
/** * {@inheritDoc} */ @Override public void addRepository( String repository ) { super.addRepository( repository ); try { File file = new File( new URL( repository ).getPath().replaceAll( "%20", " " ) ); if ( file.isDirectory() ) { addClassDirectory( file ); } else if ( file.isFile() && file.getName().endsWith( ".jar" ) ) { addFile( file ); } } catch ( MalformedURLException muex ) { throw new RuntimeException( muex ); } }
/** * Shuts down all embedded tomcats which got started up to now. * * @throws org.apache.maven.plugin.MojoExecutionException * if shutting down one or all servers failed */ public void execute() throws MojoExecutionException { if ( skip ) { getLog().info( "skip execution" ); return; } try { EmbeddedRegistry.getInstance().shutdownAll( getLog() ); } catch ( Exception e ) { if ( !skipErrorOnShutdown ) { throw new MojoExecutionException( messagesProvider.getMessage( "ShutdownMojo.shutdownError" ), e ); } } } }