public ReturnCode dump ( ) { System . out . println ( MessageFormat . format ( BootstrapConstants . messages . getString ( "info.serverDumping" ) , serverName ) ) ; Set < JavaDumpAction > javaDumpActions = new LinkedHashSet < JavaDumpAction > ( ) ; parseJavaDumpInclude ( javaDumpActions ) ; ServerDumpPackager sdp = new ServerDumpPackager ( bootProps , launchArgs . getOption ( BootstrapConstants . CLI_ARG_ARCHIVE_TARGET ) ) ; sdp . initializeDumpDirectory ( ) ; ReturnCode dumpRc = createDumps ( javaDumpActions , true , sdp . getDumpTimestamp ( ) ) ; boolean serverInactiveStatusFlag = dumpRc == ReturnCode . SERVER_INACTIVE_STATUS ; boolean serverUnknownStatusFlag = dumpRc == ReturnCode . SERVER_UNKNOWN_STATUS ; boolean serverCommandPortDisabledFlag = dumpRc == ReturnCode . SERVER_COMMAND_PORT_DISABLED_STATUS ; if ( dumpRc == ReturnCode . OK ) { File dumpedFlag = new File ( sdp . getDumpDir ( ) , BootstrapConstants . SERVER_DUMPED_FLAG_FILE_NAME ) ; if ( ! dumpedFlag . exists ( ) ) { dumpRc = ReturnCode . ERROR_SERVER_DUMP ; } } // already dumped, then zip up. Dump zip must be created in the output directory if ( dumpRc == ReturnCode . OK || dumpRc == ReturnCode . SERVER_INACTIVE_STATUS || dumpRc == ReturnCode . SERVER_UNKNOWN_STATUS || dumpRc == ReturnCode . SERVER_COMMAND_PORT_DISABLED_STATUS ) { if ( javaDumpActions != null && ( ! ! ! javaDumpActions . isEmpty ( ) ) ) { dumpRc = sdp . packageDump ( true ) ; } else { dumpRc = sdp . packageDump ( false ) ; } } sdp . cleanupDumpDirectory ( ) ; if ( dumpRc == ReturnCode . OK ) { if ( serverInactiveStatusFlag ) { // We are dumping a stopped server. Since it is not a problem, just print a message. System . out . println ( MessageFormat . format ( BootstrapConstants . messages . getString ( "info.serverNotRunning" ) , serverName ) ) ; } if ( serverUnknownStatusFlag ) { // We tried to attach to the server process, but that failed. // Since it might indicate an error, print a message and change the return code though the dump archive has been generated successfully. System . out . println ( MessageFormat . format ( BootstrapConstants . messages . getString ( "info.serverStatusException" ) , serverName ) ) ; dumpRc = ReturnCode . SERVER_UNKNOWN_STATUS ; } if ( serverCommandPortDisabledFlag ) { System . out . println ( MessageFormat . format ( BootstrapConstants . messages . getString ( "warning.serverDumpCompleteCommandPortDisabled" ) , serverName , sdp . getDumpFile ( ) . getAbsolutePath ( ) ) ) ; } else { System . out . println ( MessageFormat . format ( BootstrapConstants . messages . getString ( "info.serverDumpComplete" ) , serverName , sdp . getDumpFile ( ) . getAbsolutePath ( ) ) ) ; } } else { System . out . println ( MessageFormat . format ( BootstrapConstants . messages . getString ( "info.serverDumpException" ) , serverName ) ) ; } return dumpRc ; }
Dump the server