Question about System.in, FileoutputStream and blocking

Hello everybody,
I have written a simple java program that read the System.in and append it to file (which is the first argument of the program).
Here is the context: my client launch several instance of this program at the same time, with the same file passed in argument. In a first time, I did not use the FileChannel.lock() method because I didn't know there will be several instance, but this is not the question.
The problem is simple: sometime, I can't figure why (and this is why I'm here to ask you), one of the process block, and stay like this until my client kill it.
So why? It has something to do with the absence of FileChannel.lock()?
My client is on Solaris, don't know which version, with a JDK 1.5.0_04
Here is the code:
InputStream is = System.in;
InputStreamReader ir = new InputStreamReader(is, encodingMode);
BufferedReader reader = new BufferedReader(ir);
FileOutputStream fos = new FileOutputStream(args[0], true);
String lineSeparator = System.getProperty("line.separator");
String buf = null;
while ((buf = reader.readLine()) != null) {
     fos.write(buf.concat(lineSeparator).getBytes(encodingMode));
}I think the FileChannel.lock on the output file will solve the problem, but I'm just curious about that odd issue.
Thanks for help, and excuse me for my bad english.

Ok, I try to launch 20 occurences at the same time on opensolaris 2009.06 and here is what I've got:
Error occurred during initialization of VM
Could not reserve enough space for object heap
# An unexpected error has been detected by Java Runtime Environment:
# java.lang.OutOfMemoryError: requested 32756 bytes for ChunkPool::allocate. Out of swap space?
#  Internal Error (allocation.cpp:120), pid=1603, tid=2
#  Error: ChunkPool::allocate
# Java VM: Java HotSpot(TM) Client VM (11.3-b02 mixed mode solaris-x86)
# An error report file with more information is saved as:
# /export/home/eric/SocGen/hs_err_pid1603.log
# If you would like to submit a bug report, please visit:
#   http://java.sun.com/webapps/bugreport/crash.jsp
Error occurred during initialization of VM
java/lang/ClassNotFoundException: error in opening JAR file /usr/jdk/instances/jdk1.6.0/jre/lib/rt.jarI've also got a nice core file and a hs_err_pid1603.log ( here: http://pastebin.com/m513df649
Funny think is that I can't reproduce it on AIX.
Hope that can help you helping me.
Edited by: Eric-Fistons on 13 oct. 2009 13:43
Edited by: Eric-Fistons on 13 oct. 2009 13:45

