Singleton with timeout

Hi!
I have to implement Singleton pattern, but I have the following restriction: The getInstance() method should not stop the entire application.
I wrote the following code, to achieve my objective:
public class ServiceProvider {
    private static Service service;
    private static final PrivateClass singletonProvider = new PrivateClass();
    private ServiceProvider() {}
    public static synchronized Service getInstance() throws MyException {
        if (service == null) {
            Thread thread = new Thread(singletonProvider);
            thread.start();
            try {
                // Ten seconds for the construction of the service field.
                Thread.sleep(10000);
            } catch (InterruptedException ex) {
                throw new MyException("InterruptedException!!!", ex);
            // Is the verification based on Thread.isAlive() safe?
            // I am not sure. Please, tell me.
            if (!thread.isAlive()) {
                if (service == null) {
                    throw new MyException("Service is still not available");
                } else {
                    return service;
            } else {
                throw new MyException("Service is still not available");
        } else {
            return service;
    // Using a private class I do not need to expose the public run() method.
    private static class PrivateClass implements Runnable {
        private PrivateClass() {}
        private synchronized Service defineInstance() throws MyException {
            if (service == null) {
                service = new Service();
            return service;
        public synchronized void run() {
            try {
                singletonProvider.defineInstance();
            } catch (Exception e) {
                e.printStackTrace();
public class Service {
    public Service() throws MyException {
        try {
            // Simulating a problem: the constructor is taking 20 seconds to be finished.
            Thread.sleep(20000);
        } catch (InterruptedException ex) {
            throw new MyException("InterruptedException in the Service constructor", ex);
    public void method() {
}I am just not sure if the verification based on Thread.isAlive() is safe.
Thanks!!!

malcolmmc wrote:
This sounds all very familiar. This is an occasion to use wait and notify to synchronize with your background thread. For one thing, the way you've written it, the caller to getInstance() will wait 10 seconds even if the service instance is loaded much faster than that.Yes... I tried what you are suggesting, but the problem is that using wait and notify I have to lock the PrivateClass field of the ServiceProvider class. So, since the fields should be locked, the call to the Service constructor will also be locked, and then I always have to wait the constructor finishes, no matter how I implement the logic of wait and notify.
So instead of sleep(10000L) use wait(10000L). Then when your loader sets the instance variable it calls notify on the same monitor. This will wake the main thread up if it's waiting.
You also need to deal with the case where getInstance is called a second time either when the first call to getInstance() is waiting, or after the first call has given up.I did the following solution instead. It works fine:
public class ServiceProvider {
    private static Service service;
    private static final PrivateClass privateClass = new PrivateClass();
    private ServiceProvider() {}
    public static synchronized Service getInstance() throws MyException {
        if (service == null) {
            ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(1);
            AnotherPrivateClass anotherPrivateClass = new AnotherPrivateClass();
            Future future = executor.submit(anotherPrivateClass);
            try {
                // Ten seconds for the construction of the service field.
                future.get(10000,TimeUnit.MILLISECONDS);
            } catch (TimeoutException ex) {
                throw new MyException("Service is still not available");
            } catch (ExecutionException ex) {
                throw new MyException("Service is still not available");
            } catch (InterruptedException ex) {
                throw new MyException("Service is still not available");
            } finally {
                executor.shutdown();
            // Is the verification based on Thread.isAlive() safe?
            // I am not sure. Please, tell me.
            if (!anotherPrivateClass.thread.isAlive()) {
                if (service == null) {
                    throw new MyException("Service is still not available");
                } else {
                    return service;
            } else {
                throw new MyException("Service is still not available");
        } else {
            return service;
    private static class AnotherPrivateClass implements Runnable {
        private Thread thread;
        private AnotherPrivateClass() {
            this.thread = new Thread(privateClass);
        public synchronized void run() {
            thread.start();
            try {
                synchronized (privateClass) {
                    while (!privateClass.done) {
                        privateClass.wait();
                    if (service == null) {
                        privateClass.done = false;
            } catch (InterruptedException ex) {
                ex.printStackTrace();
    // Using a private class I do not need to expose the public run() method.
    private static class PrivateClass implements Runnable {
        boolean done = false;
        private PrivateClass() {}
        private synchronized void defineInstance() throws MyException {
            if (service == null) {
                service = new Service();
        public synchronized void run() {
            try {
                privateClass.defineInstance();
            } catch (Exception e) {
                e.printStackTrace();
            done = true;
            this.notify();
}

Similar Messages

  • "with timeout" when sending Remote Events

    I have a script which accesses a dozen odd remote servers using "eppc://..." Finders and duplicates some files etc... as required by the script. The only problem with this is the script frequently hangs as if a server is not reachable it keeps on trying and fails to report it back as an error.
    I have tried putting "with timeout...." etc.. but nothing seems to work. I have developed a workaround to run a separate script pinging all the machines and if all the machines come back with suitable trip times I allow the script to continue but this is not an ideal workaround - any other suggestions or experience with this problem?

    Here's a copy/paste from a post some time back. Wish I could credit the original author, but I don't have the information.
    This was written for 10.3.9 but may apply in your case also... (easy enough to revert if it doesn't help)
    Jeff
    So there is an issue with OS X Server, where OS X tells SquirrelMail that SSL is enabled, even when its not. This causes some strange problems, like when you send an email, in Safari the mail will send but you won't be forwarded back to the inbox. In FireFox, the mail is sent but you get some strange error -12281. Well the solution (hack) to this problem is to make SquirrelMail always use non SSL. The other solution is to actually configure and USE SSL. But for the hack:
    Hack Away...
    1) Open up this file
/usr/share/squirrelmail/functions/strings.php
    2) Go to line 239 in the file. It should be a blank line, below it should be:
/* Get the hostname from the Host header or server config. */
    3) Add the following to the blank line:
$proto = 'http://';
    Thats it. That does it, just save and reload and SquirrelMail should now work properly. Alternativly, instead of adding that bit of code, you can instead comment out the block above line 239, so that line 216 is the last code before 239. That will also work.
    This hack is done with 10.3.9 and SM 1.4.4. Other versions might have differnet results.

  • VSS snapshot of 1.1TB is ending after few hours with timeout. No errors in event log

    Hello,
    does someone have experienced issue where starting making snapshot (forum GUI or command line) is taking a lot of time and then it just ends with timeout?
    I have scenario on virtualised Windows Web Server 2008 R2 where backup is being made by Idera Backup Software but since it relies on VSS Snapshots then we can just skip this point because making snapshots from directly Windows command line or drive preferences/GUI
    is ending with timeout for this single drive after few hours. Affected system has 3 drives: C - 95GB, D-1.06TB and E-120GB. C and E can be backuped correctly and only drive D has problems. System is updated with latest drivers vssadmin for writers returns
    list without any errors and snapshot for drive D which ends with timeout is not generating any error in event log. I wanted to configure VSS trace like it is being instructed on this site:
    http://publib.boulder.ibm.com/infocenter/tsminfo/v6/index.jsp?topic=%2Fcom.ibm.itsm.tshoot.doc%2Ft_pdg_traceprfrm.html
    but I don't see any trace.txt file on given location. If I remove drive D from backup process it ends without errors. System was restarted many times. Only thing which is visible in windows Event log (application part) is that "The VSS service is shutting
    down due to idle timeout." about 4 hours after snapshot making proces is starting.
    I've contacted Idera backup about this but they can't help too much if Windows snapshot process is failing. They suggested that something can be wrong with this drive but since this is virtualised machine and all of my VM are being stored on RAID10 disk
    array connected to my server using fiber connections then I don't think that this is hardware issue (especially when other two drives are located on the same LUN on disk array).
    Any suggestions?
    Regards

    Hi,
    Do you create VMs on Hyper-V or VMWare? Based on research, possible causes could be:
    1. Files changes in the volume is very huge. So the shadow size may be big and the current shadow storage my not able to hold it. And that’s cause the shadow copy creation failure. 
    2. The I/O in D drive is heavy and make the shadow copy I/O failed. 
    3. Server is too busy to handle the request.
    4. The disk is heavily defragment.
    Please refer to the articles to troubleshoot the issue:
    Time-out errors occur in Volume Shadow Copy service writers, and shadow copies are lost during backup and during times when there are high levels of input/output
    http://support.microsoft.com/kb/826936/en-us
    VSS timeouts during backup? What could contribute to that?
    https://blogs.technet.com/b/askpfeplat/archive/2012/09/12/vss-timeouts-during-backup-check-fragmentation.aspx
    Regards,
    Mandy
    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.

  • Planning Data Pull process failed with timeout error

    Hi Experts,
    Version: Oracle apps 11.5.10.2
    Issue: Planning Data Pull process failed with timeout error
    message in the log file as follows,
    The Request id : 90018907 has Phase : COMPLETE and Status: ERROR
    Concurrent Message : Timeout error.
    There is an Unknown error in the Worker.
    Planning Data Pull process failed.
    +-------------------------------------
    Please advice what could be the problem. I submitted, standard data collection programs with 900 mins and 8 workers.
    Refresh Collection Snapshot completed without any issue

    Please see these docs.
    Data Collection Fails Because Of Time Out Timeout error [ID 339968.1]
    OPM-ASCP: Data Collection Timeout Error [ID 601539.1]
    STD COLLECTION FAILING AT PLANNING DATA PULL WITH TIMEOUT ERROR [ID 978472.1]
    Data Collections is Failing - All Errors - First Diagnostic Steps [ID 207644.1]
    Troubleshooting Errors with ATP/Planning Data Collections [ID 1227255.1]
    MSCPDC PLANNING ODS LOAD ERRORS WITH TIMEOUT ERROR - POOR PERFORMANCE [ID 417633.1]
    Thanks,
    Hussein

  • AppleScript Ignoring "with timeout" Command

    Mac OS 10.4.11
    AppleScript 1.10.7
    Hi all. I'm experimenting with the idea of using my screensaver as my Desktop Background. In order to continue using a script in the macosxhints site that locks the screen via the keychain menubar item (so I'm not forced to have it require a password when it normally accesses the screensaver), I need to modify it so that it turns the said feature off and displays a dialog enabling me to turn it back on when I return.
    Here's the problem: By the time I do return, the script times out on me, preventing me from accessing its dialog. I've applied the "with timeout" command, but it doesn't seem to have any effect on the script at all. Even a "with timeout of 1 second" command does not change its behavior from the default timeout time. Any help here? Here's what I've been able to come up with thus far:
    with timeout of 86400 seconds
    tell application "System Events"
    if process "ScreenSaverEngine" exists then tell application "ScreenSaverEngine" to quit
    end tell
    activate application "SystemUIServer"
    tell application "System Events"
    tell process "SystemUIServer"
    repeat with i from 1 to number of menu bar items of menu bar 1
    tell menu bar item i of menu bar 1
    click
    try
    if name of menu item 1 of front menu is "Lock Screen" then
    click menu item "Lock Screen" of front menu
    exit repeat
    end if
    end try
    end tell
    end repeat
    end tell
    end tell
    display dialog "Select the desktop background type:" buttons {"Normal", "ScreenSaver"} default button 2
    if button returned of result = "ScreenSaver" then
    do shell script "/System/Library/Frameworks/ScreenSaver.framework/Resources/ScreenSaverEngine.a pp/Contents/MacOS/ScreenSaverEngine -background > /dev/null 2>&1 &"
    else
    tell application "System Events"
    if process "ScreenSaverEngine" exists then tell application "ScreenSaverEngine" to quit
    end tell
    end if
    end timeout
    Thanks in advanced!
    Message was edited by: Viewer07

    HI,
    Try posting in the AppleScript forum here: http://discussions.apple.com/forum.jspa?forumID=724
    Carolyn

  • GIT pull failling with timeout error.

    Hi all,
    I am new to tfs 2013 & GIT so I have one query. when I try to pull the repository using GIT pull I am getting error "Timeout".
    I am little bit in confusion why it is happening. Please help me with the troubleshooting steps and the probable reasons of this error.
    Thanks for help.

    Please see these docs.
    Data Collection Fails Because Of Time Out Timeout error [ID 339968.1]
    OPM-ASCP: Data Collection Timeout Error [ID 601539.1]
    STD COLLECTION FAILING AT PLANNING DATA PULL WITH TIMEOUT ERROR [ID 978472.1]
    Data Collections is Failing - All Errors - First Diagnostic Steps [ID 207644.1]
    Troubleshooting Errors with ATP/Planning Data Collections [ID 1227255.1]
    MSCPDC PLANNING ODS LOAD ERRORS WITH TIMEOUT ERROR - POOR PERFORMANCE [ID 417633.1]
    Thanks,
    Hussein

  • Production Portal hangs with timeouts

    Hi all,
    Several times during the day the Portal 10.1.4.0.0 hangs with timeouts.
    In order to recover, Portal needs to be re-started.
    (The timeout also occurred during the time they had a db corruption, but now that corruption has been resolved, the hangs still occur.
    After running the SVU in CLEANUP mode, the issue still occurs.
    Timeout has been set to well over the default. Stall has been increased also. Neither have helped to resolve the issue.
    The java portlets are from a specific OC4J Provider, and all of them are on pages under a Page Group.
    These portlets reads (also trough views) data on portal schema in order to create the "style" and css of the portal pages. All of the database statements are select, exception of rare insert operation on a table of their custom schema.
    User load:
    The access statistics indicates that about 800 users access this site in 1 hour.
    The more high user access in one hour was 1100 users.
    The concurrent user access are about 500.
    Thanks for any help.
    Edited by: hmannila on May 11, 2010 11:50 PM

    Hello Helenna,
    In this particular case, the PPE timeout settings are set to very high values causing exhaustion of fetcher threads in the PPE fetcher thread pool :
    <servlet>
       <servlet-name>page</servlet-name>
       <servlet-class>oracle.webdb.page.ParallelServlet</servlet-class>
       <init-param>
    <param-name>requesttime</param-name>
    <param-value>120</param-value>
       </init-param>
       <init-param>
           <param-name>minTimeout</param-name>
           <param-value>180</param-value>
       </init-param>
       <init-param>
           <param-name>stall</param-name>
           <param-value>200</param-value>
       </init-param> This should be the action plan for you :
    >
    As you already pointed out, the portal seems to become unresponsive because the Edison provider is not responding fast enough to requests from the Portal framework. Oracle Portal should be able to recover from thi in normal cases. Unfortunately the configuration settings in the Portal were changed from the default values making it almost impossible for the framework to recover from the error. To understand this, we will need to go through the theory :
    The Oracle Portal framework collects information from various sources and assembles these to web pages which are then sent to the end users internet browser. Providers are one source of information. To retrieve the information from providers, Oracle Portal allocates a so-called fetcher thread in OC4J_Portal. This fetcher thread will create a session with the (remote) provider and fetch the content, similar to how a web browser would contact a web server to retrieve an HTML page. It is important to note that Oracle Portal allocates a fetcher thread for each portlet on a page. For a page with five portlets, five fetcher threads are allocated as the content is fetched in parallel.
    In a default configuration with only one OC4J_Portal process, the number of fetcher threads is limited to 25. With five portlets on a page, the Portal will be able to serve up to five requests simultaneously before the pool of fetcher threads gets exhausted. This is normally not a problem because the fetcher threads are allocated for just a few seconds normally. Once they have received the response from the provider, they are returned to the pool and will be available to the Portal again.
    The problems start when the provider's response becomes sluggish. The fetcher thread is not returned to the pool immediately. The requests start to queue up until the system doesn't have any fetcher threads available anymore. Once there are no fetcher threads available, the Portal will wait for a new fetcher thread for a certain period of time (as specified by the queueTimeout). After expiration of this queue timeout, the Portal will return an error to the Oracle HTTP Server. This is when end users will start to experience errors in the pages.
    To keep the Portal alive and healthy, administrators should take care that the fetcher threads pool doesn't get exhausted. Obviously the best way to do this is to ensure that all providers respond in a reasonable amount of time. If there is no control on the response times of the providers, administrators can use the timeouts in the framework to assure that long running requests are killed off by the framework to assure that the fetcher threads are returned to the pool again. These parameters are configured in the web.xml from the application portal in the OC4J container called OC4J_Portal. Obviously users will see timeout errors for particular portlets on certain pages but the overall framework will be available. In addition, administrators can decide to increase the number of fetcher threads by starting more than one OC4J_Portal process. Each additional process will increase the amount of fetcher threads with 25. There is a memory penalty for this however as each process can consume between 256 - 512 Mb of memory. Administrators should only increase the amount of processes when they have checked that the Portal midtier system has enough free memory available to accommodate for these additional processes.
    Action plan :
    1. Change the timeout values for the Portal framework to the default values :
    a. Navigate to $ORACLE_HOME/j2ee/OC4J_Portal/applications/portal/portal/WEB-INF
    b. Copy the web.xml :
    % cp web.xml web.xml_23MAR2010
    c. Edit the web.xml :
    For both the RepositoryServlet and the PortalServlet, remove the STALL timeout
    For the page servlet, remove the requesttime, minTimeout, stall and queueTimeout parameters
    2. Increase the number of OC4J_Portal processes from 1 to 4 :
    a. Create a copy of the file $ORACLE_HOME/opmn/conf/opmn.xml :
    % cp opmn.xml opmn.xml_23MAR2010
    b. Open the file opmn.xml
    c. Locate the following section :
    <process-type id="OC4J_Portal" module-id="OC4J">
    d. Within the section for the process OC4J_Portal, change the following line :
    <process-set id="default_island" numprocs="1"/>
    to
    <process-set id="default_island" numprocs="4"/>
    3. Synchronize the DCM repository :
    % $ORACLE_HOME/dcm/bin/dcmctl updateconfig
    4. Restart the midtier processes
    % $ORACLE_HOME/opmn/bin/opmnctl stopall
    % $ORACLE_HOME/opmn/bin/opmnctl startall
    4. Check whether the changes have are in effect :
    a. Number of OC4J_Portal processes :
    Run opmnctl status and count the number of OC4J_Portal processes. You should see four of them.
    b. Timeout parameters in OC4J_Portal
    Open the file $ORACLE_HOME/j2ee/OC4J_Portal/application-deployments/portal/OC4J_Portal_default_island_1/application.log and check for the following line at the end of the file :
    10/03/08 06:32:32 portal: PPE version : 10.1.2.0.2 (29022008)
    10/03/08 06:32:32 portal: Tuning parameter values : poolSize(Fetchers)=25[default=25] : minTimeout(MinTimeout)=5s[default=5s] : requesttime(DefaultTimeout)=15s[default=15s] : stall(MaxTimeout)=65s[default=65s] :
    queueTimeout(QueueTimeout)=10s[default=10s] maxParallelPortlets=20[default=20] maxParallelPagePortlets=10[default=10]

  • Sometimes tests fail abruptly with timeout in CUITE

    Hi,
    we have a tests suite of codedui tests, and sometimes we noticed that tests fails with timeout :
    Test 'XXXX' exceeded execution timeout period.
    The problem with this is that when we get this failure, it seems that the tests doe not execute MyTestCleanup(), so  the following tests fail.
    the header of our functions looks like the following :
           [TestMethod, Timeout(5  60  1000)]
            [Description("Description")]
            [Owner("pm")]
            [TestCategory("C1"), TestCategory("Regression"), TestCategory("C2"), Priority(2)]
            public void VerifyFunctionality1()
    is there any wahy to make the tests execute the MytestCleanup() when they timeout ?? please note we use vstest.console.exe and visual studio 2012.
    Regards

    Hi kaki2000,
    >>is there any wahy to make the tests execute the MytestCleanup() when they timeout ?? please note we use vstest.console.exe and visual studio 2012.
    The real issue is that where you design the MytestCleanup(), do you use the cleanup method like ClassCleanup Attribute or the TestCleanup Attribute?
    If so, I think it would have a limitation for it, for example,
    the TestCleanup: Identifies a method that contains code that must be used after the test has run and to free resources obtained by all the tests in the test class.
    I think you could get useful information here "How Cleanup Methods Affect Test Run Time-Outs
    https://msdn.microsoft.com/en-us/library/ms243175.aspx?f=255&MSPPError=-2147217396 
    The test run might have a time-out value assigned. The amount of time that is used by the cleanup methods is added to the total amount of time that is used by the test run. In other words, the cleanup time counts toward the time limit that you have
    imposed on the test run as a whole, and therefore could cause the test run to time out.
    Best Regards,
    Jack 
    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.

  • Creating Singleton with Workshop

    I am trying to create a Singleton with Workshop and am having some difficulties. When I try to add the <singleton-service> element to the weblogic-application.xml deployment descriptor, I get a schema error because the element is not defined in the supplied schema location of http://www.bea.com/ns/weblogic/90/weblogic-application.xsd. If I change the location to http://www.bea.com/ns/weblogic/920/weblogic-application.xsd (note the change from "90" to "920"), then the <singleton-service> element is defined, but this schema has two subelements defined as <singleton-class> and <singleton-uri>. According to the documentation (and oddly enough the comments in the schema itself), these elements should be <class-name> and <name> respectively.
    There is a weblogic-application.xsd file located in a eclipse plugins folder under workshop that is the same as the old version without the <singleton-service> element. I am assuming that some eclipse builder uses this schema and may be causing the problem. I tried updating this file, but that just causes eclipse to crash on startup.
    Anyone have any ideas on how to get an EAR project with a singleton to build successfully in Workshop?

    Hi Vimala,
    I tried your example and got the deployment problem as well. I don't think the way you have your schema defined is correct. By putting xmlns:xls="http://www.bea.com/ns/weblogic/90", you are associating all tags that begin with "wls:" with that namespace. By specifying the schemas location for http://www.bea.com/ns/weblogic/920, you are telling it where it can find the "920" schema, but it is never stated where you find the "90" schema. This effectively turns off schema checking for the "90" namespace. By not putting "wls:" in front of singleton-service, you are putting it at the default namespace which is not defined. This all seems to make Eclipse happy because it cannot fully validate the document.
    I did find a jar file in the weblogic install that contains the schemas that weblogic uses internally. The jar file is at \beahome\weblogic92\server\lib\schema\weblogic-container-binding.jar. The schema for weblogic-application.xml is in this jar and is different from either the "90" or "920" schemas that is online. I believe this is why there is an error when you try to deploy your app. It must validate against this schema.
    I have found as long as I match this schema, I can just leave the schemaLocation out of my weblogic-application.xml file and get it to build and deploy. I do get problems reported by eclipse that I need to define library references because it is needed by dependent projects. I believe this is because internally eclipse has its own copy of the schema which predates the <singleton-service> element. The builder is trying to validate the document against this schema and is failing because of the <singleton-service> element, so it cannot find the <library-ref> elements that are in the document. I did not get the same problem with your example application and I haven't figured out why yet. Funny thing, I can make a change to some other file in the project and save and all the reported problems disappear.
    I believe using this work-around, I am able to get a good EAR file to build and deploy. It just seems that after I deploy and define my singleton using the admin console that nothing happens. I get no indications that the singleton is working or not in the logs. This did cause me to try a little experiment in that I configured a singleton service using the admin console to a singleton that did not exist. It acts identically to the one that did exist. No warnings or errors at all. I would hope that if I configured a singleton that I would get an error if weblogic could not start it.
    Thanks for your efforts. Let me know if you find out anything else,
    Jeff

  • Help needed to start HTTP Protocol with timeout

    I am looking for information to point me in the right direction. I would like to create a class that would implement the HTTP protocol and would allow the user to specify a timeout if unable to connect to the server. I have used the URL and HttpURLConnection classes before, but have not used any of the other classes in the java.net package. I am just trying to create an app that will download a file from a specified URL. Something that I could use in the future and something to get more programming experience using the java.net package.
    Could you tell me:
    1) Which classes I would need to use to help implement a timeout
    2) Where I can find an example or other information on how to implement the HTTP protocol with the class from question 1 above.
    TIA for any information

    That would definately reduce the coding time but would
    do little to help with my understanding of classes in
    the java.net package or to gather a better
    understanding of the HTTP protocol. :-)
    That said, I am currently downloading the 1.5 beta to
    see what they have done.If it's just an academic thing to re-invent the wheel (code) that deals with the HTTP protocol, then go right ahead (ok, you don't need my permission).

  • Problem with timeout exception on a block step

    Hi there, i have a BPM with a block step that has a 1 minute duration timeout,  when i see the steps on the sxmb_moni_bpe the block deadline is being reached after 2:50 more or less, on the block i have an infinite loop with a receive step, does anybody knows why is taking more than expected?, how can i fix it?, thanks for all the help on the matter,
    Regards,
    Robert.

    Hi ,
    This may be due to some missed runtime environment parameters.
    Go to trans - SWU3
    In Maintain Runtime Environment
    Execute the following activities :-
    1. Schedule background job for missed deadline
    2. Schedule background job for deadline Monitoring
    Also have a look at sap note 1117735, if you are not able to execute the above activities.
    Regards,
    Sunil Chandra
    Edited by: sunil chandra on Sep 29, 2009 8:18 PM

  • How can I add logic control with timeout in OSB?

    In the proxy service, when I try to call business service, the business service may timeout, how can I add logic with this? Like, I can set the timeout to 20 seconds, if more than 20 seconds, then do something else. But I just want this service can set to 20 seconds, others may different. Is that possible? Thanks.

    There is a Read Timeout and Connection Timeout setting in the Business service configuration.
    You can change the default values and test.Inside the error handler you can choose to do something else after you 20 seconds.
    Test and let us know if it works.

  • SOAP - XI - RFC / Problem with timeout-handle

    hi gurus
    B I G   U R G E N T problem. how can it be:
    - i've got an custom-bapi
    - in receiver-rfc-adapter 'commit-controller' is on
    when i force an time-out in sap ecc the soap-caller receives an system-error 'time-out...'.
    but: the custom-bapi becomes an commit and in ecc the document is booked!
    how can it be?
    thanks
    t

    hi Rajesh
    in sxmb_moni the message has the status 'log-version'.
    soap-adapter-log:
    2010-06-24 17:04:42 Erfolgreich calling the module processor for channel CC_SD01_WS_OUT
    2010-06-24 17:04:42 Erfolgreich MP: Tritt in den Modulprozessor ein
    2010-06-24 17:04:42 Erfolgreich MP: Lokales Modul localejbs/sap.com/com.sap.aii.af.soapadapter/XISOAPAdapterBean wird verarbeitet
    2010-06-24 17:04:42 Erfolgreich SOAP: request message entering the adapter with user KOMM
    2010-06-24 17:04:42 Erfolgreich SOAP: request message leaving the adapter (call)
    2010-06-24 17:04:42 Erfolgreich Die Anwendung versucht eine XI Message synchron zu senden über SOAP_http://sap.com/xi/XI/System
    2010-06-24 17:04:42 Erfolgreich Versuch die Message in die Call-Queue zu stellen
    2010-06-24 17:04:42 Erfolgreich Message erfolgreich in Queue gestellt
    2010-06-24 17:04:42 Erfolgreich Die Message wurde erfolgreich aus der Call-Queue abgerufen
    2010-06-24 17:04:42 Erfolgreich Der Status der Message wurde auf DLNG gesetzt
    2010-06-24 17:05:47 Fehler Rückgabe synchroner Fehlerbenachrichtigung an rufende Anwendung: com.sap.aii.af.ra.ms.api.RecoverableException: Received HTTP response code 500 : Timeout.
    2010-06-24 17:05:47 Fehler Die Übertragung der Message über http://szhm2179:8001/sap/xi/engine?type=entry ist fehlgeschlagen, weil: com.sap.aii.af.ra.ms.api.DeliveryException: Received HTTP response code 500 : Timeout
    2010-06-24 17:05:47 Fehler Der Status der Message wurde auf FAIL gesetzt
    2010-06-24 17:05:47 Fehler Zurück zur Anwendung. Ausnahme: com.sap.aii.af.ra.ms.api.DeliveryException: Received HTTP response code 500 : Timeout
    2010-06-24 17:05:47 Fehler SOAP: call failed: com.sap.aii.af.ra.ms.api.DeliveryException: Received HTTP response code 500 : Timeout
    2010-06-24 17:05:47 Fehler SOAP: call failed: com.sap.aii.af.ra.ms.api.DeliveryException: Received HTTP response code 500 : Timeout
    2010-06-24 17:05:47 Fehler MP: Ausnahme aufgetreten mit Grund com.sap.aii.af.ra.ms.api.RecoverableException: Received HTTP response code 500 : Timeout: com.sap.aii.af.ra.ms.api.DeliveryException: Received HTTP response code 500 : Timeout
    rfc-adapter-log:
    2010-06-24 17:04:43 Erfolgreich Message wurde erfolgreich vom Messaging-System empfangen. Profil: XI URL: http://szhm2179.stzh.ch:50100/MessagingSystem/receive/AFW/XI Credential (User): PIISUSER
    2010-06-24 17:04:43 Erfolgreich Mit der Verbindung RFC_http://sap.com/xi/XI/System. Versuch die Message in die Request-Queue zu stellen
    2010-06-24 17:04:43 Erfolgreich Message erfolgreich in Queue gestellt
    2010-06-24 17:04:43 Erfolgreich Die Message wurde erfolgreich von der Request-Queue abgerufen
    2010-06-24 17:04:43 Erfolgreich Der Status der Message wurde auf DLNG gesetzt
    2010-06-24 17:04:43 Erfolgreich Liefert an Kanal: CC_SD01_RFC_IN
    2010-06-24 17:04:43 Erfolgreich MP: Tritt in den Modulprozessor ein
    2010-06-24 17:04:43 Erfolgreich MP: Lokales Modul localejbs/RfcAFBean wird verarbeitet
    2010-06-24 17:04:43 Erfolgreich RFC-Adapter hat synchrone Message erhalten. Versucht, sRFC für /STZH/SOZ_CD_F2_BELEG_CREATE zu senden
    2010-06-24 17:04:43 Erfolgreich RFC-Adapter hat synchrone Message erhalten. Versucht, sRFC für J2EE_GUEST zu senden
    2010-06-24 17:05:47 Fehler SOAP: error occured: com.sap.aii.af.ra.ms.api.RecoverableException: Received HTTP response code 500 : Timeout: com.sap.aii.af.ra.ms.api.DeliveryException: Received HTTP response code 500 : Timeout
    2010-06-24 17:08:43 Erfolgreich BAPI-Response war eine Struktur des Typs BAPIRET2
    2010-06-24 17:08:43 Erfolgreich TYPE='S', Message (ID:/stzh/messages, NUMBER:000): "I:/stzh/messages:000 Beleg wurde erfolgreich gebucht", LOG_NO:, LOG_MSG_NO:000000 (PARAMETER:, ROW:0, FIELD:, SYSTEM:D70450)
    2010-06-24 17:08:43 Erfolgreich BAPI erfolgreich ausgeführt
    2010-06-24 17:08:43 Erfolgreich Commit-Transaktion mit BAPI_TRANSACTION_COMMIT
    2010-06-24 17:08:43 Erfolgreich MP: Verlässt den Modulprozessor
    2010-06-24 17:08:43 Fehler Zustellung der Message an die Anwendung über RFC_http://sap.com/xi/XI/System ist fehlgeschlagen weil: com.sap.aii.af.ra.ms.api.MessageExpiredException: Sync application request expired.. Message wird auf 'fehlgeschlagen' gesetzt
    2010-06-24 17:08:43 Fehler Der Status der Message wurde auf FAIL gesetzt
    2010-06-24 17:08:43 Fehler Rückgabe der synchronen Fehler-Message an rufende Anwendung: com.sap.aii.af.ra.ms.api.MessageExpiredException: Sync application request expired..
    why does the rfc-adapter sends the bapi_transaktion_commit after an soap-error?
    thank you for your help.
    regards
    t.

  • EJB 3.1 @Singleton with @Startup causes @PostConstruct to be called twice...

    I have been working on initializing a some elements in the @PostConstruct annotated method within an EJB that is already annotated as @Singleton.  I decided that I wanted the initialization to be done when the EJB is deployed so I added the @Startup.  Both the constructor and @PostConstruct method is getting called twice.  Can someone please explain to me why it appears the EJB is being initialized twice and if there is a way to prevent the @PostConstruct method from being called twice?
    Many thanks,
    - Joe

    Is this with GlassFish?

  • Problems with timeout - Jersey Client

    Hi, my names is Alexandre,
    I'm building a client to a restful webservice using jersey as client engine. The problem is that one of the services exposed has more then 20 seconds to bring the response. And jersey doesn´t set any timeout grater then 20 seconds..... I need a timeout of, at least, 300000 miliseconds. Does anyone know how to configure a timeout in jersey, not using the method setTimeoutConnection from the com.sun.jersey.api.client.Client? This method doesn´t work for timeouts superior to 20 seconds.
    Thanks in advance.

    Hi Alexandre,
    we have the same problem. Have you resolved it ?
    By the way we use Jersey-client 1.3 and setting a timeout greater than 20 seconds seems to work (I successfully tried with 60 seconds).
    But is there a way (as you wondered) to set the timeout on something else than the Client object ?
    We need to set short timeouts for usual requests, but for lengthy requests (like video upload) we need a much larger timeout.
    If the Client class is the only place where we can set the timeout, then we'll have to use 2 Client instances, that is less than ideal...
    I was more looking for a setTimeout() on WebResource or AsyncWebResource, or on their get() or post() methods...
    I did RTFM, but I didn't find anything in the Jersey doc.
    Hum... Just searched the source code... I confirm currently it's not possible to have a request-specific timeout...
    Thierry

Maybe you are looking for