ObjectInputStream.available() is zero

Hi,
i have a huge problem:
i have my deserialization and the file that has to be deserialized in a package.
When i add those source files to my workspace and run the application from eclipse, my ObjectInputStream has no bytes available, although it finds the resource.
What could be the reason for that?
Liz

let me be more specific ,
i guess you know the CubbyHole problem, where 2 different threads(producer/consumer) hold the same object(CubbyHole).
now, suppose u have 2 objects CubyHole1 and CubbyHole2 which 2 different threads hold them . and you want to access both of them (in a sequential manner) but not to be blocked when you access each one of them .
the operation that the CubbyHole does when accessing to it is : " ObjectInputStream.readObject() " .
" ObjectInputStream.readObject() " is a blocking operation. as most of the programers would use some kind of available() method before accessing the CubyHole ,but available() always retur....... . so no such a solution is supplied by the Java Sun.(not that i have complains , they really did a great job with all the documentation....)
I didn't invent the CubbyHole problem, this is a solution that is supplied and i use it. now u suggest me to
take that CubyHole1 and CubyHole2 and make each one of them a thread !!!??!!
well ,i don't think it should be the solution for a problem that can and should be solved by the Java Sun developers ( the available() issue ).
anyway , if there is no other choise (except for the third solution that i suggested and the ugliest one) ,
i will use the "CubyHole is a thread " ,but it will make me other problems , i really rather to work here sequentially and not asynchroniaslly way.
if u have a solution that i don't see , i would really appreciate it if u help me with that ( isn't that the reason why we are here ? ) , since it is not a main issue in my project and i have many other things to do ,like all of us .
thank you
and fuck the system

