How to start, stop and restart the task

Hi all
Need advice on what is the right way to start, stop, and restart a Java task?

I tried with Executors.newCachedThreadPool () or fixedThreadPool(), however I could not present the task once. My program crashed when I tried again the task again after a shutdownnow command()

Tasks are designed to be run once. If you want to restart features, use a service:
http://docs.Oracle.com/JavaFX/2/API/JavaFX/concurrent/service.html

Service I posted in the following thread shows how to proceed:
Multithreading

Use of executors is unnecessary because a Service encapsulates the management of execution threads (although you can set your own liquidator on the service if you really need). Everything you need to do is use the start of the service, cancel, restart, and reset if necessary. If you do not use the cancel method, then you must ensure that your service is properly interrupt the current to cancel it for function, as you expect.

Tags: Java

Similar Questions

  • How to start, stop, and restart automatically

    Hello

    I'm Pramod.S, I PCI - 5154 digitizer, I'm acquirng data now my question is I want to acquire the data for say 1 min to stop, after the gap of 2: I want to start acquirng again automatically for 1 min. can you please guide me in this way. I'll be gratefull if you send examples to demonstrate this feature.

    Pramod Hello,

    Regarding your question on the acquisition of a min, wait 2 minutes and acquires again for a minute, you'll need to create a program to control the acquisition and away. Is there a programming language you will use to control the acquisition?

    A simple control may use the function time in LabVIEW feature to see how long the acquisition has run before deciding to interrupt the acquisition and become inactive for 2 minutes. A simple implementation to start is attached.

    Hope this helps

  • Stop and restart the cssd on all cluster nodes

    Hello

    Release our system to operate under linux Red Hat Enterprise Linux Server 5.3 (Tikanga) 2.6.18 - 128.1.1.el5
    Our ASM is 11.1.0.7.0 block of POWER 2
    Only ASM is clustered. Databases are not.
    2 cluster nodes (Clusterware 11.1.0.7.0)

    I have two questions:
    1. we need to stop and start the cssd (crsctl stop crs, crsctl start crs) on both our 2 nodes of clusters.
    In our test group, I stopped first the ASM and dbs all running on 2 nodes
    Then I got arrested and restarded the cssd on the first node, and then on the second node. What is the good order or procedure?
    I noticed after the cssd (crsctl stop crs) stopped the process "/ bin/sh /etc/init.d/init.cssd fatal" was always present. I waited for 30 seconds, but he was always there. Then I restarted the cssd (crsctl start crs) in any case. Why was the fatal process always there? It happened on both nodes. After you restart the cssd, I killed the "/ bin/sh /etc/init.d/init.cssd fatal" on both nodes. He was evidently reappear.

    in the event that we want to restart both nodes of the cluster, should 2 - I start by disabling the crs before restart the cluster of 2 knots (crsctl disable crs), and then turn it back on after that 2 linux servers are back (crsctl enable crs)?

    Thank you, man

    Hello

    So, for the closure of this thread, which is the appropriate procedure - for them stopping and restarting the cssd on the two cluster 2 node - among the two below:

    1 - do a "crsctl stop Sir' and then 'crsct start crs' on the first node. Then do the same thing on the second node
    2. make a "Sir crsctl stop" on both nodes. Then do 'crsct start crs' on both nodes

    I want to avoid is the two nodes start to restart because of the cssd.

    You can run 'crsctl stop/start' at the same time on both nodes or so as you want (1 or 2), no problem.

    If you start the clusterware on a first node and later the second node, just make sure that all services who were on the first node the second node have been properly resettled on the second node.

    Kind regards
    Levi Pereira

  • When I try to delete anything out of my windows mail Inbox stops and restarts the imedietly.

    Restart mail Windowas

    When I try to delete anything out of my windows mail Inbox stops and restarts the imedietly.

    Try to compact and repair the database (see www.oehelp.com/WMUtil/).  There is likely an inconsistency between what is really there and what think the database is where and who must reconcile the two.  So beware of interference from antivirus software which can cause these issues (see www.oehelp.com/OETips.aspx#3).

    Steve

  • Can I stop or restart the Task Scheduler service from the command prompt in Windows 2008 service?

    I'm on Server 2008. I have a scheduled task that is not working properly. I went to Services, and I see that it is configured to start automatically and it is actually being run. The problem is that I can't stop, pause, or restart the service. Y at - there a command I can run that can stop or restart the service?

    Why not with the right button of the job itself in the Task Scheduler, and then stop it?

    There are several methods to stop the Task Scheduler service that. Here's one of them:

    1. Create a task scheduled, called 'StopScheduler' as follows:
      -Triggering factor: at boot time
      -Command: sc.exe
      -Settings: time stop
      -User: System
      -Run with the highest privileges.
    2. Right click on the task of StopScheduler, and then click Run.
    3. Solve your tasks.
    4. Restart the Task Scheduler.
    5. Disable or remove the task StopScheduler.
    Note also that this forum focuses on the issue of Windows 7 in a domestic environment. There are dedicated forums for Server 2008.
  • Problem stopping and restarting the computer

    Hello

    I searched for so long for a solution, until I decided to post a question here.

    Whenever I have shut down my computer (via Start menu / alt + f4) the computer off first and perform a restart immediately afterwarrds.

    Well, this is what happens ALL the time. My computer stops and restarts, until I am led the newspaper to the page. On the page (after ctrl + alt + del) to connect, I keep having the same problem after pressing the off button.

    It's extremely frustrating because I have two options:

    Leave my computer running in locked mode (allowing my computer to heat and drain its battery)

    or

    Force a stop down by holding the power button down (damage my computer system - directed to a page (for running normal windows not start))

    Here is my contact information for the computer and all the...

    Lenovo G400

    (Standard plug)
    500 GB WD hard drive

    Windows 7 ENTERPRISE

    If you need more details let me know, so I can help you.

    Hope to hear something soon!

    MBT

    In order to diagnose your problem, we need run Windows performance toolkit, the instructions that are in this wiki

    If you have any questions do not hesitate to ask

    Please use the restart configuration.  This will reboot your computer 3 times then save your work

  • updates Windows returns to the start-up and restart the portable computer

    I put a clean image of windows 7 on my laptop and started running the updates of windows. There were 200 +. They download and restarted the computer and start the installation. The problem is now that he gets so far installs it fails and he returned to the starting point and then restart the laptop and the process begins again. They only way I can get back to my computer through safe mode. Any suggestions?

    Try excluding upgrades recommended to install important updates and only load the Important updates first which should be updated about 159 200 not.

    If you get hung up refer to the latter.

    It is expected by M$, we must now jump through hoops to clean install.

    http://www.ZDNet.com/article/sticking-with-Windows-7-the-forecast-calls-for-pain/

    http://answers.Microsoft.com/en-us/Windows/Forum/Windows_7-update/Windows-Update-remains-at-checking-for-updates/ff3c442e-79a6-40d3-AC35-29e130cebef1

    If looking for updates to hang on a current installation,

    Switch your windows update setting to never check the updates temporarily

    Restart the machine

    Then you download this from your download folder run from there.

    https://TechNet.Microsoft.com/library/security/MS16-039?f=255&MSPPError=-2147217396

    Download the x 86 for 32-bit or x 64 for 64-bit

    Install it and restart when prompted too after he did a search of stand-alone for updates that should not

    take too long, it took all of 5 seconds, '' If '' windows update settings are turned on forever check

    updates before running from the downloads folder.

    Once it installs and restarts

    You can reset your updates affecting everything you had before default =...

    Then check the updates manually.

    I think that the solution came from Softpedia and Joel_CS posted on this thread,

    http://News.Softpedia.com/news/Windows-Update-hanging-when-downloading-April-12-patches-502886.shtml

    You must scroll down for Joel SC post threads, it is the last answer on this page,

    http://answers.Microsoft.com/en-us/Windows/Forum/Windows_7-update/Windows-Update-hangs/dbd539c3-bfc6-42DF-a6ff-0e55ef7938eb?page=6

  • How to start stop type in the search box

    I want to stop "To start, type in the search box" and also find some br

    Sounds like something office search Bing would do?

    Please confirm.

    Take screenshots,
    Usually, you can press the SHIFT key (maybe the Alt key) or (FN key on your laptop) and press prtscrn.
    Open microsoft Paint, and then click Paste on the top left.
    Painting is located in the Accessories folder in all programs from the Start button.

    http://Windows.Microsoft.com/en-us/Windows7/using-paint

    Then click on the blue button on the file and click Save as, click jpeg file type and name the file.
    Upload to skydrive or photobucket in a public album and post a direct link to the file here.

    Or use the windows snipping tool,
    http://Windows.Microsoft.com/en-us/Windows-Vista/use-Snipping-Tool-to-capture-screen-shots
    Refer to this topic on how to make a public record and present screen shot here.
    http://answers.Microsoft.com/en-us/feedback/forum/suggest/how-to-insert-an-image-into-a-post-at-answers/bdae0306-c3cb-4d31-ace9-7281ea1a8a73

    You can also look at this for the new format in skydrive

    http://sdrv.Ms/RtThbH

  • Stop and restart the virtual machines in the remote server

    I need to close virtual machines running guests 4 1 ESX from a remote server (IBM System i).

    The remote server in fact control the storage used by ESX and VM OS, so I'll have to scripts running on the remote server that:

    Stop the virtual machine

    Performs maintenance

    Reboot the virtual machine

    I tried to understand the big picture of the reading discussions here, but I'm still confused.

    VMA is to provide the best way for the virtual machines of withdrawal from a script running on a remote server?

    Scripts can I use SSH to connect to the vSphere environment to run scripts or issue the command?

    Thank you.

    vCLI (really its vSphere SDK for Perl), PowerCLI, VI Java, etc are all vSphere SDK to correct and they are a of the client-side bindings different scripts and programming languages which bind to the vSphere API. When I say 'API', I mean using one of these SDK is you use the vSphere API to perform the work.

    The SDK is initiated on the remote server, this can be windows, linux, etc as long as it supports one of these boxes to tools. In general, for admins, you will use either vCLI (vSphere SDK for Perl) that supports Linux and Windows, or if you are more windows-oriented, you can use PowerCLI.

    Documentation has been referenced in my first post, please take some time the documents because they provide much more detail on the use cases for each + a lot of examples with orders. Yet once, there no involved SSH if you use the vSphere API. As I told, vMA is a virtual appliance, you can download and start using if you do not want to install vCLI or PowerCLI on a remote system, this is assuming that you are comfortable in a Linux environment. If you're not, then I highly recommend using PowerCLI, who will need a remote server for Windows.

    Here are a few started getting additional resources:

    vSphere SDK for Perl + vMA:

    Getting started with vSphere SDK for Perl

    Introduction to the vMA (tips/tricks)

    PowerCLI:

    http://www.VMware.com/support/developer/windowstoolkit/

    http://www.virtu-al.NET/2009/11/10/PowerCLI-where-do-i-start/

    =========================================================================

    William Lam

    VMware vExpert 2009

    Scripts for VMware ESX/ESXi and resources at: http://engineering.ucsb.edu/~duonglt/vmware/

    Twitter: @lamw

    repository scripts vGhetto

    Introduction to the vMA (tips/tricks)

    Getting started with vSphere SDK for Perl

    VMware Code Central - Scripts/code samples for developers and administrators

    VMware developer community

    If you find this information useful, please give points to "correct" or "useful".

  • stop and restart the BIOS G470 2.19 problem 40cn33ww_64

    Hi there, please kindly help me.

    I have laptop of G470, Lenovo. Core I3, 8 GB RAM, 500 GB HDD, Bios Version 2.19 (updated)

    in fact, after I have updated to version 2.19 bios I got these problem.

    When I click on stop. the disc but stops the power still running.

    When I click on restart (on battery) my laptop goes off completely

    When I click on stop (on the adapter) my laptop will reboot.

    first of all, I think that it is BONE, I have try all the BONES, but it is still the same problem.

    Please give me a solution. Thank you.


  • How can I remove and restart the device from the devices pending?

    Hello

    I have a problem with the number of systems in State waiting, but I am unable to assign layer or something.

    I tried to remove the Mirage client several times already but without success - systems stay in "connected suspended" State.

    Any ideas that I can do to make it work?

    Thanks in advance

    2013-08-29 16_42_21-Remote Desktop Manager [mirage-man].png

    Hello world

    Thanks for the replies.

    I managed to past this error with VMware, no real support solution, and more:

    -These "suspended" systems seems to have an action being performed on them (e.g. layer provisioning) - clear all Task Monitor allows

    -update to 4.0 4.23 also authorized "ghost" items, new version also seems to be more stable

    It could be that useful...

  • window will stop in less than a minute, stops and restarts everytime I use the computer

    message-windows will be stop in less than a minute. appears, and then the computer stops and restarts. It's windows vista and it's this evertime I use the computer

    Hello

    ·        This happens randomly, or when you open any application on the system?

    ·        Since when are you facing this problem?

    ·        Remember to make changes to the system?

    Check the event viewer for the newspapers and let us know. Follow the steps mentioned in the link below.

    Open event viewer

    http://Windows.Microsoft.com/en-us/Windows7/open-Event-Viewer

    What are the information contained in the logs of the event (Event Viewer)?

    http://Windows.Microsoft.com/en-us/Windows7/what-information-appears-in-event-logs-Event-Viewer

    Method 1:

    Step 1:

    I suggest you to check in safemode, if the problem persists. Follow the steps mentioned below.

    a. restart the computer and keep tapping F8 until you reach the start menu.

    b. Select safe mode and press ENTER.

    Step 2:

    I suggest you do a clean boot and see if the problem still occurs.

    To perform a clean boot follow the steps mentioned in the link given below.

    How to troubleshoot a problem by performing a clean boot in Windows Vista or in Windows 7

    http://support.Microsoft.com/kb/929135

    Note: Follow step 7 to start the computer in normal startup.

    Method 2:

    It may be there is a scheduled task on your system. Check in Task Scheduler and if there is no scheduled tasks then, remove and check if the problem persists.

    Automate tasks with Task Scheduler

    http://Windows.Microsoft.com/en-us/Windows-Vista/automate-tasks-with-Task-Scheduler-from-Windows-Vista-inside-out

    Schedule a task

    http://Windows.Microsoft.com/en-us/Windows-Vista/schedule-a-task

    Thanks and regards.

    Thahaseena M
    Microsoft Answers Support Engineer.
    Visit ourMicrosoft answers feedback Forum and let us know what you think.

  • Frequently, my computer stops and restarts all am surfing the net? What should I do?

    Frequently, my computer stops and restarts all am surfing the net.  What can I do?

    Hello

    1. what type of internet connection do you use? What is a wired or wireless?

    2. you receive messages or error codes?

    2. did you of recent changes on the system?

    Step 1:

    You can check the following items and check if the problem occurs in safe mode with network.

    Start your computer in safe mode

    Startup options (including safe mode)

    Step 2:

    If you do not experience the problem in safe mode with networking, you can perform a clean boot and check.

    A clean boot to check if startup item or services to third-party application is causing this issue.

    You can read the following article to put the computer in a clean boot:

    How to troubleshoot a problem by performing a clean boot in Windows Vista or in Windows 7

    After the troubleshooting steps, please refer to clean the boot link to put the computer to normal startup mode.

  • How instance recovery and restart the database after SHUTDOWN ABORT?

    How instance recovery and restart the database after the database is closed by using the command "SHUTDOWN ABORT"?

    Recovery if instance Oracle background SMON instance failure process using or stop quitting or database starting strength. After shutdown abort you just restart the startup database, oracle will take care for instance recovery you need'nt to intervene for example recovery.

  • The Print Spooler Service has stopped. Restart the print spooler and try to print and make the same mistake.

    Recharging according to the printing software and get always the same error.

    Hello

    You must ask in the answers – Windows Forums for your version of Windows.

    Answers - Windows Forums
    http://answers.Microsoft.com/en-us/Windows

    How to ask a question
    http://support.Microsoft.com/kb/555375

    ==================================

    Here is a troubleshooting guide for Windows 7 - Vista would be very similar.

    Check with the printer manufacturer for updated drivers and support for known issues.

    Check chan seen message here - one of the highest.

    fixed spooler subsystem app stopped working
    http://social.technet.Microsoft.com/forums/en/itprovistaprinting/thread/460f297a-dd66-4476-A176-542e1519ca3e

    ==================================

    Follow these steps in the kind of prerequisites:

    Clean the General corruption and repair or replace the damaged/missing files.

    Run DiskCleanup - start - all programs - Accessories - System Tools - Disk Cleanup

    Start - type this in the search box-> find COMMAND at the top and RIGHT CLICK – RUN AS ADMIN

    Enter this at the command prompt - sfc/scannow

    How to fix the system files of Windows 7 with the System File Checker
    http://www.SevenForums.com/tutorials/1538-SFC-SCANNOW-Command-System-File-Checker.html

    Then run checkdisk (chkdsk).

    How to run check disk in Windows 7
    http://www.SevenForums.com/tutorials/433-disk-check.html

    ------------------------------------------------------

    References to Vista also apply to Windows 7.

    Go to the printer manufacturer's website and get the latest drivers - download - REGISTER - install yet. When loan
    to install - make a right-click on the pilot - run as administrator.

    Also check with the manufacturer of your printer and forums support.

    --------------------------------------

    Use this method to clear the spooler and then uninstall and reinstall your printer (check with the manufacturer for)
    the latest driver).

    Check Mr. Fixits here and if you use the other methods go back and try again later.

    Problems of print and error - a Mr Fixit of printing
    http://support.Microsoft.com/GP/printing_problems

    Solve printer problems - a Mr Fixit
    http://windowshelp.Microsoft.com/Windows/en-us/help/8c11977e-8244-408f-A036-7978a618d7a21033.mspx

    ------------------------------------------------------

    Logon as administrator

    Start - type in the search box-> COMMAND - control to the top of the list and RIGHT CLICK – RUN AS ADMIN

    You can copy and paste each line except those brackets and press ENTER after each.

    net stop Spooler

    (echo suppression of all print jobs)<-- you="" should="" see="" this="">

    ping localhost n 4 > zero

    del/q %SystemRoot%\system32\spool\printers\*.*

    net start Spooler

    (sound Done!)<-- you="" should="" see="" this="">

    ping localhost n 4 > zero

    Another way
    http://4sysops.com/archives/how-to-cancel-a-print-job-that-hangs-under-Windows-Vista-and-XP/

    Check the print - DELETE/STOP queue all jobs - then right click on the printer - REMOVAL
    http://windowshelp.Microsoft.com/Windows/en-us/help/bb6f81d9-4092-4ac8-9716-2bd008f513e11033.mspx

    If you use Control Panel - Classic - printers

    Try after unplugging your printer if necessary.
    -------------------------------------------------------------

    Also check the spooler print and its dependencies and addictions Service.

    Print Spooler service (see the following link BlackViper for Windows 7 default dependencies)
    http://wiki.blackviper.com/wiki/Print_Spooler

    BlackViper Windows 7 Service - default settings
    http://www.blackviper.com/Windows_7/servicecfg.htm

    How difficulty Windows Vista print spooler starts do not
    http://www.ehow.com/how_4920100_vista-print-spooler-not-starting.html

    ------------------------------------------------------------

    Check this thread if necessary - to stop and erase the spooler

    http://social.answers.Microsoft.com/forums/en-us/vistaperformance/thread/a15779d6-ac0d-42FD-9Ac2-a1da241ea19f/

    and here

    http://social.answers.Microsoft.com/forums/en-us/vistahardware/thread/58b54fa9-cf6f-40F7-90b2-8093c6777493

    I hope this helps.

    Rob Brown - Microsoft MVP<- profile="" -="" windows="" expert="" -="" consumer="" :="" bicycle="" -="" mark="" twain="" said="" it="">

    I hope this helps.

    Rob Brown - Microsoft MVP<- profile="" -="" windows="" expert="" -="" consumer="" :="" bicycle="" -="" mark="" twain="" said="" it="">

