Thread Synchronization problem

We guys are developing a P2P file sharing software(on LAN) and our program requires that we implement a multi-threaded client. I somewhere read on the forum about a multi threaded server but it doesnt work in my case (not on the client side.)The program runs properly when a single transfer is happening but if more then one file is getting downloaded the program seems to fall apart. Here's the code that provides the client side implementation of a file transfer.
class Down implements Runnable     
                     DataOutputStream dataOutput;     
                     BufferedInputStream bufferedInput;     
                     FileOutputStream fileOutput;
                     Socket down;
                     public void run()
                                  try
                                          int data=0;
                                          long i=0;
                                          down=new Socket(user,9999);
                                          dataOutput=new DataOutputStream(down.getOutputStream());  //The following two lines send the file path to the server, to make the server's job easier rather than the server going for a file search
                                          String msg=path.replace('\\','/');   dataOutput.writeUTF(msg);     
                                          dataOutput.flush();
                                          bufferedInput=new BufferedInputStream(down.getInputStream());
                                          fileOutput=new FileOutputStream(new File(path));
                                          while (data != -1)
                                                   data=bufferedInput.read();
                                                   fileOutput.write(data);
                                                   fileOutput.flush();
                                                   i++;
                                                   System.out.println("Transferring "+i);
                                          System.out.println("File Transfer Done");
                                          done=true;
                                 catch (Exception e)
                                             e.printStackTrace();
                                 } Can you guys point out specifically where my program would need synchronization, since im a noob when it comes to threads. Thanks

Thanks ejp for those prompt replies .......yeah the path and the down socket) variables are unique...... from what i see on my network .... the server side of the transfer happens at a faster rate i.e the final println line printing the transferred byte (at the end of the while loop) is much ahead at the server side of the transfer ...... the client lags far behind in this regard...... and from what i know Lan connections support upto 100Mbps so there's no question of data loss..... one of the reasons i opted for byte by byte transfer....... just to be on the safer side...... and yes ill make that small change in my program

