ThreadLocals With Singletons

We are using a 3rd party product here. This product runs in its own JVM. We can customize it by subclassing some of their classes. But their architecture will only create one instance of our subclasses. This instance is reused for multiple requests.
My subclass is pretty complicated and is just an abstract class for numerous other subclasses. I need to make my class thread safe. My first inclination is to use a ThreadLocal class variable to hold the state for each instance of my class.
I've never used ThreadLocal before, so I wrote a little test. As I haven't used Java Threads in years, I am having trouble getting this sample code to work.
The sample essentially starts 2 threads. The 1st thread is supposed to wait 4 seconds so the 2nd thread can start running and I can test 2 threads in the same instance to make sure I get two separate serial numbers.
The problem is, for some reason the 1st thread runs t o completion before the 2nd thread starts. I don't know why. I'm sure I'm an idiot and the solution is very simple. But I can't figure it out and would appreciate any help.
Thanks.
Here is the thread creator/driver:
public class ThreadMgr
    public void runIt()
        ThreadTest t1 = ThreadTest.getInstance();
        ThreadTest t2 = ThreadTest.getInstance();
        System.out.println("t1 == t2: " + (t1 == t2));
        System.out.println("Start A");
        Thread threadA = new Thread(t1);
        threadA.setName("ThreadA");
        threadA.run();
        System.out.println("A has been started");
        System.out.println("Start B");
        Thread threadB = new Thread(t2);
        threadB.setName("ThreadB");
        threadB.run();
        System.out.println("B has been started");
    public static void main(String[] args)
        new ThreadMgr().runIt();
    }Here is the singleton which I need to ensure is threadsafe:
public class ThreadTest implements Runnable
    private ThreadLocal serialNumber = null;
    private static ThreadTest threadTest = null;
    public static ThreadTest getInstance()
        if (threadTest == null)
            threadTest = new ThreadTest();
        return threadTest;
    private ThreadTest()
    public void run()
        System.out.println("In ThreadTest");
        serialNumber = new ThreadLocal();
        Double randomNbr = new Double(Math.random());
        serialNumber.set(randomNbr); //Just for testing
        try
            Thread.sleep(4000);  //Sleep 4 seconds to allow the other thread to enter
        catch (InterruptedException e)
            e.printStackTrace();
        System.out.println("Serial # for thread " + Thread.currentThread().getName() + " = " + serialNumber.get());
}

