Commit MetaInfo
Log Message
Remove all remaining Java 1.2.x support code.
Change Summary
Diff
| | @@ -9,6 +9,8 @@ | | 9 | 9 | for users who tried to pass other parameters to the JVM. | | 10 | 10 | * Correct a couple log messages in the WrapperManager class which were missing | | 11 | 11 | the correct prefix identifying where they originated. | | 12 | +* Remove some old reflection code needed for Java 1.2.x support as we have | | 13 | + required Java 1.4 since version 3.4.0. | | 12 | 14 | | | 13 | 15 | 3.5.14 | | 14 | 16 | * Fix a problem in the AppCommand.bat.in file where a parenthesis in the |
| | @@ -3111,7 +3111,7 @@ | | 3111 | 3111 | if ( m_debug ) | | 3112 | 3112 | { | | 3113 | 3113 | m_outDebug.println( getRes().getString( | | 3114 | | - "WrapperManager.stop({0}) called by thread: {1}" , | | 3114 | + "WrapperManager.stop({0}) called by thread: {1}", | | 3115 | 3115 | new Integer( exitCode ), Thread.currentThread().getName() ) ); | | 3116 | 3116 | } | | 3117 | 3117 | |
| | @@ -3237,58 +3237,7 @@ | | 3237 | 3237 | | | 3238 | 3238 | signalStopped( exitCode ); | | 3239 | 3239 | | | 3240 | | - // Execute runtime.halt(0) using reflection so this class will | | 3241 | | - // compile on 1.2.x versions of Java. | | 3242 | | - Method haltMethod; | | 3243 | | - try | | 3244 | | - { | | 3245 | | - haltMethod = | | 3246 | | - Runtime.class.getMethod( "halt", new Class[] { Integer.TYPE } ); | | 3247 | | - } | | 3248 | | - catch ( NoSuchMethodException e ) | | 3249 | | - { | | 3250 | | - m_outError.println( getRes().getString( "halt not supported by current JVM." ) ); | | 3251 | | - haltMethod = null; | | 3252 | | - } | | 3253 | | - | | 3254 | | - if ( haltMethod != null ) | | 3255 | | - { | | 3256 | | - Runtime runtime = Runtime.getRuntime(); | | 3257 | | - try | | 3258 | | - { | | 3259 | | - haltMethod.invoke( runtime, new Object[] { new Integer( exitCode ) } ); | | 3260 | | - } | | 3261 | | - catch ( IllegalAccessException e ) | | 3262 | | - { | | 3263 | | - m_outError.println( getRes().getString( "Unable to call runtime.halt: {0}" , e ) ); | | 3264 | | - } | | 3265 | | - catch ( InvocationTargetException e ) | | 3266 | | - { | | 3267 | | - Throwable t = e.getTargetException(); | | 3268 | | - if ( t == null ) | | 3269 | | - { | | 3270 | | - t = e; | | 3271 | | - } | | 3272 | | - | | 3273 | | - m_outError.println(getRes().getString( "Unable to call runtime.halt: {0}" , t ) ); | | 3274 | | - } | | 3275 | | - } | | 3276 | | - else | | 3277 | | - { | | 3278 | | - // Shutdown normally | | 3279 | | - | | 3280 | | - // This is safe because we are already checking for the privilege to stop the JVM | | 3281 | | - // above. If we get this far then we want the Wrapper to be able to do everything | | 3282 | | - // necessary to stop the JVM. | | 3283 | | - AccessController.doPrivileged( | | 3284 | | - new PrivilegedAction() { | | 3285 | | - public Object run() { | | 3286 | | - privilegedStopInner( exitCode ); | | 3287 | | - return null; | | 3288 | | - } | | 3289 | | - } | | 3290 | | - ); | | 3291 | | - } | | 3240 | + Runtime.getRuntime().halt( exitCode ); | | 3292 | 3241 | } | | 3293 | 3242 | | | 3294 | 3243 | /** |
| | @@ -3881,16 +3830,23 @@ | | 3881 | 3830 | // Always send the stop command | | 3882 | 3831 | sendCommand( WRAPPER_MSG_STOP, Integer.toString( exitCode ) ); | | 3883 | 3832 | | | 3884 | | - // Give the Wrapper a chance to register the stop command before stopping. | | 3885 | | - // This avoids any errors thrown by the Wrapper because the JVM died before | | 3886 | | - // it was expected to. | | 3887 | | - try | | 3833 | + if ( delay > 0 ) | | 3888 | 3834 | { | | 3889 | | - Thread.sleep( delay ); | | 3835 | + // Give the Wrapper a chance to register the stop command before stopping. | | 3836 | + // This avoids any errors thrown by the Wrapper because the JVM died before | | 3837 | + // it was expected to. | | 3838 | + if ( m_debug ) | | 3839 | + { | | 3840 | + m_outDebug.println( getRes().getString( "Pausing for {0}ms to allow a clean shutdown...", new Integer( delay ) ) ); | | 3841 | + } | | 3842 | + try | | 3843 | + { | | 3844 | + Thread.sleep( delay ); | | 3845 | + } | | 3846 | + catch ( InterruptedException e ) | | 3847 | + { | | 3848 | + } | | 3890 | 3849 | } | | 3891 | | - catch ( InterruptedException e ) | | 3892 | | - { | | 3893 | | - } | | 3894 | 3850 | } | | 3895 | 3851 | } | | 3896 | 3852 | |
| | @@ -32,8 +32,6 @@ | | 32 | 32 | import java.io.BufferedReader; | | 33 | 33 | import java.io.InputStreamReader; | | 34 | 34 | import java.io.IOException; | | 35 | | -import java.lang.reflect.InvocationTargetException; | | 36 | | -import java.lang.reflect.Method; | | 37 | 35 | import java.util.Enumeration; | | 38 | 36 | import java.util.Properties; | | 39 | 37 | |
| | @@ -212,67 +210,11 @@ | | 212 | 210 | } | | 213 | 211 | else if ( action.equals( "halt0" ) ) | | 214 | 212 | { | | 215 | | - // Execute runtime.halt(0) using reflection so this class will | | 216 | | - // compile on 1.2.x versions of Java. | | 217 | | - Method haltMethod; | | 218 | | - try | | 219 | | - { | | 220 | | - haltMethod = Runtime.class.getMethod( "halt", new Class[] { Integer.TYPE } ); | | 221 | | - } | | 222 | | - catch ( NoSuchMethodException e ) | | 223 | | - { | | 224 | | - System.out.println( Main.getRes().getString( "halt not supported by current JVM." ) ); | | 225 | | - haltMethod = null; | | 226 | | - } | | 227 | | - | | 228 | | - if ( haltMethod != null ) | | 229 | | - { | | 230 | | - Runtime runtime = Runtime.getRuntime(); | | 231 | | - try | | 232 | | - { | | 233 | | - haltMethod.invoke( runtime, new Object[] { new Integer( 0 ) } ); | | 234 | | - } | | 235 | | - catch ( IllegalAccessException e ) | | 236 | | - { | | 237 | | - System.out.println( Main.getRes().getString( "Unable to call runtime.halt: {0}", e.getMessage() ) ); | | 238 | | - } | | 239 | | - catch ( InvocationTargetException e ) | | 240 | | - { | | 241 | | - System.out.println( Main.getRes().getString( "Unable to call runtime.halt: {0}", e.getMessage() ) ); | | 242 | | - } | | 243 | | - } | | 213 | + Runtime.getRuntime().halt( 0 ); | | 244 | 214 | } | | 245 | 215 | else if ( action.equals( "halt1" ) ) | | 246 | 216 | { | | 247 | | - // Execute runtime.halt(1) using reflection so this class will | | 248 | | - // compile on 1.2.x versions of Java. | | 249 | | - Method haltMethod; | | 250 | | - try | | 251 | | - { | | 252 | | - haltMethod = Runtime.class.getMethod( "halt", new Class[] { Integer.TYPE } ); | | 253 | | - } | | 254 | | - catch ( NoSuchMethodException e ) | | 255 | | - { | | 256 | | - System.out.println( Main.getRes().getString( "halt not supported by current JVM." ) ); | | 257 | | - haltMethod = null; | | 258 | | - } | | 259 | | - | | 260 | | - if ( haltMethod != null ) | | 261 | | - { | | 262 | | - Runtime runtime = Runtime.getRuntime(); | | 263 | | - try | | 264 | | - { | | 265 | | - haltMethod.invoke( runtime, new Object[] { new Integer( 1 ) } ); | | 266 | | - } | | 267 | | - catch ( IllegalAccessException e ) | | 268 | | - { | | 269 | | - System.out.println( Main.getRes().getString( "Unable to call runtime.halt: {0}", e.getMessage() ) ); | | 270 | | - } | | 271 | | - catch ( InvocationTargetException e ) | | 272 | | - { | | 273 | | - System.out.println( Main.getRes().getString( "Unable to call runtime.halt: {0}", e.getMessage() ) ); | | 274 | | - } | | 275 | | - } | | 217 | + Runtime.getRuntime().halt( 1 ); | | 276 | 218 | } | | 277 | 219 | else if ( action.equals( "restart" ) ) | | 278 | 220 | { |
| | @@ -29,9 +29,6 @@ | | 29 | 29 | * included in all copies or substantial portions of the Software. | | 30 | 30 | */ | | 31 | 31 | | | 32 | | -import java.lang.reflect.InvocationTargetException; | | 33 | | -import java.lang.reflect.Method; | | 34 | | - | | 35 | 32 | /** | | 36 | 33 | * | | 37 | 34 | * |
| | @@ -42,50 +39,32 @@ | | 42 | 39 | * Main Method | | 43 | 40 | *-------------------------------------------------------------*/ | | 44 | 41 | public static void main(String[] args) { | | 45 | | - // Locate the add and remove shutdown hook methods using reflection so | | 46 | | - // that this class can be compiled on 1.2.x versions of java. | | 47 | | - Method addShutdownHookMethod; | | 48 | | - try { | | 49 | | - addShutdownHookMethod = | | 50 | | - Runtime.class.getMethod("addShutdownHook", new Class[] {Thread.class}); | | 51 | | - } catch (NoSuchMethodException e) { | | 52 | | - System.out.println( Main.getRes().getString( "Shutdown hooks not supported by current JVM.") ); | | 53 | | - return; | | 54 | | - } | | 55 | | - | | 56 | 42 | System.out.println( Main.getRes().getString( "This application registers a shutdown hook which") ); | | 57 | 43 | System.out.println( Main.getRes().getString( "should be executed after the JVM has told the Wrapper") ); | | 58 | 44 | System.out.println( Main.getRes().getString( "it is exiting." ) ); | | 59 | 45 | System.out.println( Main.getRes().getString( "This is to test the wrapper.jvm_exit.timeout property" ) ); | | 60 | 46 | | | 61 | | - Runtime runtime = Runtime.getRuntime(); | | 62 | | - Thread hook = new Thread() { | | 63 | | - public void run() { | | 64 | | - System.out.println( Main.getRes().getString( "Starting shutdown hook. Loop for 25 seconds.") ); | | 65 | | - System.out.println( Main.getRes().getString( "Should timeout unless this property is set: wrapper.jvm_exit.timeout=30" ) ); | | 47 | + Runtime.getRuntime().addShutdownHook( new Thread() | | 48 | + { | | 49 | + public void run() { | | 50 | + System.out.println( Main.getRes().getString( "Starting shutdown hook. Loop for 25 seconds.") ); | | 51 | + System.out.println( Main.getRes().getString( "Should timeout unless this property is set: wrapper.jvm_exit.timeout=30" ) ); | | 66 | 52 | | | 67 | | - long start = System.currentTimeMillis(); | | 68 | | - while(System.currentTimeMillis() - start < 25000) | | 53 | + long start = System.currentTimeMillis(); | | 54 | + while(System.currentTimeMillis() - start < 25000) | | 55 | + { | | 56 | + try | | 69 | 57 | { | | 70 | | - try | | 71 | | - { | | 72 | | - Thread.sleep( 250 ); | | 73 | | - } | | 74 | | - catch ( InterruptedException e ) | | 75 | | - { | | 76 | | - // Ignore | | 77 | | - } | | 58 | + Thread.sleep( 250 ); | | 78 | 59 | } | | 79 | | - System.out.println( Main.getRes().getString( "Shutdown hook complete. Should exit now." ) ); | | 60 | + catch ( InterruptedException e ) | | 61 | + { | | 62 | + // Ignore | | 63 | + } | | 80 | 64 | } | | 81 | | - }; | | 82 | | - try { | | 83 | | - addShutdownHookMethod.invoke(runtime, new Object[] {hook}); | | 84 | | - } catch (IllegalAccessException e) { | | 85 | | - System.out.println( Main.getRes().getString( "Unable to register shutdown hook: {0}", e.getMessage() ) ); | | 86 | | - } catch (InvocationTargetException e) { | | 87 | | - System.out.println( Main.getRes().getString( "Unable to register shutdown hook: {0}", e.getMessage() ) ); | | 88 | | - } | | 65 | + System.out.println( Main.getRes().getString( "Shutdown hook complete. Should exit now." ) ); | | 66 | + } | | 67 | + } ); | | 89 | 68 | | | 90 | 69 | System.out.println( Main.getRes().getString( "Application complete. Wrapper should stop, invoking the shutdown hooks." ) ); | | 91 | 70 | System.out.println(); |
| | @@ -13,8 +13,6 @@ | | 13 | 13 | | | 14 | 14 | import java.io.IOException; | | 15 | 15 | import java.io.InterruptedIOException; | | 16 | | -import java.lang.reflect.InvocationTargetException; | | 17 | | -import java.lang.reflect.Method; | | 18 | 16 | import java.net.InetAddress; | | 19 | 17 | import java.net.Socket; | | 20 | 18 | import java.net.SocketException; |
| | @@ -447,38 +445,7 @@ | | 447 | 445 | { | | 448 | 446 | public void run() | | 449 | 447 | { | | 450 | | - // Execute runtime.halt(0) using reflection so this class will | | 451 | | - // compile on 1.2.x versions of Java. | | 452 | | - Method haltMethod; | | 453 | | - try | | 454 | | - { | | 455 | | - haltMethod = | | 456 | | - Runtime.class.getMethod( "halt", new Class[] { Integer.TYPE } ); | | 457 | | - } | | 458 | | - catch ( NoSuchMethodException e ) | | 459 | | - { | | 460 | | - m_out.println( WrapperManager.getRes().getString( "halt not supported by current JVM." ) ); | | 461 | | - haltMethod = null; | | 462 | | - } | | 463 | | - | | 464 | | - if ( haltMethod != null ) | | 465 | | - { | | 466 | | - Runtime runtime = Runtime.getRuntime(); | | 467 | | - try | | 468 | | - { | | 469 | | - haltMethod.invoke( runtime, new Object[] { new Integer( 0 ) } ); | | 470 | | - } | | 471 | | - catch ( IllegalAccessException e ) | | 472 | | - { | | 473 | | - m_out.println( WrapperManager.getRes().getString( | | 474 | | - "Unable to call runitme.halt: {0}", e.getMessage() ) ); | | 475 | | - } | | 476 | | - catch ( InvocationTargetException e ) | | 477 | | - { | | 478 | | - m_out.println( WrapperManager.getRes().getString( | | 479 | | - "Unable to call runitme.halt: {0}", e.getMessage() ) ); | | 480 | | - } | | 481 | | - } | | 448 | + Runtime.getRuntime().halt( 0 ); | | 482 | 449 | } | | 483 | 450 | } ); | | 484 | 451 | } |
| | @@ -11,7 +11,8 @@ | | 11 | 11 | * http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html | | 12 | 12 | */ | | 13 | 13 | | | 14 | | -import java.util.Vector; | | 14 | +import java.util.ArrayList; | | 15 | +import java.util.List; | | 15 | 16 | | | 16 | 17 | /** | | 17 | 18 | * A WrapperUser contains information about a user account on the platform |
| | @@ -25,9 +26,8 @@ | | 25 | 26 | /* The name of the user. */ | | 26 | 27 | private String m_user; | | 27 | 28 | | | 28 | | - /** A list of the groups that this user is registered with. | | 29 | | - * This uses a Vector to be compatable with 1.2.x JVMs. */ | | 30 | | - private Vector m_groups = new Vector(); | | 29 | + /** A list of the groups that this user is registered with. */ | | 30 | + private List m_groups = new ArrayList(); | | 31 | 31 | | | 32 | 32 | /*--------------------------------------------------------------- | | 33 | 33 | * Constructors |
| | @@ -58,7 +58,7 @@ | | 58 | 58 | */ | | 59 | 59 | void addGroup( WrapperGroup group ) | | 60 | 60 | { | | 61 | | - m_groups.addElement( group ); | | 61 | + m_groups.add( group ); | | 62 | 62 | } | | 63 | 63 | | | 64 | 64 | /** |
旧リポジトリブラウザで表示
|