Similar Messages

  • Java Two Threads Synchronization Problem

    Hello to all, i have a scenario like this where a manager open a restaurant which signal the arrival of customer.
    Each entity here is one thread.
    How to signal the customer from manager that is open state ?
    I have a boolean variable (IsOpen) in manager class.
    My code:
    public class Manager implements Runnable {
         boolean IsOpen, IsStartWorking, IsLastOrder,
              IsClosingTime;
         public void run()
             try
                  // while not closing time
                  while (true)
                       if (!IsOpen && !IsStartWorking)
                            open();
                            startWorking();
                       prepareCappuccino();
                       prepareHotChocolate();
                       prepareFruitJuice();
                       // serve drink then refill Ingredients based on
                       // order
                       myCoffeePowder.refillCoffeePowder();
                       myCocoPowder.refillCocoPowder();
                       myMilk.refillMilk();
                       myFJ.refillFruitJuice();
                       Thread.sleep(100);
                  // Manager alert closing time
                  //closingtime();
                   //sanityCheck();
                   //statisticsDispaly();
                   //managerLeave();           
             catch(InterruptedException e)
                  e.printStackTrace();
              public void open() {
             IsOpen = true;
              System.out.println(dateFormat.format(cal.getTime()) +
                   " Thread Manager: Manager open Restaurant");
              //notifyAll();
    }I want to notify the customer thread when the IsOpen state become true.
    As you can see from open() method, there is notifyAll() but it turn error because it does not own the monitor.
    I have solution like this create a monitor with Isopen variable and once is open notifyAll().
    I never tried that.
    Please give some comment.
    The logic here is model using FSP like below
    MANAGER = (manager.open->startWorking->STARTWORKING),
    CUSTOMER = (manager.open->CUST_ARRIVE),manager.open is a shared action in FSP.
    Please help.
    Thanks.

    I think you had taken notify and notifyall in not correct way. According to me you need a another class say HotelManagement which hold the information of state of Manager and customer. This will hold the list of customer which are requsting to be allowed in hotel.So this class has methods like (Please pardon me for choosing some bad names ..I hope you will find some better names).
    1. updateStateOfManager() = which allow manager to Update its state. and if state become open it will take each customer from RequsetedCustomer list and call their allowed method. If state become Closed it will take each customer from RequsetedCustomer list and call their removed method.
    2. requestfromCustomer()= this method called by customer requesting for entry in hotel. if the state is open it allowed them immediately and kept in RequestedCustomer list too so that they can be removed when manager state changed. and if manager state is closed they are not allowed but kept in RequsetedCustomer list.
    3. finshedFromCustomer()= customer done in hotel so remove from RequsetedCustomer list;
    You can used AtomicBoolean objects for keeping state of Manager other thread safe data Structure for holding other objects.

  • Need help for thread synchronization

    Hi guys,
    i got some problem with the thread synchronization.
    actually my code is like,
    class myClass
    public static void main()
    PvsIdentify identifyThread = new PvsIdentify(this); //Child trd 1
    PvsPolling pollingThread = new PvsPolling(this); //Child trd 2
    identifyThread.start();
    pollingThread.start();
    synchronized(this) {
    try {
    this.wait();
    } catch (Exception ex) {
    ex.printStackTrace();
    /// Code to follow based on the ouput from these two child threads
    if( ! identifyThread.getOutput() =="")
    my requirement is ,
    the identifyThread is giving an output. so after the completion of that child thread only IF condition should execute.
    but for me the IF condition is getting execute before the complete execution of identifyThread.
    what may be the problem.
    thanx in advance.---------------Subbu

    my problem is, that child thread identifyThread will do some process and final throw the output in a JOption dialog box to the main window.
    if we use join for the child thread then that dialog box will not come the the main window.
    This is my code,
              businessCancel = false;
              pollingCancel = false;
              String userName = txtInputId.getText();
                    //CHECK FOR EXISTANCE OF USER NAME
                    boolean isNameExist=false;
                    int isString = this.isValidName(userName);
                    try { // This code block invokes the PalmsSEIPort:isNameExist operation on web service
                        palmsecuresdk.sample.Palms palms = new palmsecuresdk.sample.Palms_Impl();
                        palmsecuresdk.sample.PalmsSEI _palmsSEIPort = palms.getPalmsSEIPort();
                        isNameExist = _palmsSEIPort.isNameExist(userName);
                        System.out.println("The result of isNameExist is==="+isNameExist);
                    } catch(javax.xml.rpc.ServiceException ex) {
                        // TODO handle ServiceException
                    } catch(java.rmi.RemoteException ex) {
                        // TODO handle remote exception
                    } catch(Exception ex) {
                        // TODO handle custom exceptions here
                    if(isNameExist==false)
                        if (isString==1) {
                            // CHECK FOR EXISTANCE OF USER PALM DATA
                            //Identify process
                            setComponentEnabled(false);
                            PvsIdentify identifyThread = new PvsIdentify(this);
                            PvsPolling pollingThread = new PvsPolling(this);
                            identifyThread.start();  
                            pollingThread.start();
                            btnCancel.requestFocus();
                            synchronized(this) {
                                    try {
                                        System.out.println("the owner of this thread is "+this.getOwner());
                                         identifyThread.join();
                                         pollingThread.join();
                                        System.out.println("Main thread is sleeping now");
                                    } catch (Exception ex) {
                                        ex.printStackTrace();
                            this.notifyAll();
                            System.out.println("After the identify process over");
                            String isPalmExist = identifyThread.getFinalResult();
                            while(isPalmExist.equals(""))
                                isPalmExist = identifyThread.getFinalResult();
                                if(!isPalmExist.equals(""))
                                    this.notifyAll();
                            System.out.println("The identify result is "+isPalmExist);
                            if(isPalmExist.equalsIgnoreCase("Identify Failed"))
                                // To display PROCEED MsgBox
                                identifyThread.result=102;
                                identifyThread.resultNotify(isPalmExist);                           
                                // Execute enrollment process.
                                setComponentEnabled(false);
                                PvsEnroll enrollThread = new PvsEnroll(this, this, userName);
                                //PvsPolling pollingThread = new PvsPolling(this);
                                enrollThread.start();
                                pollingThread.start();
                                btnCancel.requestFocus();                           
                            else
                                identifyThread.result=101;
                                identifyThread.resultNotify(isPalmExist);
                        else {
                                // Guidance display(ID is not correct.)
                                String message = langFileAccessor.getLangInfo(
                                                                        PvsLangFileAccessor.KEY_GUIDANCE_ILLEGALID);
                                dispGuidance(message);
                                initState();
                    else
                        String message = langFileAccessor.getLangInfo(PvsLangFileAccessor.KEY_GUIDANCE_EXISTINGID);
                        dispGuidance(message);
                        initState();
                    }

  • Client Synchronization Problem

    Hi All,
    When I am synchronizing for the first time to get deviceid from mobile client
    getting the following error.
    • Synchronization started 
    • Proxy http://xyz:port/meSync/servlet/meSync?~sysid=ABC& 
    • Connection to server failed. 
    • Synchronization problems: Transport-layer (http) sync exception raised (root cause: Exception while synchronizing (java.io.IOException: Not in GZIP format)) 
    Could anybody tell what  I have to do please.
    Regards,
    Ameer Baba

    Hi Abhijit,
    Here it is.
    Trace   
    [20070219 08:57:53:791] I [MI/API/Logging ] ***** LOG / TRACE SWITCHED ON 
    [20070219 08:57:53:791] I [MI/API/Logging ] ***** Mobile Engine version: MI 70 SP 9 Patch 5 Build 200612061055 
    [20070219 08:57:53:791] I [MI/API/Logging ] ***** Current timezone: Indian/Reunion 
    [20070219 08:57:53:791] I [MI ] Trace severity: All (1000) 
    [20070219 08:57:53:791] D [MI/PIOS ] No implementations found. Error Code:(3) 
    [20070219 08:57:53:791] D [MI/API/Runtime/JSP ] AbstractMEHttpServlet:dispatch request to '/jsp/trace/trace.jsp' 
    [20070219 08:57:59:808] D [MI/Core ] Set current application to 'MOBILEENGINE_JSP' 
    [20070219 08:57:59:808] D [MI/API/Runtime/JSP ] AbstractMEHttpServlet:doGet(...) called 
    [20070219 08:57:59:808] D [MI/API/Runtime/JSP ] AbstractMEHttpServlet:getEvent() done with event name = '' 
    [20070219 08:57:59:808] I [MI/API/Sync ] Terminate connection feature is not configured 
    [20070219 08:57:59:808] D [MI/API/Runtime/JSP ] AbstractMEHttpServlet:dispatch request to '/jsp/home/home.jsp' 
    [20070219 08:58:01:569] D [MI/Core ] Set current application to 'MOBILEENGINE_JSP' 
    [20070219 08:58:01:569] D [MI/API/Runtime/JSP ] AbstractMEHttpServlet:doGet(...) called 
    [20070219 08:58:01:569] D [MI/API/Runtime/JSP ] AbstractMEHttpServlet:getEvent() done with event name = '' 
    [20070219 08:58:01:569] D [MI/API/Runtime/JSP ] AbstractMEHttpServlet:dispatch request to '/jsp/home/syncpassword.jsp' 
    [20070219 08:58:06:432] D [MI/Core ] Set current application to 'MOBILEENGINE_JSP' 
    [20070219 08:58:06:432] D [MI/API/Runtime/JSP ] AbstractMEHttpServlet:doGet(...) called 
    [20070219 08:58:06:432] D [MI/API/Runtime/JSP ] AbstractMEHttpServlet:getEvent() done with event name = '' 
    [20070219 08:58:06:432] P [MI/Sync ] Notify R3 called 
    [20070219 08:58:06:432] D [MI/Sync ] There is already a container for method WAF_REGISTRY and user AMEERB in the outbound queue 
    [20070219 08:58:06:432] I [MI/API/Sync ] Terminate connection feature is not configured 
    [20070219 08:58:06:432] D [MI/API/Runtime/JSP ] AbstractMEHttpServlet:dispatch request to '/jsp/home/home.jsp' 
    [20070219 08:58:06:447] D [MI/API/Services ] MEResourceBundle:Constructor: Create MEResourceBundle(com/sap/ip/me/awtapps/home/mobile_engine, en_IN, (null)) 
    [20070219 08:58:06:447] D [MI/API/Services ] MEResourceBundle:Constructor: Use classloader com.sap.ip.me.core.Startup@18fe7c3 
    [20070219 08:58:06:447] D [MI/API/Services ] CREATED MEPropertyResourceBundle com.sap.ip.me.api.services.MEResourceBundle$MEPropertyResourceBundle@d24e3f for bundleName: com/sap/ip/me/awtapps/home/mobile_engine with Locale: _en 
    [20070219 08:58:06:463] D [MI/API/Services ] CREATED parent MEPropertyResourceBundle for child bundle: com.sap.ip.me.api.services.MEResourceBundle$MEPropertyResourceBundle@d24e3f using bundle name: com/sap/ip/me/awtapps/home/mobile_engine 
    [20070219 08:58:06:463] I [MI/Sync ] Synchronize with backend called, Thread=Thread-27 
    [20070219 08:58:06:463] I [MI/Sync ] Thread=Thread-27 took lock for synchronization. 
    [20070219 08:58:06:463] P [MI/Sync ] Use following gateway for synchronization: http://cymobile:8001 
    [20070219 08:58:06:588] D [MI/SyncMonitor ] New synchronization process has been started 
    [20070219 08:58:06:588] D [MI/Sync ] Synchronisation: Fire SyncEvent 0 
    [20070219 08:58:06:588] D [MI/API/Services ] MEResourceBundle:Constructor: Create MEResourceBundle(com/sap/ip/me/awtapps/home/mobile_engine, en_IN, (null)) 
    [20070219 08:58:06:588] D [MI/API/Services ] MEResourceBundle:Constructor: Use classloader com.sap.ip.me.core.Startup@18fe7c3 
    [20070219 08:58:06:588] D [MI/API/Services ] CREATED MEPropertyResourceBundle com.sap.ip.me.api.services.MEResourceBundle$MEPropertyResourceBundle@10f41e9 for bundleName: com/sap/ip/me/awtapps/home/mobile_engine with Locale: _en 
    [20070219 08:58:06:603] D [MI/API/Services ] CREATED parent MEPropertyResourceBundle for child bundle: com.sap.ip.me.api.services.MEResourceBundle$MEPropertyResourceBundle@10f41e9 using bundle name: com/sap/ip/me/awtapps/home/mobile_engine 
    [20070219 08:58:06:603] D [MI/API/Sync ] SyncEvent com.sap.ip.me.api.sync.SyncEvent[source=com.sap.ip.me.sync.SyncManagerMerger@5bb966] skipped for User because he has not been installed on MW. 
    [20070219 08:58:06:603] D [MI/API/Sync ] SyncEvent com.sap.ip.me.api.sync.SyncEvent[source=com.sap.ip.me.sync.SyncManagerMerger@5bb966] skipped for User because he has not been installed on MW. 
    [20070219 08:58:06:603] D [MI/API/Sync ] SyncEvent com.sap.ip.me.api.sync.SyncEvent[source=com.sap.ip.me.sync.SyncManagerMerger@5bb966] skipped for User because he has not been installed on MW. 
    [20070219 08:58:06:603] D [MI/API/Sync ] SyncEvent com.sap.ip.me.api.sync.SyncEvent[source=com.sap.ip.me.sync.SyncManagerMerger@5bb966] skipped for User because he has not been installed on MW. 
    [20070219 08:58:06:603] D [MI/API/Sync ] SyncEvent com.sap.ip.me.api.sync.SyncEvent[source=com.sap.ip.me.sync.SyncManagerMerger@5bb966] skipped for User because he has not been installed on MW. 
    [20070219 08:58:06:603] D [MI/API/Sync ] SyncEvent com.sap.ip.me.api.sync.SyncEvent[source=com.sap.ip.me.sync.SyncManagerMerger@5bb966] skipped for User because he has not been installed on MW. 
    [20070219 08:58:06:603] D [MI/API/Sync ] SyncEvent com.sap.ip.me.api.sync.SyncEvent[source=com.sap.ip.me.sync.SyncManagerMerger@5bb966] skipped for User because he has not been installed on MW. 
    [20070219 08:58:06:603] D [MI/API/Sync ] SyncEvent com.sap.ip.me.api.sync.SyncEvent[source=com.sap.ip.me.sync.SyncManagerMerger@5bb966] skipped for User because he has not been installed on MW. 
    [20070219 08:58:06:603] D [MI/API/Sync ] SyncEvent com.sap.ip.me.api.sync.SyncEvent[source=com.sap.ip.me.sync.SyncManagerMerger@5bb966] skipped for User because he has not been installed on MW. 
    [20070219 08:58:06:603] P [MI/Sync ] Start updating data completeness flag for user all sync relevant users 
    [20070219 08:58:06:634] P [MI/Sync ] Update data completeness flag for user AMEERB 
    [20070219 08:58:06:634] P [MI/Sync ] Update data completeness flag for user (SHARED) 
    [20070219 08:58:06:634] P [MI/Sync ] Finished updating data completeness flag for user all sync relevant users 
    [20070219 08:58:06:634] P [MI/Sync ] Repetitive sync is turned off 
    [20070219 08:58:06:634] P [MI/Sync ] Synchronization started for user (SHARED) 
    [20070219 08:58:06:634] D [MI/API/Services ] MEResourceBundle:Constructor: Create MEResourceBundle(com/sap/ip/me/awtapps/home/mobile_engine, en_IN, (null)) 
    [20070219 08:58:06:634] D [MI/API/Services ] MEResourceBundle:Constructor: Use classloader com.sap.ip.me.core.Startup@18fe7c3 
    [20070219 08:58:06:634] D [MI/API/Services ] CREATED MEPropertyResourceBundle com.sap.ip.me.api.services.MEResourceBundle$MEPropertyResourceBundle@b05acd for bundleName: com/sap/ip/me/awtapps/home/mobile_engine with Locale: _en 
    [20070219 08:58:06:634] D [MI/API/Services ] CREATED parent MEPropertyResourceBundle for child bundle: com.sap.ip.me.api.services.MEResourceBundle$MEPropertyResourceBundle@b05acd using bundle name: com/sap/ip/me/awtapps/home/mobile_engine 
    [20070219 08:58:06:634] D [MI/SyncMonitor ] Sync monitor data file does not exist; use default values 
    [20070219 08:58:06:634] D [MI/SyncMonitor ] Start sync cycle at 20070219085806 (1171875486634) 
    [20070219 08:58:06:634] D [MI/Sync ] PackageManager: old package file C:\Program Files\SAP Mobile Infrastructure\sync\(SHARED)\out\package.out was successfully deleted 
    [20070219 08:58:06:634] D [MI/Sync ] PackageManager: create package with maximum 2147483647 items 
    [20070219 08:58:06:650] D [MI/API/Services ] MEResourceBundle:Constructor: Create MEResourceBundle(com/sap/ip/me/awtapps/home/mobile_engine, en_IN, (null)) 
    [20070219 08:58:06:650] D [MI/API/Services ] MEResourceBundle:Constructor: Use classloader com.sap.ip.me.core.Startup@18fe7c3 
    [20070219 08:58:06:650] D [MI/API/Services ] CREATED MEPropertyResourceBundle com.sap.ip.me.api.services.MEResourceBundle$MEPropertyResourceBundle@1989b5 for bundleName: com/sap/ip/me/awtapps/home/mobile_engine with Locale: _en 
    [20070219 08:58:06:650] D [MI/API/Services ] CREATED parent MEPropertyResourceBundle for child bundle: com.sap.ip.me.api.services.MEResourceBundle$MEPropertyResourceBundle@1989b5 using bundle name: com/sap/ip/me/awtapps/home/mobile_engine 
    [20070219 08:58:06:650] D [MI/Sync ] PackageManager: filled package with 0 acknowledge received container(s) 
    [20070219 08:58:06:650] D [MI/API/Services ] MEResourceBundle:Constructor: Create MEResourceBundle(com/sap/ip/me/awtapps/home/mobile_engine, en_IN, (null)) 
    [20070219 08:58:06:650] D [MI/API/Services ] MEResourceBundle:Constructor: Use classloader com.sap.ip.me.core.Startup@18fe7c3 
    [20070219 08:58:06:650] D [MI/API/Services ] CREATED MEPropertyResourceBundle com.sap.ip.me.api.services.MEResourceBundle$MEPropertyResourceBundle@a00185 for bundleName: com/sap/ip/me/awtapps/home/mobile_engine with Locale: _en 
    [20070219 08:58:06:666] D [MI/API/Services ] CREATED parent MEPropertyResourceBundle for child bundle: com.sap.ip.me.api.services.MEResourceBundle$MEPropertyResourceBundle@a00185 using bundle name: com/sap/ip/me/awtapps/home/mobile_engine 
    [20070219 08:58:06:666] D [MI/Sync ] PackageManager: filled package with 0 acknowledge container(s) 
    [20070219 08:58:06:666] D [MI/API/Services ] MEResourceBundle:Constructor: Create MEResourceBundle(com/sap/ip/me/awtapps/home/mobile_engine, en_IN, (null)) 
    [20070219 08:58:06:666] D [MI/API/Services ] MEResourceBundle:Constructor: Use classloader com.sap.ip.me.core.Startup@18fe7c3 
    [20070219 08:58:06:666] D [MI/API/Services ] CREATED MEPropertyResourceBundle com.sap.ip.me.api.services.MEResourceBundle$MEPropertyResourceBundle@c3c315 for bundleName: com/sap/ip/me/awtapps/home/mobile_engine with Locale: _en 
    [20070219 08:58:06:666] D [MI/API/Services ] CREATED parent MEPropertyResourceBundle for child bundle: com.sap.ip.me.api.services.MEResourceBundle$MEPropertyResourceBundle@c3c315 using bundle name: com/sap/ip/me/awtapps/home/mobile_engine 
    [20070219 08:58:06:666] D [MI/Sync ] PackageManager: filled package with 0 container items or headers 
    [20070219 08:58:06:666] D [MI/Sync ] PackageManager: filled package with 1 notify container(s) 
    [20070219 08:58:06:666] D [MI/SyncMonitor ] Finished outbound preparation at 20070219085806 (1171875486666) 
    [20070219 08:58:06:666] D [MI/Sync ] Package file C:\Program Files\SAP Mobile Infrastructure\sync\(SHARED)\out\package.out exists and can be read 
    [20070219 08:58:06:666] P [MI/Sync ] Synchronisation started 
    [20070219 08:58:06:666] D [MI/Sync ] Begin: Dumping file C:\Program Files\SAP Mobile Infrastructure\sync\(SHARED)\out\package.out 
    <ID>MISYNC</ID><FLAGS>0x1</FLAGS><VERSION>251500</VERSION> 
    <CONTAINER> 
    <HEADER> 
    <CONTAINER_ID>0110d938dbcae8b4c559</CONTAINER_ID> 
    <OWNER></OWNER> 
    <CONTAINER_TYPE>N</CONTAINER_TYPE> 
    <METHOD></METHOD> 
    <CONVERSATION_ID></CONVERSATION_ID> 
    <PARENT_CONTAINER_ID></PARENT_CONTAINER_ID> 
    <MESSAGE_INDEX>-1</MESSAGE_INDEX> 
    <MESSAGE_TYPE> </MESSAGE_TYPE> 
    <SERVER_ID>NEW_PROTOCOL</SERVER_ID> 
    <BODY_TYPE></BODY_TYPE> 
    <BODY_LENGTH>0</BODY_LENGTH> 
    <SUB_CONTAINER_ID>-1</SUB_CONTAINER_ID> 
    <SUB_CONT_MAX>0</SUB_CONT_MAX> 
    <ITEM_FROM>-1</ITEM_FROM> 
    <ITEM_TO>-1</ITEM_TO> 
    </HEADER> 
    </CONTAINER> 
    <SYNC_MONITOR> 
    <NEW_SYNC_FLAG>1</NEW_SYNC_FLAG> 
    <OUTBOUND_PREPARATION_TIME>0</OUTBOUND_PREPARATION_TIME> 
    <OUTBOUND_PREPARATION_FINISHED>20070219085806</OUTBOUND_PREPARATION_FINISHED> 
    <LAST_SERVER2CLIENT_NETWORK_TIME>-2147483648</LAST_SERVER2CLIENT_NETWORK_TIME> 
    <LAST_INBOUND_PROCESSING_TIME>-2147483648</LAST_INBOUND_PROCESSING_TIME> 
    <LAST_SYNC_CYCLE_TIME>-2147483648</LAST_SYNC_CYCLE_TIME> 
    <LAST_SYNC_GUID></LAST_SYNC_GUID> 
    </SYNC_MONITOR> 
    [20070219 08:58:06:681] D [MI/Sync ] End: Dumping file C:\Program Files\SAP Mobile Infrastructure\sync\(SHARED)\out\package.out 
    [20070219 08:58:06:681] I [MI/Sync ] Outbound file size for user (SHARED) is 131 
    [20070219 08:58:06:681] P [MI/Sync ] Do not use http proxy (system properties update) 
    [20070219 08:58:06:681] P [MI/Sync ] Use following gateway for synchronization: http://cymobile:8001 
    [20070219 08:58:06:681] I [MI/Sync ] GzipDataCompression: Gzip data compression is switched on 
    [20070219 08:58:06:681] P [MI/Sync ] Sending outbound file compressed to server. 
    [20070219 08:58:06:681] P [MI/Sync ] Outbound file was compressedly sent. 
    [20070219 08:58:06:697] I [MI/Sync ] HttpSynchronizer caught exception java.io.FileNotFoundException: http://name:port/sap/bc/MJC/mi_host?sysid=XYZ&client=100&~language=EN&ACKNOWLEDGE=& 
    java.io.FileNotFoundException: http://name:port/sap/bc/MJC/mi_host?sysid=XYZ&client=100&~language=EN&ACKNOWLEDGE=& 
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:812) 
    at com.sap.ip.me.sync.HTTPSynchronizer.getInputStreamViaTimeOutOrNot(HTTPSynchronizer.java:351) 
    at com.sap.ip.me.sync.HTTPSynchronizer.synchronize(HTTPSynchronizer.java:258) 
    at com.sap.ip.me.sync.HTTPSynchronizer.synchronize(HTTPSynchronizer.java:484) 
    at com.sap.ip.me.sync.HTTPSynchronizer.exchangeData(HTTPSynchronizer.java:73) 
    at com.sap.ip.me.sync.SyncManagerImpl.processSyncCycle(SyncManagerImpl.java:847) 
    at com.sap.ip.me.sync.SyncManagerImpl.syncForUser(SyncManagerImpl.java:1304) 
    at com.sap.ip.me.sync.SyncManagerImpl.processSynchronization(SyncManagerImpl.java:935) 
    at com.sap.ip.me.sync.SyncManagerImpl.synchronizeWithBackend(SyncManagerImpl.java:440) 
    at com.sap.ip.me.sync.SyncManagerImpl.synchronizeWithBackend(SyncManagerImpl.java:303) 
    at com.sap.ip.me.api.sync.SyncManager.synchronizeWithBackend(SyncManager.java:79) 
    at com.sap.ip.me.apps.jsp.Home$SyncRunnable.run(Home.java:568) 
    at java.lang.Thread.run(Thread.java:534) 
    [20070219 08:58:06:697] E [MI/Sync ] Exception while synchronizing via http 
    com.sap.ip.me.api.services.HttpConnectionException: Exception while synchronizing (java.io.FileNotFoundException: http://name:port/sap/bc/MJC/mi_host?sysid=XYZ&client=100&~language=EN&ACKNOWLEDGE=&) 
    at com.sap.ip.me.sync.HTTPSynchronizer.synchronize(HTTPSynchronizer.java:334) 
    at com.sap.ip.me.sync.HTTPSynchronizer.synchronize(HTTPSynchronizer.java:484) 
    at com.sap.ip.me.sync.HTTPSynchronizer.exchangeData(HTTPSynchronizer.java:73) 
    at com.sap.ip.me.sync.SyncManagerImpl.processSyncCycle(SyncManagerImpl.java:847) 
    at com.sap.ip.me.sync.SyncManagerImpl.syncForUser(SyncManagerImpl.java:1304) 
    at com.sap.ip.me.sync.SyncManagerImpl.processSynchronization(SyncManagerImpl.java:935) 
    at com.sap.ip.me.sync.SyncManagerImpl.synchronizeWithBackend(SyncManagerImpl.java:440) 
    at com.sap.ip.me.sync.SyncManagerImpl.synchronizeWithBackend(SyncManagerImpl.java:303) 
    at com.sap.ip.me.api.sync.SyncManager.synchronizeWithBackend(SyncManager.java:79) 
    at com.sap.ip.me.apps.jsp.Home$SyncRunnable.run(Home.java:568) 
    at java.lang.Thread.run(Thread.java:534) 
    [20070219 08:58:06:697] P [MI/Core ] original context restored 
    [20070219 08:58:06:697] W [MI/Sync ] Synchronisation problems 
    com.sap.ip.me.api.sync.SyncException: Transport-layer (http) sync exception raised (root cause: Exception while synchronizing (java.io.FileNotFoundException: http://name:port/sap/bc/MJC/mi_host?sysid=XYZ&client=100&~language=EN&ACKNOWLEDGE=&)) 
    at com.sap.ip.me.sync.HTTPSynchronizer.exchangeData(HTTPSynchronizer.java:82) 
    at com.sap.ip.me.sync.SyncManagerImpl.processSyncCycle(SyncManagerImpl.java:847) 
    at com.sap.ip.me.sync.SyncManagerImpl.syncForUser(SyncManagerImpl.java:1304) 
    at com.sap.ip.me.sync.SyncManagerImpl.processSynchronization(SyncManagerImpl.java:935) 
    at com.sap.ip.me.sync.SyncManagerImpl.synchronizeWithBackend(SyncManagerImpl.java:440) 
    at com.sap.ip.me.sync.SyncManagerImpl.synchronizeWithBackend(SyncManagerImpl.java:303) 
    at com.sap.ip.me.api.sync.SyncManager.synchronizeWithBackend(SyncManager.java:79) 
    at com.sap.ip.me.apps.jsp.Home$SyncRunnable.run(Home.java:568) 
    at java.lang.Thread.run(Thread.java:534) 
    [20070219 08:58:06:697] D [MI/Sync ] Synchronisation: Fire SyncEvent 1 
    [20070219 08:58:06:697] D [MI/API/Services ] MEResourceBundle:Constructor: Create MEResourceBundle(com/sap/ip/me/awtapps/home/mobile_engine, en_IN, (null)) 
    [20070219 08:58:06:697] D [MI/API/Services ] MEResourceBundle:Constructor: Use classloader com.sap.ip.me.core.Startup@18fe7c3 
    [20070219 08:58:06:697] D [MI/API/Services ] CREATED MEPropertyResourceBundle com.sap.ip.me.api.services.MEResourceBundle$MEPropertyResourceBundle@1328c7a for bundleName: com/sap/ip/me/awtapps/home/mobile_engine with Locale: _en 
    [20070219 08:58:06:697] D [MI/API/Services ] CREATED parent MEPropertyResourceBundle for child bundle: com.sap.ip.me.api.services.MEResourceBundle$MEPropertyResourceBundle@1328c7a using bundle name: com/sap/ip/me/awtapps/home/mobile_engine 
    [20070219 08:58:06:697] P [MI/Core ] Thread Thread-27 switched context to MI414d45455242 / MI414d45455242 (User: AMEERB, MSD: Name: / MOBILEENGINE_JSP (V. 7095), Target=, Type=com.sap.ip.me.core.FrameworkApplicationType) (stack level 1) 
    [20070219 08:58:06:697] I [MI/API/Sync ] SyncEvent Performing com.sap.ip.mi.systemnews.SyncListener on ConversationId MI414d45455242 
    [20070219 08:58:06:697] P [MI/Core ] original context restored 
    [20070219 08:58:06:697] P [MI/Core ] Thread Thread-27 switched context to MI2853484152454429 / MI2853484152454429 (User: (SHARED), MSD: Name: / MOBILEENGINE_JSP (V. 7095), Target=, Type=com.sap.ip.me.core.FrameworkApplicationType) (stack level 1) 
    [20070219 08:58:06:697] I [MI/API/Sync ] SyncEvent Performing com.sap.ip.me.ccms.remotetracing.RemoteTracingListener on ConversationId MI2853484152454429 
    [20070219 08:58:06:697] P [MI/Core ] original context restored 
    [20070219 08:58:06:697] P [MI/Core ] Thread Thread-27 switched context to MI2853484152454429 / MI2853484152454429 (User: (SHARED), MSD: Name: / MOBILEENGINE_JSP (V. 7095), Target=, Type=com.sap.ip.me.core.FrameworkApplicationType) (stack level 1) 
    [20070219 08:58:06:697] I [MI/API/Sync ] SyncEvent Performing com.sap.ip.me.ccms.LastSuccessfulSyncAlert on ConversationId MI2853484152454429 
    [20070219 08:58:06:697] P [MI/Core ] original context restored 
    [20070219 08:58:06:697] P [MI/Core ] Thread Thread-27 switched context to MI2853484152454429 / MI2853484152454429 (User: (SHARED), MSD: Name: / MOBILEENGINE_JSP (V. 7095), Target=, Type=com.sap.ip.me.core.FrameworkApplicationType) (stack level 1) 
    [20070219 08:58:06:697] I [MI/API/Sync ] SyncEvent Performing com.sap.ip.me.ccms.AlertManagerImpl on ConversationId MI2853484152454429 
    [20070219 08:58:06:697] P [MI/Core ] original context restored 
    [20070219 08:58:06:697] P [MI/Core ] Thread Thread-27 switched context to MI2853484152454429 / MI2853484152454429 (User: (SHARED), MSD: Name: / MOBILEENGINE_JSP (V. 7095), Target=, Type=com.sap.ip.me.core.FrameworkApplicationType) (stack level 1) 
    [20070219 08:58:06:697] I [MI/API/Sync ] SyncEvent Performing com.sap.ip.me.sync.LogSender on ConversationId MI2853484152454429 
    [20070219 08:58:06:712] P [MI/Core ] original context restored 
    [20070219 08:58:06:712] P [MI/Core ] Thread Thread-27 switched context to MI2853484152454429 / MI2853484152454429 (User: (SHARED), MSD: Name: / MOBILEENGINE_JSP (V. 7095), Target=, Type=com.sap.ip.me.core.FrameworkApplicationType) (stack level 1) 
    [20070219 08:58:06:712] I [MI/API/Sync ] SyncEvent Performing com.sap.ip.me.services.os.AgentManager$AgentSyncEventListener on ConversationId MI2853484152454429 
    [20070219 08:58:06:712] P [MI/Core ] original context restored 
    [20070219 08:58:06:712] P [MI/Core ] Thread Thread-27 switched context to MI414d45455242 / MI414d45455242 (User: AMEERB, MSD: Name: / MOBILEENGINE_JSP (V. 7095), Target=, Type=com.sap.ip.me.core.FrameworkApplicationType) (stack level 1) 
    [20070219 08:58:06:712] I [MI/API/Sync ] SyncEvent Performing com.sap.ip.me.core.StatusUpdater on ConversationId MI414d45455242 
    [20070219 08:58:06:712] P [MI/Core ] original context restored 
    [20070219 08:58:06:712] P [MI/Core ] Thread Thread-27 switched context to MI2853484152454429 / MI2853484152454429 (User: (SHARED), MSD: Name: / MOBILEENGINE_JSP (V. 7095), Target=, Type=com.sap.ip.me.core.FrameworkApplicationType) (stack level 1) 
    [20070219 08:58:06:712] I [MI/API/Sync ] SyncEvent Performing com.sap.ip.me.ccms.configinfo.ConfigInfoListener on ConversationId MI2853484152454429 
    [20070219 08:58:06:712] P [MI/Core ] original context restored 
    [20070219 08:58:06:712] P [MI/Core ] Thread Thread-27 switched context to MI2853484152454429 / MI2853484152454429 (User: (SHARED), MSD: Name: / MOBILEENGINE_JSP (V. 7095), Target=, Type=com.sap.ip.me.core.FrameworkApplicationType) (stack level 1) 
    [20070219 08:58:06:712] I [MI/API/Sync ] SyncEvent Performing com.sap.ip.me.services.os.ScriptManager on ConversationId MI2853484152454429 
    [20070219 08:58:06:712] P [MI/Core ] original context restored 
    [20070219 08:58:06:712] I [MI/Sync ] Synchronization finished, Thread=Thread-27 
    [20070219 08:58:16:703] D [MI/Core ] Set current application to 'MOBILEENGINE_JSP' 
    [20070219 08:58:16:703] D [MI/API/Runtime/JSP ] AbstractMEHttpServlet:doGet(...) called 
    [20070219 08:58:16:703] D [MI/API/Runtime/JSP ] AbstractMEHttpServlet:getEvent() done with event name = '' 
    [20070219 08:58:16:703] I [MI/API/Sync ] Terminate connection feature is not configured 
    [20070219 08:58:16:703] D [MI/API/Runtime/JSP ] AbstractMEHttpServlet:dispatch request to '/jsp/home/synclog.jsp' 
    [20070219 08:58:21:317] D [MI/Core ] Set current application to 'MOBILEENGINE_JSP' 
    [20070219 08:58:21:317] D [MI/API/Runtime/JSP ] AbstractMEHttpServlet:doGet(...) called 
    [20070219 08:58:21:317] D [MI/API/Runtime/JSP ] AbstractMEHttpServlet:getEvent() done with event name = '' 
    [20070219 08:58:21:317] I [MI/API/Sync ] Terminate connection feature is not configured 
    [20070219 08:58:21:317] D [MI/API/Runtime/JSP ] AbstractMEHttpServlet:dispatch request to '/jsp/home/home.jsp' 
    [20070219 08:58:22:579] D [MI/Core ] Set current application to 'MOBILEENGINE_JSP' 
    [20070219 08:58:22:579] D [MI/API/Runtime/JSP ] AbstractMEHttpServlet:doGet(...) called 
    [20070219 08:58:22:579] D [MI/API/Runtime/JSP ] AbstractMEHttpServlet:getEvent() done with event name = '' 
    [20070219 08:58:22:579] D [MI/API/Runtime/JSP ] AbstractMEHttpServlet:dispatch request to '/jsp/trace/trace.jsp' 
    [20070219 08:58:24:684] D [MI/Core ] Set current application to 'MOBILEENGINE_JSP' 
    [20070219 08:58:24:684] D [MI/API/Runtime/JSP ] AbstractMEHttpServlet:doGet(...) called 
    [20070219 08:58:24:684] D [MI/API/Runtime/JSP ] AbstractMEHttpServlet:getEvent() done with event name = '' 
    Regards,
    Ameer Baba.

  • [WLS92] Thread synchronization bottleneck in RJVMManager

    All,
    First off, apologies for the long post -- there is a lot to get through.
    h3. Environment:
    Weblogic Server 9.2 MP3 deployed into Solaris 10 / Sparc hosts.
    Sun JDK 1.5.0_12 JVM (shipped with WLS)
    h3. Problem:
    We are experiencing a problem with out WLS 9.2/MP3 (Solaris/Sparc) installation. We have a number of servers each running the same WLS configuration but some with different application: one server is running App A, 4 other servers are running App B (not in a cluster). We are using JMS to transfer messages from App A to App B in a strict failover configuration such that App A will always try and send to App B1, App B2, AppB3 and finally App B4, moving from one to the next if the transfer fails or takes longer than a given timeout (10 seconds). The dispatching happens in separate threads, which I will refer to as 'senders', so we can timeout the transfer attempt.
    In the 'happy day' scenario where all four App B servers are up and running, everything works as expected.
    Problems start to surface when we test the failover configurations.
    In scenarios where the hosts are available but WLS is in either not running or in Admin mode, the failover proceeds as expected.
    In scenarios where the hosts are unavailable (hardware is powered down, network is disrupted etc.), the failover does not proceed as expected. In a scenario where App B1 is down but the other three are available for example, the following are observed:
    1. the time taken for the underlying socket connection to App B1 to timeout is very long (~7.5 minutes).
    2. the connections to the other hosts appear to block until after the socket timeout to App B1 occurs.
    The relevant section of the code is:
    weblogic.security.Security.runAs(new Subject(), new PrivilegedAction<Void>() {
         public Void run() {
              InitialContext context = null;
              try {
                   * During server-to-server sending of messages we must establish and maintain
                   * a new context that will contain the security information established by
                   * the initial context object. This has to be done per thread, hence why it
                   * is applied here to the dispatcher. The context will be closed when
                   * the thread is returned.
                   final Hashtable<?,?> environment = getEnvironment();
                   try {
                        if (log.isDebugEnabled()) {
                             log.debug(format("run(): Sender %d Creating initial context; env=%s", id, environment));
                        context = new InitialContext(environment);
                        if (log.isDebugEnabled()) {
                             log.debug(format("run(): Sender %d Created initial context in %d ms", id, System.currentTimeMillis() - start));
                        runWithContext();
                   } catch (NamingException e) {
                        log.error(format("run(): Sender %d cannot create initial context", id), e);
              } finally {
                   try {                           
                        if (context != null) {
                             if (log.isDebugEnabled()) {
                                  log.debug(format("run(): Sender %d closing initial context", id, context));
                             context.close();
                   } catch (NamingException e) {
                        log.error(format("run(): Sender %d cannot close initial context", id), e);
              return null;
    Thread stacks for two sample threads in this scenario are as follows. Thread '20' is the sender attempting to connect to App B1, Thread '8' is the sender attempting to connect to App B2 and is representative of a number of other threads all attempting to connect to known good hosts.
    Daemon Thread [[ACTIVE] ExecuteThread: '20' for queue: 'weblogic.kernel.Default (self-tuning)'] (Suspended)     
         PlainSocketImpl.socketConnect(InetAddress, int, int) line: not available [native method]     
         SocksSocketImpl(PlainSocketImpl).doConnect(InetAddress, int, int) line: 333     
         SocksSocketImpl(PlainSocketImpl).connectToAddress(InetAddress, int, int) line: 195     
         SocksSocketImpl(PlainSocketImpl).connect(SocketAddress, int) line: 182     
         SocksSocketImpl.connect(SocketAddress, int) line: 366     
         SSLSocketImpl(Socket).connect(SocketAddress, int) line: 519     
         SSLSocketImpl(Socket).connect(SocketAddress) line: 469     
         SSLSocketImpl(Socket).<init>(SocketAddress, SocketAddress, boolean) line: 366     
         SSLSocketImpl(Socket).<init>(InetAddress, int, InetAddress, int) line: 266     
         SSLSocketImpl(SSLSocket).<init>(InetAddress, int, InetAddress, int) line: 195     
         SSLSocketImpl.<init>(TLSSystem, InetAddress, int, InetAddress, int) line: not available     
         SSLSocketFactoryImpl.createSocket(InetAddress, int, InetAddress, int) line: not available     
         ChannelSSLSocketFactory.createSocket(InetAddress, int) line: 77     
         MuxableSocketT3S(AbstractMuxableSocket).createSocket(InetAddress, int, int) line: 207     
         MuxableSocketT3S(MuxableSocketT3).newSocketWithRetry(InetAddress, int, int) line: 252     
         MuxableSocketT3S(MuxableSocketT3).connect(InetAddress, int, int) line: 421     
         MuxableSocketT3S.createConnection(InetAddress, int, ServerChannel, JVMID, int) line: 79     
         ConnectionManager.createConnection(Protocol, InetAddress, int, ServerChannel, JVMID, int) line: 1749     
         ConnectionManagerServer(ConnectionManager).findOrCreateConnection(ServerChannel, JVMID, int) line: 1410     
         ConnectionManagerServer(ConnectionManager).bootstrap(JVMID, ServerChannel, int) line: 448     
         ConnectionManagerServer(ConnectionManager).bootstrap(InetAddress, int, ServerChannel, int) line: 326     
         RJVMManager.findOrCreateRemoteInternal(InetAddress, int, String, String, int) line: 261     
         RJVMManager.findOrCreate(InetAddress, int, String, String, int) line: 204     
         RJVMFinder.findOrCreateRemoteServer(InetAddress, int, String, int) line: 226     
         RJVMFinder.findOrCreate(boolean, String, HostID, int) line: 189     
         ServerURL.findOrCreateRJVM(boolean, String, HostID, int) line: 154     
         WLInitialContextFactoryDelegate$1.run() line: 342     
         AuthenticatedSubject.doAs(AbstractSubject, PrivilegedExceptionAction) line: 363     
         SecurityManager.runAs(AuthenticatedSubject, AuthenticatedSubject, PrivilegedExceptionAction) line: 147     
         WLInitialContextFactoryDelegate.getInitialContext(Environment, String, HostID) line: 337     
         Environment.getContext(String, HostID) line: 307     
         Environment.getContext(String) line: 277     
         WLInitialContextFactory.getInitialContext(Hashtable) line: 117     
         NamingManager.getInitialContext(Hashtable<?,?>) line: 667     
         InitialContext.getDefaultInitCtx() line: 247     
         InitialContext.init(Hashtable<?,?>) line: 223     
         InitialContext.<init>(Hashtable<?,?>) line: 197     
         FailoverMessageSender$Sender$1.run() line: 475     
         FailoverMessageSender$Sender$1.run() line: 458     
         AuthenticatedSubject.doAs(AbstractSubject, PrivilegedAction) line: 321     
         SecurityManager.runAs(AuthenticatedSubject, AuthenticatedSubject, PrivilegedAction) line: 121     
         Security.runAs(Subject, PrivilegedAction) line: 41     
         FailoverMessageSender$Sender.run() line: 457     
         DelegatingWork.run() line: 61     
         J2EEWorkManager$WorkWithListener.run() line: 259     
         ExecuteThread.execute(Runnable) line: 209     
         ExecuteThread.run() line: 181     
    Daemon Thread [[ACTIVE] ExecuteThread: '8' for queue: 'weblogic.kernel.Default (self-tuning)'] (Suspended)     
         RJVMManager.findOrCreateRemoteInternal(InetAddress, int, String, String, int) line: 252     
         RJVMManager.findOrCreate(InetAddress, int, String, String, int) line: 204     
         RJVMFinder.findOrCreateRemoteServer(InetAddress, int, String, int) line: 226     
         RJVMFinder.findOrCreate(boolean, String, HostID, int) line: 189     
         ServerURL.findOrCreateRJVM(boolean, String, HostID, int) line: 154     
         WLInitialContextFactoryDelegate$1.run() line: 342     
         AuthenticatedSubject.doAs(AbstractSubject, PrivilegedExceptionAction) line: 363     
         SecurityManager.runAs(AuthenticatedSubject, AuthenticatedSubject, PrivilegedExceptionAction) line: 147     
         WLInitialContextFactoryDelegate.getInitialContext(Environment, String, HostID) line: 337     
         Environment.getContext(String, HostID) line: 307     
         Environment.getContext(String) line: 277     
         WLInitialContextFactory.getInitialContext(Hashtable) line: 117     
         NamingManager.getInitialContext(Hashtable<?,?>) line: 667     
         InitialContext.getDefaultInitCtx() line: 247     
         InitialContext.init(Hashtable<?,?>) line: 223     
         InitialContext.<init>(Hashtable<?,?>) line: 197     
         FailoverMessageSender$Sender$1.run() line: 475     
         FailoverMessageSender$Sender$1.run() line: 458     
         AuthenticatedSubject.doAs(AbstractSubject, PrivilegedAction) line: 321     
         SecurityManager.runAs(AuthenticatedSubject, AuthenticatedSubject, PrivilegedAction) line: 121     
         Security.runAs(Subject, PrivilegedAction) line: 41     
         FailoverMessageSender$Sender.run() line: 457     
         DelegatingWork.run() line: 61     
         J2EEWorkManager$WorkWithListener.run() line: 259     
         ExecuteThread.execute(Runnable) line: 209     
         ExecuteThread.run() line: 181     
    h3. Conclusion:
    All of the threads are jamming up in RJVMManager.findOrCreateRemoteInternal(..) behind the one thread that is actually attempting to make a connection.
    A quick disassemby of the offending method class shows the following snippet:
    /* */ private RJVM findOrCreateRemoteInternal(InetAddress paramInetAddress, int paramInt1, String paramString1, String paramString2, int paramInt2)
    /* */ throws UnrecoverableConnectException, IOException
    /* 246 */ RJVM localRJVM = findExisting(paramInetAddress, paramInt1, (ServerChannel)localObject1);
    /* 248 */ if (localRJVM != null) return localRJVM;
    /* 250 */ synchronized (this.bootstrapLock)
    /* 252 */ localRJVM = findExisting(paramInetAddress, paramInt1, (ServerChannel)localObject1);
    /* 253 */ if (localRJVM != null) return localRJVM;
    /* 256 */ if ((Kernel.DEBUG) && (debugConnection.isDebugEnabled())) {
    /* 257 */ RJVMLogger.logDebug("Bootstrapping connection to: '" + paramInetAddress + ":" + paramInt1 + "' using: '" + localProtocol + "'");
    /* 260 */ ConnectionManager localConnectionManager = ConnectionManager.create(null);
    /* 261 */ return record(localConnectionManager.bootstrap(paramInetAddress, paramInt1, (ServerChannel)localObject1, paramInt2), paramInetAddress);
    Now the problem becomes clear. I suspect that the reason for the synchronized block on line 250 is to prevent two threads attempting the relatively expensive operation on line 261 (see lines 248-250 and 252-253). However, the flaw here is that the synchronization blocks all threads irrespective of which InetAddress (param 1) the thread is attempting to connect to. My personal opinion is that the monitor used for thread synchronization should be timed to the host (InetAddress) for the connection, which incidentally is used in the record(..) method anyway.
    The problem is exacerbated by the very long network connection timeout.
    h3. Solutions:
    We've tried setting the sun.net.defaultConnectTimeout JVM property to try and reduce the impact but haven't seen any noticeable improvement.
    We've tried specifying the weblogic.jndi.clientTimeout and weblogic.jndi.requestTimeout values when creating the InitialContext. For some reason specifying these properties caused all connection attempts to fail -- even the happy day scenarios.
    h3. Final Questions:
    Is this a bug? If so, what do I need to do to get this fixed urgently?
    Is this a bug other people have run into? If so, how was it resolved?
    Any other suggestions?
    Thanks!
    Edited by: user11373704 on 10-Jul-2009 08:52

    Perhaps the relevant timeouts are socket/network related in this case.
    To detect "silent" network failures, WebLogic uses a heartbeat mechanism, but I'm told that one should not tune the related settings too aggressively. I think this is tunable on a per server basis -- at least for the default network channels. Specifically there's heartbeat interval and period length on the console at "Server -> Configuration Tab --> Tuning Tab --> Advanced".
    There's also "Complete Message Timeout" under "Protocol -> General".
    In addition, TCP/IP timeouts are tunable on the operating system itself. I don't know the specifics for Solaris.
    Tom

  • A very strange synchronization problem

    Hi Everybody,
    I would like to get some help regarding a strange synchronization problem that I have found. I have created a java server application and after a lot of testing I have found the following problem:
    A certain thread (Thread-A) is stuck forever on a synchornized (objX) line, whereas another thread (Thread-B) every 30 seconds performs a section which is protected by the same synchornized (objX) line.
    It seems that the objX is not held by any thread, but Thread-A is stuck forever.
    The BUG is reproducible after the server runs about 1 day.
    The server is running on Linux machine (Red Hat 7.3) with JVM 1.4 (Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01)).
    I would appreciate any help.
    Thanks In Advance,
    Idan Zach

    This is not a starvation problem since Thread-B performs its job every 30 seconds. The job is very short (I have added log messages before Thread-B starts its job and after it completes the job).
    However, the priority of both threads are the same.
    Thanks In Advance,
    Idan Zach

  • Has anyone not working with .dv files had synchronization problems?

    Has anyone not working with .dv files had sound synchronization problems? I'm not exactly sure what the alternatives to DV are, but I think one of them is HD.
    The reason for asking this question is to help isolate the nature and cause of a very serious flaw in iMovie '11. In the original release of iMovie '11 (version 9.0) there was a small--but serious--synchronization problem. In the 9.01 there is a large synchronization problem. We know of one person who has not experienced the problem, and he is not working with DV files (media). So we want to find out if anyone who is using something other than .dv files is experiencing a lack of synchronization between sound and picture. Knowing the answer to this will help with figuring out where the cause lies. For the initial iMovie '11 release (9.0), you probably would not notice a problem unless you had very long event-clips, e.g., two hours long. Events get this long if you are transferring from analog 8 mm tapes. Even then, it would have to be in scenes in which the connection between event and sound is obvious, e.g., close ups of people talking. It isn't until the 9.01 release that most people would notice anything. All we need to do is establish one case of a synchronization problem in which the person is using something other than DV.
    Message was edited by: Paul Bullen

    Hopefully, the 9.0.2 release will make my question moot. Zyfert must have posted the announcement of the release just as I was formulating my question. Still, if you have information on the subject, it would be interesting to hear.

  • How to avoid synchronization problem in a  JSP webpage

    HI,
    In my web page im facing a problem like if two user are workin, by that time one's page is getting reflected in other's page.
    Can anyone tell me how to avoid this synchronization problem?
    Thanx a lot

    Hi Rajesh,
    we Have Configured LDAP tree Successfully....the Problem is the Role Assignment iview under Portal Admin is not appearing....if we check the Test Connection with the  users Configured with LDAP in Authentication server TAB under user configuration,it is showing success message...but at the same time we are unable to login with the same user in to the Portal..we are working with EP 5.0....any help can be appreciated
    Regards
    Sudhir

  • To those who have had synchronization problems: Did your files end in .dv?

    In order to determine whether the synchronization problems were restricted to people using DV files, it would be helpful if anyone who had a problem could say whether their files ended in .dv. So: if you had a problem, could you please say what sort of files (medium) you were using? DV? HD? Whatever else there is? Thank you.

    my clips were all pulled directly from my Canon FS20 camcorder. the file extensions of the raw footage is all ".mov" ... hope that helps. J
    Thanks. It does help--or at least it should help the people who know enough about the subject to digest its significance. I'm trying to help them. They said this would be useful to know. (I think you actually posted this information before, but it slipped by; so I am glad you provide it again.)

  • Having email imap synchronization problems with outlook 365 proplus

    Hello,
    I have email imap synchronization problems with outlook 365 proplus.
    If I sent emails , my sent items box does not synchronized.
    This is really a bug, because I see more problems like this on internet.
    Please make ASAP a solution , this is not professional
    JMR

    Hi JMR,
    Assuming you are referring to Outlook 2013 by "outlook 365 proplus". This is actually because Outlook 2013’s IMAP implementation has changed when compared to previous versions of Outlook.
    While configuring the IMAP account, Outlook will talk to the IMAP server for the correct folders first. If Outlook 2013 can’t find the correct folder for the Sent Items in your mail server, it will create a folder which doesn’t sync with the mail server.
    To sync the Sent Items folder with IMAP server, we can try to root the mailbox:
    Go to FILE->Account Settings->Account Settings…
    Double click on your IMAP account.
    Click More Options… button, then Advanced tab
    Type "Inbox" as the "Root folder path"
    Hope this helps.
    Regards,
    Ethan Hua
    TechNet Community Support
    It's recommended to download and install
    Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
    programs.

  • 9.0.2 does NOT solve synchronization problems

    Since we have one title that says 9.0.1 solves the synchronization problem and one that says it does not, we truly have an issue, i.e., conflicting claims that need to be adjudicated.

    Ok starting to understand what you are describing. My only other suggestion is to do this:
    1. Quit iMoive, then go to the event in the Finder where you DV clips live.
    2. Delete ALL of the iMovie cache folders INCLUDING the one that is inside the Thumbnail folder.
    3. Relaunch iMovie and wait for everything to regenerate
    Try that, I've had success in the past using this method
    Thank you for your patience. Since I have quite a few such cache folders, unless I hear different from you, I will try this out on one carefully chosen event. By carefully chosen, I mean one in which there is a scene near the end of the long event that now clearly exhibits a lack of synchronization.
    (My tentative guess is that 9.0.2 solves the problems caused by 9.01, but not the lesser ones caused by 9.0. In the latter case, only people with very long events will notice a problem.)

  • Possible "pitch/synchronization" problems when exporting

    I have a video that I edited in Adobe Premiere Pro, with a Sequence setting of 23.976fps... in the editor, when I render it and play it back... it plays back beautifully. Just the way I want it to.
    I exported it as an MP4 file (with NATIVE fps, 23.976) and uploaded it to Vimeo, and played it there - and I SEE that it's off.
    The way my video is edited is very fast, and relies heavily on Audio/Video synchronization, it's the WHOLE point of my video.
    In Vimeo - I can SEE that it's off. The video is just a few milliseconds lagging. It's not catastrophical, but spending a month editing and playing it back over and over again in Premiere Pro, I pretty much know how it should play out... and the moment I saw it playback on Vimeo, I spotted this slight un-synchronization. The audio is slightly faster than the image that is supposed to be in synchronization with that audio effect
    Is this a frame rate problem or am I exporting it wrong?
    My Adobe Premiere Sequence settings are
    [quote]Sequence 01
    1920 x 1080
    00;20;26;11, 23.976 fps
    48000 Hz - Stereo[/quote]
    when I right click on the actual audio IN the timeline the settings are
    [quote]Source Audio Format: 44100 Hz - compressed - Stereo
    Project Audio Format: 44100 Hz - 32 bit floating point - Stereo
    Total Duration: 00:04:39:37476
    Average Data Rate: 39 KB / second[/quote]
    Can anyone tell me if there's something I'm doing wrong?
    the 44hz, and the Sequence 48Hz are different, yes... but why is it when I play it back rendered in Premiere that it syncs perfectly then? or does the problem lie in something else?
    Again for reference, my video is very experimental, the cuts are very fast that sync with the sound.

    Hate to bring up an old thread, but this is EXACTLY the same type of issue I am always having, and rather than be accused of not doing a search, I thought that I'd reply to this and see if any can give some insight.
    I'm in the exact same situation where the type of edits that I do are critical in syncing audio and sfx to visual cues in the video. As the OP mentioned, I spend countless hours getting things just right on the Premiere timeline, only to have things be not quite right on export...regardless of format it seems.
    The bigges then I'm thinking is the root cause is the fact that many audio sources are different. Most music from CDs or online are in 44kHz whereas default sequences in Premiere are in 48kHz, as well as audio from video cameras.
    It's really difficult to understand what is the "proper" workflow when working with 48kHz and 44kHz to ensure that WYHIWYG (what you hear is what you get), on export.
    Is there anyone that can explain or point in the right direction to solve this issue?

  • Synchronization problem with BBr curve 9320 and outlook 2010

    Following the installation of office 2010 it's impossible to synchronize my BBR wth my PC; I get the message below:
    Thanks for your help.
    Message:
    Caught_com_error exception. description();(null); error(): 2147312566 (0x80029C4A);
    Errormessage(): erreur lors du chargement de la bibliothèque/DLL dy type; Source();(null)
    Solved!
    Go to Solution.

    Dychow wrote:
    I'm dylan from malaysia. I facing a problem! What the service about blackberry? I cannot find an contact to call blackberry customer service! Does Blackberry have office in malaysia?? My blackberry device 9320, always like burning (feeling hot), no matter i take off the battery and fix back, or i restart back the device, still the same question! And it kill my battery faster! WTF with this problem?
    Hi and Welcome to the Community!
    BlackBerry actually provides zero front line support to end users, including warranty...all support starts with the carriers, authorized resellers, and authorized service centers, all who can escalate cases into BlackBerry at no charge to the end user. So your service/support path would start by checking your original purchase documentation and finding out what it tells you regarding how it works in your region -- it can vary by region as well as by specific issue. From what you describe, your's sounds like a device-level issue, which would therefore be either an authorized service center or your original place of purchase.
    There also might be some good reading here:
    http://us.blackberry.com/legal/handheld-limited-warranty.html
    If you remain unsure where to go, then I'd recommend you check with your original place of purchase or your mobile service provider for local guidance.
    Good luck!
    Occam's Razor nearly always applies when troubleshooting technology issues!
    If anyone has been helpful to you, please show your appreciation by clicking the button inside of their post. Please click here and read, along with the threads to which it links, for helpful information to guide you as you proceed. I always recommend that you treat your BlackBerry like any other computing device, including using a regular backup schedule...click here for an article with instructions.
    Join our BBM Channels
    BSCF General Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • Thread concurrency problem - how to know when thread is dead?

    My applet uses a thread to draw an iteration graph step by step.
    The user as the option of pressing two buttons:
    - PLAY button - iteration Points are stored in an arrayList and drawn step by step (a sleeping time follows each step) (drawIterations thread)
    - TO_END button - iteration Points are all stored in the arrayList (swingworker thread) and after all of them have been stored the graph is drawn instantly.
    I have problems in this situation:
    When executing the PLAY-button thread, if the user presses TO_END button, the remaining graph lines should draw instantly. Sometimes I get more points on the graph than I should. It seems that the PLAY thread, which I stop when TO_END buton is pressed, still remains storing new points into the arrayList concurrently to the new thread created after TO_END button was pressed .
    Any ideas?
    I'm already using synchronization.
    private volatile Thread drawIterations;
    public void playButtonClick(JToggleButton btn) {
         pointSet1 = new ArrayList<Point2D.Double>();
         if (drawIterations == null) drawIterations = new Thread(this,   "drawIterations");
         drawIterations.start();
    public void toEndButtonClick(JToggleButton btn) {
         stopThread() ;
         pointSet1 = new ArrayList<Point2D.Double>();
         computeIterationGraphPointsAndRefreshGraph();
    public synchronized void stopThread() {
         drawIterations = null;
         notify();
    private void computeIterationGraphPointsAndRefreshGraphs() {
         SwingWorker worker = new SwingWorker() {
              public Object construct() {
                   // compute all iteration points
                         //repaint graph
         worker.start();
    }Is there a way of testing if a thread is actually dead after setting the thread object to null??

    In general, a Thread keeps running until it's run
    method completes. Threads don't stop when their
    handle is set to null. Your run method should
    constantly be checking on a variable to know when to
    stop running and exit the run method. In this case,
    you could check on the drawIterations variable to see
    if it's null.<br>
    <br>Even using the following line on my run method I get the the same problem:
    <br>
    <br>while (myThread == drawIterations && drawIterations!=null && halfStep < 2 * totalIterations) {
    <br>...
    <br>
    <br>Here's the whole method:
    <br>(actually there are 2 graphs being drawn and the second is only refreshed every 2 steps:)
    <br>
    <br>     <br>public void run() {
         <br>  Thread myThread = Thread.currentThread();
         <br>  int totalIterations = transientIterations +iterationsToDraw ;
              <br>  while (myThread == drawIterations && drawIterations!=null && halfStep < 2 * totalIterations) {
              <br>     computeNextHalfIterationGraphPoint( );
              <br>      if (!TRANSIENT_IS_ENABLED || halfStep >= 2*transientIterations ) {// is     not in transient calculations
              <br>                       graphArea1.repaint();
              <br>                       if (halfStep%2 ==0 ) graphArea2.repaint();
              <br>                       if (halfStep < 2*totalIterations){//no need to execute the following block if at last iteration point
                   <br>                         if (lastIterationPointsFallOutsideGraphArea(toEndCPButtonActive)) break;
                        <br>          try {
                             <br>                      Thread.sleep(sleepingTimeBetweenHalfIterationRendering);
                             <br>                      if (threadInterrupted ){//if clause included to avoid stepping into a synchronized block if unnecessary
                                  <br>                        synchronized (this) {
                                       <br>                          while (threadInterrupted && myThread==drawIterations ) wait();
                                                      <br>    }
    <br>                                               }
         <br>                                   } catch (InterruptedException e) {
              <br>                                     break;
                   <br>                         }     
                        <br>               }
    <br>                            }
         <br>        stopThread();
         <br>     }
    <br>

  • Concurenncy - synchronization problems

    Hello,
    I have read about synchronization in about 5 sources so far and I still don't understand it and mostly because of codes that sources show do not work as they are intended to work.
    For example I will show the code from this webpage: http://www.roseindia.net/java/thread/SynchronizedThreads.shtml
    I tried this code:
    class Share extends Thread{
      static String msg[]={"This", "is", "a", "synchronized", "variable"};
      Share(String threadname){
        super(threadname);
      public void run(){
        display(getName());
      public synchronized void display(String threadN){
        for(int i=0;i<=4;i++)
          System.out.println(threadN+msg);
    try{
    this.sleep(1000);
    }catch(Exception e){}
    public class SynThread1 {
    public static void main(String[] args) {
    Share t1=new Share("Thread One: ");
    t1.start();
    Share t2=new Share("Thread Two: ");
    t2.start();
    }And my output the most time is the same like they showed so it's like:Thread One: This
    Thread One: is
    Thread One: a
    Thread One: synchronized
    Thread One: variable
    Thread Two: This
    Thread Two: is
    Thread two: a
    Thread Two: synchronized
    Thread Two: variableHowever, sometimes when i run this program it's like:Thread Two: This
    Thread One: This
    Thread One: is
    Thread One: a
    Thread One: synchronized
    Thread One: variable
    Thread Two: is
    Thread Two: a
    Thread Two: synchronized
    Thread Two: variable
    Okay I decided to make my own program the counter, who will start two threads at the same time which will use the same variable from the same object.
    Here it is:public class Main
    public static void main(String[] args) throws InterruptedException
    Counter counter = new Counter();
    Thread t = null;
    t = new Thread(new CounterRunnable(counter, true), "theOneWhoIsIncreased");
    t.start();
    t = new Thread(new CounterRunnable(counter, false), "theOneWhoIsDecreased");
    t.start();
    class Counter
    public synchronized void increaseCounter()
    counter++;
    System.out.println("I'm being increased");
    public synchronized void decreaseCounter()
    counter--;
    System.out.println("I'm being decreased");
    public synchronized int getCounter()
    System.out.println("Here "+Thread.currentThread()+" The result is: "+ counter);
    return counter;
    private int counter = 500;
    class CounterRunnable implements Runnable
    public CounterRunnable(Counter counter, boolean increase)
    this.increase = increase;
    this.counter = counter;
    public void run()
    for (int i = 0; i < 10; i++)
    if(increase)
    counter.increaseCounter();
    else
    counter.decreaseCounter();
    counter.getCounter();
    boolean increase;
    Counter counter;
    But unluckly results are like that, even though methods are synchronized, why?? run:
    I'm being increased
    I'm being decreased
    Here Thread[theOneWhoIsDecreased,5,main] The result is: 500
    I'm being decreased
    Here Thread[theOneWhoIsDecreased,5,main] The result is: 499
    I'm being decreased
    Here Thread[theOneWhoIsDecreased,5,main] The result is: 498
    I'm being decreased
    Here Thread[theOneWhoIsDecreased,5,main] The result is: 497
    I'm being decreased
    Here Thread[theOneWhoIsDecreased,5,main] The result is: 496
    I'm being decreased
    Here Thread[theOneWhoIsDecreased,5,main] The result is: 495
    I'm being decreased
    Here Thread[theOneWhoIsDecreased,5,main] The result is: 494
    I'm being decreased
    Here Thread[theOneWhoIsDecreased,5,main] The result is: 493
    Here Thread[theOneWhoIsIncreased,5,main] The result is: 493
    I'm being increased
    Here Thread[theOneWhoIsIncreased,5,main] The result is: 494
    I'm being increased
    Here Thread[theOneWhoIsIncreased,5,main] The result is: 495
    I'm being increased
    Here Thread[theOneWhoIsIncreased,5,main] The result is: 496
    I'm being increased
    Here Thread[theOneWhoIsIncreased,5,main] The result is: 497
    I'm being increased
    Here Thread[theOneWhoIsIncreased,5,main] The result is: 498
    I'm being increased
    Here Thread[theOneWhoIsIncreased,5,main] The result is: 499
    I'm being increased
    Here Thread[theOneWhoIsIncreased,5,main] The result is: 500
    I'm being increased
    Here Thread[theOneWhoIsIncreased,5,main] The result is: 501
    I'm being increased
    Here Thread[theOneWhoIsIncreased,5,main] The result is: 502
    I'm being decreased
    Here Thread[theOneWhoIsDecreased,5,main] The result is: 501
    I'm being decreased
    Here Thread[theOneWhoIsDecreased,5,main] The result is: 500
    I supossed that results would be like first only increasing and then only decreasing output, or first deacreasing and then increasing output. Why is that different?
    I know that I can achieve that thing by for example using *join* method but well I want to understand synchronization ;)
    So what's the problem, I'm totally confused about that synchronization things. Somehow i still think it doesn't work at all. I learnt about the object which is called Lock also, about the ReentrantLock... and well it still doesn't work good with that...
    Please explain me what is the problem, i'm really confused...
    Best regards,
    Armon                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    The first example doesn't work because the display method synchronizes on different objects (their own instance). A quick fix could be to synchronized on the Share.class, but since anyone could lock on that (if it was public), better make a local lock object.
    // quick fix
    public void display(String threadN){
      synchronized(Share.class) {
        for(int i=0;i<=4;i++)
          System.out.println(threadN+msg);
    try{ this.sleep(1000); } catch(Exception e) {}
    // better, though should really extend Thread
    class Share extends Thread {
    private final Object lock;
    Share(String threadname, Object lock){
    super(threadname);
    this.lock = lock;
    public void display(String threadN){
    synchronized(lock) {
    public class SynThread1 {
    public static void main(String[] args) {
    Object lock = new Object();
    Share t1=new Share("Thread One: ", lock);
    t1.start();
    Share t2=new Share("Thread Two: ", lock);
    t2.start();
    You own example has the same problem: synchronizing on different objects.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Maybe you are looking for

  • Change in delivery quantity for batch managed items.

    30.09.2010 Hi friends, We have activated batch management. During delivery after the batch is determined and if i want to change the delivery quantity say for example from 50 to 30 then first i have to go and adjust the quantity in the batches to toa

  • Importing MVK files into Premiere Pro (all versions)

    Dear folks, I see the old topic was locked (probably because it got WAY out of hand, OT and flameworthy) and I have no interest in adding fuel to the fire but I do want to bring light and a solution that I've been using for a while with great success

  • Connecting Samsung Mythic to Macbook

    I recently got a macbook and was trying to connect my samsung mythic cell phone to it, to transfer photos, add music, and such. I was able to pair my phone with the mac, but i couldn't figure out how to connect it to my mac, to transfer files and wha

  • Weblogic running as a service

    I want to collect performance data from weblogic running as a service. I customized the commandline in the installSvc script and inserted a profiler class in front of weblogic.Server. When i start the service, beasvc crashes. How can i work around th

  • Updated to Mountain Lion, Macbook Pro Won't save any app preferences

    My wife has a 2009 Macbook Pro. We recently upgraded it to Moutain Lion, and now we are having quite a few issues. Additionally, we upgraded to MS Office 2011 from 2008.  Anytime we open most applications, no preferences have saved, and it goes throu