wrapper 

Commit MetaInfo

Revision176 (tree)
Time2012-02-22 03:17:01
Authormortenson

Log Message

Remove some code to try to reconnect the backend socket from Java.

Change Summary

Diff

--- trunk/wrapper/doc/revisions.txt (revision 175)
+++ trunk/wrapper/doc/revisions.txt (revision 176)
@@ -11,6 +11,9 @@
1111 the correct prefix identifying where they originated.
1212 * Remove some old reflection code needed for Java 1.2.x support as we have
1313 required Java 1.4 since version 3.4.0.
14+* Remove some code to try to reconnect the backend socket from Java. It has
15+ never been possible to do so without restarting the JVM, and the related
16+ messages were confusing.
1417
1518 3.5.14
1619 * Fix a problem in the AppCommand.bat.in file where a parenthesis in the
--- trunk/wrapper/src/java/org/tanukisoftware/wrapper/WrapperManager.java (revision 175)
+++ trunk/wrapper/src/java/org/tanukisoftware/wrapper/WrapperManager.java (revision 176)
@@ -4981,6 +4981,7 @@
49814981 {
49824982 if ( m_debug )
49834983 {
4984+ // We want to show these messages even if we are pretending to be hung.
49844985 if ( ( code == WRAPPER_MSG_PING ) && ( message.equals( "silent" ) ) )
49854986 {
49864987 // m_outDebug.println( "Send silent ping packet." );
@@ -5003,19 +5004,13 @@
50035004 getPacketCodeName( code ) , message ) );
50045005 }
50055006 }
5007+
50065008 if ( m_appearHung )
50075009 {
50085010 // The WrapperManager is attempting to make the JVM appear hung, so do nothing
50095011 }
50105012 else
50115013 {
5012- // Make a copy of the reference to make this more thread safe.
5013- if ( ( !m_backendConnected ) && isControlledByNativeWrapper() && ( !m_stopping ) )
5014- {
5015- // The socket is not currently open, try opening it.
5016- openBackend();
5017- }
5018-
50195014 if ( ( code == WRAPPER_MSG_START_PENDING ) || ( code == WRAPPER_MSG_STARTED ) )
50205015 {
50215016 // Set the last ping time so that the startup process does not time out
@@ -5404,93 +5399,89 @@
54045399 // Initialize the last ping tick count.
54055400 m_lastPingTicks = getTicks();
54065401
5407- boolean gotPortOnce = false;
5408- while ( !m_disposed )
5402+ try
54095403 {
5410- try
5404+ openBackend();
5405+
5406+ // After the socket has been opened the first time, mark the thread as
5407+ // started. This must be done here to make sure that exits work correctly
5408+ // when called on startup.
5409+ if ( !m_commRunnerStarted )
54115410 {
5412- openBackend();
5413-
5414- // After the socket has been opened the first time, mark the thread as
5415- // started. This must be done here to make sure that exits work correctly
5416- // when called on startup.
5417- if ( !m_commRunnerStarted )
5411+ synchronized( WrapperManager.class )
54185412 {
5419- synchronized( WrapperManager.class )
5420- {
5421- m_commRunnerStarted = true;
5422- WrapperManager.class.notifyAll();
5423- }
5413+ m_commRunnerStarted = true;
5414+ WrapperManager.class.notifyAll();
54245415 }
5425-
5426- if ( m_backendSocket != null || m_backendConnected == true)
5427- {
5428- handleBackend();
5429- }
5430- else
5431- {
5432- // Failed, so wait for just a moment
5433- try
5434- {
5435- Thread.sleep( 100 );
5436- }
5437- catch ( InterruptedException e )
5438- {
5439- }
5440- }
54415416 }
5442- catch ( ThreadDeath td )
5417+
5418+ if ( m_backendSocket != null || m_backendConnected == true)
54435419 {
5444- m_outError.println( getRes().getString( "Server daemon killed" ) );
5420+ handleBackend();
54455421 }
5446- catch ( Throwable t )
5422+ else
54475423 {
5448- if ( !isShuttingDown() )
5424+ // Failed, so wait for just a moment
5425+ try
54495426 {
5450- // Show a stack trace here because this is fairly critical
5451- m_outError.println( getRes().getString( "Server daemon died!" ) );
5452- t.printStackTrace( m_outError );
5427+ Thread.sleep( 100 );
54535428 }
5454- else
5429+ catch ( InterruptedException e )
54555430 {
5456- if ( m_debug )
5457- {
5458- m_outDebug.println( getRes().getString( "Server daemon died!" ) );
5459- t.printStackTrace( m_outDebug );
5460- }
54615431 }
54625432 }
5463- finally
5433+ }
5434+ catch ( ThreadDeath td )
5435+ {
5436+ m_outError.println( getRes().getString( "Server daemon killed" ) );
5437+ }
5438+ catch ( Throwable t )
5439+ {
5440+ if ( !isShuttingDown() )
54645441 {
5442+ // Show a stack trace here because this is fairly critical
5443+ m_outError.println( getRes().getString( "Server daemon died!" ) );
5444+ t.printStackTrace( m_outError );
5445+ }
5446+ else
5447+ {
54655448 if ( m_debug )
54665449 {
5467- m_outDebug.println( getRes().getString( "Returned from backend handler." ) );
5450+ m_outDebug.println( getRes().getString( "Server daemon died!" ) );
5451+ t.printStackTrace( m_outDebug );
54685452 }
5469- // Always close the backend here.
5470- closeBackend();
5471- if ( !isShuttingDown() )
5453+ }
5454+ }
5455+ finally
5456+ {
5457+ if ( m_debug )
5458+ {
5459+ m_outDebug.println( getRes().getString( "Returned from backend handler." ) );
5460+ }
5461+ // Always close the backend here.
5462+ closeBackend();
5463+ if ( !isShuttingDown() )
5464+ {
5465+ if ( m_detachStarted && m_started )
54725466 {
5473- if ( m_detachStarted && m_started )
5467+ // This and all further output will not be visible anywhere as the Wrapper is now gone.
5468+ m_outInfo.println( getRes().getString( "The backend was closed as expected." ) );
5469+
5470+ try
54745471 {
5475- // This and all further output will not be visible anywhere as the Wrapper is now gone.
5476- m_outInfo.println( getRes().getString( "The backend was closed as expected." ) );
5477-
5478- try
5479- {
5480- nativeRedirectPipes();
5481- }
5482- catch ( UnsatisfiedLinkError t )
5483- {
5484- m_outError.println( getRes().getString( "Failed to redirect stdout and stderr before the Wrapper exits.\nOutput from the JVM may block.\nPlease make sure the native library has been properly initialized."));
5485- }
5472+ nativeRedirectPipes();
54865473 }
5487- else
5474+ catch ( UnsatisfiedLinkError t )
54885475 {
5489- m_outError.println( getRes().getString( "The backend was closed unexpectedly. Restart to resync with the Wrapper." ) );
5490- restart();
5491- // Will not get here.
5476+ m_outError.println( getRes().getString( "Failed to redirect stdout and stderr before the Wrapper exits.\nOutput from the JVM may block.\nPlease make sure the native library has been properly initialized."));
54925477 }
54935478 }
5479+ else
5480+ {
5481+ m_outError.println( getRes().getString( "The backend was closed unexpectedly. Restart to resync with the Wrapper." ) );
5482+ restart();
5483+ // Will not get here.
5484+ }
54945485 }
54955486 }
54965487
旧リポジトリブラウザで表示