ResultWaiter, is there any in java standard API

I need a class like the following for "synchronizing" asynchronus results.
public class ResultWaiter {
   private Object lock;
   private Exception ex;
   private Object result;
   public ResultWaiter() {
      lock = new Object();
      result= null;
      ex = null;
   public Object getResult() throws Exception {
      if (result == null) {
         synchronized (lock) {
            try {
               lock.wait(5000);
            } catch (InterruptedException ex) {}
      if (result== null && ex == null) {
         throw new Exception("A timeout occured ");
      if (result != null) {
         return result;
      throw ex;
   public void handleResult(Object result) {
      synchronized (lock) {
         this.result= result;
         lock.notifyAll();
   public void handleError(Exception ex) {
      synchronized (lock) {
         this.ex = ex;
         lock.notifyAll();
}Is there a class which provides this behaviour in the Java APIs or do I need to write it myself?

java.util.concurrent.Future
java.util.concurrent.FutureTask?

Similar Messages

  • I am in the process of doing a Proof Of Concept / Evaluating products that can help us build a Java Application to Convert a PDF document to a Searchable PDF.   I wanted to check is there any simple JAVA API from Adobe to achive this ? Any direction in th

    I am in the process of doing a Proof Of Concept / Evaluating products that can help us build a Java Application to Convert a PDF document to a Searchable PDF. 
    I wanted to check is there any simple JAVA API from Adobe to achive this ? Any direction in this regard is greatly appreciated.@

    You can achieve this using LiveCycle PDF Generator JAVA API. You can find required code here:
    Adobe LiveCycle * Quick Start (SOAP mode): Converting a Microsoft Word document to a PDF document using the Java API
    In parameters:
    //Set createPDF2 parameter values
    String adobePDFSettings = "Standard";
    String securitySettings = "No Security";
    String fileTypeSettings = "Standard OCR";
    "Standard OCR" file type setting will run OCR on input pdf. In the code, instead of doc file provide a pdf file. Resultant pdf will be searchable PDF i.e OCRed PDF.
    Feel feel to ask any further questions.

  • Is There any Purge program Or API to replace Calander and period type.

    Is There any Purge program Or API through which we can replace Calander name and Period type with another Calander name and Period type.?
    Or any other alternate for doing So?
    Bachan
    Message was edited by:
    Bachan

    Yes:
    IBY_EXT_BANKACCT_PUB - Create Bank Accounts
    IBY_DISBURSEMENT_SETUP_PUB - Create Payee / Instrument
    Regards,
    Gareth

  • For this issue Is there any solution in Standard solution or any Developmet

    Hello Friends,
    I have one issue that is
    When ever the forecast is release from DP to PPDS (Monthly - days) of a material quantities should be bucketed into Monthly bucketed quantities and split into day level ( e.g: Product1 1st week 1000ton, 3rd week  2000ton , when it releases system aggregates the quantities and depending upon the product profile and setup time it shold give me result as product1 -3000ton in day 1 and product2 --2000ton on day 2 ...so on) .Standard SAP APO release of Monthly forecast quantity to daily bucket is divided into 30 or 31 days and split the quantities equally( e.g: Product1 1st week 1000ton, 3rd week  2000ton , when it releases system aggregates the quantities and divides in 30 days in a month and split the quantities equally).
    For this issue Is there any solution in Standard SAP or any Developmet is required in APO-DP.
    Pl Through me some lights on me .
    Regards,
    sivaram76.

    Hi
    If you are using u201C/SAPAPO/MC90  for releasing the FCST , I think you can define different Planning Buckets Profiles according your requirement for example according your needs for disaggregation of your FCST. A planning buckets profile contains the periodicities or a subset of the periodicities that you defined in the storage buckets profile.
    Once you maintain the planning bucket profile you can put it in tab Daily Buckets Profile while releasing the FCST.
    It will be nice if you please cross check it its meet you requirement.
    Thanks
    Amol

  • Is there any Specific naming standards needs to be followed ?

    Hi ,
    Is there any Specific naming standards needs to be followed while in the PL/SQL Programming.
    Please help me out , If any one have any documentation for the same.
    Please mail me @ [email protected]
    Regards
    raja K

    Hold it right there, Mister! Are you planning on another endless "please mail me too"-thread, hah? Wasn't PL/SQL Coding Standards bad enough?
    C.

  • Is there any bapi for standard deviation

    is there any bapi for standard deviation

    You can use the function module
    1. 'QRKT_STD_DEVIATION_SHEWHART'-Algorithms for Shewhart chart for s with internal dispersion and mean line
    2.'QRKT_STD_DEVIATION_SHEWHART_2'- Algorithms for Shewhart chart for s with overall dispersion and mean line.
    You could also calculate it yourself of course - standard deviation is the square root of the sum of the square of the differences between the mean and each value divided by the number of values you have less one.
    Reward points..

  • Is there any core java tutorial form sun site

    HI all,
    is there any core java tutorial form sun site where i can down load it study them on offline rather that seeing it on line.
    can any give me link for it.........
    vijay

    thank you for reply ,
    i have googled and find this help full in getting the details and u can download from here.
    "http://java.sun.com/docs/books/tutorial/information/download.html"
    vijay

  • Is there any Sun Java's official SVG API for Java SE?

    Hi, I'm still learning Java and SVG.
    Currently I want to build a kind of client-server application transferring SVG files.
    I'm using JSR 226 to parse SVG files in my Java ME client, but I dont know what API I should use to parse SVG files in my Java SE server.
    I want the server to read a large SVG image file and then parse it and divide it into some small linked SVG image parts before it can transferred to the client.
    Does Java SE have a standard API for SVG? Bcause I only found Batik..
    thnks in advance.

    Hello,
    I am using SVG Salamander... it is a nice small library.
    https://svgsalamander.dev.java.net/
    Jacco

  • Is there any pure Java OS for PC ?

    When i testing programe with applet, i found that the performance is not good at all, i think that if there pure native java os here, i can run directly with my class file, is it already be true ?

    i dont think anyone can write an OS purely in java.You are wrong. Mainly because the question isn't very specific. I had the same opinion until someone in another thread convinced me. The solution is not the one you are thinking of. Search for the thread and read the entire thing.
    first question to answer is How good is java's IO? is
    it atleast half as good as that of C? No.Huh? Many implementations that use the Java API library could be improved if the authors took time to write a bettern implementation specific to their library. Or in some cases just used the API correctly in the first place. There is at least one magazine article that points this out.

  • Is there any Frame/Chan​nel API command to clear Rx CAN queue ?

    Hi everybody,
    Is there any NI-CAN CVI command to clear CAN Rx queue/buffer ? .... Something like FlushInQ in CVI ?
    Petko G.

    Hi Petko,
    I didn't find any command which would work like "flush queue", but I believe you should be able to clean the entry queue by reading number of frames available in the read queue, and then calling "Read Net Multiple.vi". All the read data you can just ignore, but I bett you will empty entry queue.
    regards,
    Stefo

  • Anybody there familiar with Java Mail API ???? I need help

    I have a problem using the MessageCount Listener in mail API... Problem is simple........... The Listener doesn't work at all...
    Has anyone tried it out .. Please reply if u have so that i can present the real picture.... Please dont avoid me by giving links to tutorials... Believe me... i've tried a few of them but nothing seems to help me...

    Hai pal,
    I'm using a pop3 account.. Here i tried using the getmessagecount command... But it doesn't work.. Its showing the same count every time in spite of new messages arriving. The listener doesn't fire at all..
    To get the folder show updated count, i have to close and reopen the folder. This itself makes the concept of message listeners quite vague... Do u have any further tips on this..
    Thanks
    Dst

  • Is there any 'configuration based' tool/api available for content purging in CQ 5.5?

    Hi All,
    I am looking for some api/tool which could be utilized for the content purging in CQ 5.5. It should be a configuration based api which would take content path hierarchy as an input to do the purging.
    Any help/ideas are appreciated.
    Thanks.

    For what it's worth, I had no problems migrating an authentication plugin from 4 to 5. This is really good, because otherwise I wouldn't be able to use 5.1.

  • Is there any native java compiler?

    I want to distribute my java application in a native form so i can leave the virtual machine away. Is this possible?

    I have find my solution at
    http://forum.java.sun.com/thread.jsp?forum=31&thread=166500
    Thanks for all

  • Is there any official SIGTRAN Java API?

    Hi,
    Is there any official Java package/API that implements the SIGTRAN protocol stack?
    Has anyone had any experience with this so far?
    Thanks in advance.

    Yes, thanks, I've already Googled a lot for this and I'm aware of Java SCTP implementation, which could help a lot.
    I'm just wondering is there anything we can use to completely handle the Sigtran protocol stacks, for example, this one:
    eth:ip:sctp:m3ua:sccp:tcap:gsm_map:gsm_sms
    or, is there any way to stack libraries/packages, in such a way that we can use Java SCTP to handle the transport protocol and some other library to handle the rest of those protocols, like m3ua, sccp.. (from the SS7 protocols family).
    Is there any easy way to just replace the SS7 signaling with SCTP based transport layer?
    Thanks for your help.

  • Is there any API to keep the Invoice Scheduled  Payment on Hold ?

    Hi All
    Is there any public or private API to keep the Invoice Scheduled Payment on Hold? Your help would be greatly appreciated.
    Regards
    Krishna
    Edited by: krishna on Feb 21, 2012 1:17 PM

    Hii,
    Invoice goes automatically on schedule payment hold, if bank details are not updated (only in case of "Electronic" payment method). Moreover, one can manually check the box for payment hold at Schedule payment level.
    Hope this clarifies your query.
    Regards
    Sandeep

Maybe you are looking for