Thread basics

This may seem like a very simple question -
The JVM spec suggests that threads have their own local copy of variables, which is copied between the main memory.
In terms of variables that are local to a method, do these variables reside locally within the context of each thread.
As an example :
public class A
  public void methodA(SomeObject so)
    int i = so.getMethodResult();
}The question is - if two methods were accessing the method concurrently, would any operation on the local variable i require synchronizing, of if all of the operations within methodA are purely local, would multiple threads interfere with each thread's local copy of those variables?
Thank You
Jim

No. There is a dual dichotomy here.
Variables local to the method are allocated at the beginning of the method, deallocated at the end, and belong to the specific invocation of the method. Two threads calling the same method will get independent copies of the method-local variables and no synchronization of any kind is needed. This is perhaps clearer if you consider a local variableString s = new String("Some dynamically created string" + hashCode());The string is separately allocated as part of execution of the new method anytime the object or class method is called. If the object or class method is called four times, four separate String references will be allocated (and eventually garbage-collected). It doesn't matter if two of the invocations happened concurrently in two different threads.
The other side of the dual dichotomy is itself a dichotomy (that's what makes it "dual"). Consider the following variation on your classpublic class A
  int i = 12; // Here we have an instance variable
  public void methodA(SomeObject so)
    // Set an object instance variable rather than a local variable
    i = so.getMethodResult(); // Now the implications are broader
}Suppose this class is used in two different threadsA a = new a();
// The same instance a of object A is passed to two different threads...
// Thread 1 code
// Invoke methodA on our reference to the object of class A created in the parent code
thread1sa.methodA(new SomeObject(17); // thread1sa refers to the same object as thread2sa
// Thread 2 code
// Invoke methodA on our reference to the object of class A created in the parent code
thread2sa.methodA(new SomeObject(23); // thread1sa refers to the same object as thread2saNow i might need to be protected by a synchronize block because it could be an index into a shared array that could be corrupted by unprotected concurrent access. This is simply a coding consideration inherent with any multithreaded code
But, in addition, there are also JVM/underlying-hardware-implementation considerations to deal with, even if no modifications are made to shared data. This is the other half of the second dichotomy and is, I think, the implication that prompted your original question. Consider the following codepublic class A
  int i = 12; // The shared instance variable
  public void methodA(SomeObject so)
    // Set an object instance variable rather than a local variable
    i = so.getMethodResult();
  public int sayHowBigIsi()
    // Return where we are
    if (i < 7)
      Thread.Sleep(3000); // This raises the possibility that instance variable i will change while we're not looking
      System.out.println("i is" + i);
    else
      System.out.println("i is greater than 7");
}The original intent of methodB is to print the value of i if it is less than 7, but there is a possibility that between the time i is tested and the time it is printed, another thread could change it to something else, causing the println to print out an incorrect value of i. This is because the generated bytecode keeps local copies of variables for performance (and in fact some values could on the bare metal level be kept in even more volatile storage, such as registers) and these local copies aren't guaranteed to be kept updated at all times. That is, the value of i printed by the println could be an old copy of i that is now wrong.
One solution would be to enclose the code that uses i in a synchronize block. This would alleviate the problem, but would inevitably incur a thread bottleneck at that point, and since no data is actually modified, control as strict as is provided by synchronize is not necessary. Instead, Java provides the volatile keyword, which signals to the Java compiler and JVM that a variable may be updated asynchronously and that implementation-local copies should either not be kept, or always be refreshed before use. This also incurs a performance cost, but does not result in a thread bottleneck.public class A
  volatile int i = 12; // The shared instance variable now made volatile
  public void methodA(SomeObject so)
    // Set an object instance variable rather than a local variable
    i = so.getMethodResult();
  public int sayHowBigIsi()
    // Return where we are
    if (i < 7)
      Thread.Sleep(3000); // This raises the possibility that instance variable i will change while we're not looking
      // ...but now there's no problem because i is volatile.
      System.out.println("i is" + i);
    else
      System.out.println("i is greater than 7");
}

