Multiple KJS & Static Varibles

Hi
We have an application running on iAS6.0 SP3 on Solaris Box with 4 KJS
processes. We have a Java Class which have static varibles in it. When we
access the class, the class is getting loaded 4 times, one on each KJS
process which is causing 4 copies of the static data. So, each time we hit a
new KJS our previous values are lost. Are we doing some thing wrong and this
is the expected behavious. If so how do we go about finding an alternate
way?
Thanks in advance,
Bhamu
Eclipse Networks Inc.

Yes, this is expected behavior. (And is true in any multi-JVM
environment, not just iAS.)
Generally, you should avoid having one variable that must remain unique
in an entire cluster. By definition, this will limit your scalability.
That said, you could consider storing the information in a
ServletContext attribute. iAS will automagically distribute the value to
all of the KJS engines (assuming that you are using DSYNC). It will
perform some caching of the attribute so that you will minimize the
affect on your application.
David
Bhamu wrote:
Hi
We have an application running on iAS6.0 SP3 on Solaris Box with 4 KJS
processes. We have a Java Class which have static varibles in it. When we
access the class, the class is getting loaded 4 times, one on each KJS
process which is causing 4 copies of the static data. So, each time we hit a
new KJS our previous values are lost. Are we doing some thing wrong and this
is the expected behavious. If so how do we go about finding an alternate
way?
Thanks in advance,
Bhamu
Eclipse Networks Inc.