Similar Messages

  • HT201263 What will i do?screenshot There is a problem with your iPhone. Please visit the Service Answer Center to find answers to all your questions about service options, warranty and other processes in your country. To find your nearest Apple Store, cli

    What will i do? ITune screenshot is as follows >
    There is a problem with your iPhone. Please visit the Service Answer Center to find answers to all your questions about service options, warranty and other processes in your country. To find your nearest Apple Store, click here.

    Do what it said to do.
    "Please visit the Service Answer Center to find answers to all your questions about service options, warranty and other processes in your country. "

  • TS1814 There is a problem with your iPhone. Please visit the Service Answer Center to find answers to all your questions about service options, warranty and other processes in your country. To find your nearest Apple Store, click here.

    There is a problem with your iPhone.
    Please visit the Service Answer Center to find answers to all your questions about service options, warranty and other processes in your country.
    To find your nearest Apple Store, click here.
    Please help me i can aktivate my phone imei 012423006333181.

    There is a problem with your iPhone.
    Please visit the Service Answer Center to find answers to all your questions about service options, warranty and other processes in your country.
    To find your nearest Apple Store
    no imei also

  • A simple question about the Integration process and the PI system

    Hi all
    Out PI system gets more and more slowly .
    in the Monitor I can se that there are many ufinished IP about 100.
    in the Outbound colon there is a Watch icon with the message
    QMessage being sent                     
    and in the graphic of the IP thers is a Send Message Asynchronously  with text in process.
    my question is can those unfineshed IP be guilty in slowing down the system by taking resources, they have been there for quit a long time .
    Thanks

    Hi again
    I have checked sm12 , no locks
    theres is no mapping involved in this step , the IP is trying to send a file to  server.
    I just want to know if  100 unfinished IP slow down the system .
    It does not matter if the file has been sent or not
    is there any way to check those IP if they are taking resources.
    Thanks.

  • Problem\question about System.in and DataInputStream

    Hello everybody,
    I have the following code, trying to read an int and a string into two variables using System.in and DataInputStream:
    package objectIO;
    import java.io.*;
    public class WriteStudentObject
         * @exception IOException Can not read the file
          public static void main(String[] args)  throws IOException
              a loop could be used here to create more than one
              student object and write each one to a file
              Student mary = new Student("Mary Martin", 12345);
              // open inputstream to read data from keyboard
              InputStream is = System.in;
              DataInputStream dis = new DataInputStream(is);
              int  g;
              String c;
              for (int i =0; i < mary.grades.length ; i++)
                  System.out.println("Enter a grade for test" + i);
                  g  = dis.readInt(); //*QUESTION 1*
                  System.out.println("Enter a comment for test"+i);
                  Datainput stream can read String
                 and store as text or reverse
                  c = dis.readUTF(); //*QUESTION 2*
                  mary.grades= new Grade(g,c);
    try
    FileOutputStream fos = new FileOutputStream("c:\\personal\\test\\studentObject.dat");
    ObjectOutputStream oos = new ObjectOutputStream(fos);
    oos.writeObject(mary); // write obj to file
    oos.close();
    } catch(IOException e) {
    System.out.print("Error: " + e);
    System.exit(1);
    The class uses a Student object -attributes are name\String, id\int and Grades (Grade class has grade obtained\int and a comment from the teacher\String).
    My questions are: (as bolded in the code)
    1) at "g  = dis.readInt()" I have to press Enter 3 times to finish the reading (one after entering a single int and then just 2 times Enter). Should I add bellow this line "System.in.read()" to clear the newline\return character?! What exactly does "System.in.read()" clears? After leaving the method readInt() the variable g has an enormous value... like 9 digits... why? I also tried "g  = (int)dis.readInt()" but the results are the same... I want to read an int from keyboard, but using DataInputStream, not with System.in.read()
    2) at this line the program never ends, it tries continuously to read characters... no matter what I enter it does not complete... I want to read a String from keyboard, but again using DataInputStream...
    Many thanks in advance (and hopefully now I can assign the offered stars...)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    don1983p wrote:
    I read an int form keyboard with 'int read_int = System.in.read();' but why I must, after this line, enter a new System.in.read()? (what does this clears? the return character? )Yep. Note that InputStream.read() only reads the next byte of data. If your user had input something that required multiple bytes to represent, you would not have read all of it.
    Fun Fact: Even if you had used Scanner.nextInt() to get your integer from the console, you still need to do a .nextLine() as .nextInt() only reads up to the newline and does not consume it.

  • Some questions about Unity 4.0 and IPC

    I have a couple of questions and I was looking for "real world" answers, not specific answers from the design guide.
    1.What is this bandwidth requirement between Exchange and Unity and what is it used for?
    2. What sort of issues would we experience if we placed the Unity UM Server at the Colo and placed the Exchange server at the customer premise; with a single T1 between the sites?
    3.What else is involved with a Unity UM install vs. a Unity VM install?
    4.Does the Unity UM and Exchange servers have to be running AD?
    5. Can Unity or the Exchange box be the Domain Controller? Or does it need to be a separate server?
    6. Where does a vm message get streamed from? The Unity server or the Exchange server?

    No you do not pay for FaceTime. It uses your WiFi network, so if you have access to WiFi it is free.
    There is no server required for FaceTime, it will use a direct device to device protocol.
    I can't answer the question about using phones in different countries as that will depend on if you buy a phone that is locked to a carrier.
    If you buy a phone in Germany and it is locked to a German phone network then it will most likely not work with a SIM from Turkey. You would need to buy an unlocked phone which are very expensive as they do not have any carrier subsidy applied to the price.

  • Various questions about System Restore Point

    How can I delete old System Restore Points?
    Is it possible to move the folder that holds them to a different drive then C:?
    Can I limit the amount of data System Restore is allowed to have?
    I have downloaded the TreeSize program to see what is using up so much space on my SSD and a folder named "System Volume Information" has 17GB of storage. Now I have found out that this is the folder that keeps System Restore Points and I checked
    on my restore points. There are too many of them and I was wondering if I could delete some of the old ones? I read on another post that someone said that you could limit the amount of data System Restore is allowed to use. Is this possible?
    Best Regards.

    Hello HurricaneHojax,
    Here I list the requirement, and please correct me if I have misunderstanding:
    1. Delete some System restore point
    2. Move the folder that hold system restore data to a different drive then C:.
    3. Limit the amount of system restore data.
    1, We can delete some system restore point.
    For more information, please take a look at the following article.
    http://windows.microsoft.com/en-hk/windows/delete-restore-point#1TC=windows-7
    2,We are not able to move the system restore folder to other Drive.
    3, We can limit the amount of system restore data.
    For more information, please take a look at the following article about managing the disk space that is used by System Restore.
    http://windows.microsoft.com/en-hk/windows7/how-much-disk-space-does-system-restore-require
    Best regards,
    Fangzhou CHEN
    Fangzhou CHEN
    TechNet Community Support

  • Question about using 10g/11g and APEX ...

    Hi,
    I just recently learned of Oracle's APEX and have a few questions about using it.
    Can I use APEX with express, standard, and enterprise editions of 10g and 11g?
    Are all of these free to use?

    You might want to read about APEX rather than jumping into questions that are reasonably well documented. Info at http://www.oracle.com/technology/products/database/application_express/index.html
    Your specific questions:
    1) Apex is a package that can be installed into any properly licensed database.
    2) The price for the production license of the database varies by edition.
    The price for Express Edition is $0 for use in production. Part of the cost for that edition is 'no Oracle Support based support, no patches, data volume limitation, etc.'

  • Questions about JVC GZ HD7 and Final Cut

    i'm planning to buy a JVC GZ HD7, but i have some questions about it...
    My imac configuration is
    Imac 20" late 2006
    1 Gb Ram
    Leopard 10.5.2
    Final Cut Studio 2
    Ok
    So my questions are:
    1- When shooting the best setting for me is the 1440cbr, or 1920x1080
    is better? i would like to have progressive instead of interlaced
    moviefiles, but for what i have read the JVC HD7 only shoots interlaced...is possible to turn them into progressive after working in final cut?
    2- In Final Cut Pro what are the sequence settings and the video
    settings for a video shoot from this camera?
    I would like to know the best settings possible for me,
    regarding that i would like to edit in real time, no rendering needed,
    and to have the best image quality that this camera can offer...

    FCE is designed to work with DV/HDV files. It cannot work natively with MPEG2 files. You will need something like MPEG Streamclip to convert your files to a format that FCE understands
    Streamclip is free but you need to buy Apple's MPEG Playback Component to make it work

  • Techie Question about iWeb, outbound links, and Google Analytics

    Hi,
    I have a kind of pretty technical question about using Google Analytics (GA) with iWeb sites to measure clicks on outbound links. Here's the setup:
    1) My website's online, and GA is working properly.
    2) I don't sell stuff directly, but I do have a "Purchase" page which contains a link to a specific Amazon page.
    3) I'm pretty sure I can measure how many people go to the Purchase page using GA, but how do I measure whether visitors click on the Amazon link? It would be interesting to me to be able to gauge what the conversion rate is; that is, how many people actually proceed to purchase the product at Amazon.
    I've checked the GA instructions and there's a page about manually tracking clicks on outbound links but it requires some code inputting. I know zero about coding, but I'm pretty sure that in iWeb you can't get access to the source code to input the required code.
    Am I wrong about this? And if I am, then does anyone here know how to measure the clickthrough rate?
    Anyway, hope you can help. Thanks in advance.

    I don't know about the link tracking but you could have the link take you to a redirect page which automatically sends them to Amazon.com after a preset time, 0 seconds to whatever you'd like. You can put a counter on that redirect page, like StatCounter. StatCounter can tell you how many, from where they came, i.e country and area, repeat visits, etc.
    Tutorials #12 & #13 describe how to put a visible counter on a page but with a redirect page you wouldn't have to bother since it wouldn't be seen. You can get all of your information from your account on the StatCounter site.
    The redirect page would be a simple plain text page titled redirect.html and would look like this:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="refresh"
    content="0; Destination URL">
    <title>Redirecting or whatever you'd like to appear at the top of the browser</title>
    </head>
    <body>
    </body>
    </html>
    0 Is the number of seconds to wait before redirecting the visitor. If set to zero the visitor would not know they were being redirected. Replace Destination URL with the Amazon URL you want them to go to.
    OT

  • I just have questions about the AirPort Express and how it works.

    My household Wi-Fi is not the strongest in  my room and I found out about the AirPort Express and I read the overvie, but I still have some questions on how it works, how its setup and other questions as well.

    The AirPort Express will not wirelessly extend the signal from another router unless that router is also an Apple product.
    Not sure what other questions you might have, but we'll try to answer if you want to ask.

  • Questions about system connections

    Would someone help me clarify something?
    When the ECC QAS system has been copied from the PRD system, the connection between the ECC QAS and the BID system is broken. I was told by Basis that after the copy, the connection has to be restored, and for some reason restoring the connection between the QAS and the BID system, the InfoSources and their transfer rules are completely wipe out from the system.
    We are using the business contents and have not yet did the migration.
    I am not sure why restoring the connection between the ECC and BID system would cause the InfoSources to de deleted. Has anyone come across this problem? Is it something that Basis can prevent from happening? I have not seen this from BW 3.5.

    Hi,
    We tried your suggestions but it is still wiping out the InfoSources. We are aware that the broken connection between the ECC and the BI systems will allways occur when we do a copy. Restoing the connection between the ECC and BI systems is causing the wipe out of the InfoSources.
    We're asking if anyone has come across this problem and was able to fix it,
    Quote of the day:
    "Arrogant idiots go to hell..."

  • Question about suitability of iPhone and specific comparisons

    I like the Verizon network (for which I'm considering upgrading to the Omnia II) but am thinking about biting the bullet and going to AT&T for the iPhone. I use Macs at home and at work. My main uses will be phonecalls (with reliable voice dialing from my car - bluetooth stereo and earpiece), mail (Exchange server access for calendar, mail, and addressbook), internet through the cellphone network (not wifi) - browsing, SFTP, VNC, etc., watching videos, photos, and listening to music, calendar reminders (as well as periodic sound reminders for missed calls, voicemails, etc.), opening PDF and Word documents, GPS (ideally with spoken driving directions),and Skype. Given these uses, can anyone advise me if there's anything here that is a problem for the iPhone?
    thanks,
    Mike

    "VNC"
    There are pretty nice VNC clients for the platform, the best being Jaadu VNC. (See my just-published "Everything you will ever want to know about the remote desktop controllers on the iPhone" for more info if interested; it's been cross-posted to several iPhone forums. Not this one - yet - as I still don't have Level 1.)
    watching videos
    The 3G S (but not the 3G!) is far better than current for example Windows Mobile or Symbian phones in that it can play back MPEG-4 / H.264 videos without excessive power consumption. That is, if all your videos are in this format, the 3G S is the way to go.
    Nevertheless, if your videos are in DivX, XviD or - even worse - WMV, you won't be able to natively play them back - you'll need to transcode them first.
    This, unfortunately, also means WMV streaming TV stations are far harder to watch than on, say, Windows Mobile. The only AppStore app ("Streamer") supporting them is really bad and delivers dismal performance, even on the 3G S.

  • Urgent Question about System Center Server Names and Dashes

    Hey guys I have a quick Urgent question that would be awesome if it happens to get answered quickly :). 
    So in the past we had problems with different server names in components of System Center when setting up different servers.... I never myself saw the errors or what it did, but an absentee colleague did. For example is anything wrong with a name setup like
    xx-scom-01 / xx-scom-02  as compared to the standard scom01 scom02? We have a certain naming convention we are moving to and I wanted to see if this was fixed. I wanted to say it had something to do with the hyphens... anyways any foresight anyone can
    provide would be awesome. Thanks!

    Dashes in the name will work fine.
    Jonathan Almquist | SCOMskills, LLC (http://scomskills.com)

  • Questions about XI ADD-ON and BUSINESS SYSTEM

    Hello,
    Is it possible that somebody validate these point ?
    I want to use ABAP proxy in a SAP 4.7 (WAS 6.20) to communicate with a SAP XI 2.0, for that i should configure my SAP 4.7 as a business system and i should install the XI ADD-ON APPINT right ?
    Is it possible to do that if my SAP 4.7 is an non unicode system ?
    Is it possible to do that if my SAP 4.7 is an ORACLE version ?
    Best regards,
    Vincent LECONTE

    Hello!
    > I want to use ABAP proxy in a SAP 4.7 (WAS 6.20) to
    > communicate with a SAP XI 2.0, for that i should
    > configure my SAP 4.7 as a business system and i
    > should install the XI ADD-ON APPINT right ?
    Correct.
    > Is it possible to do that if my SAP 4.7 is an non
    > unicode system ?
    > Is it possible to do that if my SAP 4.7 is an ORACLE
    > version ?
    This should be possible, we have installed the XI ADD-ON on a non-Unicode Oracle WAS 6.20 system and it can communicate with XI 2.0 using ABAP proxies.
    Regards, Tanja

Maybe you are looking for

  • Use of video effects

    I wonder if there's a novice out there like me who has tried to edit effects for an old VHS and found some short cuts?  eg. I have an video that's only about 20 years old but because it was taken inside at night it's quite dark and grainy, not to men

  • Having trouble downloading OS X Mavericks

    Having trouble downloading OS X Mavericks

  • Quicktime error, windows xp and guitar world cd

    at first it ran fine, then i got a macromedia projector error. now when i install gitar world cd, it tells me quicktime 7.0 or higher is needed to run disk iv`e uninstalled and re install quicktime stand alone player a million times with no luck,keep

  • Permission to create bootable media

    what are the needed permissions needed for a user to create a bootable media? We are encountering the error "Error invoking WMI method SMS_Site.SubmitRegistrationRecord (0x80041001)" The user who is creating the bootable media was already part of the

  • WRT54GS v7 Password Problems

    Hello, I have the WRT54GS V7 Router and i had tech support help me set this up. We had it running in no time including the security features. We did not however change the password we left it at the default password. I figured i would change later, a