Stopping and Starting a server - bootstrap pattern?

Hi,
I have a very simple server. It simply extends Thread, and provides a startup method to perform any initialization and to start itself. A shutdown methods performs any cleanup.
What I am trying to figure out is the best way to start/stop this server.
I have created a class that implements main and starts the server. What I am wondering is how to stop it again.
I noticed that with tomcat it has a bootstrap class, which implements main. It seem's overly complex for what I need, so I'm wondering is there a common pattern for creating a 'bootstrap' style class that when passed the argument 'start'; will start my server (but the bootstrap main will exit iself). Running the class again with 'stop' should then stop the server.
I know on unix I can write the PID to a file, then write a script to read that value and send a signal, but I'm not sure the seem implementation would work on windows, as it doesn't seem to provide signal handling.

One thing worth mentioning if the launcher (+java Bootstrap start+) actually forks another JVM: on Unices at least, you have to consume the output streams (stdout/stderr) of the forked process, otherwise this latter may block.
See this famous article [When Runtime.exec() won't|http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html] .
That's one good reason for the launcher to simply run the app (what does it bring to spawn another JVM?).

Similar Messages

  • SSRS Report queries begin running slowly, have to stop and start report server to restore performance

    We have had a production issue crop up twice now where reports begin running slowly seemingly at random.  
    When this happens we can see from running SQL Profiler that the report queries are taking an extremely long time to execute.  The same queries when run directly in management studio run quickly.  
    Initially I suspected parameter sniffing, and tried using OPTION (RECOMPILE) in the reports, as well as clearing out the particular query from the plan cache and running the SQL in SSMS to try and get a better plan etc but no amount of jiggery pokery by
    me could get the queries to run any faster.
    The really weird thing - is that stopping and starting the report server via the reporting services configuration manager instantly cures the problem.  
    I'd really love to know - why this might be?  Is it something to do with the report server closing and re-opening its connections to the database? That's the only sort of thing I can think of...any ideas? Anyone? Any suggestions would be much appreciated.
    LucasF

    Hi LucasF,
    In your scenario, usually we can monitor the execution log in Report Database. If you run below query, you can get the results how long the report takes to render (TimeRendering), how long to process the report(TimeProcessing) and how long to retrieve data
    from Database(TimeData). You can check the starttime and endtime to know the total time for executing a report.
    SELECT TOP1000 *FROM[ReportServer].[dbo].[ExecutionLog2]
    More details information, please reference to similar thread below:
    Steps for troubleshooting a slow SSRS 2014 server
    Troubleshooting Reports: Report Performance
    In SQL Server Reporting Services, a job will be created by SQL Server Agent if any of the following processes is underway:
    query execution on a remote or local database server
    report processing
    report rendering
    To cancel a job that is running on the report server, we can cancel the job directly or reduce the report execution time-out value in the SQL Server Management Studio and then will stop query execution. Please refer to the steps below:
    Open SQL Server Management Studio, and connect to "Reporting Services".
    Under the Report Server node, right-click on the "Jobs" folder and select "Refresh". Then, right-click on "Jobs" again and click "Cancel All Jobs".
    Right-click on the Report Server node and open the "Server Properties" dialog.
    Click the "Execution" option, and set the "Limit report execution to the following number of seconds:" to a much smaller number. After this issue is resolved, this configuration should revert to the previous state.  
    Reference:
    Managing a Running Process
    Setting Time-out Values for Report and Shared Dataset Processing
    In addition, we can also use the KILL Transact-SQL statement to terminate a normal connection by terminating the transactions that are associated with the specified session ID. For the details information, you can refer to:
    KILL (Transact-SQL)
    If you still have any problem, please feel free to ask.
    Regards,
    Vicky Liu
    Vicky Liu
    TechNet Community Support

  • defunct process when stop and start web server

    Dear all,
    I am using Sun One Web Server 6.1 SP6. When i try to stop and then start the web server. The <defunct> process is generated (his parent PID points to webservd).
    The following is the result:
    1st stop and start the web server (defunct process is generated)
    2nd stop and start the web server (defunct process disappears)
    3rd stop and start the web server(defunct process is generated)
    4th stop and start the web server (defunct process disappears)
    Here is my magnus.conf
    ServerID www
    ServerName www.abc.edu.hk
    ErrorLog /i03_01/SUNWwbsvr616/https-www/logs/errors
    PidLog /i03_01/SUNWwbsvr616/https-www/logs/pid
    User nobody
    DNS off
    Security off
    ClientLanguage en
    AdminLanguage en
    DefaultLanguage en
    RqThrottle 512
    StackSize 131072
    Init fn="load-modules" funcs="caspreq,caspinit,casptrans" shlib="/i03_01/casp/module/sunos5_optimized/netscape_6.x/nes_casp2.so"
    Init fn="caspinit" casplib="/i03_01/casp/asp-server-3078"
    Init fn="load-modules" funcs="htaccess-init,htaccess-find" shlib="/i03_01/SUNWwbsvr616/plugins/htaccess/htaccess.so"
    Init fn="htaccess-init"
    Init access="/i03_01/SUNWwbsvr616/https-www/logs/access" format.access="%Ses->client.ip% - %Req->vars.auth-user% [%SYSDATE%] \"%Req->reqpb.clf-request%\" %Req->srvhdrs.clf-status% %Req->srvhdrs.content-length% \"%Req->headers.referer%\" \"%Req->headers.user-agent%\"" fn="flex-init"
    Init fn="load-modules" shlib="/i03_01/SUNWwbsvr616/bin/https/lib/libj2eeplugin.so" shlib_flags="(global|now)"
    TempDir /tmp/https-www-61c30017
    # Load modules for PHP
    Init fn="load-modules" funcs="php4_init,php4_execute,php4_auth_trans" shlib="/i03_01/SUNWwbsvr616/bin/libphp4.so"
    Init fn="php4_init" LateInit="yes" errorString="Failed to initialize PHP!" [php_ini="/i03_01/SUNWwbsvr616/https-www/config/php.ini"]
    # Enable statistics
    Init fn="stats-init" update-interval="5" virtual-servers="100" profiling="yes"
    any ideas? Thank

    - which OS & version are you running into this issue ?
    - By definition, defunct processes (or zombie processes) are processes that have exited prior to it's parent calling a wait() on it to get the return status .
    - couple of things I can think of to narrow down the cause of this issue
    1. disable ASP & php plugins and see if this still causes this issue
    2. try starting the web server with log level to finest and see fi you get any useful information from the server error logs
    hope this helps

  • How to stop and start Managed Server using weblogicServer

    Hi
    We are new.
    We have 2 managed servers and an Admin Server.
    We're trying to use the command line to stop/start our Managed Server.
    Could someone share examples on how one could write the command line that's similar to the WLS console Server Start tab ?
    We have a couple of classpaths and a bunch a arguments;
    When we tried to start one of the managed server it defaults to use some other settings as opposed to the ones in Server Start tab.
    What did we do wrong ?
    Thanks

    Hi,
    Follow the below links,each n every links have various methods and example for starting and stopping of Weblogic services
    We have 2 managed servers and an Admin Server.
    We're trying to use the command line to stop/start our Managed Server.http://docs.oracle.com/cd/E15523_01/core.1111/e10105/start.htm#CIHBIGCD
    We have a couple of classpaths and a bunch a arguments;http://docs.oracle.com/cd/E13222_01/wls/docs90/admin_ref/weblogicServer.html#frequently_used_optional_arguments
    http://docs.oracle.com/cd/E13222_01/wls/docs90/admin_ref/weblogicServer.html#1008628
    Regards
    Fabian

  • Stopping and starting the server for deploying

    Hai,
    When I run a project from the java Enterprise studio, the domain is stopped and then restarted. This takes quite some time. Is it really required for redeploying a project?
    Is there any way to avoid it?
    I have included below exerpts of the output when I run a project.
    Thanx in advance ..
    run-deploy:
    Stopping server Sun Java System Application Server 8.1
    C:\Program Files (x86)\Sun\IDE\AppServ8.1UR2\bin\asadmin.bat stop-domain --domaindir C:\Program Files (x86)\Sun\IDE\AppServ8.1UR2\domains\ domain1
    Starting server Sun Java System Application Server 8.1
    C:\Program Files (x86)\Sun\IDE\AppServ8.1UR2\bin\asadmin.bat start-domain --domaindir C:\Program Files (x86)\Sun\IDE\AppServ8.1UR2\domains\ domain1
    Redeploying E:\staff\saniya\DbServlet\dist\DbServlet.war
    Saniya

    I guess this is the answer - http://www.netbeans.org/issues/show_bug.cgi?id=54840
    In short, sometimes this is required, so the development team considers this to be a feature. This does not happen always/for everyone as well..

  • How to stop and start IGS(internet graphic server)

    Hi Techies
    How to stop and start IGS(internet graphic server) in Solaries
    IGS is 7.0 1patch
    Is this the command to stop and start IGS
    stopigs and startigs
    If this correct will there be any issues if i stop the IGS from the above command
    Thank You
    Haroon

    Hoi Haroon
    On base 6.40 there were stopigs/startigs scripts, yes. When we upgraded our systems to 7.0 I encountered the same problem, the igs could be stopped, but not started anymore (externally). Can you check, if the startigs/stopigs-scripts are 7.0 or 6.40.
    I then opened an oss and got as answer:
    "To start and to stop the igs there's only the offical way by stopping and starting the sap system".
    However I found a solution to start and stop:
    start:
    nohup /sapmnt/<SID>/exe/igswd_mt -mode=profile pf=/usr/sap/<SID>/SYS/profile/<Instaneprofile> &
    e.g.:
    nohup /sapmnt/P72/exe/igswd_mt -mode=profile pf=/usr/sap/P72/SYS/profile/P72_DVEBMGS01_migzmc10 &
    stop:
    --> stopigs, therefore the 6.40-stopigs script has to remain in the exe directory.
    Hope this helps.
    Regards Patrick

  • How may I automatically stop and start Mail services at a set time please

    Hi folks. I was wondering if anyone could tell me how to automatically stop and start Mail services (or any other services) at a set time please in Leopard Server? Is there a script someone has created which might help?
    Cheers, David ( a realy newbie when it comes to administering OS X server)

    launchd works through a series of XML documents that define tasks to run, either at launch, on a time schedule, in response to network events, etc.
    So you'll need to create two .plists - one to start the mail server and one to stop it. They should be saved in /Library/LaunchDaemons. I'd suggest something like:
    /Library/LaunchDaemons/local.postfix.stop.plist:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple
    .com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
      <key>Label</key>
      <string>local.postfix.stop</string>
      <key>ProgramArguments</key>
      <array>
        <string>/usr/sbin/serveradmin</string>
        <string>stop</string>
        <string>mail</string>
      </array>
      <key>StartCalendarInterval</key>
      <dict>
        <key>Hour</key>
        <integer>1</integer>
        <key>Minute</key>
        <integer>00</integer>
      </dict>
    </dict>
    </plist>
    and /Library/LaunchDaemons/local.postfix.start.plist:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple
    .com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
      <key>Label</key>
      <string>local.postfix.start</string>
      <key>ProgramArguments</key>
      <array>
        <string>/usr/sbin/serveradmin</string>
        <string>start</string>
        <string>mail</string>
      </array>
      <key>StartCalendarInterval</key>
      <dict>
        <key>Hour</key>
        <integer>4</integer>
        <key>Minute</key>
        <integer>00</integer>
      </dict>
    </dict>
    </plist>
    You'll need to either use launchctl load /Library/LaunchDaemons/local.postfix.stop (or start) to load the tasks, or reboot your server.
    I'm curious, though, as to why you want to do this. Mail is typically one of the services that people want to run 24/7 so they don't miss out on any emails (even though SMTP can tolerate this). Why do you want to shut yours down?

  • Script to stop and start Business Object and its components

    Hi Guru
    I have installed Business Objects and few of its componenents.
    Please assist where I can find a proper script to do a clean stop and start of its services.
    My server is Windows 2008 SP2.
    Target services to have a scripts are;
    1. MySQL server 5.1.
    2. Apache Tomcat 5.5.20.
    3. BW Publisher Service 12.
    4. Server Intelegence Agent.
    Appreciate some assistance here. Thanks!
    -Ace-

    All of those components are available as Windows services. You can use the relevant
    net stop
    commands to stop them.
    Regards,
    Stratos

  • Reset (stop and start) Apple Remote Desktop

    Log in SSH to my xServe, I want to reset (stop and start) the Apple Remote Desktop service of the sharing system preferences of my server. I'm looking for a command: systempsetup -set...

    kickstart can do this and much much more.
    http://docs.info.apple.com/article.html?artnum=108030

  • How to stop and start only the process of Oracle Application Express?

    I'd like to know how to stop the process of Oracle Application Express on my server installed oracle express package.
    After installed Oracle Express edition, not only oracle database server processes but also Oracle Application Express, such as http server, is started automatically...
    I hope to stop and start Application Express on demand but is this feature enabled?

    Oracle Apex is an API, if that helps you understand / visualize. You do not start Apex process nor stop it.
    When an Apex session starts it starts calling the API.
    You can however start / stop the listener. It may be OHS, ApexListener and the J2EE container running it, OC4J or any other "server" that you are using.
    The built-in EPG is something like an API again, you cannot start / stop it but you can disable/enable it with DBMS_XDB.SETHTTPPORT API.
    Regards,

  • Stop and start the system via the SAP GUI

    ........ although I don't know the answer!
    We have SAP running on an iSeries/DB2 format.
    And we of course have stopped and started our SAP systems many times before via an iSeries screen.
    One thing we have never had to do, is stop and start the system via the SAP GUI.
    Is this possible? If so, how is it done?
    Surprisingly difficult to find a solution online.
    Edited by: Juan Reyes on Aug 10, 2010 11:10 AM

    Paui,
    You can also do a soft shutdown, which waits till the active users/sessions are logged out (Draing out the sesstions) and no more new users are allowed to login during that time.
    Goto SM51, select the instace/server you want to stop then menu --> Goto --> Server Name --> Administration --> Shut Down Server (soft).
    Here you can also select a hard shutdown if the situation demands by following the same menu path.
    Even though your question is answered but I still wanted to update you the options to select.
    -Mahesh

  • How to STOP and START the BO EXPLORER/POLESTAR - LINUX

    Dear friends,
    Could you please let me know on How to STOP and START the BO EXPLORER/POLESTAR on LINUX platform?
    Thank you,
    Nikee

    Oracle Apex is an API, if that helps you understand / visualize. You do not start Apex process nor stop it.
    When an Apex session starts it starts calling the API.
    You can however start / stop the listener. It may be OHS, ApexListener and the J2EE container running it, OC4J or any other "server" that you are using.
    The built-in EPG is something like an API again, you cannot start / stop it but you can disable/enable it with DBMS_XDB.SETHTTPPORT API.
    Regards,

  • How to Stop and Start Scheduler Service

    Does anyone know how to stop and start the Scheduler service for Hyperion Financial Reporting in release 9.3.1?

    please see the metalink note
    How to Start/Stop MWA Services Using Control Scripts adstrtal.sh/adstpall.sh? [ID 731320.1]
    This is how i startup and shutdown WMA
    for stopping :
    1) login to Applications tier
    2) To see if the MWA (telnet) server is running use:
    ps -ef|grep DPID
    3) cd $MWA_TOP/bin
    3) ./mwactl.sh -login sysadmin/xxxxx stop_force 10200;
    4) check the wma process from OS level
    ps -ef|grep mwa
    for starting
    1) login to Applications tier
    2) cd $MWA_TOP/bin
    3) ./mwactl.sh -login sysadmin/xxxxx start _force 10200;
    4) check the wma process from OS level
    ps -ef|grep mwa

  • How to stop and start WMA in 11i system

    how to stop and start MWA in 11i system, its Linux server.

    please see the metalink note
    How to Start/Stop MWA Services Using Control Scripts adstrtal.sh/adstpall.sh? [ID 731320.1]
    This is how i startup and shutdown WMA
    for stopping :
    1) login to Applications tier
    2) To see if the MWA (telnet) server is running use:
    ps -ef|grep DPID
    3) cd $MWA_TOP/bin
    3) ./mwactl.sh -login sysadmin/xxxxx stop_force 10200;
    4) check the wma process from OS level
    ps -ef|grep mwa
    for starting
    1) login to Applications tier
    2) cd $MWA_TOP/bin
    3) ./mwactl.sh -login sysadmin/xxxxx start _force 10200;
    4) check the wma process from OS level
    ps -ef|grep mwa

  • Problem stop and start the ias 6.0

    Hi all,
    i have a problem when i stop and start the ias 6.0 sp2. The problem
    apparent is that when i stop the ias the IAS web connector plugin stop,
    then i start the ias and when i try to connect to a servlet in my ias
    the page i find in my brwser tell me "The documento contained no
    data.Try later again ..". Afte this i see that the IAS web plugin begin
    to start and then the same connect to the servlet works.
    Somebody can help me.
    Thanks in advance.
    Ignacio Ramos Garcia
    Division TSO
    Area de Telecomunicaciones
    Tecsidel
    C/ Enrique Jardiel Poncela, 6
    28016 Madrid
    Tel: (+34) 91 353 08 19
    Fax: (+34) 91 353 08 81
    <mailto:[email protected]>
    www.tecsidel.es

    Hi,
    This really looks like a problem, kindly let me know the following...
    - The O/S version & the web server with the service pack
    - What method are you using to start & stop the application & web
    server ?
    - What application are you invoking to see this error ?
    Regards
    Raj
    Ignacio Ramos Garcia wrote:
    Hi all,
    i have a problem when i stop and start the ias 6.0 sp2. The problem
    apparent is that when i stop the ias the IAS web connector plugin stop,
    then i start the ias and when i try to connect to a servlet in my ias
    the page i find in my brwser tell me "The documento contained no
    data.Try later again ..". Afte this i see that the IAS web plugin begin
    to start and then the same connect to the servlet works.
    Somebody can help me.
    Thanks in advance.
    Ignacio Ramos Garcia
    Division TSO
    Area de Telecomunicaciones
    Tecsidel
    C/ Enrique Jardiel Poncela, 6
    28016 Madrid
    Tel: (+34) 91 353 08 19
    Fax: (+34) 91 353 08 81
    <mailto:[email protected]>
    www.tecsidel.es