Similar Messages

  • Regarding multiple KJS in  iAS 6.0 application server

    hi,
    Why we have multiple kjs log option in iAS 6.0. How this impacts the server performance or any other issues related to it.
    How we can merge multiple KJS to single (any configuration needs to be done).
    thanks in advance
    mohan.

    Hi Karmesh,
    As a role of thumb, Oracle does not support any extended shared memory segments on IBM AIX. Please take a look OSS notes #105429, 123366.
    Additionally, I would like to suggest that you use dynamic SGA that has been mentioned in OSS note #105429.
    What kind of memory, you are talking about, in your last question? Oracle memory tuning or SAP memory tuning?
    Regards,
    Orkun Gedik
    Senior SAP R/3 Basis and Development Consultant
    ASTRON

  • Configuring optimizeit profiler for multiple kjs

    Hi,
    I am facing problems in configuring optimizeit profiler for multiple kjs. It
    works fine if i have a single kjs in my app server and i am able to read the
    profiler output. I am using iAS6.0sp2.
    When i try to change the script that attaches the profiler with kjs for
    multiple kjs all the kjs start on the same port i.e 10819. I want all the
    kjs to start on different ports so that i can read the profiler output for
    all of then at one go.
    If any body has done this before with success then please help me at an
    earlier date.
    This is very very urgent for me.
    sandhya

    There is three things important While you working with custom member ship and FBA to work. 
    1. If you have developed Custom membership extending SQLServerMembership provider then make sure to check for Machine Key. as internally if usese combincation of this to encrypt password, so if you used first userid using some other method of creating user
    then probably it does not use machine key in that configuration file.
    2. if you doing brand new implementation from base classes you probably want to check your query & stored Procedure. make sure to run sql profiler to see what query is getting fired.
    3. this one is most least and mostly not will be problem but do check Application Name,
    Note: Key to get this working is Machine key, Application Name, your custom code revisit, sql profiler and you should be good,
    Also do review FBA Code from CodePlex you can save significant time in developing from scratch.
    -Samar
    www.gosam.info
    Please remember to click Mark as Answer on the answer if it helps you
    Sr. Software engineer

  • Mac OS X Server 1-to-1 Routing: Multiple DSL Static IPs

    Hi all -
    Question here regarding Mac OS X Server 10.4's ability to handle multiple static IP's coming from my DSL ISP. Can this be handled through the Server Admin GUI or does it need to be done in Terminal with iptables or something similar?
    My ultimate goal is to send 1 of the static IPs to a Mac Pro, another to a Mini, another to a DVR, etc.
    As a piggyback question - what is the general consensus here on using a Mac Pro or Xserve with Gateway Setup Assistant as a VPN router in place of a traditional SonicWALL / Linksys / Netgear, etc?
    Thanks in advance.
    Eric

    >As a piggyback question - what is the general consensus here on using a Mac Pro or Xserve with Gateway Setup Assistant as a VPN router in place of a traditional SonicWALL / Linksys / Netgear, etc?
    Go with the traditional box.
    For a few bucks you get a box that's designed for that kind of thing, has a far better interface for managing it, and far more fine-grained control over what traffic can come through.
    In addition to that, by having a dedicated hardware router/firewall/NAT device you avoid the chance to leak any services to the public - if you're like most people, your gateway machine isn't just running as a gateway - it's also got sshd running, maybe a web server, file server, DNS server, possible even running as a directory server.
    Since this gateway machine, by definition, has its proverbial *** hanging out in the wind there's a possibility that these services could be compromised by remote hackers.
    By using a dedicated hardware box you can be very specific about what incoming traffic you want to allow, completely insulating your server from the outside world except for the services you know you really want to be public.

  • JMQ Resource in conflict on multiple KJS's via IAS 6.5

    Hello,
    As part of running our app under IAS 6.5 Solaris, we connect to a queue using JMQ. However, since we run 2 KJS's on our machine, we're actually connecting twice - once for each KJS. When the 2nd KJS comes up, we get the following exception:
    javax.jms.JMSException: [C4055]: Resource in conflict
    at com.sun.messaging.jmq.jmsclient.ProtocolHandler.addInterest(ProtocolHandler.java:1305)
    at com.sun.messaging.jmq.jmsclient.WriteChannel.addInterest(WriteChannel.java:37)
    at com.sun.messaging.jmq.jmsclient.ConnectionImpl.addInterest(ConnectionImpl.java:572)
    at com.sun.messaging.jmq.jmsclient.Consumer.registerInterest(Consumer.java:90)
    at com.sun.messaging.jmq.jmsclient.MessageConsumerImpl.addInterest(MessageConsumerImpl.java:126)
    at com.sun.messaging.jmq.jmsclient.MessageConsumerImpl.init(MessageConsumerImpl.java:121)
    at com.sun.messaging.jmq.jmsclient.QueueReceiverImpl.<init>(QueueReceiverImpl.java:40)
    at com.sun.messaging.jmq.jmsclient.QueueSessionImpl.createReceiver(QueueSessionImpl.java:82)
    The JMQ server that is running gives the following message simultaneously:
    [25/Apr/2002:17:14:03 EDT] WARNING [B2009]: Creation of consumer lstCreateLoanApp to destination 1 failed:
    B4006: com.sun.messaging.jmq.jmsserver.util.BrokerException: [B4006]: Unable to attach to queue queue:lstCreateLoanApp: a primary queue is already active
    In researching the problem, we found that you must manually set QueueConnection.setClientID() to a unique number. We therefore did the following:
                   String newClientId = String.valueOf(Math.random());
                   queueConnection.setClientID(newClientId);
                   cat.debug("Set QueueConnection clientID to [" + newClientId + "]");
    That is successfully resetting the client ID and prints out stuff that looks like this:
                   Set QueueConnection clientID to [0.8012784079113983]
    However, even after resetting the client ID to a random number on each QueueConnection, we still get the Resource in conflict problem.
    Is our thought that the client ID needs to be reset to a unique number for each QueueConnection valid? If so, does the code above do the job correctly? If not, how do we get around this?
    Thanks in advance,
    Mike

    I don't know if you guys are still wrestling with this, but I just wanted to let you know that I have the same configuration - iPlanet app server 6.5 with 2 kjs's integrated with JMQ 2.0 beta - and i don't have this problem at all. From the information given, I can't begin to guess what the differences are.

  • Accessing a static varible from different object at the same time

    hi
    assume that i have calss it contains a static variable i am creating
    N numbere object of that class and i am try to access the static variable at the same time from different object.if i access like that any problem(deadlock) will occure or not? plz help me
    with regards
    suresh

    FeedFeeds : Read news and blogs a new way!
    http://www.feedfeeds.com
    Please don�t spread any kind of propaganda in this forum...;-)

  • Configure RRAS with multiple public STATIC IP address

    <p>I have Server 2012 Standard edition. &nbsp;I have two network cards installed. &nbsp;I have configure my server to be my router aka NAT BOX using Server 2k12 RRAS. We recently added more servers to our internal network. We needed more
    Public Static IP address. Currently we had one and then upgrade to 5 with Time Warner. I configure my WAN NIC card on the server with the new Static IP address from TIME WARNER. How do I add the remaining ones to RRAS. THen i can use services tab to add that
    static IP address with this port to that internal ip address which happens to be another server. &nbsp;</p><p>Currently when I add to the address pool tab couple my PC or servers gets kicked off the internet especially when I add the service
    port and the public ip address from the public ip address pool and the internal ip address and the internal port.&nbsp;</p><p></p><p>Anyhow, what i am trying achieve here is NAT the remaining public IP Address to an internal ip
    address. Only a certain ports such as SMTP Port, VPN port, pop3 port, HTTP port HTTPS ports. &nbsp;Can someone help me configure this on RRAS on server 2012</p>

    how can i do port forwarding with the address pool of public static IP address.  Currently my  Server 2012 is my acting router. I have NIC cards on there. One of the NIC is connected to the Cable Modem and the other NIC card is connected to the
    switch. How can I use port forwarding with the other remaining public IP address.  The reason is I have two exchange server in my internal network. Both can't be using the same ports so I got more public IP addresses. I just want to configure my RRAS
    port forward 80, 443, 25, 110, 143 to both exchange server who have an internal ip address. In order to achieve that I need to have two public IP address. 
    Tell me if there is a solution. 

  • How can multiple kjs produce different results?

    I have two kjs's running on a single (unclustered) machine. Now whenever I run the server the first kjs seems to be O.K the second however seems to just accept requests and not return them - I see thread add contiously added to the kjs.log and every other browser request will hang, if I disable the second kjs everything works o.k. Have have also noticed running top that this second kjs is constantly running consuming a minimum of 30%+ processor all the time.
    Does anybody have any idea as to how the 2kjs's could behave differently considering they are using the same script parameters ?

    need some more clues:
    1. Is the behaviour specific to the VM, i.e if you were to disable kjs1 and only enbale kjs2 does the app behave correctly.
    2. is is this behaviour specific to your app, i.e does fortune work on both engines.
    3. are you limited by some backend resource like db, jms etc.

  • Dynamic varibles and Static Varibles

    I have this table row with these data element in it........I
    want to be able to change the text of my data elements and when i
    write them to a file they are changed when i view the
    file......Right now if i change the value in the text field it
    still writes the data from the database to the file.......Do i need
    to change the ouput to the name instead of the values????? Any help
    on this would be great....

    If you display the form and the values from the database are
    shown, you are on the right track. When a user makes a change in
    the content of a text box and clicks the submit button, the action
    page declared in the <FORM> tag is loaded. The name/value
    pair of each text box is available in the action page. Use these
    values to update your database.

  • Can I use static variable in EJB?

    Many books suggest developer don't use static variable in EJB,I want to know why?
    I know there isn't any problem if the static varibale is read only
    For writable static varible ,what will happen if I use a static Hashtable for share data
    Help me!Thank you very much!!

    Greetings,
    I know that "EJB business methods are not allowed to
    block on synchronized resources" Just where do you "know" that from?? The EJB 2.0 Specification, at least, is nowhere in agrement with this statement. If it comes from a book I would question the author's reasoning. Contractually, there's no sound basis for this. In the case of Session Beans, they have an expressedly direct and single-threaded association with a client. From a design viewpoint, it certainly seems unnecessary for a bean to "block" its one-and-only client, but to say that it "is not allowed to" do so is without merit. Entity Beans, on the other hand, are concurrently accessible. Yet, with regard to a transactional context being in effect, the container does indeed block on a bean's business methods. For the bean to do so itself is, therefore, unnecessary. Furthermore, the specification explicitly concedes that a "Bean Provider is typically an application domain expert" and "is not required to be an expert at system-level programming." (EJB 2.0 Spec. 3.1.1) From these statements alone it is reasonable to assume the above statement is meritless since the Bean Provider is not expected to even consider synchronization issues when developing a bean.
    But I'm mixed up why we could use "Hashtable" or otherApparently, because your sources are as well...
    collection classes in the EJB ,in these method many
    methods are synchronized In fact, not only "can we use" them but, with respect to multiple-row finders in Entity Beans we are [i]required to use them (or an iteration of them)! Not all Collection classes are synchronized (so called "heavy-weight collections"). As shown above, that the choice of a particular Collection class might be synchronized is of little consequence since a bean designed under strict adherence to the specification ensures that it is never concurrently writeable.
    Could someone provide a good way for this problem?
    Please Help Me!!!Regards,
    Tony "Vee Schade" Cook

  • SRP547W On Multiple IPs

    I got hold of an SRP547W.
    1. Can I use this for multiple public static IP (i.e. 203.xxx.xxx.30, 31, 32) to buy from Telco then link them one-to-one to a private IP (i.e. 10.xxx.xxx.30, 31, 32) virtual webservers? On one PC.  For HTTPS?  Say 203.xxx.xxx.30   forwarded to 10.xxx.xxx.30;     203.xxx.xxx.31   forwarded to 10.xxx.xxx.31;   203.xxx.xxx.32   forwarded to 10.xxx.xxx.32
    2. How to do it?
    I have read the Admin manual,  I have log-in as Admin via web interface, tried to navigate, tried to understand, but application is quiet technical for me. Could not sort out where to put 1st public IP then link to 1st private IP virtual web server, then again where to put 2nd public IP then link to 2nd private IP virtual web server,   then again where to put 3rd public IP then link to 3rd private IP virtual web server.
    3. Any additional awarenes or precautions?
    I just read that this model is being discontinued.
    Greatly appreciated.
    TechHobbyist

    Your typical IP stack in your typical operating system uses the recvfrom() function to receive UDP packets. recvfrom() does not return the receiving IP address. So no, the Java API can't return the receiving address because the operating system has no way of returning it. recvfrom() documentation: google or http://www.opengroup.org/onlinepubs/009695399/functions/recvfrom.html
    You can figure out the receiving address by creating several sockets, one for each network interface.

  • Clarification about static variables declaration

    I'm getting "Illegal Start of Expression" error, When i try to declare a static variable within a static metho or nonstatic method.
    Could you please clarify me,
    Is it possible to declare a static varible within a static method or non static method ?
    Thanks

    Hi Vikas,
    First, note that this forum is devoted to Sun Java Studio Creator IDE. General Java questions can be asked on forums here: http://forum.java.sun.com/
    Second, note that static variable can be defined only as member of class. It cannot be defined inside of method.
    Thanks, Misha
    (Creator team)

  • How to clear the value of variable declared with STATICS keyword in FM?

    Hi All,
    I am using a standard CRM FM:CRM_CLA_RES_UPDATE_FM in that a STATICS variable is declared. In my code this STATICS varible value is populating. Iam to clear that Varible.
    How to do that.
    Thanks and Regards,
    Shabeer Ahmed,

    If you have 6.0 or up version then you will have a spiral button for your ABAP editor in you application toolbar. this is to find enhancements provided to you for standard programs. if you click on this you will get the enhancement points which you can identify and use accordingly to change/edit your STATICS variable content.
    if not, then you'll probably have to write to OSS , if you can open the code and do the required correction.

  • Static Variable Clusters

    Hi,
    I want to count the number of users visiting a particular web page .
    Can anyone please say how to go about it?
    We can use static varible for it which can be increased everytime the page is accessed.but what I want is that if it is in a cluster how to do it?
    I do not have any database.
    Can it be done in anyway throgh jsp and servlets??
    Thanks

    You could use a variable stored in the servlet context. Add a SessionListener that increments the variable everytime a session is created and decrements when the session is destroyed.

  • Best Practice to Atomic Read and Write a Field In Database

    I am from Java Desktop Application background. May I know what is the best practice in J2EE, to atomic read and write a field in database. Currently, here is what I did
    // In Servlet.
    synchronized(private_static_final_object)
        int counter = read_counter_from_database();
        counter++;
        write_counter_back_to_database(counter);
    }However, I suspect the above method will work all the time.
    As my observation is that, if I have several web request at the same time, I am executing code within single instance of servlet, using different thread. The above method shall work, as different thread web request, are all referring to same "private_static_final_object"
    However, my guess is "single instance of servlet" is not guarantee. As after some time span, the previous instance of servlet may destroy, with another new instance of servlet being created.
    I also came across [http://code.google.com/appengine/docs/java/datastore/transactions.html|http://code.google.com/appengine/docs/java/datastore/transactions.html] in JDO. I am not sure whether they are going to solve the problem.
    // In Servlet.
    Transaction tx = pm.currentTransaction();
    tx.begin();
        int counter = read_counter_from_database();  // Line 1
        counter++;                                                  // Line 2
        write_counter_back_to_database(counter);    // Line 3
    tx.commit();Is the code guarantee only when Thread A finish execute Line 1 till Line 3 atomically, only Thread B can continue to execute Line 1 till Line 3 atomically?
    As I do not wish the following situation happen.
    (1) Thread A read counter from Database as 0
    (2) Thread A increment counter to 1
    (3) Thread B read counter from Database as 0
    (4) Thread A write counter as 1 to database
    (5) Thread B increment counter to 1
    (6) Thread B write counter as 1 to database
    What I wish is
    (1) Thread A read counter from Database as 0
    (2) Thread A increment counter to 1
    (4) Thread A write counter as 1 to database
    (3) Thread B read counter from Database as 1
    (5) Thread B increment counter to 2
    (6) Thread B write counter as 2 to database
    Thanks you.
    Edited by: yccheok on Oct 27, 2009 8:39 PM

    This is my understanding of the issue (you should research it further on you own to get a better understanding):
    I suggest you use local variables (ie, defined within a function), and keep away from static variables. Those local variables are thread safe. If you call functions within functions, its still thread safe. If you read or write to one record in a database using sql, its thread safe (you dont need a transaction). If you read/write to multiple tables and/or records, you probably need a transaction. Servlets are thread safe. You usually dont need the 'synchronized' word anywhere unless you have a function updating/reading a static variable and therefore want to ensure only one user is accessing the static varible at a time. Also do so if you are writing to some resource (such as a file, a variable in applicaton scope, session scope, or resource that everyone uses such as email server). You dont want more than one person at a time to write to it). Note the database is one of of those resources that is handled by transactions rather than the the synchronized keyword (the synchronized keyword is applied to your application only (not other applications that someone is running), whereas the transaction ensures all applications are locked out while you update those records in the database).
    By the way, if you have a static variable, you should have one and only one function (synchronized) that updates it that everyone uses. If you have more than one synchronized function, that updates it, its probably not thread safe.
    An example of a static variable you would use is a Datasource object (to obtain your database connections). You only need one connection pool in your application and you access it via the datasource variable.
    If you're unsure your code is thread safe, you can create two seperate threads that call the same block of functions repeatedly to ensure it works as expected.