Similar Messages

  • No more basic threads, please!

    It is just a suggestion, however ...
    Is it only my impression, or we have done the job search field? I have seen many similar threads and replies with links to other threads!
    Is it so complicated to use the forum search?
    Please, before opening a new thread (basic) search for similar.
    regards,
    Angelo

    Hi Gilad,
    thnaks a lot for the hint. Unfortunately; i already use the 10.2.0.4 driver
    Regards,
    Jochen

  • Basic Material for XI

    Hi Dudes,
    Can any one provide me the material on XI or any webpage links also could be helpful.
    Thanks in advance.
    Regards,
    Suneel G

    Hi,
    Please follow these links which will help you to learn XI Basics
    Aspirant to learn SAP XI...You won the Jackpot if you read this!-Part III
    Aspirant to learn SAP XI...You won the Jackpot if you read this!-Part I
    Aspirant to learn SAP XI...You won the Jackpot if you read this!-Part II
    In XI there are few basic areas which you should know like
    IR (Integration Repository)
    ID (Integration Directory)
    IE (Integration Engine)
    IS (Integration Server)
    AE (Adapter Engine)
    RWB (Runtime Work Bench)
    SLD (System Landscape Directory)
    BPM (Business Process Management)
    IP (Integration Process)
    What is XI?
    http://help.sap.com/saphelp_nw04/helpdata/en/14/80243b4a66ae0ce10000000a11402f/frameset.htm
    What is IR and ID?
    http://help.sap.com/saphelp_nw04/helpdata/en/61/fec608bc27654daadb20c1e6da7dd1/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/b9/64663c7a6c2545ae292fb26d8c33c4/content.htm
    Runtime
    http://help.sap.com/saphelp_nw04/helpdata/en/2e/278a8363b5ac4483dc1efc382e51df/content.htm
    Good Blog for new to XI:
    New to XI?
    XI –Starter
    http://help.sap.com/saphelp_nw04/helpdata/en/e1/8e51341a06084de10000009b38f83b/frameset.htm
    SAP XI - Where to Find Information
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/sap%20xi%20-%20where%20to%20find%20information.pdf
    All the information you need in XI :
    http://help.sap.com/saphelp_nw04/helpdata/en/0f/80243b4a66ae0ce10000000a11402f/frameset.htm
    Understand the Architecture of XI
    http://help.sap.com/saphelp_nw04/helpdata/en/14/80243b4a66ae0ce10000000a11402f/frameset.htm
    You can also go through the url for Elearning :
    https://www.sdn.sap.com/sdn/elearning.sdn
    https://www.sdn.sap.com/irj/sdn/sdnpilot/elearning
    Following is the link for 'how to guides', A step by step guide to create scenarios:
    https://websmp201.sap-ag.de/nw-howtoguides
    Configuration of Adapters
    http://help.sap.com/saphelp_nw04/helpdata/en/0d/5ab43b274a960de10000000a114084/frameset.htm
    One of the most powerful feature of XI, Business Process Management:
    http://help.sap.com/saphelp_nw04/helpdata/en/3c/831620a4f1044dba38b370f77835cc/frameset.htm
    How the messages are delivered through XI:
    http://help.sap.com/saphelp_nw04/helpdata/en/17/50d440e14f8431e10000000a1550b0/frameset.htm
    Refer this thread:
    Basics of XI ...
    Installation Guide
    http://help.sap.com/bp_bpmv130/Documentation/Installation/XI30InstallGuide.pdf
    Configuration Guide
    http://help.sap.com/bp_bpmv130/Documentation/Installation/Configuration_Guide_FP.pdf
    A Beginner?s Guide to SAP XI Settings, Part II
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/6bd6f69a-0701-0010-a88b-adbb6ee89b34
    A Beginner?s Guide to SAP XI Settings, Part I
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/73527b2c-0501-0010-5398-c4ac372c9692
    General Configuration Steps
    http://help.sap.com/saphelp_nw04/helpdata/en/cf/230240d981e469e10000000a155106/content.htm
    SAP Exchange Infrastructure (XI) : Installation & CONFIGURATION GUIDE
    http://help.sap.com/saphelp_nw04/helpdata/en/d7/f01a403233dd5fe10000000a155106/frameset.htm
    Personal Settings
    http://help.sap.com/saphelp_erp2004/helpdata/en/e9/c4cc9b03a422428603643ad3e8a5aa/content.htm
    Roles and Tool Access : Administration, Technical Configuration,Design,Configuration,Monitoring
    http://help.sap.com/saphelp_nw04/helpdata/en/89/05793c05f0807be10000000a11405a/content.htm
    http://www.forumtopics.com/busobj/viewtopic.php?t=59586&start=15&postdays=0&postorder=asc
    SLD:
    How To?Handle the SLD for SAP XI
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/9e76e511-0d01-0010-5c9d-9f768d644808
    How To?Handle Caches in SAP XI 3.0
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/1a69ea11-0d01-0010-fa80-b47a79301290
    Refer these post installation links
    http://help.sap.com/saphelp_nw70/helpdata/en/a0/40084136b5f423e10000000a155106/frameset.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/14/39084136b5f423e10000000a155106/frameset.htm
    Link for posnt installation guide
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/95d7d490-0301-0010-ce93-c58f9a3cde0b
    https://websmp101.sap-ag.de/~sapidb/011000358700009389172004E.PDF
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/95d7d490-0301-0010-ce93-c58f9a3cde0b
    2004s PI installation - help.sap.com:
    http://help.sap.com/saphelp_nw04s/helpdata/en/78/f59442062bcd6ae10000000a155106/frameset.htm
    For scenarios refer this wiki.
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/xi/step-by-step+guides
    for guides try this link.
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/xi/home
    SAP XI INTRODUCTION
    Aspirant to learn SAP XI...You won the Jackpot if you read this!-Part I
    Aspirant to learn SAP XI...You won the Jackpot if you read this!-Part II
    Aspirant to learn SAP XI...You won the Jackpot if you read this!-Part III
    http://www.erpgenie.com/sap/netweaver/xi/namingconventions.htm
    http://www.erpgenie.com/sap/netweaver/xi/howto.htm
    http://www.erpgenie.com/sap/netweaver/xi/tips.htm
    http://www.erpgenie.com/sap/netweaver/xi/xiauthorizations.htm
    https://www.sdn.sap.com/irj/sdn/wiki
    Interfacing to XI from Webdynpro
    Understanding message flow in XI
    Ready Reference for XI Developers
    Message Mapping
    Message Mapping Simplified - Part I
    /people/sravya.talanki2/blog/2005/12/08/message-mapping-simplified-150-part-ii
    http://help.sap.com/saphelp_nw04/helpdata/en/43/c4cdfc334824478090739c04c4a249/frameset.htm
    New functions in the Graphical Mapping Tool XI 3.0 SP13
    File Content Conversion for Multi Hierarchical Structure
    Message Splitting Using the Graphical Mapping Tool
    Number formatting to handle LARGE Numbers
    Optimizing Lookup's in XI
    Minimize memory usage during Message Mapping when replicating an element
    Mapping Context Changes in XI
    /people/jeyakumar.muthu2/blog/2005/12/19/data-mining-using-apriori-algorithm-in-xi-150-part-ii
    /people/jeyakumar.muthu2/blog/2005/11/23/data-mining-using-apriori-algorithm-in-xi-150-part-i
    /people/jeyakumar.muthu2/blog/2005/12/30/data-mining-using-apriori-algorithm-in-xi-150-part-iii
    Java Mapping to handle flat files in SAP XI
    xpath functions in xslt mapping
    "JAVA MAPPING", an alternate way of reading a CSV file
    B2B Mapping Techniques Using the Graphical Mapping Tool
    Duplicating Subtrees and Numbering Them Using the Graphical Mapping Tool
    How to parse "XX/YY/ZZ;AA/BB/CC;11/22/33" in message mapping.
    Introduction to queues in message mapping
    Handling of Mixed Content Element in XI
    The specified item was not found.
    The specified item was not found.
    ValueMapping using the Graphical Mapping Tool
    Accessing Value Mapping defined in Directory using Java functions
    Comparing Performance of Mapping Programs
    /people/jin.shin/blog/2006/02/07/multi-mapping-without-bpm--yes-it146s-possible
    Runtime WorkBench Monitoring
    XI CCMS Alert Monitoring : Overview and Features
    The specified item was not found.
    The specified item was not found.
    http://help.sap.com/saphelp_nw04/helpdata/en/58/d22940cbf2195de10000000a1550b0/content.htm
    The specified item was not found.
    The specified item was not found.
    The specified item was not found.
    The specified item was not found.
    XI :  How to Re-Process failed XI Messages Automatically
    BPM
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/xi/integrationProcess%28ccBPM%29inXI&
    Walkthrough with BPM
    Reconciliation of Messages in BPM
    RFC Scenario using BPM --Starter Kit
    The specified item was not found.
    Schedule Your BPM
    Demonstrating Use of Synchronous-Asynchronous Bridge to Integrate Synchronous and Asynchronous systems using ccBPM in SAP Xi
    https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/1403 [original link is broken] [original link is broken] [original link is broken]
    Sync/Async scenarios without BPM
    Sync/Async communication in JMS adapter without BPM (SP19)
    IDOCs (Multiple Types) Collection in BPM
    /people/jin.shin/blog/2006/02/07/multi-mapping-without-bpm--yes-it146s-possible
    File to File Scenario
    Step by Step Guide: XML File 2 XML File Scenario: Part I
    Step by Step Guide: XML File 2 XML File Scenario: Part II
    Converting XML to PDF using XI
    Introduction to simple(File-XI-File)scenario and complete walk through for starters(Part1)
    Introduction to simple (File-XI-File)scenario and complete walk through for starters(Part2)
    "JAVA MAPPING", an alternate way of reading a CSV file
    Dynamic File Name using XI 3.0 SP12 Part - I
    Dynamic file name(XSLT Mapping with Java Enhancement) using XI 3.0 SP12 Part -II
    Push Data to MVC Architectured application using XI
    How to send any data (even binary) through XI, without using the Integration Repository
    XI in the role of a FTP
    The specified item was not found.
    The specified item was not found.
    The specified item was not found.
    The specified item was not found.
    IDOC Scenario
    Introduction to IDoc-XI-File scenario and complete walk through for starters.
    Troubleshooting  File-to-IDOC Scenario in XI.
    Convert any flat file to any Idoc-Java Mapping
    IDOCs (Multiple Types) Collection in BPM
    Outbound Idoc's - Work around using "Party"?
    Troubleshooting  File-to-IDOC Scenario in XI.
    RFC Scenario
    Exposing BAPI as Web Services through SAP XI
    RFC Scenario using BPM --Starter Kit
    The specified item was not found.
    The specified item was not found.
    HTTP to RFC - A Starter Kit
    Also refer the below help:
    1) What is XI:
    http://help.sap.com/saphelp_nw04/helpdata/en/3c/831620a4f1044dba38b370f77835cc/frameset.htm
    2) Design and Configuration:
    http://help.sap.com/saphelp_nw04/helpdata/en/3c/831620a4f1044dba38b370f77835cc/frameset.htm
    3) Integration Processes (ccBPM)
    http://help.sap.com/saphelp_nw04/helpdata/en/3c/831620a4f1044dba38b370f77835cc/frameset.htm
    4) Central Monitoring:
    http://help.sap.com/saphelp_nw04/helpdata/en/3c/831620a4f1044dba38b370f77835cc/frameset.htm
    5) Adapters:
    http://help.sap.com/saphelp_nw04/helpdata/en/ae/d03341771b4c0de10000000a1550b0/frameset.htm
    Just go through the below link which has all the topics:
    http://www.sap.com/services/education/certification/certificationtest.epx?context=FFC760B8923D16BB5150DAE63E7C1A6B331AF0B9E3A8F73CE3A9B7046E051044503600C911DBA13DCE978D3AC9057626D2B68111A7CD2D707E2EEC31213097E46EB790DD0106435EE0756F7B22F3FA4B4FF0645C06954BF3A150E023B4164DA282F33B1BD441FBE4083F2C923E33EA0C5960F8C8950FDEB6081ABED6E0E05E2617A693D85077260F9EA218716A79AEF3AA57C7D5E8975334%7cE41BF735AA1862BF88AE1830FD06B8FCD2D8AECBF5109A3E
    File 2 file:
    Step by Step Guide: XML File 2 XML File Scenario: Part I
    File content conversion:
    FCC
    Ref:
    Sender -
    Introduction to simple(File-XI-File)scenario and complete walk through for starters(Part1)
    Key value:
    How to send a flat file with various field lengths and variable substructures to XI 3.0
    Content Conversion (Pattern/Random content in input file)
    NAB the TAB (File Adapter) -
    TAB delimited
    File Content Conversion for Unequal Number of Columns
    Content Conversion ( The Key Field Problem )
    The specified item was not found.
    NAB the TAB (File Adapter)
    NAB the TAB (File Adapter)
    Receiver FCC no need of Endseparator
    File Adapter (Receiver) - Are we "really" sure about the concepts?
    RFC:
    Weblog to send Response from RFC to File in Asyn Mode Using Proxy
    HTTP to RFC - A Starter Kit HTTP to RFC - A Starter Kit
    Weblog to send Response from RFC to File in Asyn Mode Using Proxy: Weblog to send Response from RFC to File in Asyn Mode Using Proxy
    IDOC:
    ALE configuration for pushing idocs from SAP to XI
    ALE configuration for pushing idocs from SAP to XI
    IDOC testing using WE19
    Reposting IDocs instead of Recreating - For Testing Purpose (XI)
    IDOC configuration :
    This is expalined both the scenarios:
    Please follow the below process for configuration:
    Pre-requisites for Inbound IDoc to R/3 from PI:
    Configuration required at Xi side:
    Go to IDX1: configure the port.
    Go to IDX2: load the DOC metadata.
    Go to SM59: Create RFC destination which points to R3 system this is require in the case where your IDOC is sent to R 3 system,
    Configiration required at R3 side:
    Maintain Logical System for PI (SALE transaction):
    Maintain Partner Profile for XI system(WE20):
    Pre-requisites for Outbound IDoc from R/3 to PI:
    Configurations required in R/3:
    Maintain Logical System (SALE)
    Define RFC Destination (SM59) which points to PI system Maintain Port (WE21) Maintain partner profile. (WE20):
    Maintain Distribution Model (BD64):
    File To IDOC - Part1 (SLD and Design):
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/profile/2007/05/11/fileToIDOC&
    File To IDOC - Part2 (Configuration):
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/profile/2007/05/11/fileToIDOC-Part2+(Configuration)&
    File To IDOC - Part3 (Steps required in XI and R3):
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/profile/2007/05/11/fileToIDOC-Part3(StepsrequiredinXIandR3)&
    IDOC Collecting
    ave a look at this Blog
    Collection of Multiple type IDOCs in BPM By Pooja Pandey Collecting IDocs without using BPM By Stefan grube's
    Collecting IDocs without using BPM
    XI:Idoc Message Packages By Sravya Talanki Collecting from Multiple Interface and sending it to R3 By Prasad Babu Nemalikanti
    Idoc to File:
    Introduction to IDoc-XI-File scenario and complete walk through for starters.
    Collection of IDoc to Single File
    IDOCs (Multiple Types) Collection in BPM
    BPM:
    Walkthrough with BPM - Walk through BPM BPM in XI https://www.sdn.sap.com/irj/sdn/wiki?path=/display/xi/integrationProcess%28ccBPM%29inXI&
    BPM-1 Walkthrough with BPM
    BPM-2 Reconciliation of Messages in BPM
    BPM-3 RFC Scenario using BPM --Starter Kit
    BPM-4 The specified item was not found.
    Schedule BPM Schedule Your BPM
    Use of Synch - Asynch bridge in ccBPM Demonstrating Use of Synchronous-Asynchronous Bridge to Integrate Synchronous and Asynchronous systems using ccBPM in SAP Xi
    Use of Synch - Asynch bridge in ccBPM https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/1403 [original link is broken] [original link is broken] [original link is broken]
    without BPM Sync/Async scenarios without BPM
    without BPM1 Sync/Async communication in JMS adapter without BPM (SP19)
    IDOC BPM IDOCs (Multiple Types) Collection in BPM
    multimapping without BPM /people/jin.shin/blog/2006/02/07/multi-mapping-without-bpm--yes-it146s-possible
    PRoxy:
    First start with configuration:
    ABAP Proxy configuration:
    How do you activate ABAP Proxies?
    ABAP Proxies in XI(Client Proxy)
    Smarter Approach for coding ABAP Proxies
    http://help.sap.com/saphelp_nw04/helpdata/en/2b/f49b21674e8c44940bb3beafd83d5c/frameset.htm
    for java proxies
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a068cf2f-0401-0010-2aa9-f5ae4b2096f9
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f272165e-0401-0010-b4a1-e7eb8903501d
    ABAP proxy:
    ABAP Proxy
    Client Proxy -
    ABAP Proxies in XI(Client Proxy)
    In this case you can define you scenario as a proxy to File. The blog explains the proxy part. Map the structure to a file and complete the scenario.
    Please chekc this PDF :
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/3dfac358-0d01-0010-5598-d4900e81a30c
    Server Proxy -
    ABAP Server Proxies
    File to Inbound Proxy:
    File to R/3 via ABAP Proxy
    Debugging Inbound Proxy:
    XI: Debug your inbound ABAP Proxy implementation
    Regards,
    Nithiyanandam

  • [Solved][Boost] Condition_variable exception on thread termination

    Hi folks,
    I'm trying to implement an object that accepts some data and processes it in a separate thread (basically producer-consumer model). The object's thread should run until object destructor is called. To notify of new data I use condition_variable. The most important part of code (full here: http://pastebin.com/uEtU0KG1 , with irrelevant parts simplified) :
    std::queue<std::string> msgs;
    boost::mutex read_write_queue;
    bool finish;
    boost::condition_variable new_msgs;
    void thread_func()
    std::string m;
    while(true) // !!!
    { // lock begins
    boost::unique_lock<boost::mutex> lk(read_write_queue);
    while(msgs.empty())
    new_msgs.wait(lk);
    if(finish) // to be called on object destruction
    lk.unlock();
    return;
    m = msgs.front();
    msgs.pop();
    } // end of lock
    std::cout << m << "\n"; // some processing of data
    The problem is following: on object destruction (at the end of main()) getting an error that condition_variable couldn't cleanly terminate:
    a.out: /usr/include/boost/thread/pthread/condition_variable_fwd.hpp:46: boost::condition_variable::~condition_variable(): Assertion `!pthread_mutex_destroy(&internal_mutex)' failed.
    When the line marked with 3 bangs (start of while cycle) is commented out, as if the object receives only one message, everything is ok. Have thought and googled about it a lot, but without any success.
    I would be very grateful if someone would point at the fault (guess it's something simple).
    Last edited by yl3dy (2011-11-13 09:21:48)

    Well, I've finally figured out what was wrong. As I thought, the reason is quite simple. Destructor of an object didn't wait until thread will do all the termination things (unlocking condition variable, check for finish state and calling return). Adding a.join() at the end of destructor function will do the job.
    What a stupid mistake.

  • Using observer pattern (NSNotificationCenter) accross threads [iPhone]

    On my main thread I register an observer for the NSNotificationCenter defaultCenter.
    I then start a background process via [self performSelectorInBackground...].
    The idea is that the background threas fires a notification (using defaultCenter, too) to inform the "calling/main" thread once it has finished.
    However, the event seems to never arrive at the main thread.
    Any hints?
    Do I have to create kind of a shared Notification Center???

    Sounds like you've laid out your problem quite well.
    You could use a fifo queue (producer-consumer queue) per thread - basically receiveResponse would check to see if there is anything in its (response) queue - if so, it is removed, if not, it waits. The socket thread receives a packet, finds the appropriate queue and pushes in the response - which wakes the receiver. This is thread safe, if done correctly - it is easy to do correctly.
    Now that I think about it more, your queue can only store one element, given the request/response nature of the communication, so you don't even need to use a collection.
    As for patterns, I think that Pattern Oriented Software Architecture Volume 2 (http://www.cs.wustl.edu/~schmidt/POSA/) may be of interest. And if threading and concurrency are of interest, checkout Concurrent Programming in Java, Doug Lea (http://www.amazon.com/exec/obidos/ASIN/0201310090/)

  • Sap basic java libs, JMON, JCO

    Hi,
    Iam applying patch 27 for the portal ep6 sp2. the current patch is ep6 sp2 patch3 with j2ee pl 19.
    Now first iam doing patch 4 for ep6 sp2 and then upgrading to patch 27.
    My question now is for upgrading to patch 4 what version of java libs, jmon and jco i should maintain and later for patch 27 what version of basic java lib, jmon and jco i should maintain.
    The patch4 document says to update basic javalibs, jmon and jco to the latest available one.
    The latest available patches are
    basic java lib - patch 18
    jmon - patch 19
    do anyone know how to do this. any documents are notes available ???
    Thanks for your help in advance
    regards
    Moses

    Hi Moses,
    here is what to you have to do:
    1. Patch the Software Delivery Manager (SDM) to the newest Patch Level (PL 14) - as described in SAP Note 532892
    2. Patch the J2EE Engine to the newest available patch (PL 30) - as described in SAP Note 738921
    3. Patch SAP Basic Java Libs 6.20 to Support Package 18 - as described in SAP Note 544979
    Make sure IRJ service is stopped as mentioned in the thread Basic Java Libs 16
    4. Patch JMON to Patch Level 19. Installation (path were to copy the files) is described in SAP Note 657143. Unfortunately this note is not released. If you don't have a user to see the note, here is in short what you have to do:
    - unzip the archive: "sapcar -xfv JMON_19*.SAR"
    - copy file jmonapi.jar to the following directories:
         - ...j2ee_<Instance_Nr>adminlib
         - ...j2ee_<Instance_Nr>admin     ools
         - ...j2ee_<Instance_Nr>clusterdispatcheradditional-lib
         - ...j2ee_<Instance_Nr>clusterserveradditional-lib
         - ...j2ee_<Instance_Nr>clusterstateadditional-lib
         - ...j2ee_<Instance_Nr>clusterserverservicesfileworklibs
         - ...j2ee_<Instance_Nr>clusterserverstatefileworklibs
    - copy file jmon.dll and sapccmsr.exe to the directory:
         - ...j2ee_<Instance_Nr>os_libs
    5. If needed, patch SAP Java Connector to Service Release 2.0.10 - as described in SAP Note 682686 and the there mentioned installation guide.
    6. Now you can go on patching the Portal first to Patch 4 and than to Patch 27 as described in the installation guides.
    Hope this helps,
    Robert
    PS: Please consider rewarding points to people like Dominik (and me) , who are spending a lot of their time to give helpful replies like in this thread: cross domain SSO-EP6

  • Extends Thread versus Implements Runnable... difference?

    I've seen them both used and to the naked eye it seems to be pretty much the same (besides the execution).
    Can anyone tell me the major differences between the two methods of multi-threading and how/if one is better?
    Do you ever make a deliberate choice to use Extends over Implements (or vice versa) for a specific task?

    For the record, I've normally used extends Thread, and
    seeing the light that in doing that, I can only extend
    one class, I'm looking into the alternative.
    Are...
    Thread t1 = new Thread(new myRunnableThread());
    Thread t2 = new Thread(new myRunnableThread());
    t1.start();
    t2.start()
    and...
    MyExtendedThread t1 = new MyExtendedThread();
    MyExtendedThread t2 = new MyExtendedThread();
    t1.start();
    t2.start();
    equivalent?
    equivalent meaning that they are equally fast? I'd say no, because in the first example you are creating a thread and a runnable, in the second you are only creating a thread.
    >
    Additionally, consider -
    public class myExtendedThread extends Thread {
    ServerSocket ServiceConnectSocket = new
    ServerSocket(4000);
    NotificationListener mainThread;
    public myExtendedThread(NotificationListener
    _mainThread) {
    mainThread = _mainThread;
    public void run()  {
          while(true)
                 if (ServiceConnectSocket != null)
                     return;
                 try
                     Thread.sleep(5000);
    ServiceConnectSocket = new
    ectSocket = new Socket(host, port);
                     ServiceConnectSocket.close();
                     mainThread.serviceReady();
                 catch (Exception e)
    >
    This thread basically tries to connect to a socket,
    and when it does, it closes the socket it made,
    notifies another thread (passed in at the constructor)
    and returns.
    My question is on what happens when Threads return.
    When this thread returns... what happens exactly?
    What if mainThread.serviceReady restarted that
    t thread? Would it start a NEW thread or just re-run
    the run() of the old one?
    Once a thread returns, how long before Garbage
    Collection will free up the memory it used?
    When the run method returns, the thread is dead. It is not reused automatically. You have to implement some type of thread reuse like my code above.
    I would assume that the normal GC rules apply. Each JVM can decide to cleanup the thread whenever it feels like it.

  • MSI K8N neo 2 Plat System still to be Built from Scratch!!!

    Hi to all,
    My first post and it's gonna be lengthy I think!  
    I am not a gamer ever, most of what I do is Video encoding (mainly this 100% CPU hogging activity) and Graphics manipulation.
    Below is a list of what I have to start my build:
    Note that I do not overclock ever so please, no reference to this!!!
    MSI K8N Neo2 Platinum (7025)
    Athlon 64 3500+ 92nm Winchester Core (retail)
    Cooler = Zalman CNPS7000B-CU Ultra-Quiet CPU Cooler (think I might have fitting probs with memory slots DIMM's 1+2(G/P) on the MSI Neo2 Plat board, DIMM's 3+4(G/P) might be my only option if I want to stick with this cooler but for fault finding purposes I can always use the stock cooler?)
    Corsair TwinXL PC3200 - CMX512-3200XLPRO 400Mhz 2.2.2.5 LL
    Antec True Power 550W with SATA supply (X2)
    1 X Western Digital 74Gb SATA Raptor HDD (I want this as my C: main boot, no Raid)
    2 X Seagate Barracuda 300Gb 7K2rpm SATA HDD (I want these as RAID 0/stripe=performance only)
    GPU: On order!
    http://www.msi.com.tw/program/products/vga/vga/pro_vga_detail.php?UID=636
    Will use my old trustworthy and reliable GeForce 2 Ti 64 Mb card for XP+SP1 instalation only.
    1 X 120 Gb 7K2 HDD (IDE 1 Master) (from old set up)
    1 X 120 Gb 7k2 HDD (IDE 1 Salve) (from old set up)
    1 x  PlexWriter 52x/24x/52x CD-ReWriter (IDE 2 Master)
    1 X Pioneer DVR-108 Black16x DVD±RW Dual layer (IDE 2 Slave)
    PCI = Creative Sound Blaster Audigy 2 Value 7.1 PCI Sound Card - OEM
    Case = Lian-Li PC V1100 Black Aluminium Midi-Tower  
    Everthing is new in this set-up apart from my old IDE HDD's, still in boxes and ready to go ready for your input?
    Q1. Quote
    Keep in mind that you will need the special drivers to install your SATA Raid drives if you have any. When the windows install starts you need to keep tapping the F6 key to load those drivers from the diskette MSI supplied. "If you are using an Nvidia3 chipset with a single SATA drive and not raiding, you can skip this step, it will automatically be recognized by windows." (Tip Provided by timkessler)
    Straight forward if you are using one or the other methods mentioned in Tiresmokes thread Basic Building Tips(which is gr8, thnx for that Tiresmoke). But as above I want my W/D raptor as my C: main boot drive only, no RAID?
    Can I use the F6 option at the XP instal and then go on to set up the Raptor drive accordingly - and from there set up my 300Gb Seagates as RAID 0 (Seagates wont be attached till Raptor is set to C: main boot)???
    Once I get to this stage I will start asking about board BIOS and Driver details which I dont know as of yet, like I said everything is still boxed.
    I thought personally that starting this thread - people wanting to use this board would benefit from a brand new instalation from scratch guide from a relatively newbie point of view?
    I know there are alot of issues regarding the boards features, but I thought if I done this in public the relevant problems could be linked as I go along, either with problems or without - depending on the individual experience?
    pheeeewww, I said it was gonna be lengthy didnt I?

    Quote
    Originally posted by Supershanks
    On install windows will see 3 drives all sata which is why i suggestd the configuration, i did you dont need to set up your raid array at all as the drives are just going to be data drives.
    If you wish you could even install windows without f6 & loading any drivers
    Having then got widows installed.
    Seperate project to
    enable raid in bios, creating the raid & let windows install drivers later.
    assuming you have an original windows cd ie pre sp1, the quickest method of installation is to slipstream windows.
    Basically you download latest service pack sp1 or sp2 insert your OS cd & run a program which merges the 2 & creates a new OS cd with the SP integrated. Any updates needed then are miimal.
    see
    Slipstreaming - Autostreamer Neowin - i'ts so easy i've heard grannies can do it
    hope this helps
    Looks like they moved the AutoStreamer thread, and updated to 1.033---> AutoStreamer 1.0.33

  • Help with EJB Arch: Synchronous front-end -- Asynchronous back-end

    Hi folks, We are developing an application with the following characteristics: - users can invoke requests on our appl and they will expect a quick response - to obtain the information requested by the user, our application talks with Tibco using RV. This communication follows a pub/sub messaging paradigm and is asynchronous. - thus, we have a synchronous req/resp front-end and an asynch back-end.
    We would like some advice as to the best way of architecting this application. Here is our approach. Please critic and suggest alternatives.
    1. Consider an user who has requested something from our app. 2. The user will be using a JSP based front-end. (S)he submits the request on a form and a servlet is driven. 3. The servlet uses a session EJB and invokes one of its methods, which handles some business-specific logic. 4. The method in the session EJB then instantiates a helper class. 5. A method on our helper class is now driven. This method sends a message to Tibco and it provides a callback method in the helper class. 6. The method in the helper class blocks the thread - basically, it waits. 7. Meanwhile, Tibco does the processing and invokes the callback method (in the helper class) with the result. 8. In the callback method, the data sent by Tibco is stored in member variables of the helper class. 9. The callback method wakes up the blocking thread. 10. The method in step 6 wakes up and returns the information to the session EJB. 11. The session EJB returns the information to the invoking servlet. 12. The servlet provides the information back to the user.
    The version of Tibco-RV that we are using is not JMS compliant.
    We keep hearing that threads should be handled very carefully in an EJB container environment, so we would like to know if the way we are handling the thread in the helper class is okay. Could we remove the helper class and do the same thread-handling in the session EJB itself?
    Can we use JMS in this solution even though our Tibco-RV does not support JMS?
    Tools: Weblogic App Server 6.1, JBuilder 5.0.
    Thanks for your advice and suggestions!

    Let me start off by mentioning that Sonic MQ (an excellent JMS server) now provides a bridge for TIB/Rendezous. I am also wrestling with a simliar issue, something that requires threading at the servlet or ejb level, and have given some thought to using JMS. My concern was that JMS is an asynchronous process so it's model does not fit well with the synchronous front end. Technically I can see a few ways to implement it but architecturally I am not convinced that they are sound. You could send a message from the session bean to the TIB via SonicMQ and have a JMS message bean registered as a listener for messages from the TIB, again via SonicMQ. The JMS bean could update a static class or singleton which your session checks but you still have the issue of making the session bean wait on that event.
    I'll do a bit more digging and see if there's a design pattern available for this situation.
    -Dat

  • I have a Google redirect virus which redirects every hit I click on in every search engine, in every browser, to a completely unrelated website. No anti-virus software I've tried can get rid of it. Help.

    ''Locked due to age. If you still have a problem, please [https://support.mozilla.org/en-US/questions/new start a new thread]''
    Basically the Google redirect virus is caused by a trojan with rootkit capability, and so whenever I click on a link on Google, it redirects me to a completely unrelated site. I think I got it on there because of downloading pirated software (patches, cracks, keygens) to avoid paying: so stealing software didn't pay off :(
    I know you guys aren't specialised in internet security, but can you help?

    There seems to be more than one, possibly several malware objects that can cause Google search redirects in both Firefox and Explorer... some result in multiple infected files and are self- regenerating. I tried rootkit, gooredfix, tdskiller and every other tool I could download... several times I was certain it was gone but it always came back! If you want to kill this thing for good, combofix is the only thing that removes ALL of the infected elements. Combofix takes a long time to run (circa 30 min?) and requires some user input and also messes with your system settings a little but it is VERY thorough and it does work and best of all, it's free.

  • [SOLVED] lspci only detecting half my video RAM

    So i needed to look up details about my video card when i noticed something strange. It seems the system is only allocating half of the available video memory for some reason. What's the reason for this? I haven't tweaked it or assigned any swap memory or anything like that for it either so i don't know what's up. I should have 512 MB, but i only have half. Here's my lspci output:
    sudo lspci -v -s 01:00.0
    01:00.0 VGA compatible controller: nVidia Corporation G94 [GeForce 9600 GT] (rev a1) (prog-if 00 [VGA controller])
    Subsystem: ASUSTeK Computer Inc. Device 827c
    Flags: bus master, fast devsel, latency 0, IRQ 16
    Memory at fd000000 (32-bit, non-prefetchable) [size=16M]
    Memory at d0000000 (64-bit, prefetchable) [size=256M]
    Memory at fa000000 (64-bit, non-prefetchable) [size=32M]
    I/O ports at cc00 [size=128]
    [virtual] Expansion ROM at fe880000 [disabled] [size=512K]
    Capabilities: [60] Power Management version 3
    Capabilities: [68] MSI: Enable- Count=1/1 Maskable- 64bit+
    Capabilities: [78] Express Endpoint, MSI 00
    Capabilities: [b4] Vendor Specific Information: Len=14 <?>
    Capabilities: [100] Virtual Channel
    Capabilities: [128] Power Budgeting <?>
    Capabilities: [600] Vendor Specific Information: ID=0001 Rev=1 Len=024 <?>
    Kernel driver in use: nvidia
    Kernel modules: nvidia, nvidiafb, nouveau
    Is there any way i can fix this? I mean i have no problems whatsoever and i can watch 1080p videos and using 1920x1080 resolution without any lag, even play most games on high settings without too much lag, but still, it would be nice to have all my video memory.
    edit:
    Didn't see that thread in the search, but thanks! interesting to know. And if anyone happens to stumble upon this thread, basically the "problem" is:
    (quoted from this thread )
    On most GPUs, it's sized 256MB to avoid various SBIOS compatibility and resource contention/exhaustion problems. Please note that the size of BAR1 does not impact how much video memory the GPU can access. It does limit how much video memory can be accessed directly by the CPU, but due to the large size discrepancies between BAR1 (typically 256MB, as I said above) and video memory (1+GB on high-end GPUs), the NVIDIA Linux graphics driver does not rely heavily on CPU mappings of surfaces in video memory.
    Last edited by waspy (2011-11-12 21:24:35)

    https://bbs.archlinux.org/viewtopic.php?id=107223

  • Directory scan NullPointer results in error (sometimes)

    Could somebody explain the flowing error to me please:
    Exception in thread "Basic L&F File Loading Thread" java.lang.NullPointerException
    statistics.pass1.xml
            at java.util.Arrays$ArrayList.<init>(Arrays.java:3357)
            at java.util.Arrays.asList(Arrays.java:3343)
            at sun.awt.shell.Win32ShellFolderManager2.isFileSystemRoot(Win32ShellFolderManager2.java:358)
            at sun.awt.shell.ShellFolder.isFileSystemRoot(ShellFolder.java:242)
            at javax.swing.filechooser.FileSystemView.isFileSystemRoot(FileSystemView.java:323)
            at javax.swing.filechooser.FileSystemView.getShellFolder(FileSystemView.java:531)
    statistics.xml
            at javax.swing.filechooser.FileSystemView.getFiles(FileSystemView.java:443)
            at javax.swing.plaf.basic.BasicDirectoryModel$LoadFilesThread.run0(BasicDirectoryModel.java:218)
            at javax.swing.plaf.basic.BasicDirectoryModel$LoadFilesThread.run(BasicDirectoryModel.java:211)
    BUILD SUCCESSFUL (total time: 6 seconds)The error is basically always the same, but I don't always get the errors.
    When I run the directory scanner on (for example) my c:\ drive it runs without problems. But in some folders it gives me the errors above but I don't see why. They both have files and folders in it so I don't see the difference.
    The same with my laptop.
    Both running Windows 7 and Java JDK/JRE 6 update 20
    I hope someone can help me ;)
    Below the code that gives the error:
    import java.io.File;
    import javax.swing.JFileChooser;
    public class NewMain {
        public static void main(String[] args) {
            JFileChooser fc = new JFileChooser();
            fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
            fc.showOpenDialog(fc);
            File folder = new File(fc.getSelectedFile().toString());
            File[] listOfFiles = folder.listFiles();
            for (int i = 0; i < listOfFiles.length; i++) {
                System.out.println(listOfFiles.getName());

    wastrel wrote:
    Still I think this line looks strange,
    fc.showOpenDialog(fc);
    This method should be called with the parent Component and it doesn't seem right to use the JFileChooser object as its own parent. I suggest you try this instead,
    fc.showOpenDialog(null);
    With a little luck the bug is associated with the case where a parent Component is specified.Not a chance. As the JFileChooser hasn't been added to a Window, the call to JOptionPane.getWindowForComponent(parent) in JFileChooser.createDialog(Component parent) returns SwingUtilities.getSharedOwnerFrame(). The same results from passing null instead of fc. See the sources for JFileChooser and JOptionPane.
    That said, it's certainly bad programming practice to pass as the parent parameter any reference that cannot possibly be used as a parent for the resulting dialog.
    db

  • How to increase java heap space on BIEE 10.1.3.3.1

    Hi All,
    I am using BIEE 10.1.3.3.1.
    while doing bursting i am getting java heap space error. how can i increase java heap space.
    Please anyone explain how to increase .. its very urgent
    Regards

    Yes, but I have not one, but TWO configurations.
    One configuration named StateTEDSTest points at the DataSource named teds_proxy_tedsdev_dasis8. Another named StateTEDSProd points at the DataSource named teds_proxy_teds_dasis8.
    What you seem to be saying is that I should only have one configuration, point it at a DataSource named, say, teds_proxyDS, then make teds_proxyDS reference the test database on the test application and the production database on the production application. I agree that that would probably work, but it negates any benefit of being able to define more than one configuration.
    What I asked is, how do I tell one deployment to use the configuration named StateTEDSTest, and another to use the configuration named StateTEDSProd?
    Looks like I'm not the first to ask this - see this thread:
    basic deployment question
    Unfortunately, no answer there either.

  • 11.2 documentation errata ?

    Pl see this thread - Basic compression on tablespace
    The 11.2 documentation for CREATE TABLESPACE command - CREATE TABLESPACE
    states that basic tablespace compression can only be enabled for dictionary managed tablespaces, which is incorrect since basic compression can also be set for locally managed tablespaces. can this be corrected ?
    Thanks
    Srini

    Hi Srini,
    Thank you for reporting this error! It will be fixed in the next revision of the SQL Language Reference.
    Beth

  • Hey, why do Muse buttons appear garbled when published to Business Catalyst?

    Buttons look fine when exported to html and uploaded to normal web server. So what's going on with BC. Also sometimes BC delays new files, or fails to render new files. See attached screen print.

    It appears the size of the image generated by Muse for the top, middle and bottom slices of the rounded corner bevel image is slightly too wide for the button and thus it wraps around by a couple pixels.
    Aishvarya, can you check in the BC backend to see what width these three PNG images are on the BC servers?
    http://httpwwwtalentsearchbgwcom.businesscatalyst.com/images/u14135-m-sprite.png
    http://httpwwwtalentsearchbgwcom.businesscatalyst.com/images/u14209-r-sprite.png
    http://httpwwwtalentsearchbgwcom.businesscatalyst.com/images/u14209-sprite.png
    The images being served are all 1521 pixels wide, but they should be 1515 pixels wide. It's unclear whether BC is serving an older cached version of the images or whether Muse generated and uploaded images of the wrong width. Thanks.
    paulrussell1 you'll receive more timely assistance from the forum community if you continue to reply with information regarding a single issue in a single forum thread. Starting a new thread basically restarts the process of getting to a solution. If a thread is going unanswered, replying to your own thread will bring it back to the top of the recently active threads and increase the likelihood of receiving assistance from the community.
    If immediate 1-on-1 support from Adobe is required, Live Chat and Phone Support are available at <Contact Customer Care>.

Maybe you are looking for

  • Residual Clearing through F-44

    Hi Experts, I have passed one Credit entry in Vendor 7000001(TCode - FV60) of Rs.2310063(After TDS) Now i am clearing this credit balance using F-44. While clearing, i am putting Rs. 310063 in residual item. When i clicking 'post' icon, its giving fo

  • Custom TestSTand model required

    Hi, I'm running a test that run for a long time (around 30 minutes).  The setup is such that there are 4 packs of the same type whereas only one of them is the UUT.  In order to increase the yield, I would like to run a test that tests 4 packs at a t

  • Retrieve tuples

    how to retrieve tuples based on some criteria from a table through procedure call......//

  • New macbook pro doesn't keep wireless devices connected

    I have the brand new 2012 15" Macbook Pro w/o retina display, 2.7ghz, 8gb ram, 750gb @ 7200rpm and 10.7.4. I've already received and returned this setup once in the time that it has been released because wireless devices don't seem to stay connected

  • Suddenly, Slow Browsing

    I've had some issues lately. Right now though I'm trying to isolate a problem I'm having browsing. Sometimes it just takes forever for pages to load and it hasn't been that way before. I replaced my router with a Belkin Wireless N and I've spoken to