How to stop an infinite Stream?

I have a Stream instace which produces values using an infinite Supplier (it supplies values taken from an electronic sensor -- so unless the battery is low, the sensor will provide "for ever").
The stream is processed by a Collector using Stream.collect() (e. g. imagine that the values from the sensor should be averaged; in fact what it does is a bit more compliacted maths).
The problem is that the collector does not produce a result but hangs up, as the supplier does never stop providing more sensor values.
So what I need is a limitation rule that stops the stream. While there is a Stream.limit(long) method, it actually does not solve my problem as in my case it is not practical to stop after a particular count, while I actually want to stop streaming when the sensor value exceeds a particular limit etc. (hence, voids an arbitrary rule).
To sum up, what I need is Stream.limit(Predicate), i. e. the stream will stopped once the predicate becomes true.
Unfortunately I did not find anything like that in JRE 8. :-(
Is that planned for JRE 8.1 or JRE 9.0? Or is there a known (and sophisticated) workaround?
Thanks!
-Markus

Would something like this do the trick?
Stream.anyMatch((v) => {v > 1000})

Similar Messages

  • How to stop threads, process, streams when closing a (internal) JFrame?

    Dear all,
    I read a Javaworld article about Runtime.exec(), which will output the process outputs and error outputs to either a file or System.out. Now I want to practice it by outputing the process output/error to a Swing JTextArea. It works fine if the process ends successfully.
    My problem is that I want to stop all the output threads and clear all the streams when user click close JFrame button before the process finished. The code is shown below. Note that this frame is poped up by a click from another main frame. ( it is not exiting the main Swing application). This happened when I want to kill a process when it is running.
    I tried to implements a WindowListener and add
    public void windowClosing(WindowEvent e) to the JFrame.
    Inside this method I used process.destroy() and errorGobbler = null, outputGobbler = null, or outputGobbler.interrupt(), errorGobbler.interrupt(). But all these seems does not work. Sometimes thread was not stopped, sometimes process was not destroyed (because the stream was still print out something), sometimes the error stream was not successfully closed - by printing out interruptted by user error message.
    How can I make sure all the underlying streams and threads, including the PrintStream in StreamGobbler class are closed?
    Again this Frame could be a Dialog or InternalFrame, i.e, when I close the frame, the main frame does not exit!
    import java.util.*;
    import java.io.*;
    class StreamGobbler extends Thread
        InputStream is;
        String type;
        OutputStream os;
        StreamGobbler(InputStream is, String type, JTextArea out)
            this(is, type, null, out);
        StreamGobbler(InputStream is, String type, OutputStream redirect, JTextArea out)
            this.is = is;
            this.type = type;
            this.os = redirect;
        public void run()
            try
                PrintWriter pw = null;
                if (os != null)
                    pw = new PrintWriter(os);
                InputStreamReader isr = new InputStreamReader(is);
                BufferedReader br = new BufferedReader(isr);
                String line=null;
                while ( (line = br.readLine()) != null)
                    if (pw != null)
                        pw.println(line);
                    out.append(type + ">" + line);   
                if (pw != null)
                    pw.flush();
            } catch (IOException ioe)
                ioe.printStackTrace(); 
    public class Test extends JFrame
        private JTextArea output;
        private StreamGobbler outputGobbler;
        private StreamGobbler errorGobbler;
        public Test (String file)
            super();
            output = new JTextArea();
            try
                FileOutputStream fos = new FileOutputStream(file);
                Runtime rt = Runtime.getRuntime();
                Process proc = rt.exec("java jecho 'Hello World'");
                errorGobbler = new
                    StreamGobbler(proc.getErrorStream(), "ERROR", out);           
                outputGobbler = new
                    StreamGobbler(proc.getInputStream(), "OUTPUT", fos, out);
                errorGobbler.start();
                outputGobbler.start();
                int exitVal = proc.waitFor();
                output.append("ExitValue: " + exitVal);
                fos.flush();
                fos.close();       
            } catch (Throwable t)
                t.printStackTrace();
         setSize(400,400);
         show();
    }Thanks !

    Thread.interrupt() doesn't stop a thread. You'll have to read the API for more specifics. You could use something like interrupt to force interruption of the thread for the reason of checking the terminating case though. I believe you would want to use this in the case where operations can take a long time.
    Setting your reference to the thread to be null won't stop the thread since it's running. You just lose your reference to it.
    I believe once the thread stops running your streams will be closed, but possibly not cleanly. Someone who has more knowledge of threads might be able to answer this better, but I would generally say clean up after yourself especially if you are writting out data.

  • How to stop delay when streaming data from a script as URL to an Applet?

    I have a strange problem and do not know what is causing it. Hope someone here with some experience can help.
    I have a Java Applet which makes a line graph of data. The data source is to be streaming, where the first chunk of data comes from what is already in a data file, and then new data is sent whenever it is ready. The problem in brief is that if I just collect and show the data from the data file and do not stream everything works fine. If I also have the streaming and wait for a long time, everything works fine, but when the applet is first loaded, the graph is not shown until after a long delay time.
    Here is a snippet of the applet code:
             String dataendpoint = "http://phpfunction.php";
             URL url = new URL(dataendpoint);
             InputStream is = url.openStream();
             String line;
             InputStreamReader isr = new InputStreamReader(is);
             BufferedReader br = new BufferedReader(isr);
             while ((line = br.readLine()) != null) {
                   // my code here to handle each line of data which prepares it for
                   // showing on a line graph.
             } In the above, I show the dataendpoint variable hardcoded, but in reality this comes as an Applet parameter. It is a URL of a php script which is on the same server as the applet's code and there are no access problems here.
    The PHP script does the following: It first opens a data file, parses it and prints it out to its standard output using echo or printf statements. The script then enters a loop where it periodically looks to see if new data has been made available. If so, that new data is also printed out to the standard output.
    The PHP script looks like this (in pseudo code):
       // open data files, read lines, and send to standard output using echo
       // flush buffers using ob_flush() and flush() calls
       while (1) {
          sleep(30);
          // get new data, if any, then send to standard output
          // flush buffers again
       Again my problem: If I have the PHP script exit before the while loop everything works fine, my applet makes the graph immediately.
    However, if I include the while loop, then initially the applet does not appear, not until some time afterwards, and then the applet works like it should, scrolling along every time new data arrives.
    I have done a Wireshark sniff and I can see that the initial data is being sent out the the browser and applet immediately. So I do not think it is a buffering problem on the PHP side.
    I have wrapped every Applet code line with debug print statements and from the Java console I see that the Java Applet is stopping at this line:
    InputStream is = url.openStream();
    Can someone explain what is happening here? Why the delay in returning from the openStream() function and how to avoid it?
    By the way, the server is Linux and the Applet is being run on Windows Vista, and I have tried both Internet Explorer and Firefox, both give the same behavior.
    Thanks in advance!
    Steve, Denmark

    I still cannot solve this problem, but I have some more observations:
    1) yes it is a JApplet, and yes, the data streaming is performed in a separate thread.
    2) Wireshark sniffing shows that data sent out by the PHP datasource on the server is sent immediately, and is not buffered (am using ob_start(), ob_flush() and flush() alls in the PHP script).
    3) On Windows Vista, using Internet Explorer or Firefox, there is a constant 30 second delay before the Applet returns from this line: InputStream is = url.openStream();
    4) After this 30 seconds, data appears in the Applet, but it can be seen also with java console debug prints that the data seems to be buffered. The newest data shown in the Applet is not the newest data sent to the client by the PHP datasource script.
    5) On a SUSE Linux client, the Applet works as it should, there is no delay time in showing the data.
    It appears as if there is on Windows a buffering of data which I do not wish to have and which does not occur on Linux. I need to find out how to get the URL openStream() call to return immediately allowing the initial data to be read and shown on the Applet. And I need to remove the buffering of data so that the data can be shown on the Applet when it arrives.
    Can anyone help? Why does this work on Linux but not on Windows, and what can I do, at best within the Java code, to get the Applet to work on Windows as it does on Linux?
    Thanks!
    Steve, Denmark

  • How to Stop an infinite loop

    I'm reading from the keyboard. I take the input and use it as a while statement's condition. However, I can't break out of the loop once i'm in it. I've tried everything, but nothing works. The loop should terminate after null is returned, but it doesn't. Here is my code:
    inputline = keyboard.readLine();//read the keyboard
    while( inputline = keyboard.readLine() )!= null){
    inputline = keyboard.readLine();//read the keyboard
    System.out.println(" i'm in the loop");
    DiskOut.println( inputline );
    DiskOut.flush();
    inputline = keyboard.readLine();//read the keyboard again
    }//end while
    Also, I have tried this while statement
    while( inputline =="\n" || inputline == "\r" || inputline == null)
    please help!!

    Your code won't even compile. The part between "while" and "{"
    has too many right-parentheses.
    What are "keyboard", "DiskOut", etc.? You'll probably need to provide
    more details, plus the actual code you're trying to debug, before anybody can help you.
    Assuming "inputline" is a String, then that alternative while expression wouldn't work anyway. You can't compare Strings with "==" (at least not in the way you probably mean).
    The following code does something which seems to be roughly what you want:
    import java.io.*;
    public class Foo {
      public static void main(String[] argv) {
        try {
          BufferedReader foo = new BufferedReader(new InputStreamReader(System.in));
          String line;
          while((line = foo.readLine()) != null) {
            doSomething(line);
        } catch (IOException e) {
          e.printStackTrace();
      public static void doSomething(String it) {
        // do something here
    }But note that the while loop doesn't end when someone inputs a blank line; it ends when the stream ends, which in this case is when someone inputs EOT (in unix systems, Control-D).
    readLine() doesn't return null on blank lines.
    If that's what you're looking for, then maybe you want to end your while loop when inputline.length() == 0.

  • Clicking on a link once generates an infinite stream of tabs that I can't stop without closing Firefox

    If I click on a hyperlink within a message on Thunderbird, I open an infinite stream of tabs on Firefox. What's happening? Yesterday I was able to close to close tabs and stop the progression; today I had to close Firefox entirely.

    This can happen when you set Firefox as the program to open a type of content it can't actually handle. Please see this support article on how to clear that setting: [[Firefox repeatedly opens empty tabs or windows after you click on a link]].

  • How to Stop Message Driven Beans to go into an infinite loop

    hi,
    Am kiran peddireddy, have the following problem. When i sent a chunk of 50 messages to the MessageDrivenBean, let us say 25 have passed and at the 26th message there was a problem and could not deliver. so, it throws an exception due this the MDB goes into an infinite loop. Can anyone suggest how to stop the MDB from infinite loop. I need help for this ASAP.
    thanks,
    Kiran Peddireddy.

    To Crackers,
    You have to let the container deal with the message - expire/cancel the message after a certain number of tries. This is easy to manage in the WLS console. Which version of Weblogic has this option? 7.0 or 8.1 ?
    I didnt see this option in Weblogic 7.0!!!!!!
    Corect me if I am wrong.
    Seetesh

  • Workflow infinite loop how to Stop?

    hi,
    My workflow is having a loop it runs infinite bcos the condition is not proper. Inside the loop i have a send mail step.. How to stop the Running workflow???
    Regards
    Roops

    Roop,
    It seems that the loop condition is a workflow step and not something in the method code.
    For active instances of this workflow you will have to manually intervene. There can be 2 options -
    1. Open the workflow log and change the container values such that it comes out of the condition
    2. Logically delete the workflow.
    Hope this helps

  • How do I stop an infinite loop because of a poorly placed user prompt during developmen​t without closing LabView?

    How do I stop an infinite loop because of a poorly placed user prompt during development without closing LabView?
    Thank you!
    Solved!
    Go to Solution.

    chuck72352 wrote:
    Here is an example of a VI that I can't stop.
    Epic Fail
    but seriously, as was suggested, download Darren's Abort.vi. It comes in very handy for these.
    Message Edited by Broken Arrow on 05-03-2010 01:06 PM
    Richard

  • HT5902 how to stop emails from Photo Stream

    I receive emails every time someone joins a Photo Stream.  Their is a link that reads
    Don't Send Me Photo Stream Emails
    but it does not work.  Anyone know how to stop the emails?

    Would love to know what the deal is with this too. Bump

  • How to stop photo stream uploading/downloading in the background

    Does anyone know how to stop the iphoto upload/download as my broadband gets killed everytime I add photos to my mac.
    Let me explain that I have a 6-8 MB down link but my uplink is only 0.2Mb really slow.  So when I quit iphoto I can't play any online games for ages as Photostream is taking up my complete band width.  Mainly due to the fact that it is also downloading the photos to my iPad and my wifes iPhone I just imported the photos off those two devices but photostream wants to put a second copy on the device. argh
    please give me better control I want to upload the photos (shared library) to photostream but only when the iPhoto app is open so I have the choice of when my bandwidth is used. either that or make the upload only happen with the device is switch off / not used so if I open a network game the bandwidth is freed until the game is closed.
    thanks
    IrishAdo

    Talk to Apple here...
    http://www.apple.com/feedback/

  • I believe that i have malware on my mac, osx 10.9.4. accordingly, i've tried to run clamxav (on my mac HD) but just get a spinning wheel, then have to shut down. any advice on how to stop spinning wheel or get rid of malware? please help. :-).

    i believe that i have malware (possible highjack of safari browser) on my mac, osx 10.9.4. accordingly, i've tried to run clamxav (on my mac HD) but just get a spinning wheel, then have to shut down. any advice on how to stop spinning wheel or get rid of malware? i have symnatic endpoint and, after scanning, it reveals nothing. please help. :-).

    are locked user files or that have incorrect permission a bad thing?
    Yes.
    why am i removing symantec?
    Short answer: Because it's worse than useless and worse than the imaginary "viruses" you're afraid of would be if they really existed. For the long answer, see below.
    1. This is a comment on what you should—and should not—do to protect yourself from malicious software ("malware") that circulates on the Internet and gets onto a computer as an unintended consequence of the user's actions. It does not apply to software, such as keystroke loggers, that may be installed deliberately by an intruder who has hands-on access to the computer, or who has been able to log in to it remotely. That threat is in a different category, and there's no easy way to defend against it.
    The comment is long because the issue is complex. The key points are in sections 5, 6, and 10.
    OS X now implements three layers of built-in protection specifically against malware, not counting runtime protections such as execute disable, sandboxing, system library randomization, and address space layout randomization that may also guard against other kinds of exploits.
    2. All versions of OS X since 10.6.7 have been able to detect known Mac malware in downloaded files, and to block insecure web plugins. This feature is transparent to the user. Internally Apple calls it "XProtect."
    The malware recognition database used by XProtect is automatically updated; however, you shouldn't rely on it, because the attackers are always at least a day ahead of the defenders.
    The following caveats apply to XProtect:
    ☞ It can be bypassed by some third-party networking software, such as BitTorrent clients and Java applets.
    ☞ It only applies to software downloaded from the network. Software installed from a CD or other media is not checked.
    As new versions of OS X are released, it's not clear whether Apple will indefinitely continue to maintain the XProtect database of older versions such as 10.6. The security of obsolete system versions may eventually be degraded. Security updates to the code of obsolete systems will stop being released at some point, and that may leave them open to other kinds of attack besides malware.
    3. Starting with OS X 10.7.5, there has been a second layer of built-in malware protection, designated "Gatekeeper" by Apple. By default, applications and Installer packages downloaded from the network will only run if they're digitally signed by a developer with a certificate issued by Apple. Software certified in this way hasn't necessarily been tested by Apple, but you can be reasonably sure that it hasn't been modified by anyone other than the developer. His identity is known to Apple, so he could be held legally responsible if he distributed malware. That may not mean much if the developer lives in a country with a weak legal system (see below.)
    Gatekeeper doesn't depend on a database of known malware. It has, however, the same limitations as XProtect, and in addition the following:
    ☞ It can easily be disabled or overridden by the user.
    ☞ A malware attacker could get control of a code-signing certificate under false pretenses, or could simply ignore the consequences of distributing codesigned malware.
    ☞ An App Store developer could find a way to bypass Apple's oversight, or the oversight could fail due to human error.
    Apple has so far failed to revoke the codesigning certificates of some known abusers, thereby diluting the value of Gatekeeper and the Developer ID program. These failures don't involve App Store products, however.
    For the reasons given, App Store products, and—to a lesser extent—other applications recognized by Gatekeeper as signed, are safer than others, but they can't be considered absolutely safe. "Sandboxed" applications may prompt for access to private data, such as your contacts, or for access to the network. Think before granting that access. Sandbox security is based on user input. Never click through any request for authorization without thinking.
    4. Starting with OS X 10.8.3, a third layer of protection has been added: a "Malware Removal Tool" (MRT). MRT runs automatically in the background when you update the OS. It checks for, and removes, malware that may have evaded the other protections via a Java exploit (see below.) MRT also runs when you install or update the Apple-supplied Java runtime (but not the Oracle runtime.) Like XProtect, MRT is effective against known threats, but not against unknown ones. It notifies you if it finds malware, but otherwise there's no user interface to MRT.
    5. The built-in security features of OS X reduce the risk of malware attack, but they are not, and never will be, complete protection. Malware is a problem of human behavior, and a technological fix is not going to solve it. Trusting software to protect you will only make you more vulnerable.
    The best defense is always going to be your own intelligence. With the possible exception of Java exploits, all known malware circulating on the Internet that affects a fully-updated installation of OS X 10.6 or later takes the form of so-called "Trojan horses," which can only have an effect if the victim is duped into running them. The threat therefore amounts to a battle of wits between you and the scam artists. If you're smarter than they think you are, you'll win. That means, in practice, that you always stay within a safe harbor of computing practices. How do you know when you're leaving the safe harbor? Below are some warning signs of danger.
    Software from an untrustworthy source
    ☞ Software of any kind is distributed via BitTorrent, or Usenet, or on a website that also distributes pirated music or movies.
    ☞ Software with a corporate brand, such as Adobe Flash Player, doesn't come directly from the developer’s website. Do not trust an alert from any website to update Flash, or your browser, or any other software.
    ☞ Rogue websites such as Softonic and CNET Download distribute free applications that have been packaged in a superfluous "installer."
    ☞ The software is advertised by means of spam or intrusive web ads. Any ad, on any site, that includes a direct link to a download should be ignored.
    Software that is plainly illegal or does something illegal
    ☞ High-priced commercial software such as Photoshop is "cracked" or "free."
    ☞ An application helps you to infringe copyright, for instance by circumventing the copy protection on commercial software, or saving streamed media for reuse without permission.
    Conditional or unsolicited offers from strangers
    ☞ A telephone caller or a web page tells you that you have a “virus” and offers to help you remove it. (Some reputable websites did legitimately warn visitors who were infected with the "DNSChanger" malware. That exception to this rule no longer applies.)
    ☞ A web site offers free content such as video or music, but to use it you must install a “codec,” “plug-in,” "player," "downloader," "extractor," or “certificate” that comes from that same site, or an unknown one.
    ☞ You win a prize in a contest you never entered.
    ☞ Someone on a message board such as this one is eager to help you, but only if you download an application of his choosing.
    ☞ A "FREE WI-FI !!!" network advertises itself in a public place such as an airport, but is not provided by the management.
    ☞ Anything online that you would expect to pay for is "free."
    Unexpected events
    ☞ A file is downloaded automatically when you visit a web page, with no other action on your part. Delete any such file without opening it.
    ☞ You open what you think is a document and get an alert that it's "an application downloaded from the Internet." Click Cancel and delete the file. Even if you don't get the alert, you should still delete any file that isn't what you expected it to be.
    ☞ An application does something you don't expect, such as asking for permission to access your contacts, your location, or the Internet for no obvious reason.
    ☞ Software is attached to email that you didn't request, even if it comes (or seems to come) from someone you trust.
    I don't say that leaving the safe harbor just once will necessarily result in disaster, but making a habit of it will weaken your defenses against malware attack. Any of the above scenarios should, at the very least, make you uncomfortable.
    6. Java on the Web (not to be confused with JavaScript, to which it's not related, despite the similarity of the names) is a weak point in the security of any system. Java is, among other things, a platform for running complex applications in a web page, on the client. That was always a bad idea, and Java's developers have proven themselves incapable of implementing it without also creating a portal for malware to enter. Past Java exploits are the closest thing there has ever been to a Windows-style virus affecting OS X. Merely loading a page with malicious Java content could be harmful.
    Fortunately, client-side Java on the Web is obsolete and mostly extinct. Only a few outmoded sites still use it. Try to hasten the process of extinction by avoiding those sites, if you have a choice. Forget about playing games or other non-essential uses of Java.
    Java is not included in OS X 10.7 and later. Discrete Java installers are distributed by Apple and by Oracle (the developer of Java.) Don't use either one unless you need it. Most people don't. If Java is installed, disable it—not JavaScript—in your browsers.
    Regardless of version, experience has shown that Java on the Web can't be trusted. If you must use a Java applet for a task on a specific site, enable Java only for that site in Safari. Never enable Java for a public website that carries third-party advertising. Use it only on well-known, login-protected, secure websites without ads. In Safari 6 or later, you'll see a lock icon in the address bar with the abbreviation "https" when visiting a secure site.
    Stay within the safe harbor, and you’ll be as safe from malware as you can practically be. The rest of this comment concerns what you should not do to protect yourself.
    7. Never install any commercial "anti-virus" (AV) or "Internet security" products for the Mac, as they are all worse than useless. If you need to be able to detect Windows malware in your files, use one of the free security apps in the Mac App Store—nothing else.
    Why shouldn't you use commercial AV products?
    ☞ To recognize malware, the software depends on a database of known threats, which is always at least a day out of date. This technique is a proven failure, as a major AV software vendor has admitted. Most attacks are "zero-day"—that is, previously unknown. Recognition-based AV does not defend against such attacks, and the enterprise IT industry is coming to the realization that traditional AV software is worthless.
    ☞ Its design is predicated on the nonexistent threat that malware may be injected at any time, anywhere in the file system. Malware is downloaded from the network; it doesn't materialize from nowhere. In order to meet that nonexistent threat, commercial AV software modifies or duplicates low-level functions of the operating system, which is a waste of resources and a common cause of instability, bugs, and poor performance.
    ☞ By modifying the operating system, the software may also create weaknesses that could be exploited by malware attackers.
    ☞ Most importantly, a false sense of security is dangerous.
    8. An AV product from the App Store, such as "ClamXav," has the same drawback as the commercial suites of being always out of date, but it does not inject low-level code into the operating system. That doesn't mean it's entirely harmless. It may report email messages that have "phishing" links in the body, or Windows malware in attachments, as infected files, and offer to delete or move them. Doing so will corrupt the Mail database. The messages should be deleted from within the Mail application.
    An AV app is not needed, and cannot be relied upon, for protection against OS X malware. It's useful, if at all, only for detecting Windows malware, and even for that use it's not really effective, because new Windows malware is emerging much faster than OS X malware.
    Windows malware can't harm you directly (unless, of course, you use Windows.) Just don't pass it on to anyone else. A malicious attachment in email is usually easy to recognize by the name alone. An actual example:
    London Terror Moovie.avi [124 spaces] Checked By Norton Antivirus.exe
    You don't need software to tell you that's a Windows trojan. Software may be able to tell you which trojan it is, but who cares? In practice, there's no reason to use recognition software unless an organizational policy requires it. Windows malware is so widespread that you should assume it's in everyemail attachment until proven otherwise. Nevertheless, ClamXav or a similar product from the App Store may serve a purpose if it satisfies an ill-informed network administrator who says you must run some kind of AV application. It's free and it won't handicap the system.
    The ClamXav developer won't try to "upsell" you to a paid version of the product. Other developers may do that. Don't be upsold. For one thing, you should not pay to protect Windows users from the consequences of their choice of computing platform. For another, a paid upgrade from a free app will probably have all the disadvantages mentioned in section 7.
    9. It seems to be a common belief that the built-in Application Firewall acts as a barrier to infection, or prevents malware from functioning. It does neither. It blocks inbound connections to certain network services you're running, such as file sharing. It's disabled by default and you should leave it that way if you're behind a router on a private home or office network. Activate it only when you're on an untrusted network, for instance a public Wi-Fi hotspot, where you don't want to provide services. Disable any services you don't use in the Sharing preference pane. All are disabled by default.
    10. As a Mac user, you don't have to live in fear that your computer may be infected every time you install software, read email, or visit a web page. But neither can you assume that you will always be safe from exploitation, no matter what you do. Navigating the Internet is like walking the streets of a big city. It's as safe or as dangerous as you choose to make it. The greatest harm done by security software is precisely its selling point: it makes people feel safe. They may then feel safe enough to take risks from which the software doesn't protect them. Nothing can lessen the need for safe computing practices.

  • How to create an infinite loop that cannot be cancelled?

    Hi , im new around java and i need a program that keeps on repeating after each each input/uses(generally meant for different user) and cannot either stop using "Cancel" or "x" while stopping only using the "stop" button
    I got a few lines of codes that look like this : String arg = "";
    do{
    JOptionPane.showInputDialog("hi");
    }while ( arg != "y" || arg!= "Y");
    and it cannot be stop with both cancel and"x"(which i wanted)
    but when i used this logic with
    Valid validUserInput = new Valid();
    do {
    userInput = validUserInput.validUserInput(a);
    switch(userInput){
    case 1 : validUserInput.optionOne(b);break;
    case 2 : validUserInput.optionTwo(c);break;
    case 3 : validUserInput.optionThree(d,e);break;
    default : validUserInput.validUserInput(f);
    }while(looping != "" || looping != " ");
    it does not really work(while it will keep looping, it can be easily stop by pressing cancelled or "x")
    So is there any logic or method that can prevent the program from being stop?
    Thankyou!

    elricscript wrote:
    "That is helpful. It gives him a direction where he can focus his research. Namely, 'how to run a program in kiosk mode' rather than 'how to create an infinite loop that cannot be cancelled.'"
    No... He already mentioned he wants to "e.g Interactive kiosk", so saying "properly kiosk it" isn't adding any new information. Rather it's just giving the person a dead point of: you're doing it wrong. Pointing out someone is wrong is not a positive enlightenment. Pointing someone in the right direction is more productive.
    >"That is helpful. It gives him a direction where he can focus his research. Namely, 'how to run a program in kiosk mode' rather than 'how to create an infinite loop that cannot be cancelled.'"
    No... He already mentioned he wants to "e.g Interactive kiosk", so saying "properly kiosk it" isn't adding any new information.
    Yes it is. He asked how to do it using some Swing trickery, and I said it won't work. Which is true. The OP didn't already know that, clearly, hence the question. Now he does. That's pretty much new information if you ask me.
    Rather it's just giving the person a dead point of: you're doing it wrong.Right. He is. However, the problem is now no longer related to Java, and not something I can help him with. You should try that: not answering questions you don't know the answer to. It's actually more helpful than posting misleading, wrong answers.
    Pointing out someone is wrong is not a positive enlightenment. I'm giving basic technical help, not yoga lessons.
    Pointing someone in the right direction is more productive.As already stated, I am as ignorant of how to make a Java application into a kiosk app as the OP is. What value can I add in light of that information? I began by answering a question that was not stated to be about kiosks. Once the question moved outside of my area of knowledge, I stopped trying to answer.
    I notice you're not giving him any help, being more interested in admonishing others as you are.

  • Keep getting a prompt to install java even when not surfing the net. I have java installed and the control panel says it is right version. Want to know how to stop prompts. This started after I installed Yosemite.

    Since installing Yosemite I keep getting a prompt to install Java even when I am not surfing the net. Went system preferences and I have recommended version installed. I want to know how to stop the prompts. I do not have this problem on my iMac.

    Most likely, you have either the Facebook video calling plugin or the "NexDef" plugin for watching baseball streams. Both depend on the Java runtime distributed by Apple. If you no longer need the plugin, remove it. Otherwise, install Java.

  • How to stop the java timer

    I tried writing a program for a scheduler using java , compiled and ran in java 1.6 .The code is given below
    import java.util.*;
    public class TimerTaskEx2 {
         public static void main(String[] args) {
              Timer timer = new Timer();
              timer.scheduleAtFixedRate(new TimerTask(){
                   public void run() {
                        System.out.println("Java");
              }, 5000, 1000);
    output
    Java
    Java
    Java
    Java
    Java
    Java
    Java
    The output of this program starts after 5 milliseconds delay and keeps running infinitely becoz the program is written only in such a way .
    but my actual requirement is the timer should start 5 milliseconds after i run the program and stop after 20 milliseconds .
    Here I need to know how to stop it at a required time interval
    I dont find any api regarding this in 1.6 spec .
    please clarify how to do that .
    Thanks
    Jee

    try this code:
    import java.util.*;
    public class TimerTaskEx2 {
         public static void main(String[] args) {
              Timer timer = new Timer();
              timer.scheduleAtFixedRate(new TimerTask() {
                   int i = 0;               
                   public void run() {
                        System.out.println("Java");
                        i++;
                        if (i > 3)
                             this.cancel();                    
              }, 5000, 1000);
    Also, make sure to close the alive thread too.

  • How to stop "FROM AROUND THE WEB" and "You May Like" from coming up on each page that I browse

    It is very frustrating when I am on Mozilla looking at various websites and on each page that I go to either "FROM AROUND THE WEB" or "You May Like" come up in the middle of the page with links to other websites that I am not interested in viewing.
    Also when I am shopping on the internet another pop up called Deals, brought by iWebar keeps popping up and also "Deals" by Deal Finder. I did not change any of my settings, I only updated Mozilla Firefox and then all of these things started happening. This is very frustrating and I want to know how to turn this off. I did not sign up for any of these things, and want to be advised on how to remove them.
    Could you please advise how to stop these as I really do not want these options as I am browsing and I will go back to Internet Explorer if this continues to happen. I look forward to hearing from you promptly. Thank you

    Hi Kerri,
    You should always pay attention when installing software because often, a software installer includes optional installs, such as this adware. Be very careful what you agree to install.<br>
    Adware gets on your computer after you have installed a freeware software (video recording/streaming, download-managers or PDF creators) that had bundled into their installation this browser hijacker.
    You can use the below steps to revert back to adware-less Firefox.
    1) <u>Reset Prefs</u>
    *Navigate to '''about:config''' in your Address Bar
    *Press the "I'll be careful, I promise!" button to proceed
    *Search for <b>iWebar</b> and reset all prefs that pull up by right clicking > Reset
    2) Remove any programs that you don't recognize or remember installing from your Control Panel (Start > Control Panel > Uninstall a Program)
    3) Remove any extensions that you don't recognize or remember installing from Firefox.
    *(Press the menu button ([[Image:new fx menu]] > Add-ons > Extensions)
    4) Download ADW Cleaner to wipe out any remnants of the adware.
    *http://www.bleepingcomputer.com/download/adwcleaner/

Maybe you are looking for

  • User privilages or changing users with RMI

    I'm exploring the use of RMI, and based on some tutorials I created a distributed application which uses RMI. I launch the RMI server under my admistrator account. However, when a user launches the client portion of my application and executes code o

  • "Must Restart Computer?"

    Last night I was on my iBook G4. Suddenly, a transparent grey box appeared and in 4 or 5 different languages (freezes up the whole system), it said that I must restart the computer by holding down the power button for a few seconds. I did that. When

  • Showing Line Items in KE30

    Is it possible to show individual billing documents (or even sales order documents) in KE30 as a drill-down option? If not, is there any report similar to KE24 that is able to show computed fields? Thanks!

  • Best way to mark data that has changed when it is edited in  a spark datagrid?

    I am not sure if this is the best way to mark data that has changed (isModifiedClientSide ) when it is edited in  a spark datagrid: <GridColumn  width="140" headerText="Margin "dataField="margin" editable="false"  editable.editMode="true"  >         

  • How long will shared fotostreams remain in  iCloud?

    I did Not really care about that as all pics have eben synced with Aperture. But now:  for how Long will they live in the cloud? Thx & br Dietmar