Why can't InputStream.read() be interrupted?

I have a native application that launches a java application. To allow for the communication between the two applications, the native app launches the java app with stdin and stdout redirected to a file handles. The Java application creates a thread to read from System.in. Everything works great -- UNTIL . . .
. . . the native app closes the communcation handles and exits, leaving the java application blocking on the InputStream.read().
My question is why doesn't the blocking InputStream.read() get interrupted when the communcation handle in the native app closes? This appears to be a BUG in Java. I would expect to get an exception or error on the read when the handle on the other sides exits.
My ideas to work around this would include changing the IPC communcation to a network protocol like sockets, or MMF. However, redirecting stdin and stdout seemed to be the simpliest IPC. Any other ideas or suggestions?
Cheers,
Kyley

Thanks for all your replies. Hearing others express the same idea that it should work the way that I had thought made me revisit how the native application was launching the application and how the handles were redirected.
After getting things working on UNIX (Sun Solaris), I looked again at the code (which I didn't write) that launched the java application on Windows. After rewriting the code, the original code wasn't duplicating stdin & stdout and closing one of the original handles. Once that was done properly, AMAZINGLY everything worked as I had intended it to work.
Thanks again for the time to reply.
Kyley

Similar Messages

  • Why can't I read or send messages on my IPad ?

    Why Can't I read or send my messages on my I Pad?

    Using FaceTime http://support.apple.com/kb/ht4319
    Troubleshooting FaceTime http://support.apple.com/kb/TS3367
    The Complete Guide to FaceTime + iMessage: Setup, Use, and Troubleshooting
    http://tinyurl.com/a7odey8
    Troubleshooting FaceTime and iMessage activation
    http://support.apple.com/kb/TS4268
    iOS: FaceTime is 'Unable to verify email because it is in use'
    http://support.apple.com/kb/TS3510
    Using FaceTime and iMessage behind a firewall
    http://support.apple.com/kb/HT4245
    iOS: About Messages
    http://support.apple.com/kb/HT3529
    Set up iMessage
    http://www.apple.com/ca/ios/messages/
    iOS 6 and OS X Mountain Lion: Link your phone number and Apple ID for use with FaceTime and iMessage
    http://support.apple.com/kb/HT5538
    How to Set Up & Use iMessage on iPhone, iPad, & iPod touch with iOS
    http://osxdaily.com/2011/10/18/set-up-imessage-on-iphone-ipad-ipod-touch-with-io s-5/
    Troubleshooting Messages
    http://support.apple.com/kb/TS2755
    Troubleshooting iMessage Issues: Some Useful Tips You Should Try
    http://www.igeeksblog.com/troubleshooting-imessage-issues/
    Setting Up Multiple iOS Devices for iMessage and Facetime
    http://macmost.com/setting-up-multiple-ios-devices-for-messages-and-facetime.htm l
    FaceTime and iMessage not accepting Apple ID password
    http://www.ilounge.com/index.php/articles/comments/facetime-and-imessage-not-acc epting-apple-id-password/
    FaceTime, Game Center, Messages: Troubleshooting sign in issues
    http://support.apple.com/kb/TS3970
    Unable to use FaceTime and iMessage with my apple ID
    https://discussions.apple.com/thread/4649373?tstart=90
    How to Block Someone on FaceTime
    http://www.ehow.com/how_10033185_block-someone-facetime.html
    My Facetime Doesn't Ring
    https://discussions.apple.com/message/19087457
    Send an iMessage as a Text Message Instead with a Quick Tap & Hold
    http://osxdaily.com/2012/11/18/send-imessage-as-text-message/
    To send messages to non-Apple devices, check out the TextFree app https://itunes.apple.com/us/app/text-free-textfree-sms-real/id399355755?mt=8
    How to Send SMS from iPad
    http://www.iskysoft.com/apple-ipad/send-sms-from-ipad.html
    You can check the status of the FaceTime/iMessage servers at this link.
    http://www.apple.com/support/systemstatus/
     Cheers, Tom

  • Why can't I read my book in Reader like I bought it?????

    It's been awhile since I used one of my eBooks but every time I double-click it brings me to a web-site to install DE. Even after installing it still takes me to DE. Even when I'm in DE the experience is less than pleasurable. Why can't I read it how I want to? I hate DRM!!!!! Way to kill enthusiasm for eBooks Adobe! Guess I'll have to repurchase a paper version.
    Who programmed this piece of crap anyway? Why can't I simply hold my down arrow to scroll the document like every other application in existence? Why does clicking above or below the thumb in the scrollbar not page up or page down like every other application in existence????? Why do I have to bring up some weird little window to zoom to anything other than a predefined width??? I am completely infuriated that I cannot read my book in the format I purchased it!
    Having it in Reader was so cool. I could double-click on the file and pick up reading where I left off. It almost felt like a book. Now it feels like locked digital content that I have to jump through a bunch of hoops to get to and that may or may not be there for me when I need it. Way to go idiots!

    With Adobe Acrobat 8.0, Adobe Reader 8.0 and the Digital Editions software, Adobe has really crippled the PDF reader. I supposed, eventually Adobe will address this issue, but here's what you can do now to get the functionality back:
    If you installed or upgraded to Adobe Acrobat 8.0 or Adobe Reader 8.0, uninstall the software and go back to Adobe Acrobat 7.0 or Adobe Reader 7.0. You can still download this version of Adobe Reader from Adobe's website.
    Uninstall the Digital Editions software completely from your computer.
    Go into Adobe Acrobat 7.0 or Adobe Reader 7.0 and disable the feature that automatically updates the software (to prevent your software from being upgraded to 8.0 without your knowledge):
    Edit > Preferences > Updates > select the option "Do not automatically check for critical updates"
    Change the file association for PDF files back to Adobe Reader 7.0 (or Adobe Acrobat 7.0): open up File Explorer > select Tools > Folder Options > File Types > find and highlight the PDF file type > select the "Change" button and select Adobe Reader 7.0 or Adobe Acrobat 7.0.
    This won't fix the books you've already opened in the Digital Editions software, but now when you download DRM protected PDF files, you can use them as you are accustomed to.
    Prof Julie -- Microsoft MVP Mobile Devices

  • Why can't I read a book purchased through iPhone ibook app on my MacBook Pro?

    Why can't I read a book purchased through iPhone ibook app on my MacBook Pro? Also, is there any way to print pages from book?

    In general if you want to read paid-for ebooks on your Mac, you need to buy them from one of the other sources like Kindle, Nook, Kobo, or Googlebooks and use the free OS X and iOS reader apps which they provide instead of iBooks.

  • HT4059 Why can't I read a book on my computer that I downloaded from itunes

    Why can't I read a book on my computer that I downloaded from itunes?

    ChaneyfromFA wrote:
    Why can't I read a book on my computer...
    To read a book on your computer, get the Kindle app for PC, and download the book you want from the Kindle Store.

  • Why can't I read iBooks with wi-fi?

    Why can't I read iBooks without wi-fi?

    if the iBooks are downloaded to your iPad they should be available to read in iBooks.
    If the iBooks were downloaded onto your computer and not sync'd to your iPad then they would not be availble, but as long as they are on the iPad you should be able to open iBooks and read them.

  • Why can't I read posts?

    Why can't I read posts? Is there an outage on the forum site or is my browzer doing something to block links? I can see topics and lists of posts, but only blank windows open when I click on a post. Of course, I won't be able to read your answer should this problem be at my end and it persists ... if a system thing, somebody should post a notice at the top level of the forum ... thanks.

    I dusted-off my old PB-1400 and now I can read the posts.
    I'm in the process of trouble-shooting a failed G4, so I had signed-in with a Win-PC running 98SE and IE v. 6. I had already tried clearing the cache and made sure cookies cleared, then enabled, etc. Still can't see posts. I downloaded Firefox 1.5 and tried that, still can't see posts. I have no problem with any other sites online that require special cookies, scripts, etc.
    Perhaps the Apple discussion site saw the machine was running Win98 and snubbed me??? If not that, there must be some wierd script or something. Go figure.

  • Why can i not read my yahoo email?

    why can i not read my yahoo email? after downloading fire fox 8.01 i can not read my e Mail in yahoo any more and some of my buttons do not work this has been going on for about two to three weeks. i am thinking about going back to fire fox 3.6 where i had every thing working right. you change things to often without working out all of the bugs. and add 10x more bugs. Stan

    Open up Font Book (located in the Applications folder) and look for Helvetica Fractions. If you find it, delete it. Restart Safari and let us know what happens.

  • Why can't I read my emails from my iPad mailbox on my iPad today?Each message is replaced by the comment "This message has not been downloaded from the server."thank you

    Why can't I read my emails from my iPad mailbox on my iPad today?Each message is replaced by the comment "This message has not been downloaded from the server."thank you

    In which case, clearly communicating the intent would have been a better solution.  The steps do apply.  A more appropriate response would have been "tried that, no change".
    Regardless of whether they fixed the problem or not, they do apply.
    If English is not your native language, I would strongly encourage you to post in your native language going forward.
    If basic troubleshooting has not resolved the issue, the next step is to take the device to Apple for evaluation.

  • Why can't I read my reading list offline on my iPad 4 iOS 8.1.1?

    Why can't I read my Reading List offline on my iPad 4 iOS8.1.1?

    The Podcasts app a separate app (it's icon is the same as shows in Settings). If you can't find it on any of your iPad's home screens (if you pull down the centre of the iPad's home screen then can you find it via the spotlight search field ?) then check to see if it's hidden via Settings > General > Restrictions > Podcasts set 'off'

  • Why can't I read my itunes ebook on my pc?

    Why can't I read my itunes ebook on my pc?

    Because ibooks are only for iphone/ipad/ipod touch.

  • HT204081 why can i not read the books i bought on itunes on my itunes/computer?

    i was just wondering why can i not read my books on my computer that i just bought online on the itunes store. do i have to download anything speffic?

    ibooks bought from Apple can currently only be read in the iBooks app on an iPad, iPhone and iPod Touch - so far Apple haven't made a Mac or PC reader for them, so you won't be able to read them on your Mac.

  • Why can't I read any of my resources in a jar file?

    For an application I was developing, I wanted to create a Binary File using the following code:
    DataInputStream in = null;
            try {
                File file = new File(name);
                in = new DataInputStream(
                        new BufferedInputStream(
                            new FileInputStream(file)));
            } catch (FileNotFoundException e) {
                System.out.println("Non-existential File.");
                System.exit(0);
    }I am using Netbeans 6.5.1., and it groups my projects so that there are folders for build, src, dist, nbproject inside the project folder. The application that I am developing is a graphics demo that requires the use of several text files to represent the maps, so I wanted to read them using a FileInputStream.
    I kept this file, "islandmap.txt", in the src folder in my project. In the method above, I coded my program so that the "name" would be "src\islandmap.txt", and it read from the file perfectly. However, I needed to compile it to a Jar file too. After doing that, the program no longer functioned. I remembered when I used a tutorial long ago that used
    URL url = getClass().getClassLoader().getResource(fileName) ... in order to get the directory of the files. That made sense, because a person who is running the program via Java Webstart or a Jar Executable would definitely not have the parts of the program located in the same directory, so the code is used to find where the java program is. However, I realized something...
    File file = new File( - constructor - )There are four constructors for files, and I only think I could use two. The first is using a string, like I have done before with "src\islandmap.txt." Now, the URL url = getClass().getClassLoader().getResource(fileName) part, it was used before to locate a URL in order to open a buffered image. The constructor for File does not support URLs, but instead supports URIs.I tried converting between the two, changing a URL into a string, and producing a URI from the string. But it did not work, giving me an error that URI was not hierarchical. And that's when I realized that they were certainly not interchangable.
    More specifically, here is my code as of now:
    public boolean loadMap(String mapName) {
            String path = "src/islandmap.txt";   //This is where the map files are stored
            mapName = getClass().getClassLoader().getResource(path).getPath(); //getPath changes the URL into a String
            DataInputStream in = null;
            try {
                File file = new File(mapName);
                in = new DataInputStream(
                        new BufferedInputStream(
                            new FileInputStream(file)));
                 //code to actually read from the file goes here
            } catch (FileNotFoundException e) {
                System.out.println("Non-existential File.");
                System.exit(0);
            } finally {
                 //close in
    }So that is my problem now. I am stuck. For my purposes, I basically must use a stored text file within my jar, but I don't know how to read it. It distresses me that normally, I already know how to open images that are located inside my src folder using URLs, but not any other file requiring a File class to be wrapped within a Buffered Writer/Reader. Could somebody please assist me with this, or suggest an alternative that would also fall under my conditions? I would appreciate it so much. Thank you.
    Edited by: celestialsalt on Dec 6, 2009 5:29 PM
    Edited by: celestialsalt on Dec 6, 2009 5:49 PM

    Start with
    URL url = getClass().getClassLoader().getResource(fileName)Then observe that URL has a [openStream()|http://java.sun.com/javase/6/docs/api/java/net/URL.html#openStream()] method that will give you an InputStream. Since you are reading text you might want to create an InputStreamReader from which you can do your reading much like you used the FileReader before when you were working with a File.
    Class also has a [getResourceAsStream()|http://java.sun.com/javase/6/docs/api/java/lang/Class.html#getResourceAsStream(java.lang.String)] which combines the first two steps into one. Ie use getResource() as you mentioned when you want to get a URL that some other class will use to read (eg an image) or use getResourceAsStream() when you are going to do the reading yourself.

  • Why can't I read old iMessages on iPhone 5c?

    Suddenly I am unable to scroll back further than 1st November in a particular iMessage conversation, the thread only started in October when I got the iPhone I have contacted Apple who are unable to explain why this has happened. My message settings are set to keep messages forever but what is the point of this if you can't actually read them! Any thoughts or ideas would be gratefully received.

    settings / messages - there should be a "toggle" here to turn it on or off

  • Why can i not read my mail in firefox5.0,could before

    have this odd question perhaps but.
    problem began when firefox was updated to 5.0.
    before that it was no problem reading my meil.
    I still can open meilbox,but nothing shows.
    have just to be sure two meil accounts on different places
    hotmail.com and telia.com.Its the one at telia.com that does not work.Why is that?
    Have asked telia the same question...just to be sure

    To be able to read ibooks on a Mac you need the iBooks app, which is only available in OS X Mavericks.
    You might be able to read some of them (e.g. free ibooks or those from publisher's such as O'Reilly who don't include digital rights management on their books) in programs such as Calibre, but the majority of ibooks can only be read in the iBooks app on iOS devices and Mavericks.

Maybe you are looking for

  • Cant add music to my zen to

    I have the latest firmware the playfor sure version everything works shows up as an extra HD etc But when i go to drag and drop my files onto the player i get cant add file do not have permisson to create It it was all work fine untill then! I dont w

  • BT Infinity Usage Monitor not updating.....hmmm???

    This happens at the end of every month.  I'm starting to think it is an actual ploy from BT to stop users from knowing how much broadband usage they have left?  The usage monitor normally starts acting up around the 25th of every month....then you ge

  • Changing default email provider when submitting a form

    I created a form in LiveCycle and when I click on "Submit", (I have an email submit button set up on the form), it opens up a message in outlook, instead of just sending it to the email address I provided, how do I fix this? Thanks.

  • Im already create a new id but still maintain with previous id n what should do to ensure there is a new id.

    Hi, Im using rightknow iphone4s. which just a 3hrs ago,n i created the new id was successful but still unable to login in new id so what should i do. Thank you

  • MacBook Pro (2011) 13 inch won't boot up

    The computer will chime. The screen is grey with the apple logo. There is a status bar below the apple that takes about 5 minutes to get  the end. Then the computer shuts down. I tried the shift, option, command trick...doesn't work. Also tried optio