Maybe you are looking for

  • HD DVD on the Satellite X 200 - will not play with vista 64-bit

    I installed vista 64 bit on my x 200, thought I had everything working, but when I went to install the Toshiba HD DVD software, I get a message saying: it cannot be installed on this computer. I tried some third party decoders, and none of them has m

  • How do I right click?

    I tried several times to use the right click. in the maemo browser if I hold the pointer any longer, then the context menu is displayed. but I tried in firefox and I can't figure out how to do this simple thing... Installed extensions: None

  • HP DeskJet F4140 printer range: hp deskjet F4140 and windows 10

    Help...  I had Windows 7Pro and in the month of August, I've upgraded to Windows 10.  The download went well. I haven't used my printer up to the the other day and it does not work.  I have download the newest player for the F4100 series and my impre

  • HP Pavillion Smart Touch: Wi - Fi connectivity issues

    Hello everyone, this is my first post so I hope I'm doing this right! Recently, I changed my wifi password on my router or my security key because the neighbors were using my wifi without knowing me. Since the change, I can no longer connect my lapto

  • How to Documents and settings\All Users Data\ in Vista?

    I'm doing a game "cheats" and he said: go to "Documents and Settings\All Users\Aplication Data\... "How to this area? I think I have to go to the "C:" prompt, but I do not remember how to get there. Thank you