Similar Messages

  • ObjectInputStream from file.. EOF ?

    I have saved objects (Obj) from Vector(thing) to a file like this:
    ObjectOutputStream safe = new ObjectOutputStream(new FileOutputStream("file.obj"));
                   for(int i=0; i<thing.size(); i++)
                        Obj apu = (Obj)thing.get(i);
                        safe.writeObject(apu);
    No problem on this, the file.obj seem fine (it contains obviously things there should be.....)
    But I need to read the objects from this same file (file.obj)
    how ? This is propably the right start... but how to get EOF (End Of File, as in Visual Basic one can use NOT EOF in while loop)
    ObjectInputStream r = new ObjectInputStream(new FileInpuStream("file.obj");
    Thanks, P_trig

    Well, the idea seems to be correct, but there is one Problem:
    If you also want to write to "levyt.obj", and levyt.obj is often updated with the ObjectOutputStream.writeObject() method, there is always the mysthical number and version added to the file (at all about 4 Bytes). So FileInputStream.available() does NOT return the correct files that can be read.
    Does anyone have solution for this Problem?
    If you did not understood my bad English: here is some example-code:
    File testFile = new File("test.dat")
    for (int = 0; i < 5; i++) {
    ObjectOutputStream oos = new ObjectOutputStream((new FileOutputStream(testFile.getName(), true));
    //do code
    //close oos
    FileInputStream testInput = new FileInputStream(testFile);
    ObjectInputStream ois = new ObjectInputStream(testInput);
    int howMany = ois.available() // always zero (???)
    howMany = testInput.available() // should be: (Number of Objects in the file * size) + (5*4) bytes
    This is not very good for MY code, because my objects stored in the file are only 17 bytes, and i do not want to write a parser for the file.
    so the best way seems to be at the moment to do it via the exception handling.
    Okay, so far....
    hope someone knows the answer for this problem
    P.S.: My code throws a StreamCorruptedException, and not an EOFException

  • ITunes available app update count is incorrect - off by 1

    so for the past couple weeks i've been having this problem with itunes app updates. on the left-hand side of itunes where "apps" is, the number that pops up next to it to show the available updates to be downloaded is off by one. if i click and try to install available updates, i receive the notification that there are no new updates to install for any of my apps, but the number still shows one! totally frustrating.
    i googled this and have only found one possible solution found on an older itunes support forum, but i have no idea what it means or how to go about this:
    +"I experienced this same issue. An update number in iTunes, yet nothing to update once you click the update link.+
    +I also realized that I had duplicates in both iTunes itself and in the Music > iTunes > Mobile Applications Folder. The number of duplicated apps matched my false "update number."+
    +So, if an application was duplicated in either iTunes itself or in the Mobile Applications Folder, I made sure that each duplicated app was already synced to the iPhone, then simply removed the duplicated applications from both iTunes and from the Mobile Applications Folder.+
    +Then when I did my next sync, I made sure to choose the "transfer" button to have my apps synced back into iTunes. Once this was done, the problem completely disappeared. I hope this helps you!"+
    can please someone help me figure this out? and if by all means you have a better/clearer solution, please let me know. very much appreciated! thanks!

    I had the same problem despite regularly updating my Apps. Problem was that somewhere during the early days of using iCloud iTunes got me logged in to with my mac.com account, rather than my long running imran.com account. Result, I have 8 apps that got purchased with that mac.com ID.
    Even until now Apple has failed to provide a way to merge two AppleIDs.
    So, now I have to go through the annoying step of logging out of my main iTunes account, logging in with my mac.com account, downloading the available updates for that, then remember to logout and log back in with my primary account. That brings the app update count available to Zero.
    Convoluted situation brought to you by Apple's failure to provide linking or merging AppleIDs. Hope this helps.
    Imran

  • How to override InputStream.available()

    Hi,
    InputStream.available() always returns zero.
    now i have a requirement where I want to know total size of data in an InputStream.
    Note: I don't want to read all the data byte by byte into an byte[] etc etc.
    the reason is that data can be huge and i don't want to keep it in memory.
    Regards
    Apratim

    I'm glad you don't want to keep huge amounts of data in memory but I would consider 512Mb as huge myself.
    To override InputStream.available() all you have to do is override InputStream.available(). But if the information you want isn't available, tough.
    FileInputStream.available() returns the length of the unread portion of the file, although I don't rely on it personally. Various other implementations of available() return zero. For example, SSLSocket.getInputStream().available(), because the stream can't know without decrypting, and it mightn't have an entire cipher block to decrypt, and you wouldn't want it to block getting the rest of the cipher block so it could decrypt so it could tell you how much data was available without blocking, so what else can it do?

  • Sumif or something like it

    Post Author: Steve1040
    CA Forum: Formula
    I have 2 fields
    Availability and responsetime
    I'm trying to calculate average responsetime for an application while the application is available.
    So if Availability = 0.00 I don't want to include this in my summary.
    Avail----
    Resp
    99.00----
    1.5
    99.00----
    3.7
    0.00----
    188.5
    99.00----
    4.5
    In the above example I want to Something like AverResponse =   Sum Resp(Line 1,2,4)/count Resp (Line 1,2,4)
    I've spent hours on this and I can't find a solution.
    Any suggestions?
    Thanks
    Steve

    Post Author: amr_foci
    CA Forum: Formula
    you can make a formula which return 0 if the "avail" is zero, and take the total of this formula
    lets say  AA = if (=0) then 0 else
    then take SUM()
    good luck

  • Issue with opening stock balance in 2LIS_03_BX in BW

    HI GURUS,
    for some of the material we are not getting correct inventory stock available in BW report.
    where we have customised KF for inventory stock-non cumulative (based on difference of stock receipt and issued).
    The stock qty is  not considering the opening stock balance and hence this is coming as -ve in BW report.
    and but i checked the data in cube stock issued = stock received so ideally the stock should be zero .Also i have seen that i am not able to see stock intilized data in cube .
    also i ran the report for posting date on which stock intilization was done in BW and stock for material is coming as zero
    so hence all material where we have problem are those which has opening stock balance in  BX data source.
    we have also checked in R3 in t code MB51/52 and the stock available is zero but BW report shows -ve stock.
    Note that this problem is not for all stocks and also marker update settings are correct.We have also checked settings in RSDV .they are maintained relative to time..
    Please share your thoughts on this issue..
    thanks
    nilesh

    Have you compressed requests other than BX load and BF init load? If not run the infocube with 0RECORDTP = 1. This will give you the inital stock setup by the BX load. By default, when you run the non-*** infocube you will get records with RECORDTP '0' only. Whenever compression is done, the reference points get changes and records get written with RECORDTP '1'. If subsequent BF delta loads are also compressed i guess it would be difficult to differentiate. We have an OSS note on the importance of RECORDTP. Please check in service market place.
    One important point to note is that the BF init shoud have been done for the same selections as the BX load as the load (BF init) brings in movements for the stock already setup by BX. If there are differences in the selections for the 2 loads initially or setups were done on different days for these datasources, you could endup with issues.

  • Variance in MB5B and MMBE / LS26

    Hi There ,
    The stock on Posting date ( T Code - MB5B ) shows zero till today, where as the Stock overview MMBE / LS26 shows the correct figure as required .
    Could anybody throw some light regarding what exactly is the logic behind the MB5B report . To my understanding MMBE / LS26 should sink with each other .
    Thanks in advance for your kind help !!!!!!!!!
    With Warm Regards
    Manoj

    Hi All ,
    Thanks to all of you for your kind and quick reply .
    As per the request from Anand ..The MB5B shows stock received as well as stock isssued till 12-12-2006 is same , so the stock available is zero . but on the same date 12-12-2006 System allowed to do Transfer Orders with a quantity ...my presumption is that if the stock in MB5B on 12-12-2006 is zero then how System allowed to do a posting of TO with a quantity ..
    MB5B I believe includes the unrestricted stock ..
    Kindly assist ...thanks again in advance for your kind help .
    Best Regards
    Manoj

  • Problem in Capturing & Posting Excise Invoice

    Dear Experts,
    As my client is facing problem to post Excise Invoice.
    User has done Import PO, Invoice Verification for custom duties(BOE) and GRN. When i am going to capture excise invoice reference with Material Document i found that Part I entry is already created but Internal Number and Year showing Zero i.e.not generated.
    User already dispatched material so we cant cancel GRN and update RG23A Part I entry through J1I5. Now i need to Post excise invoice but i dont have Vendor Excise Invoice and Internal Excise Invoice Number. Please tell me procedure that how to Update RG23A Part II entry.
    Immediate reply appreciated.
    Sac

    hi,
    there seems to be some problem at the time of GR.
    Since Part1 has been created , its a bit difficult to take part1 because as u told internal no. & year is bank.
    How ever you can folow one of the paths below to serve your purpose of cenvat credit availament.
    1. Capture against GRN -J1IEX and save. Check whether part1 link is available with the ID.
    If not take the credit through J1IH->additional Excise & give ID no. as reference doc no there.
    2. If Part1 tab is present after creation of ID but credit available is zero, try changing the material type & saving the ID which will trigger A part1 cancellation so that correct part1 can be done later & credit can be availed through j1iex itself.
    These steps may involve a solution other possibility which is always open is debug but thats not suggested.

  • Time machine: An error occurred while copying files. The problem could be temporary. If the problem persists, use Disk Utility to repair your backup disk.

    Time machine backups are failing. I've followed the instructions I found on the Time Machine troubleshooting page (http://pondini.org/TM/Troubleshooting.html) but have gotten to where I don't know what to do next.
    Sequence of events:
    The main error message is always:
    An error occurred while copying files. The problem could be temporary. If the problem persists, use Disk Utility to repair your backup disk.
    Yesterday, I opened Disk Utility and verified the disk. Got this error:
    Error: This disk needs to be repaired using the Recovery HD. Restart your computer, holding down the Command key and the R key until you see the Apple logo. When the OS X Utilities window appears, choose Disk Utility.
    I ran Disk Utility and repaired the hard drive. Then I manually started the backup before going to bed, figuring it was going to take a long time to run. When I got up this morning, the backup had failed with the same "could be temporary" error. I checked the log, which says:
    Starting manual backup
    Attempting to mount network destination URL: afp://Tery%20Griffin;[email protected]/Tery%20Griffin's%20Time%20Ca psule
    Mounted network destination at mount point: /Volumes/Tery Griffin's Time Capsule using URL: afp://Tery%20Griffin;[email protected]/Tery%20Griffin's%20Time%20Ca psule
    Disk image /Volumes/Tery Griffin's Time Capsule/Tery Griffin’s Computer (44).sparsebundle mounted at: /Volumes/Time Machine Backups
    Backing up to: /Volumes/Time Machine Backups/Backups.backupdb
    Event store UUIDs don't match for volume: Macintosh HD
    Error: (-36) Applying backup protections to /Volumes/Time Machine Backups/Backups.backupdb/Tery Griffin’s Computer (44)/2014-03-05-201742.inProgress/ABB10CF2-F041-4DE5-B6AE-3C228B59ADCC
    Error: (5) setxattr for key:com.apple.backupd.SnapshotStartDate path:/Volumes/Time Machine Backups/Backups.backupdb/Tery Griffin’s Computer (44)/2014-03-05-201742.inProgress/ABB10CF2-F041-4DE5-B6AE-3C228B59ADCC size:17
    Error: (5) setxattr for key:com.apple.backupd.SnapshotState path:/Volumes/Time Machine Backups/Backups.backupdb/Tery Griffin’s Computer (44)/2014-03-05-201742.inProgress/ABB10CF2-F041-4DE5-B6AE-3C228B59ADCC size:2
    Deep event scan at path:/ reason:must scan subdirs|new event db|
    Finished scan
    Found 145601 files (11.88 GB) needing backup
    16.1 GB required (including padding), 620.77 GB available
    Copied Zero KB of 11.88 GB, 0 of 145601 items
    Copied 0 files (Zero KB) from volume Macintosh HD.
    Copy stage failed with error:11
    Backup failed with error: 11
    Ejected Time Machine disk image: /Volumes/Tery Griffin's Time Capsule/Tery Griffin’s Computer (44).sparsebundle
    Ejected Time Machine network volume.
    Starting automatic backup
    Attempting to mount network destination URL: afp://Tery%20Griffin;[email protected]/Tery%20Griffin's%20Time%20Ca psule
    Mounted network destination at mount point: /Volumes/Tery Griffin's Time Capsule using URL: afp://Tery%20Griffin;[email protected]/Tery%20Griffin's%20Time%20Ca psule
    Disk image /Volumes/Tery Griffin's Time Capsule/Tery Griffin’s Computer (44).sparsebundle mounted at: /Volumes/Time Machine Backups
    Backing up to: /Volumes/Time Machine Backups/Backups.backupdb
    Event store UUIDs don't match for volume: Macintosh HD
    Error: (-36) Applying backup protections to /Volumes/Time Machine Backups/Backups.backupdb/Tery Griffin’s Computer (44)/2014-03-05-201742.inProgress/9F8E7957-9C50-49C3-8314-880E5203E3D9
    Error: (5) setxattr for key:com.apple.backupd.SnapshotStartDate path:/Volumes/Time Machine Backups/
    Does anyone know what the problem is here and what I should do?
    Thanks,
    Tery

    You have repaired your boot drive (which is good) but have you repaired your time machine drive?  I don't own a Time Capsule so I don't know if disk utility can operate on it.  If it can, you should repair it as well.  You may need to erase it and start a new backup.  That happens to time machine volumes from time to time and is why people who are serious about their data never rely on a single source of backup.

  • Bock a housebank in APP F110

    Hi,
    I want to block an houbank that already exist in App F110 for a particular co code. Same time it should be available for making manual payments.
    Can anybody suggest me the way by which i can block it only for APP.
    Regards,
    Leena Borker

    HI,
    This solution is not working. I deleted the housebank from the ranking order , but still it picks the same  housebank ifrom Vendor master & invoice.
    I tried by making Available amts zero for that particular housebank & PM.
    But still it is not working.
    If you have any other solution , please tell me.
    Regards,
    Leena

  • Service Tax On Down Payment and Tax Payment Wizard

    Hi All,
    We would like to make a down payment and apply service tax to it.
    Once i create a AP Down payment invoice with the service tax, make an outgoing payment against it, create AP Invoice and adjust the down payment, now after following this procedure, when i run the tax payment wizard, the service credit available becomes zero.
    It works well in case of partial payment but not 100% advance.  Has anyone faced this issue??
    How can this be resolved?
    Thanks,
    Joseph

    Hi Rahul,
    Exactly! The system doesnt consider the tax on DP when we check through Tax Payment Wizard.
    I guess this is a missing functionality? What do you think? Because there may be a chance that the service tax may get deducted at down payment! What is your take on this?
    Looking for valuable responses from other experts too!
    Thanks,
    Joseph

  • Connection reset by peer problem

    I have the following code, and every time I run it i get a "java.net.SocketException: Connection reset by peer: socket write error" exception. Why is that? This is the first time I'm writing a network client application, so please help :)
    Socket s = new Socket("127.0.0.1",8080);
    OutputStream out = new BufferedOutputStream(s.getOutputStream());
    InputStream in = new BufferedInputStream(s.getInputStream());
    out.write("server status\r\n".getBytes());
    //out.flush();
    StringBuffer responseLine = new StringBuffer();
    int c;
    while(in.available() > 0) {
      c = in.read();
      responseLine.append((char)c);
    //out.close();
    //in.close();
    //s.close();
    System.out.println(responseLine.toString());P.S. It's the same problem with or wothout the out.flush(), and with or wothout closing my streams and socket.

    InputStream = new BufferedReader
    Um..just look at that code, oh boy.
    InputStream is a class and so is
    BufferedReader
    Two different classes (event if they are subclasses)
    cant be directly assigned to each other.The human eye sometimes sees what it wants to see and not what it is... :-)
    I think the problem is with the protocol and the timing. The while loop may never execute due to timing:
    1. Client's "server status" request takes a few ms to arrive in the server.
    2. In the meanwhile, in.available is zero and the client does not enter the loop and does not append any characters to the string buffer.
    3. Server writes its status on the socket which arrives at the client which is no longer reading it a few ms later.
    Which brings us to the protocol:
    If the server status is a fixed length block of data, try reading it into a single byte buffer.
    If it is variable length or text, use a BufferedReader on the socket, read the response a line at a time and make the server end the report with a token (like a last line of "END_OF_SERVER_STATUS_REPORT" or "01234567890123456789012345678901234567890123456789", whatever).
    Don't check if data is available on a socket if you know it should be, sooner or later, and you don't want to multiplex your flow on data availability.

  • Query mode in forms

    Hi, (anyone please help me out)
    I have two blocks namely recmast and recdet blocks. Recmast block deals with mater table for customer receipts and recdet block deals with corresponding invoices that are applied against the money receipt for a customer.
    I did the following steps and was facing problem.
    1. created master block for receipt master table (MRNO, MRDT,MRVAL,CCODE,STATUS) these are fields.
    2. Created detail block for receipt details (mrno, invno, invamt) these are fields in the database table. But in the block I have some non data base fields also.
    3. When I select the customer in the master block all the unpaid invoices are listed in the deails block (invno, invdt, invamt, balamt, amtpaid col with initial value as zero).
    4. As and when I select the invoices using check bok the money receipt value is getting adjusted and we can do so as long as the balance available reaches zero amount.
    5. When I save, I should save the master block fields (database fields) which I working fine.
    6. While saving I want to save only invoices which are adjusted against the receipt and not unchecked invoices.
    Here both are database block only. I have achieved it using database block for master table and content block for details table. While saving I am able to achieve my target. But I am facing a problem while querying. When I query the record I should view both master details and corresponding invoices which are originally adjusted against the receipt. This I am simulating from oracle apps (here invoices are separately shown when we click the "application" button only).
    Please help me out.
    Regards,
    Chandra sekar
    Message was edited by:
    user519600

    Hi,
    what I have understand from your question is you want to save only those record which are being updated by user, for that you can either user "update changed columns only" option of the block, or you can have an "Pre insert" trigger in which you can write you saving logic and that will override forms default saving logic,
    and other thing is if you dont have detail block as database block you cannt query it by the default way, then you can populate it by manual coding i.e. make a cursor and populate it.
    www.startwithoracle.com

  • Customer Order in MRP

    I created a customer(XD01)
    Account Group: Customer (general)
    created a sales order (VA01)
    Req.delivery date: 24/04/2010
    added the material and saved..... No issues
    Finished product strategy group 10. Run MRP (MD02) and found Customer Order w/ reference to Sales Order I created.
    Now, how to fulfill the order? Req. type is 'Sales from stock' and stock available is Zero. What is the general procedure for creating stock in this scenario?

    Dear ,
    Check the following :
    1.Sales Order should not be blocked -Goto Status Header  or Select the line item and double click -Goto Status -It should be Credit relase.Otherwise , perform VKM3  to release the order
    2.Now while carrying out MD02 , please select the following indicator -
    Process Indicator : NETCH
    Create Purchase Req Indicator : 2 -so that it will create planned order for finsihed good and PR for dependent based on the stock and shortage
    Delivery Schedule Indicator : 1 ( in case if u do no have any delivery schedule )
    MRP List : 3
    Planning Mode : 3
    Lead Time Scheduling Indicator : 2
    Tick the check box : Diplay before Save .  and Execute
    3.Make sure -Finished good should have proper MRP Type -PD,Procurement Type : E   where as dependent should have Procurement Type : F
    Please try and revert back
    Regards
    JH
    Edited by: Jiaul Haque on Mar 27, 2010 7:46 AM

  • Duplicated in Mobile Applications

    duplicated in Mobile Applications

    I had the same problem despite regularly updating my Apps. Problem was that somewhere during the early days of using iCloud iTunes got me logged in to with my mac.com account, rather than my long running imran.com account. Result, I have 8 apps that got purchased with that mac.com ID.
    Even until now Apple has failed to provide a way to merge two AppleIDs.
    So, now I have to go through the annoying step of logging out of my main iTunes account, logging in with my mac.com account, downloading the available updates for that, then remember to logout and log back in with my primary account. That brings the app update count available to Zero.
    Convoluted situation brought to you by Apple's failure to provide linking or merging AppleIDs. Hope this helps.
    Imran

Maybe you are looking for

  • Can i replace the contacts in iCloud and on my phone with those on my computer?

    When I enable iCloud on my iPhone 5 the contacts from my address book (Mac OS X)  are merged with those on my iPhone, creating multiple entries.  I have tried merging duplicates, but it resolved only some of the problems.  Now I am seeing all of the

  • Error When starting weblogic

    Sometimes when I re start WebLogic 6.1 on Solaris, I get this exception, and after restarting again, the exception disapear. Starting WebLogic Server .... <Mar 21, 2002 3:56:31 PM EST> <Notice> <Management> <Loading configuration file ./config/gendom

  • Error with iPhone app download, now can't find or open app

    I recently tried to download an app on my iPhone 4S.  There was an error with my phone mid-download.  After a restart, the app is nowhere to be found on my phone, but I cannot re-download the app, as the app store thinks it is already on my phone.  W

  • Shipping Costing - Invoice for the FWD Agent

    Hello: I am working with PO, Inbound Deliveries and Shippment in order to assign the import costs to all the items related to the shipment. I have a concern. I have created a Shipping Cost Document related to a Shipment, This document has a FWD Agent

  • PS2013 - Creating a new instance of Project Server does not run and hangs in "Waiting for Resource"

    Hi, In my Project Server 2013 environment I created an instance of Project Server which is running in a notebook Hyper-V Windows 2012 Server with 11 GB, 4 threds, 3 GHz, one box configuration with complete version of SQL Server 2012 with SP1, nothing