Maybe you are looking for

  • No ringback from cisco ip phones to alcatel Phones

    I have a CUCM 7.1.3 integrated with a Alcatel OXO PBX and when a try to place a call from cisco IP-Phones registered on CUCM to phones on PBX, I have no ringback,but  when a place a call from cisco IP-Phones registered on CUCM to PSTN using PBX as it

  • Any Ideas on Apps to Transfer PDF collections?

    Greetings, I have a bunch of PDF files I would like to distribute to Field Staff.  Many of the PDF files are organized together in subject matter.  Is there anyway I can "pre-configure" and organize this PDF collection in a single file then have the

  • Itunes on macbook pro looses sync'd content when reconnected

    I'm having an issue where I have all my music and movies playing just fine on my MacBook Pro, and the next time I sync my iPhone, any movies or music selected to sync that are not on my computer's hard drive recieve a circle with a bang in it and can

  • Resolution Scaling on Macbook Pro

    I have Windows running on bootcamp and I love having the ability to run 1080p.  Is it possible to do the same kind of resolution scaling on OS X? By the way, I understand that a 1280x800 display can't display 1080p due to the fact that there's not en

  • How do I maintain license on systems with no internet connection?

    I will be installing CS6 on PCs with initial internet connection, but they will be moved into a space without any internet. How do I keep the CS6 working without the connection? Is there a license file I can download then apply to the systems without