How to block thread until data is available?

In my program i opened the socket and got inputStream. then i wanted to read the incoming data as it comes, so i wrote:
byte[] data = new byte[2007];
while (true) {
int count = in.read(data);
byte[] rcv = new byte[count];
System.arraycopy(data,0,rcv,0,count);
// ...process the data...
}but it succesfully reads only first datablock, the next time method "read" returns -1 and the exception was raised (byte[-1] is a very weird thing). Which method should i use in order to block the thread until the data would came.

Could you log if the Socket isConnected(), isClosed(), isBound(), and isInputShutdown() before a read?That won't help at all:
- isConnected() returns 'true' forever after a socket has been connected.
- isClosed() returns 'false' until this JVM closes this socket itself.
- isBound() returns 'true' forever after a socket has been connected or bound.
- isInputShutdown() returns 'false' until this JVM calls shutdownInput() on this socket itself.
Contrary to common misconception, none of these methods tell you anything about the state of the connection or what the other end has done. They can't. There is nothing in TCP that can do that except (a) the -1 EOS indication and (b) IOException: connection reset.
In this case it is clear that the peer has definitely closed the socket or shutdown its output.

Similar Messages

  • Start Delta IP Only If Data Is Available

    Hi together,
    We have an InfoPackage, that delivers data using a DataSource in Delta-Mode. Unfortunately the InfoPackage only sporadically delivers data, mostly it returns zero records. Our question is now, how to find out, whether data is available and if not, to discontinue further processing of a process chain and to preserve system resources.
    The corresponding DataSource is of type Extract Datasource for an InfoCube in the same system. I tried to get relevant information from request tables, but couldn't establish necessary relations as yet....

    Hello Timo,
    The only standard way I can think of is to set the traffic light to yellow or red when no data is available (transaction SPRO / Automated process/ Extraction monitor settings/SEt traffic light color). But as this customizing is system wide, it can be too brutal in your case.
    Anyway, you can still create a program that will read the delta queues in the system source (the table to be read will depend on the dataSource), and use the result in a "Decision between multiple values " process chaine component. You will then be able to continue or not the process flow depending on the delta content.
    Regards,
    Fred

  • If I don't pre-order iphone 6, how long until they are available in stores?

    If I don't pre-order iphone 6, how long until they are available in stores?

        mln2603,
    Great question, it's important to have an idea when you can get the phone. Currently, the launch date annouced is September 19th, 2014. The stores will receive phones on that day as released and they will sell on the same bases, first come first serve.
    AdaS_VZW
    Follow us on Twitter at @VZWSupport 

  • Oracle Forms - How can I create a Data Block with query

    Dear friends I have a question, I couldn't do this..
    I have a sql query, I want to show the datas of the query.. How can I do this. ?
    Data Block Wizard wants a table, view or stored procedure, but I have a query, how can I create a data block with my query.. I m waiting your helps..? Please...
    Semih

    Hi,
    You have two options
    1. create a view and base the block on the view
    2. create a block with a query Data Source Type of 'FROM clause query'
    Hope this helps
    Neil

  • How to over write VBBE data when Delivery is created if at the time of SO creation stock blocking is there

    Hi,
    I want to know how to over write VBBE data after delivery creation if stock blocking is there at the time of SO creation.
    That means I want my confirmed delivery quantity to over write the SO quantity in VBBE table after delivery creation. Please help me with your valuable suggestions...
    Thanks
    Tanmoy

    Hi Tanmoy,
    This should happen automatically. The VBBE entry should reflect the quantity of the delivery requirement. Is it possible for you to post screenshots illustrating exactly what is happening on your system?

  • How to get out of pause until date if target is achieved?

    Hi,
    We are developing a SharePoint Designer 2013 platform workflow on Office 365 SharePoint Online. Following is what we are trying to achieve:
    Document Library workflow.
    There are 3 users involved e.g. UserA, UserB and UserC.
    There are 2 content types e.g. Notification Letter and Statement Method.
    As soon as UserA uploads/adds a document the workflow kicks-off.
    An email is sent to UserB where he verifies it and select a dropdown verification complete.
    This workflow also kicks-off on item change hence it creates a task process and assign UserC a task.
    If UserC rejects the task, the email is sent to UserB and he has to resubmit.
    However if UserC approves it then it goes to the approval folder.
    In the above process we need to have reminders/notifications to UserC. There are 3 reminders. As soon as the document is added the document should be sent to the approval folder within 30 days (cut off) from the item creation date. First reminder 7
    days before the cut off date. Second reminder 2 days before the cut off date. Finally the last reminder on the cut off date itself.
    If I set Pause Until Duration event then the workflow as expected doesn't do anything till the date. How to break the Pause Until Duration if the UserC approves the task within the date range before cut off date.
    I was thinking of loop but couldn't figure out how to achieve it in a better way.
    Thank you
    Tanzim
    Tanzim Akhtar

    http://blog.qumsieh.ca/2012/01/27/sharepoint-designer-workflow-pause-until-date-change/
    Here the user break the pause duration using code. if you don't want to code means just split the workflow into two
    One for managing approval
    One for managing Email
    So that the pause state in email workflow will not affect the approval workflow.
    Also in Email workflow we have check the approval and moved status so it will not send the remainder mail to approved request
    Ravin Singh D

  • How to see and clear the blocked threads

    Where can I see how many threads are currently running and how many threads are blocked and how many are in idle status.
    Where can I see all these information and if I want to kill the blocked threads how to do that
    Thanks in advance

    This can be found in Weblogic Log folder..

  • I linux inode which contains 13 member array wich stores the actual block address of data .Similarly in windows how data is managed in disk ?. How many members in this array ?

    I linux inode which contains 13 member array wich stores the actual block address of data .Similarly in windows how data is managed in disk ?. How many members in this array ?

    Hello Vijay Nerkar,
    Your question is not related to Windows Forms General. What is the data you mean and also what is that array?
    If you are looking for something related to Windows File System, see some words here:
    http://en.wikipedia.org/wiki/File_system
    For example
    "Windows makes use of the
    FAT, NTFS,
    exFAT and ReFS file systems (the last of these is only supported and usable in
    Windows Server 2012; Windows cannot boot from it).
    Windows uses a drive letter abstraction at the user level to distinguish one disk or partition from another. For example, the
    path <tt>C:\WINDOWS</tt> represents a directory <tt>WINDOWS</tt> on the partition represented by the letter C. Drive C: is most commonly used for the primary hard disk partition, on which Windows is usually installed and from which it boots. This "tradition"
    has become so firmly ingrained that bugs exist in many applications which make assumptions that the drive that the operating system is installed on is C. The use of drive letters, and the tradition of using "C" as the drive letter for the primary hard disk
    partition, can be traced to
    MS-DOS, where the letters A and B were reserved for up to two floppy disk drives. This in turn derived from
    CP/M in the 1970s, and ultimately from IBM's
    CP/CMS of 1967.
    For more details, consider consult on MS Answers:
    http://answers.microsoft.com/en-us/windows
    Regards,
    Barry Wang
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How can I  get System dates  with time scheduler using threads

    how can I get System dates with time scheduler using threads.is there any idea to update Date in my application along with system Date automatic updation...

    What the heck are you talking about and whatr has it to do with threads?
    Current time: System.currentTimeMillis. Date instances are not supposed to be updated.

  • How to block sap transactions from particular date

    how to block sap transactions from particular date

    Hi
    If it is G/L Account inactive means.
    Go to => Financial => Chart of Account => Select the Account to be Blocked = > Account Details
    You can found the Active and Inactive Parameters.  You can Specify the date period you want to block.
    If it is Business Partner Means
    Go to Business partners => Select the Business partner you want to block.
    You can find the Active and Inactive Parameters.  You can Specify the date period you want to block.
    If you want period means
    Go to Administration => System Initialization => Posting period =>  Click the above period => Select the period status and Lock
    With Regards
    Balaji

  • How make master data object available for ACR

    Hi,
    I remember that there is a program to run so that we can make the master data object available for ACR.
    i am not getting the program name. Please advice.
    Thanks,
    Dev

    Hi........
    If a master data is schedule for some changes...ie  InfoObjects and hierarchies that are planned for structural change are selected by default.........If u go to RSA1 >>  Administrator Workbench >> Tools >> Hierarchy/Attribute Changes from the menu...........If u click on Infoobject List or Hierachy List.........u will find that those infoobjects r already selected.....
    If u want to run ACR for some infoobjects manually.............either u can do it in RSA1..........by only selecting those infoobjects for which u want to run the ACR..........or u can also use the prog : RSDDS_AGGREGATES_MAINTAIN.........
    If that Particular infoobject is not there in the Infoobject or Hierarchy List in RSA1..............that means no structurak changes r required...........no need to run ACR..........
    Regards,
    Debjani.........

  • How to take a single data point for each trigger pulse ( synchronou​s acquisitio​n).

     hi
              im using the pci-mio-16E1 card, with the IDE VC++, so  im looking for an example to explicate me how to make an synchronous acquisition data using an external timing, so the idea is to acquire (take) a single data point for each trigger pulse  from one  input channel ,and saving  the data in a file .
    now im making a code using the AI_setup and DAQ_op functions, im getting  a speed acquisition (it is the start of acquisition data), and  it is  a synchronous acquisition just for one trigger pulse, and me i looking for an acquisition for each trigger pulse. 
      so to  understand my problem you can see my code :
    iStatus = Timeout_Config(iDevice, lTimeout);
             iRetVal = NIDAQErrorHandler(iStatus, "Timeout_Config", iIgnoreWarning);
       //  configuration and selection of  signal trigger  
             iStatus = Configure_HW_Analog_Trigger(iDevice, ND_ON, iLowValue,iHighValue, ND_ABOVE_HIGH_LEVEL, ND_THE_AI_CHANNEL);
            iRetVal = NIDAQErrorHandler(iStatus, "Configure_HW_Analog_Trigger", iIgnoreWarning);
      iStatus = Select_Signal(iDevice, ND_IN_CONVERT, ND_PFI_2,ND_HIGH_TO_LOW);
             iRetVal = NIDAQErrorHandler(iStatus, "Select_Signal", iIgnoreWarning);
        iStatus = AI_Setup(iDevice, iChannel, iGain);
       iRetVal = NIDAQErrorHandler(iStatus, "AI_Setup", iIgnoreWarning);
       while ((iReadingAvail != 1) && (iStatus == 0)) {
     /* Wait until reading is available. */
             iStatus = AI_Check(iDevice, &iReadingAvail, &iReading);
            iRetVal = NIDAQYield(iYieldON);
           //  Acquire data from a single channel 
        iStatus = DAQ_Op (iDevice, iChannel, iGain, piBuffer, ulCount, dSampRate);
       while ((iDAQstopped != 1) && (iStatus == 0)) {
            iStatus = DAQ_Check(iDevice, &iDAQstopped, &ulRetrieved);
            iRetVal = NIDAQYield(iYieldON);
           iStatus = DAQ_VScale(iDevice, iChannel, iGain, dGainAdjust, dOffset,ulCount, piBuffer, pdVoltBuffer);
          iRetVal = NIDAQErrorHandler(iStatus, "DAQ_VScale",iIgnoreWarning);
       /* Set analog trigger mode back to initial state. */
           iStatus = Configure_HW_Analog_Trigger(iDevice, ND_OFF, iLowValue,iHighValue, ND_ABOVE_HIGH_LEVEL, ND_THE_AI_CHANNEL);
      /* Set PFI line back to initial state. */
           iStatus = Select_Signal(iDevice, ND_IN_START_TRIGGER,ND_AUTOMATIC, ND_DONT_CARE);
              iStatus = DAQ_Clear(iDevice);
     /* Plot acquired data  */
          iRetVal = NIDAQPlotWaveform(pdVoltBuffer,ulCount, WFM_DATA_F64);
    so this is the data acquired -0.900879,-0.900879,-0.900879,-0.900879,-0.900879,​-0.900879,-0.900879,-0.900879 and i think that is a noise because all time i get this data.
    tank you very mutch fo your help

    Hello,
    Please see the responses to this thread at the following post.
    http://forums.ni.com/ni/board/message?board.id=250​&message.id=13686
    Also, please only post one thread per issue.
    Regards,
    Sean C.

  • How to know which master data objects need to activated  in R3

    SALES OVERVIEW CUBE -0SD_C03
    How to know which master data objects need to activated from delivery version to active version in R/3 for a particular standard cube like 0SD_C03.
    its very urgent please advise.
    R/3 in RSA5
    Sales Master Data
    0ACCNT_ASGN_TEXT               Account assignment group for this customer   
    0ACCNT_GRP_TEXT                Customer account group                       
    0BILBLK_DL_TEXT                Locked                                       
    0BILBLK_ITM_TEXT               Billing block for item                       
    0BILL_BLOCK_TEXT               Billing block in SD document                 
    0BILL_CAT_TEXT                 Billing Category                             
    0BILL_RELEV_TEXT               Relevant for Billing                         
    0BILL_RULE_TEXT                Billing rule                                 
    0BILL_TYPE_TEXT                Billing Type                                 
    0CONSUMER_ATTR                 Consumer                                     
    0CONSUMER_LKLS_HIER            Consumer                                     
    0CONSUMER_TEXT                 Consumer                                     
    0CUST_CLASS_TEXT               Customer Classification                      
    0CUST_GROUP_TEXT               Customer Group                               
    0CUST_GRP1_TEXT                Customer Group 1                             
    0CUST_GRP2_TEXT                Customer Group 2                             
    0CUST_GRP3_TEXT                Customer Group 3                             
    0CUST_GRP4_TEXT                Customer Group 4                             
    0CUST_GRP5_TEXT                Customer Group 5                             
    0DEALTYPE_TEXT                 Sales Deal Type                              
    0DEL_BLOCK_TEXT                Delivery block (document header)             
    0DEL_TYPE_TEXT                 Delivery Type                                
    0DISTR_CHAN_TEXT               Distribution Channel                         
    0DIVISION_TEXT                 Division                                     
    0DLV_BLOCK_TEXT                Schedule line blocked for delivery           
    0DOC_CATEG_TEXT                SD Document Category                         
    0DOC_TYPE_TEXT                 Sales Document Type                          
    0INCOTERMS_TEXT                Incoterms (Part 1)                           
    0INDUSTRY_TEXT                 Industry keys                                
    0IND_CODE_3_TEXT               Industry code 3                              
    0IND_CODE_4_TEXT               Industry code 4                              
    0IND_CODE_5_TEXT               Industry code 5                              
    0IND_CODE_TEXT                 Industry code                                
    0ITEM_CATEG_TEXT               Sales document item category                 
    0ITM_TYPE_TEXT                 FS item type                                 
    0KHERK_TEXT                    Condition Origin                             
    0MATL_GRP_1_TEXT               Material Group1                                         
    0MATL_GRP_2_TEXT               Material Group 2                                         
    0MATL_GRP_3_TEXT               Material Group 3                                         
    0MATL_GRP_4_TEXT               Material Group 4                                         
    0MATL_GRP_5_TEXT               Material Group 5                                         
    0MATL_TYPE_TEXT                Material Type                                            
    0MAT_STGRP_TEXT                Material statistics group                                
    0NIELSEN_ID_TEXT               Nielsen ID                                               
    0ORD_REASON_TEXT               Order reason (reason for the business transaction)       
    0PICK_INDC_TEXT                Indicator for picking control                            
    0PRODCAT_TEXT                  Product Catalog Number                                   
    0PROD_HIER_TEXT                Product Hierarchy                                        
    0PROMOTION_ATTR                Promotion                                                
    0PROMOTION_TEXT                Promotion                                                
    0PROMOTYPE_TEXT                Promotion Type                                           
    0PROV_GROUP_TEXT               Commission Group                                         
    0REASON_REJ_TEXT               Reason for rejection of quotations and sales orders      
    0REBATE_GRP_TEXT               Volume rebate group                                      
    0RECIPCNTRY_TEXT               Destination country                                      
    0ROUTE_TEXT                          Route                                                    
    0SALESDEAL_ATTR                Sales deal                                               
    0SALESDEAL_TEXT                Sales deal                                               
    0SALESORG_ATTR                 Sales organization                                       
    0SALESORG_TEXT                 Sales Organization                                       
    0SALES_DIST_TEXT               Sales district                                           
    0SALES_GRP_TEXT                Sales Group                                              
    0SALES_OFF_TEXT                Sales Office                                             
    0SCHD_CATEG_TEXT               Schedule line category                                   
    0SHIP_POINT_TEXT               Shipping point/receiving point  
    In BW
    Base Unit of Measure     0BASE_UOM
    Bill-to party                    0BILLTOPRTY
    Calendar Day                  0CALDAY
    Calendar Year/Month      0CALMONTH
    Calendar Year/Week      0CALWEEK
    Change Run ID              0CHNGID
    Company code              0COMP_CODE  
    Cost in statistics currency          0COST_VAL_S
    Credit/debit posting (C/D)            0DEB_CRED
    Distribution Channel       0DISTR_CHAN
    Division                                     0DIVISION 
    Number of documents    0DOCUMENTS
    Sales Document Category          0DOC_CATEG
    Document category /Quotation/Order/Delivery/Invoice 0DOC_CLASS
    Number of Document Items         0DOC_ITEMS
    Fiscal year / period
    Fiscal year variant                      0FISCVARNT
    Gross weight in kilograms           0GR_WT_KG
    Number of Employees    0HDCNT_LAST
    Material                                     0MATERIAL
    Net value in statistics currency    0NET_VAL_S
    Net weight in kilograms 0NT_WT_KG
    Open orders quantity in base unit of measure 0OPORDQTYBM
    Net value of open orders in statistics currency 0OPORDVALSC
    Payer                            0PAYER
    Plant                             0PLANT
    Quantity in base units of measure 0QUANT_B
    Record type                   0RECORDTP
    Request ID                    0REQUID
    Sales Employee            0SALESEMPLY
    Sales Organization         0SALESORG
    Sales group                   0SALES_GRP
    Sales Office                   0SALES_OFF
    Shipping point                0SHIP_POINT
    Ship-To Party                0SHIP_TO
    Sold-to party                  0SOLD_TO
    Statistics Currency                    0STAT_CURR
    In R3 RSA5 we have all the Master data data sources as mentioned above, and BW also. How to find the related Master data Infosource in R/3 Master data Data sources.
    Thanks in advance,
       Bhima.
    Message was edited by: Bhima Chandra Sekhar Guntla

    Hi,
    <i>How to know which master data objects need to activated from delivery version to active version in R/3 for a particular standard cube like 0SD_C03.</i>
    I think, you are looking for master data sources(text,attributes,hier).Am i right?
    If so, This cube has almost all SD master data characterstics. So you can activate all the all master data datasources of SD in r/3 (SD-IO).
    Any way you requirement does not stop only by using this cube . You will activate all other cubes in SD also. So if you want to activate only needed master data datasources when you are activating a cube, the job becomes senseless. There is no problem(wrong) in activating all master data available under that application , even though you want to activate only one cube.
    With rgds,
    Anil Kumar Sharma .P

  • How to block production order creation when maintenance order is generated.

    Hi All,
    Kindly share how to block production order generation when maintenance order is generated.

    Integration between PP module and PM module
    PP/PM Workcenter Integration
    There are many threads & documents available. Please do some search.

  • How to use Count with Date Parameters

    Hello,
    I am having issues using the Count() function in conjunction with date parameters.
    This is a Siebel report and in my report I have 2 date parameters(From Date, To Date). In a nutshell I am basically trying to count Opportunities that has a start date within the given date period. However I don't see a reasonable way to put my date parameters within the Count() function. The reason being is that I need to have a huge chunk of code to convert the dates into a common format that can be compared, and it won't even fit within the code block in my rtf template. I am not even sure how to put multiple conditional statements inside a Count() function since all the examples I have seen are very simple.
    Anyone have a suggestion on how to use Count() with date parameters?
    Thanks.

    Any chance you can get the date formats in the correct format from siebel?
    I don't know Siebel - so I can't help you with that. If you get the correct format it is just
    <?count(row[(FromDate>=date) and  (date<=ToDate))?>
    Otherwise the approach would probably need to use string function to get year/monthd/day from the date
    and store it into a varialbe and compare later the same way
    <?variable@incontext:from; ....?>
    <?variable@incontext:to; ...?>
    <?count(row[($from>=date) and  (date<=$to))?>
    Potentially you can use the date functions such as xdofx:to_date to do the conversion
    [http://download.oracle.com/docs/cd/E12844_01/doc/bip.1013/e12187/T421739T481158.htm]
    But I am not sure if they are available in your siebel implementation.
    Hope that helps

Maybe you are looking for

  • How to send date field value from one page to another page

    Hi every one! In my page I have a requirement....I need to select From date and Todate....based on that data has to be displayed in the table....but in my table i dont have such type of fields.....please help me

  • Help with dynmicaly update text in document/s.

    Hi, I am working on a project that will require the following. I will have a document in InDesign, everything will be formated - lets say a template. I will need a multiple instances of a certain word (let call it "word A") that is available in the d

  • Project Commitment Cost not visible for Purchase Orders with Item Categry Q

    Hello All I have a problem. My project commitment cost is not visible for PO's with Item Category Q. I assume that as the stock can be issued against any WBS elements I might not be able to see the cost against a single WBS element. But the cost shou

  • Questions about input/output streams

    In the following tutorial: http://chortle.ccsu.ctstateu.edu/CS151/Notes/chap85/ch85_10.html It mentions that some methods, such as write(), writeByte(), writeBytes(), and writeChar(), return the low eight bits of the argument to the output stream. I

  • Routing signals PXI-6602

    I'm trying to route a single input to more than one counter.  I've been wading through the routing signals options with no success.  I have a PXI-6602 and using LabView 8.20.  I have a single input that I want to measure the period and pulse width on