Or (I didn't think of Your driver, at first...):        System.out.println("Start A");
        Thread threadA = new Thread(t1);
        threadA.setName("ThreadA");
        threadA.start();                     // Use the "start"-method.
        System.out.println("A has been started");
        System.out.println("Start B");
        Thread threadB = new Thread(t2);
        threadB.setName("ThreadB");
        threadB.start();                     // Use the "start"-method.
        System.out.println("B has been started");

Similar Messages

  • Simplify the initialization of and application (currently done with singletons)

    Say I have two startup classes:
    class A extends Parent {
        public void startUp() {
            Foo.getInstance().init();
            Moo.getInstance().init();
            // and 25 more of the same kind
    class B extends Parent {
        public void startUp() {
            Foo.getInstance().init();
            AnotherMoo.getInstance().init();
            // and 25 more of the same kind
    }As you can see both classes inherit from one parent.
    Singleton init() methods are called in a specific sequence and it is important to maintain that sequence.
    Problem: I'd like to simplify startUp() methods. Ideally i'd like to keep information on all singleton dependencies at one place, perhaps I will end up pushing them up into the Parent class, perhaps it can be resolved using Spring or some other application framework...? Anyway what would be your advice on how to get rid of initialization in two separate classes?

    I can't see how this would help... I'm trying to move duplicated code from two places into one place. Let me illustrate the problem on a different example, say you have:
    // A.java
    Foo1.getInstance().init();
    Foo2.getInstance().init();
    Foo3.getInstance().init();
    Foo4.getInstance().init();
    XXX.getInstance().init(); /* It is important this particular call has happened after Foo4.getInstance().init(); and before Foo5.getInstance().init(); */
    Foo5.getInstance().init();
    Foo6.getInstance().init();
    // B.java
    Foo1.getInstance().init();
    Foo2.getInstance().init();
    Foo3.getInstance().init();
    Foo4.getInstance().init();
    YYY.getInstance().init(); /* It is important this particular call has happened after Foo4.getInstance().init(); and before Foo5.getInstance().init(); */
    Foo5.getInstance().init();
    Foo6.getInstance().init();
    // ...So what i'm trying to do is - consolidate code and make it run (or get configured) at one place, and I explore every available opportunity not just core Java functionality

  • Error with Singleton BPEL process

    Hi All,
    We have a SingletonBPEL process implemented in SOA 10G.
    This is a ever running BPEL process which is initiated once and then
    it keeps waiting for request from other InvokeSingletonBPEL process and keeps processing
    them one-by-one, this works fine for some hours or sometimes days.
    However some times we have seen lot of old InvokeSingletonBPEL process
    waiting for response from SingletonBPEL and the new one getting processed.
    Ideally this should not happen till the old one completes the new one should not get processed.
    Has anyone faced this kind of issue. Or can explain this behaviour.
    Thanks
    Yatan

    Hi Arik,
    We have a requirement where we want to make sure that when a orderID comes to
    us we are not processing it 2 times, i.e. we don't have duplicate records in the DB for
    same orderID.
    To achive this we implemented a SingletonBPEL process, taking help from this blog and almost
    replicated the same in our process.
    http://blogs.bpel-people.com/2009/04/writing-singleton-bpel-process.html
    Now this SingletonBPEL is being invoked from other SingletonAssessorBPEL process.
    SingletonBPEL receive a request process it and then returns the response back to SingletonAssessorBPEL
    We have 2 receive activity inside this SingletonBPEL first one creates the instance and the process starts
    the other receive has create instance "un-checked" and this receive keeps waiting for getting invoked
    by SingletonAssessorBPEL.
    This works fine in good times, however sometimes some of the request send by SingletonAssessorBPEL
    are never completed by SingletonBPEL and it leaves them and move to other request.
    Please advice, if you have some other design we can implement to achieve the same requirement,
    or if you can give some pointer for this.
    Thanks
    Yatan

  • Can I Use Singletone  Pattren for DAO in Stateless EJB?

    Hi friends,
    I have a design in which i am creating an Business Layer using EJB (Stateless). In my case i have only read only to DataBase and at one case where i will be updating the database. But my application will be accessed by many concurrent users.
    My problem is if i create a DAO with singleton pattren then it will be returning the same instance to all the person who access the DB. So if one person is reading the database and at the same moment one more person request for update since the DAO is singleton object will there be any conflict?
    Reply soon

    Hi Martin.S
    Thanks for your suggestion.
    U Asked
    You need to think about why have you have made your DAO a Singleton. You need to ask yourself, SHOULD it be a Singleton? It may be valid decision but I find that doubtful. Singleton DAO's suit only limited set of circumstances. Why i decided to use singleton pattren was :
    Since i am using session bean and if i won't use Singleton pattren and
    If my app was used by say 1000 users
    Then 1000 Dao instaces whould be created!
    The App Server will have 1000 refrences which may be a performance issue and may slow down the server due to more usage of server resource. So i need to know weather is it a good idea to use the Singleton pattren for DAO when using SessionBeans?
    And one more doubt I have Martin
    If i use One Dao Class Per One Table Then How about the factories if i use singleton? Need to create so many factories as DAO's? *reply
    Also i think if i use Single DAO per Table and if i have say 1 user accessing the DAO and he is in the Middle of his execution and user 2 requests for the same DAO once again the situation is worse! Am i right?
    So I think Singleton pattren comes into handy only when one person is accessing the DAO at a time. After he completes then only we can give access to some one else.
    And also while Using EJB's Using syncronized DAO is not preffered since EJB's are for multiple access
    So do you have any solution for the same? Currently I am using ordinary DAO and creating multiple instances in the Session Bean.
    Is there any way to Use SingleTon Pattren inside SessionBean?
    Reply
    A Singleton DAO would be valid choice when you are doing performance/throughput optimisation for read only access to dataset which you have cached for speed, but need to ensure only one copy exists for memory efficiency.One more query martin,
    How can we use it for read only access to a data set?
    For example i have a DAO which queries and returns some result sets based on some input value given by the user
    Now take a senario1: User1 supplys some input value and executes method1() and he is in the middle.
    User2 comes in and acess the same method1() with different input value
    Since it is a SingleTon Pattren The User2 will get same refrence
    So user1 will get the result set that is having the input parameters of user2. Right?????????
    So my inference is we cannot use singelton pattren for concurrent acess of the DAO.What do you say
    Please Reply Martin

  • Is Singleton service available in oracle application server

    Is Singleton service available in oracle application server
    if yes please provide documentation

    Hi,
    what do you mean with singleton service? I know singletons as a design pattern in J2EE, so you may have to provide more information to get this question answered.
    Frank

  • Singleton node and non singleton practical scenario

    Hi  Friends,
    Iam totally confused with singleton and non singleton node implementation please explain practical implementation on singleton and nonsingle ton node . In which scenario  non single ton node is used.
    Thanks in advance
    Prasad

    Hi,
    Singleton Node:
    A singleton node contains only one instace of the node at runtime. And that instace contains multiple elements at runtime.
    By default if we create a node under ROOT context node, it will be allways singleton true.
    Non singleton node:
    A non singeton node contains more then one node instance at runtime. And each instance contains multiple elements at runtime.
    It is not possible to create NonSingletonNodes directly under ROOT context node. We can create under any node which is under ROOT context node.
    Note: In terms of datastorage at runtime we can say if node is table then each elment of node instance is a row of that table.
    When is it requried to create non singleton nodes?
    For example if you have list of SalesOrders and each and every oder is having list of items. Then we can create this node structure in two ways:
    Orders (singleton true)
    > Items (singleton true)
    Here in this case at any point of time the there will be only one instance of Items node exist for currently selected element of Orders node. And that instance contains multiple elements nothing but items of that order.
    Orders (singleton true)
    > Items (singleton false)
    Here in this case at any point of time all the instances of Items node exist for all the elements(not only for currently selected element) of Orders node. And those instances contains multiple elements nothing but items of those corresponding orders.
    I hope it helps.
    Regards,
    Vijay K

  • Singleton Classes in Weblogic cluster

    Hi
    Our application is having singleton classes which we refresh programatically ;though very rarely. We need to move our application into a weblogic cluster. The sigleton class refresh also needs to reflect across the servers :
    I could see the SingletonService API here http://download.oracle.com/docs/cd/E12839_01/apirefs.1111/e13941/weblogic/cluster/singleton/SingletonService.html. This contain an activate() and deactivate() .Can we call this activate() method to refresh the singleton object whenever there is a refresh required ? Can we define multiple singleton service classes in the cluster ?
    Thanks
    Suneesh

    I've same issue with singleton service...
    1) I’ve created a cluster MyCluster with Man1 & Man2 managed instances.
    2) I’ve created singleton.jar out of TestCache.java, which is a singleton cache and have deployed it to the MyCluster.
    3) I’ve created man.jar out of StartupClassMan.java, which is a startup class and have deployed it to the MyCluster. And I’ve specified this as startup class for the whole MyCluster.
    4) For MyCluster, I’ve specified com.mytest.TestCache.class as singleton service with preferred server as Man1 with migratable to Man2.
    5) I run Man1, startup class StartupClassMan is invoked and it gets reference to TestCache, populates the cache & prints size as 1.
    6) Now when I run Man2, startup class StartupClassMan is invoked and it get references to TestCache & populates the cache & prints size as 1 only.
    For some reason, TestCache is not considered as true singleton. If it is true singleton, running Man2 should have printed size 2 as Man1 has already put one entry into the cache.
    And I also don't see activate & deactivate method being called when I run Man1 or Man2 servers. Any help on this is really appreciated.
    package com.mytest;
    import java.util.Map;
    import java.util.HashMap;
    public class TestCache implements weblogic.cluster.singleton.SingletonService
    private static TestCache testCache = new TestCache();
    private Map<String, String> mapCache = new HashMap<String, String>();
    private TestCache() {}
    public void activate() {
    System.out.println("TestCache activate called");
    public void deactivate() {
    System.out.println("TestCache deactivate called");
    public static TestCache getTestCache() {
    return testCache;
    public void put(String key, String value) {
    mapCache.put(key, value);
    public String get(String key) {
    return mapCache.get(key);
    public void remove(String key) {
    mapCache.remove(key);
    public int size() {
    return mapCache.size();
    package com.mytest;
    public class StartupClassMan
    public static void main(String args[]) {
    System.out.println("StartupClassMan loaded");
    TestCache testCache = TestCache.getTestCache();
    testCache.put("Man1","Man1");
    System.out.println("size: "+testCache.size());
    }

  • Use Of SUPPLY Function & Singletone Class?

    Hi,
    What is the Use of Supply Function & What is Sigletone Class?
    Thanks
    Ranveer

    Hi Ranveer,
    Each context node of a controller can be assigned a supply function. This supply
    function is called by the runtime when the data of the context node is used. This is the case
    when a UI element is to be displayed for the first time with the data of the corresponding
    context.
    In general, the supply function is called when one or more elements of a context node are
    accessed and when
    &#9679; the context node is not filled yet or is initial, or
    &#9679; the context node has been invalidated in a previous step.
    Supply Functions of Singleton Nodes
    The supply function is especially useful in combination with singleton nodes.The
    values of subnode elements of the type Singleton depend on the element of the parent node
    to which the lead selection is currently assigned. If the lead selection is changed by the user,
    the supply function can access the new lead selection element and recalculate the values of
    the subnode elements accordingly.
    You can only create such a view when the lead selection element of the node
    CARRIER_NODE is read in the supply function of the node CONNECTION_NODE:
    For eg:
    method GET_CONNECTIONS .
    data: CARR_ATTR type IF_MAINVIEW=>ELEMENT_CARRIER_NODE,
    FLIGHTS type SPFLI_TAB.
    get filled structure for parent node
    PARENT_ELEMENT->GET_STATIC_ATTRIBUTES( importing
    STATIC_ATTRIBUTES = CARR_ATTR ).
    get connections from help class
    FLIGHTS = CL_WD_GET_SPFLI=>GET_FLIGHTS_BY_CARRID(
    CARRID = CARR_ATTR-CARRID ).
    NODE->BIND_ELEMENTS( FLIGHTS ).
    endmethod.
    Explanation:
    An internal variable of the type of a context element of the parent node
    CARRIER_NODE and another internal variable of the Dictionary type SPFLI_TAB are
    declared.
    &#9679; The attribute values of the lead selection element of the parent node CARRIER_NODE
    are then passed to the internal variable CARR_ATTR.
    For this transfer, each supply function uses the parameter
    PARENT_ELEMENT of the reference type IF_WD_CONTEXT_ELEMENT.
    PARENT_ELEMENT is a reference to the lead selection element of the parent node of
    the current node. The parameter is automatically displayed in the signature of the
    supply function.
    Each time the user selects another table element as the lead selection in the table Carrier,
    the value of the parameter PARENT_ELEMENT changes. The supply function of the context
    node CONNECTION_NODE is called and the values of its attributes are newly filled
    according to the selected table line in the table Carrier.
    Supply functions can only access context data that
    &#9632; is contained in the corresponding parent node or
    &#9632; is contained in another node that is on a next-highest level compared to
    the node filled by the corresponding supply function.
    Cheers,
    Mary

  • Popup + Singleton = don't work

    I have the following situation:
    1) Popup opened by a main application;
    2) Popup work with singleton: one singleton for a toolbar, other for the data;
    3) Popup can be close any time;
    The problem: when open by the first time, the popup works with no problem, however when opened by the second time, all references seem to point to the preview popup (already closed)... How can I destroy effectively a popup when it is closed? Is dificult to work with singleton + popup or I am doing something wrong?
    Thanks.

    If I may not destroy a popup, why there is the PopUpManager.removePopUp method ??
    The method PopUpManager.removePopUp exists just to close, remove ("destroy") the popup...
    How can I solves this problem reported above? I dont want to hide... I want to close it and open again other undefined time.

  • How to Show data in grouping with check boxes.

    Hi Experts,
    I am new to ADF and want to resolve one issue for my urgent project requirement.
    My Problem is :
    In Employee, Department relationship i need to show data in a grouping of departments like for Marketing department all the related employees should come in a single column.
    eg .
    Dept Name Emp Name
    Marketing Akshay Nitin Ritu
    Sales Neeraj Vikas Venu
    * All these department names and employees should come with check boxes and if i select one department all the employees should be checked.
    Please Please suggest any solution asap.
    Many Thanks in Advance.
    Regards,
    Nitin
    Edited by: user10980736 on Feb 7, 2011 8:32 AM

    hi,
    You can create two value nodes for storing these collections. The first one would be singleton node as it is the main list. Under that create the second node with singleton = false.
    e.g.
    ---NodeA
        --attrA1
        --attrA2
        --NodeB(singleton = false)
                --attrB1
                --attrB2
    Now populate collection of object A in NodeA and after adding element in NodeA populate respective elements in NodeB.
    IPrivate<View>View.INodeANode nodeA = wdContext.NodeAnode();
    for (Iterator  it = collectionA.iterator(); it.hasNext(); )
         ObjectA objA= it.next();
         IPrivate<View>View.INodeAElement nodeAElem= nodeA.createNodeAElement();
         wdCopyservice.copy Corresponding(objA,nodeAElem);
         nodeA.addElement(nodeAElem);
         Collection collectioB =objA.getCollectionB();
         for (Iterator  it1 = collectionB.iterator(); it1.hasNext(); )
             ObjectB objB= it1.next();
            IPrivate<View>View.INodeBNode nodeB = nodeAElem.nodeBnode();
            IPrivate<View>View.INodeAElement nodeBElem= nodeB.createNodeBElement();
            wdCopyservice.copy Corresponding(objB,nodeBElem);
            nodeB.addElement(nodeBElem);
    Bind NodeA to the first table and NodeB to second one.
    After that when you select record in first table automatically its corresponding records will be populated in second table.
    Hope this helps!
    Monalisa

  • Migratable targets for singleton implementations

    Hi,
    I require some help regarding the use of migratable targets with singleton implementations
    We have a WebLogic 11g environment comprising several managed servers in a cluster. Migratable Targets are also been defined for JMS and JTA services.
    The deployment includes two EARs which may only be deployed to a single server at any one time. The first EAR contains JARs, a WAR and a RAR. The second contains JARs and EJBs. We wish to implement a fail-over solution for these "singleton" EARs on the cluster so that everything would get migrated to another server in the cluster if the initial pinned server fails.
    We had hoped to use the same mechanism as for JMS and JTA services whereby the EARs would simply assigned to a migratable target (with a defined user preferred server and constraint candidate servers). However from reading the documentation and trying out some deployments this scenario does not seem to be supported by WebLogic. For example, a migratable target may not be given as a target during EAR deployment.
    The only option for the singleton services seems to be inheriting from the SingletonService and deploying this to preferred- and candiates servers but this would mean changing quite a few services and we are not sure how to manage the "singleton" RAR.
    Does Weblogic 11g offer a way to deploy a complete EAR to a deployable target? If not, could you please suggest an alternative way of implementing a fail-over solution for our EARs.
    Thanks in advance for your help.
    Regards. Ian.

    I tried deleting and creating them anew but it then messes up the configuration of the migratable targets. What seems to work now is to delete them, create new ones with DIFFERENT names and then updateDomain(). In this case the old ones get really deleted. Really messy stuff.

  • Settin singleton property false for child node but entire column populated

    hai all,
           I have set the singleton property of child node as false but still in my wdmodifyview when i load a value help with values from backend based on the user selection in 1st column of table the entire column gets populated.
    coding used by me:
    public static void wdDoModifyView(IPrivateSalesdet wdThis, IPrivateSalesdet.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)
        //@@begin wdDoModifyView
       try
       String partfn=wdContext.currentTablepartnersElement().getPartnerfn();
         if(partfn.equals("ShiptoParty"))
    IWDAttributeInfo partattributeInfo=wdContext.nodeTablepartners().nodeTablepartnerssubnode().getNodeInfo().getAttribute(IPrivateSalesdet.ITablepartnerssubnodeElement.PARTNERS);
    ISimpleTypeModifiable part  = partattributeInfo.getModifiableSimpleType();
          //     Set field label and populate valueset
      part.setFieldLabel("key");
    IModifiableSimpleValueSet partvalueSet =  part.getSVServices().getModifiableSimpleValueSet();     
      for (int i = 0; i < wdThis.wdGetSalescustomctrllerController().wdGetContext().nodeLt_Kna1().size();i++)
    partvalueSet.put(wdThis.wdGetSalescustomctrllerController().wdGetContext().nodeLt_Kna1().getLt_Kna1ElementAt(i).getKunnr(),wdThis.wdGetSalescustomctrllerController().wdGetContext().nodeLt_Kna1().getLt_Kna1ElementAt(i).getName1());
    I need to populate only the table cell wch is next to the cell in wch user has made a selection  and not the entire column.plz help me in this issue.

    First, you should not place this code in wdDoModifyView().
    Second, I assume you want to have a value help only on a specific table cell, not for all cells in the same column, is that correct?
    This cannot be done by modification of the DDIC type because the type is used for all cells of a column. This has nothing to do with singleton vs. non-singleton.
    What exactly is your use case?
    Armin

  • Singletons and clusters

    Hi,
    Does anyone have any idea on what to do with singletons on a cluster ?
    Right now we have 3 singleton, main business objects that handle core
    method calls.
    If we decide to cluster , how do we deal with singletons across clusters
    -Sam

    Does anyone have any idea of the performance implications of moving singleton
    objects to RMI objects for clustering ?
    We have an Environment Object that is encapsulated in a Servlet so that PageObjects
    can be loaded at startup. I could easily make the Environment Object an RMI object
    but I would be creating extra network traffic from each cluster participant.
    thanks
    Joe Ryan
    Don Ferguson wrote:
    Rickard Öberg wrote:
    Hey
    Bytecode wrote:
    My point exactly.
    A singleton replicated ?? Isnt that a conradiction in terms ??
    What state are these different instances going to be in ?? Excatly identical
    at all points of time ??If I understood Don right it's the stub that will be replicated. Not
    the RMI-object. So all stubs in the clustered JNDI-tree will point to
    the same RMI-object.
    /RickardYes, that's the idea.
    -Don

  • Websphere Classloader in clustered singleton design.

    Hi,
         I am evaluting about cache management in clustered J2EE environment with singleton pattern using your product Tangosol.I need some clarification about the classloader in websphere clusters. Does Tangosol assure the state integrity of an object across classloaders., meaning an application can contain many jars inturn they may have their own classloaders. When two classes from different jars tries to access a singleton object, does they own their "copy of the instance of singleton object and state" or "different instance but share the same state".
         My requirement is simple i am not bothered about the mutiple instance but the state.We want to have same state across classloaders.
         Does your product support this feature across j2EE clustered Applications also??
         I am starter and just digging into your online documents .
         Thanks
         skumar

    IBM WS 5 does support in-memory replication for HTTP sessions using the technology from the Griffon project (JMS-based). If that is all you need, then the built-in IBM implementation will probably be sufficient. We don't comment on comparisons of scalable performance or anything like that, because IBM has been an excellent and supportive partner, and we would rather not be competing directly against them ;) ....
         Coherence provides a number of capabilities that can really help make your WebSphere application shine (or any J2EE application for that matter):
         1. Portability between application servers and versions of application servers -- including WebSphere back to 3.5.x.
         2. Peer-to-peer clustering that allows any number of WebSphere servers (and non-WebSphere processes, such as stand-alone Java processes and batches) to share data and concurrency control information.
         3. Transactional caching -- transactional controls for data that you are manipulating in the cache.
         4. In addition to replicated caching, which Coherence is well known for, it also supports automatically partitioned caching -- each server in the cluster adds more cache storage resources, so the cache is the sum of the servers (much different than "replicated" caching).
         5. Full, instant and automatic failover and failback for all types of caches.
         6. Read-through, write-through and write-behind caching that allows the cache to sit in front of a JDBC datasource, a mainframe data source, or to use a connector architecture.
         7. Distributed query support, supporting cluster-wide resources to be used to search for data in the cache using any custom filter approach you desire, including X/Path or RegEx or relational operators ... plus support for declarative indexing and cost-based optimizations.
         8. Grid computing support, allowing you to invoke agents anywhere on the grid, across WebSphere clones or separate JVMs, with full support for configurable thread pooling, fire & forget, request/response, poll operations, etc.
         9. A simple, elegant and complete API that supports concurrency control, filtering, bulk operations, and is based on the Java collections API (i.e. java.util.Map), which is the basis for the JCache JSR.
         10. Completely XML-configurable deployment, including overflow caching (cache spooling), location transparency, cache servers, etc.
         Additionally, Coherence has unbeatable performance, free developer licenses, published pricing, and (thanks to our partner!) the wonderful "Powered by WebSphere" logo.
         Peace,
         Cameron Purdy
         Tangosol, Inc.
         Coherence: Easily share live data across a cluster!

  • How to populate a context node on the basis of the values in another node?

    Hi,
    I have a Webdynpro application which has to run on Portal as well as BlackBerry.
    In this application I have a scenario where I need to have a sub node inside a node but as Blackberry doesn't support sub nodes with Singleton value false, I have to use another node for storing the values which earlier wre present in the sub node.
    The actual scenario here is that we have two tables A & B. For each row of table A we have a no of rows in table B. This can be easily accomplished for Web Browser but we need to do this for Blackberry.
    My question here is that how can i populate the data in table B at runtime using the concept of onLeadSelect. I am not able to fully undersans this concept.
    According to my approach I have two a while loop which generates data for  table A and inside this while loop I have another while which generates data for table B corresponding to each iteration of the outer while loop. I create the node elements for the rows of the table B and store them in a list and then store this list in a HashMap corresponding to a key formed by combining the values of all the elements of the row of table A.
    Now I am not able to understand how can I display this data into table on user slecting a particular row.
    Please guide ASAP.
    It wille quite useful if you can provide me with some code snippets for the same.
    Thanks in advance!
    Manish

    Hi Manish,
             In WebDynpro u can use the onLeadSelect event of table A and do all the processing in that method.Like u can use this method to fill ur context node,which will be the source node for table B. So this way u need not to use any hash map.Fill the source node of table B with data corresponding to ur selected data of table A.
      I hope this solution wud help u in solving ur problem.
    Reena

Maybe you are looking for

  • Can you save your itunes and songs onto an external hard drive so that incase your computer crashes you will still have all your music?

    Can you save your itunes and songs onto an external hard drive so that incase your computer crashes you will still have all your music?

  • Leopard + iChat + Time Capsule Port Forward

    Hi, Here are my settings OS: Leopard Modem: Motorola 2210-02 Router: Time Capsule Macbook I am trying to use video ichat with my girlfriend in Canada but I can't get it to work. (audio works) Currently I am using the modem as a Bridge and I forwarded

  • Combining Pages Files

    Suppose I have two Pages documents: 1) multipage.pages, a multipage document 2) onepage.pages, a 1-page document. Each of them consists of both text and images. How can I add onepage.pages to multipage.pages so that it becomes another page of multipa

  • HT1349 i can't add my iPhone

    Hi please i try to add my iPhone 4 here https://supportprofile.apple.com/PramsAddRegisterProduct.do i can't do this is show to me According to our records, this serial number is registered to another Apple ID. If you have more than one Apple ID, log

  • Class.forName("AClassName") always yields in an exception

    Dear Experts I am trying to get a classname at runtime and Class c = Class.forName always returns an exception I will appreciate your help in this regard. Anyways the full code is as follows: interface MyInter     void accept();     void display(); c