Maybe you are looking for

  • Data is not showingh in report

    hi experts                   in my report , i have taken timein & time out as a key figure while query output data is not showing , it s showing blank , i didn't use any calculate kf r formula ,one think also can i ask , through this i want to calcul

  • Export Release Build on Flash Builder 4 Beta 2

    Hi Everyone, I have a Flex 4 project that is organized as a main app project with several related projects that are linked in, along with several libraries that get included (I use granite dataservice and tweener, among others). The project runs fine

  • Both itunes and quicktime just stopped running

    Just recently, my itunes just stopped working. At first it was perfectly fine, then it couldn't read anything from my ipod, then it just wouldn't start up. I kept receiving a message "Itunes cannot run because it has detected a problem with your audi

  • Problems with Web Dynpro Tutorial "Creating an Email Client Using ..."

    Hello, I have a problem with the Web Dynpro Tutorial Number 6 ("Creating an Email Client using Web Dynpro and Web Services"): On page 20 of the PDF description of the Tutorial, Step 6 reads: "In the view layout, select the UI element EmailFormGroup a

  • Change group of materials

    Hi, I've changed the material group of one of my materials to a material group I've just created. It hasn't returned any mistake but, when I see the stock of the new material group the stock hasn't been assigned to this group. I mean, it seems like i