Wf and concurrent

Hi;
Is anyone know how i can find concurrent list which i belong WF and for specific time like between 1pm to 2 pm.
How i can find which package or function is working behind of those concurrent?
Thanks for advice
Helios

Hi Hussein;
Thanks god you are here as always,its so nice to hear you again.
Actualyy we noticed that JTF_FM_AQ_WRAPPER_PVT.DEQUEUE package is eatingour CPU and i found this thread:
high CPU utalization
We noticed this package run between 13.05-13.10 pm
I followed this :
login as sysdba >> submit new request>> choose specific request >> in mane field i type "%ork%" then submit and its brings me all Workflow Background process...
with details tab i can see those WF run which time period. I found one WF and its Request ID. Whiit them how i can this wf run upper package?
Thanks Helios

Similar Messages

  • Weak and concurrent hash map for caching

    Hello,
    I have written a very simple cache class with both weakness and concurrency benefits. This class is intended to be used as a weak cache in "hot redeploy" capable servers (JBoss or any other).
    My implementation uses the (problematic) "double-check" pattern with a reentrant lock and encapsulates a WeakHashMap with WeakReference values (to avoid circular key/value references). Here is the code:
    public interface ValueCreator<V> {
         public V create();
    public class WeakCache<K, V> {
         private final Lock lock = new ReentrantLock();
         private final Map<K, WeakReference<V>> weakMap;
         public WeakCache() {
              this(16);
         public WeakCache(int initialCapacity) {
              this(initialCapacity, 0.75F);
         public WeakCache(int initialCapacity, float loadFactor) {
              weakMap = new WeakHashMap<K, WeakReference<V>>(initialCapacity, loadFactor);
         public V get(K key, ValueCreator<V> creator) {
              WeakReference<V> ref = weakMap.get(key);
              if (ref == null) {
                   lock.lock();
                   try {
                        ref = weakMap.get(key);
                        if (ref == null) {
                             ref = new WeakReference<V>(creator.create());
                             weakMap.put(key, ref);
                   } finally {
                        lock.unlock();
              return ref.get();
         }One usage of this cache is for session ejb3 lookup:
    private static final WeakCache<Class, Object> LOOKUP_CACHE = new WeakCache<Class, Object>();
    public static <T> T lookup(final Class<T> serviceClass) {
         T service = (T)LOOKUP_CACHE.get(serviceClass,
              new ValueCreator<Object>() {
                   public T create() {
                        String lookup = "myapp/" + serviceClass.getSimpleName() + "/local";
                        try {
                             return (T)(new InitialContext()).lookup(lookup);
                        } catch (NamingException e) {
                             throw new RuntimeException("Could not lookup EJB " + serviceClass + ": " + lookup, e);
         return service;
    ...2 questions:
    1. Is there any issue with concurrent access to this cache ?
    2. What happens exactly when the garbage collector wants to free memory with a map with both weak keys and values ?
    Some limited tests show that the behavior of this cache fits my needs: the lookup cache is cleared on redeploy and it keeps its key/values pairs otherwise.
    Thanks for any comments.
    Message was edited by:
    fwolff999

    I know that DCL is broken under certain circumstances (but I have read it may work with modern JVM and the use of volatile variables for example).
    So: is it broken with this specific implementation and if so, what should be done to make it work ?
    The getter method is potentially setting a value (like in ConcurrentHashMap.putIfAbsent) and it uses a ValueCreator in order to actually create the value only if it is not already present in the map.

  • RMI and concurrency (newbie)

    Hi
    I have a simple question related to RMI and concurrency.
    I have a server and several clients calling remote objects concurrently.
    How is concurrency usually handled when one used RMI ?
    Can we make use of "synchronized" on some method of the remote objects ?
    I have read about risk related to performance and worse, some problems of deadlock if the synchronize is not well organized.
    Is there other ways to deal with that ?
    Thanks in advance for providinge me any information or suggestion.

    RMI is inherently multithreaded. If you have specific remote resources that you want protected from concurrency, then define all of the accessor methods to be synchronized. (I don't think you can get away with making the remote methods synchronized; I would instead figure out what which resources I want to protect, and only protect those particular objects.)
    Could there be problems? Maybe. But these are absolutely standard coding techniques.

  • Difference between multiple employment and concurrent employment

    hi,
    What is the difference between multiple employment and concurrent employment.
    Regards,
    Chandra

    Hi
    Multiple employment is one person working woth more than one company with different EE iD.
    Person who has more than one personnel assignment with one enterprise or several affiliated enterprises in an cocurerent employee.
    Please go thru the link.
    http://help.sap.com/saphelp_47x200/helpdata/en/54/f535c614aa7a46800915c6f0dbc071/frameset.htm
    Ravee
    +91.99206.33669

  • How to create a thread safe and concurrent web part

    Hi,
    I am creating a sharepoint web part. 
    The web part will store the information in the sharepoint list.
    The web part is going to be used by 300 users all at the same time at the same moment.
    Each 300 users  trying to update list clicking button on my web part almost every 20 seconds.
    I am worried will the sharepoint List be able to handle so many concurrent updates.
    How should I design my webpart so that such issues do not arise and my webpart is also fast.
    Regards
    Vinod

    Hi,
    Per my understanding, there might be a concern about the performance and concurrent operation in your Visual Web Part.
    By default, there is already a built-in system in SharePoint handling the concurrent operation in a list, if the workload is not so high, it would be OK for the commonly use in
    your scenario.
    If there would be a requirement about creating a “fast” web part,
     a possible solution can be like this:
    In the web part, users click button to submit the specific update requirements with some data to server. In server side, we can create an application to handle the requests(add/update/delete
    item) from users sequentially one after one.
    By doing this, in client side, the web part will only responsible for submitting user request with simple data, all the time consuming jobs will be split into small tasks and being
    executed sequentially in server side.
    Also, here are two links below about some useful tips in developing web part which would be helpful to you:
    https://msdn.microsoft.com/en-us/library/dd583135%28v=office.11%29.aspx?f=255&MSPPError=-2147217396
    http://apmblog.dynatrace.com/2010/03/18/how-to-avoid-the-top-5-sharepoint-performance-mistakes/
    Thanks
    Patrick Liang
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Named and Concurrent users

    Dear Friends,
    Please help me to find named number of users in PeopleSoft specific to module.Below are the modules i am using and i wanted to know named and concurrent users using these modules
    Human Resources
    Benefits Administration
    Pension Administration
    Thanks
    Uday.

    Hi Bart,
    Difference between named users and concurrent users:
    Named user means when you buy BOXI you buy a certain amount of named user licenses and then you give each of these named users a login. It`s a cheaper type of license but you have to know exactly who your users are, and so is pretty useless if your userbase is constantly changing or your exposing Infoview over the web.
    Concurrent user licenses are now only available in BOXI Edge - the equiv in BOXI Pro\Premium is a CPU license, which means you can let as many people login as your hardware will support. Concurrent user licenses are useful when you don`t know who your userbase is - you can just give a generic login for people to use. Or give people specific logins and not worry that they might not be using the system and using up a valuable named user license.
    for more information follow the below links:
    http://www.forumtopics.com/busobj/viewtopic.php?p=476977
    http://www.forumtopics.com/busobj/printview.php?t=125096&start=0&sid=095882f7c0d636e7bca723e5930c21d3
    Hope this helps.
    Regards,
    Deepti Bajpai

  • Transfer Object Pattern and Concurrency Transaction Mgmt

    I am developing an application that implements a remote rich client. For
    performance reasons I have chosen to use the Transfer Object pattern. I
    have been very successful with this from a performance standpoint, it
    really paid off. I am using it in combination with an assembler pattern
    to construct Transfer Objects for the view and to also reassemble domain
    objects based on changes made to transfer objects on my client side.
    Anyways the only problem I am having with it is I can't seem to figure
    out how I should implement optimistic locking with it. Is there a best
    practices to handle transaction control here?
    I generally try to keep visibility of stale data down, but there are still
    situations where concurrent clients could have requested to edit the same
    the Transfer Object at the same time. I would ideally like to handle this
    using a flavor of optimistic locking. I in fact have implemented
    optimistic locking on the domain side, but now I am not sure how or if I
    should integrate this into the Transfer Object or View side. The version
    field used in optimistic locking is generally a hidden field. The only
    way I can see to handle this with the view side is to expose this field on
    the Domain Objects and actually store it into assembeled transfer objects.
    This seems like it may be a bad idea from a design standpoint.
    The problem is the client requests data and it assembled and delivered to the client. Then at some later time the client may send a request to the server to update this data. At this time a new transaction must be started where the server reloads the domain data and copies over the requested changes. Since the domain data was just loaded you wouldn't ever trigger a versioning problem unless the version was maintained on the transfer object and copied over as well. I am developing this project with hibernate on the back end and unfortunately hibernate doesn't acknowledge manual changes to the version field.
    I just feel like there must be a better way to do this. I believe that using the Transfer Object or DTO pattern for remote client/server architectures is pretty common. So there must be a best practice to deal with concurrency? Suggestions, insight, lay it on me please.
    thx

    I personal respect both concepts and am using both in an application I am currently work.
    Firstly, I have my Transfer Object which I call xxxData.
    Next, the entities are called xxx
    I have my DAO classes that handles all CRUD operation. but within the DAO class I have two methods
    private <EntityClass> retrieveEntityFromObject(<EntityClassData> data) {}
    private <EntityClassData> retrieveEntityFromObject(<EntityClass> entity) {}so with these methods, I separate my business logic from my data layer. My codes will alway use data objects instead of entities. For example, a create method will be
    public ProductData createProduct(ProductData data)
         entity.persist(retrieveEntityFromObject(data));
    }I hope someone understands
    Regards

  • HttpServlet and concurrency

    Might be a very dumb question for those who has mastered this.
    How concurrent requests to httpServlet are handled? Can anyone point documentation on how Glassfish or Tomcat handles these requests.
    Is there only one instance serving all concurrent requests?
    We are considering to use HttpServlet along with url rewriting.
    For sure we are going to lock/synchronize access to shared resources, however from documentation it is not clear whether the call to doGet and doPost itself is safe for concurrent users or not?
    From documentation it "appears" (unless I missed something) there will only be one instance of HttpServlet which will serve all the requests, however somehow I cannot digest that.
    if possible we want to avoid single threaded servlet or synchronized doGet/doPost.
    If container is creating only one instance of HttpServlet, is there a way I can create pool of httpServlet instance and assign different instance to different concurrent users?
    Thanks in advance.

    Whenever any request comes to a servlet it executes in its own thread. This may only cause the problems when you have instance variables in your servlet, so avoinding instance variables in a servlets can resolve any threading issue.
    If you want more than one instance, then you can implment the SingleThreadModel in your servlet then the servlet constainer will decide whether it needs to create more than one instance to serve the request or not, it may not gurantee the creation of a new instance though.
    Sanjeev.

  • Lazy loading, EntityManager and concurrency.

    I need advice which strategy to use with lazy loading.
    My project is based on Spring, Struts 2 and Hibernate JPA. I have enough OneToMany and ManyToMany relationships and it's reasonable to use lazy loading. It seems very convenient to load data in Struts Actions with OpenEntityManagerInViewFilter in such way like:
    Style style = user.getStyle()
    But to avoid LazyLoadException I have to use:
    @PersistenceContext(type=PersistenceContextType.EXTENDED)
    Unfortunately, EntityManager in this case becomes not thread-safe, according to Spring docs: "+Extended EntityManagers are not thread-safe, hence they must not be used in concurrently accessed beans (which Spring-managed singletons usually are).+" EXTENDED means that EntityManager is shared in user session and my EntityManager is injected in singleton services.
    I've found this issue when tried to make quick sequential page reloading which call some selects and got:
    java.sql.SQLException: You can't operate on a closed Statement!!!
    What's the best practice in this situation:
    1. Try synchronize session access to EntityManager by myself or put each user database requests in separate queue (something terrible I suppose).
    2. Use HQL queries with join fetch to preload data for access outside of transaction (maybe overhead).
    3. Or something else???
    And why we need EXTENDED context if it's so unreliable??
    Thanks for help!

    Hi
    Do you have the link to the "lazy loading content"?
    I can't find a proper way to do it.
    Thanks

  • MDB topic listener and concurrent processing

    Hello to everybody.
    I ve prototyped simple db publisher ,which publishes changed data from database to JMS topic. Then I have my MDB which listens on JMS topic.
    I setup and implemented all correctly and it worked. There was 1 consumer = 1 mdb instance. Then I tried to do load testing , So I triggered 8000 changes from database. The db adapter did the job and published the 8000 messages on the JMS topic in a while. To mimic processing in MDB I put the sleep(10seconds) in MDB.
    MDB topic processing seems to me as not concurrent one. Why? I observed 10 message decrease with 5-10 seconds.
    What I expected was: concurrent processing of 8000 JMS messages by 1 MDB (so MDB is poolable component isnt it?).
    So for 500 instances of topic MDB and 8000 messages on the JMS topic, I expected at least 8000/500 X 10 = 160 seconds to process message load.
    I am using WLS 816.
    Can You give me some hits.
    Thanks
    Roman

    I did the same test on Weblogic 10 and it worked as expected. MDB durable subscriber consumed 8000 messages (each msg processing had 10 secs sleep inside.) within 2 minutes. So it is ok.
    But why it did not worked on WLS 8.1? Is this a bug ?

  • EP Performance Tunning and concurrent user login problems

    Hi all.
    We have a EP , integrated with Windows AD and SAP R3.
    In real situation, there will be 1000 users login in EP in 0.5 hours. And their operation time will be 6-8 hours, connect to R3 or other applications.
    Is EP can support such concurrent user login scenario ?
    if EP fails, is there some performance monitor tool or performance tunning issue ?

    Hi
    EP supports this logon load, however it all depends on sizing and architecture!  Also the content of the STARTPAGE can be critical (make it "light").
    If the portal fails, then often it is only one J2EE server process, which fails - so by having more server-processes will be an easy/minimum form of high availability.  A "real" HA solution must be considered if your business will not work without the portal og SAPGUI connections can be used as workaround/fallback in such situations.
    BR
    Tom Bo

  • Javabeans and concurrency

    Javabeans use instance variables that represent the bean's properties with
              getter and setter methods. Are the bean's properties thread safe?
              If I create a bean and store it in a session, can I assume when I do a
              getter/setter on the property that there will not be concurrency issues? (I
              realize that session objects have issues with frames but I can ignore that
              for now).
              Any examples I have seen of using javabeans with JSP's do not use
              single-threaded and do not synchronize access.
              thanks.
              

    Actually, we've just seen a case where a session scope bean
              was getting accessed concurrently by different threads, coming
              from a single browser window. We are using the Apache-Weblogic
              plugin, which at times will cause a failover retry on the same
              server on behalf of the same session, and so the same session
              scope bean will be used. Problem is, the failover retry should
              not have happened, since the server hadn't really failed, it was
              just taking a long time. This, I would think, is a bug in the
              Apache-Weblogic plugin mechanism.
              Anyway, the second retry attempt causes a new thread to
              assume the pre-existing session scope objects, which has
              to be a problem, in my book...
              Jason
              "WebLogic" <[email protected]> wrote in message
              news:[email protected]...
              > This is accurate except that in the session case, it is
              > really per set of browser windows. You can see concurrency
              > problems when more than one browser window is open
              > or when you use frames and share the JavaBeans in the
              > session.
              >
              > Sam
              >
              > "sumanth" <[email protected]> wrote in message
              > news:[email protected]...
              > > well it depends on the scope of the java bean.
              > > normally there are 3 sometimes 4 scope's for the beans
              > > page,request,session,application.
              > >
              > > the first 3 you will not run into any problem's as they
              > > are on a per page,per request,per user respectively.
              > > It is only when you use the bean as an application scope u
              > > should make sure that they do not have any instance variables ,
              > > if they have u should handle the synchronization.
              > >
              > > the above discussion is for beans.
              > >
              > > talking about jsp's in general...
              > > if you have any variables declared in the <%! %> (note the !)
              > > they are not thread safe as they are class variables. all jsp's by
              default
              > > DO NOT implement the singleThread Model (performance) but one can
              > > have thier jsp's implement the single thread model by having this
              > directive
              > > on the top of the page
              > > <%@page isThreadSafe="false" %>
              > >
              > > -Sumanth
              > > "JOG" <[email protected]> wrote in message
              > > news:[email protected]...
              > > > Javabeans use instance variables that represent the bean's properties
              > with
              > > > getter and setter methods. Are the bean's properties thread safe?
              > > > If I create a bean and store it in a session, can I assume when I do a
              > > > getter/setter on the property that there will not be concurrency
              issues?
              > > (I
              > > > realize that session objects have issues with frames but I can ignore
              > that
              > > > for now).
              > > >
              > > > Any examples I have seen of using javabeans with JSP's do not use
              > > > single-threaded and do not synchronize access.
              > > > thanks.
              > > >
              > > >
              > >
              >
              >
              

  • Headache with threads and concurrency

    I am trying to get my head round multithreaded concurrency in java and I am hitting some problems with a Log class I am working on. The idea is that the log has methods that write a line to a Notes document. A second thread should then save the document every five seconds. Because the logs are likely to be large, every 3000 lines the Log creates a new Notes document.
    I figured that the createNewPage and the saveDocument methods should be synchronised as attempting to write to a null document in another thread will cause a server panic. However when I modified the class to use synchonisation it hangs at 6000 lines - would someone be so kind as to cast a critical eye over the code and maybe give me some pointers on where I am going wrong?
    I thought I was beginning to understand concurrency but maybe not!
    Marc
    ====
    package com.keymed.java.utils;
    import java.util.Vector;
    import lotus.domino.*;
    import java.util.*;
    public class SimpleLog extends NotesThread {
         private final String RT_NAME = "Body";
         private final String STDT_NAME = "A$LOGTIME";
         private final String ENDDT_NAME = "A$LOGTIME_END";
         private final String ERRCODE_NAME = "A$ERRCODE";
         private final String ERRMSG_NAME = "A$ERRMSG";
         private final String TITLE_NAME = "A$PROGNAME";
         private final String USER_NAME = "A$USERNAME";
         private final String PAGE = "A$PAGE";
         private final int MAX_LINES = 3000;
         private Database logDb;
         private String logTitle;
         private Document logDoc;
         private RichTextItem rt;
         private int lineCount;
         private Vector logCollection = new Vector();
         private boolean logDocAvailable = false;
         private Session s;
         private boolean isPageAvailable;
         private boolean isLogOpen;
         public SimpleLog (String logServer, String logFileName, String logTitle) throws Exception{
         this.logTitle = logTitle;
         System.out.println(logServer + ":" + logFileName);
    logDb = ObjectFactory.getDatabase(logServer, logFileName);
    logDoc = initLogDoc();
    start();
         public void write(String msg) throws Exception{
    try{
         if (lineCount >= MAX_LINES){ createNewPage(); };
    rt.appendText(setDateToNow() + " - " + msg);
    rt.addNewLine();
    System.out.println(msg);
    lineCount++;
    } catch (NotesException ne){
    throw new Exception(ne.text);
         private synchronized void saveDocument() throws NotesException{
              try{
                   while (isPageAvailable == false){
                        System.out.println("saveDocument(): Waiting for page to be unlocked");
                        wait();
              } catch (InterruptedException e){};
              logDoc.save(true);
              isPageAvailable = false;
              notifyAll();          
         private synchronized void createNewPage() throws Exception{
              try{
                   while (isPageAvailable){
                        System.out.println("createNewPage(): Waiting for page to be unlocked");
                        wait();     
              } catch (InterruptedException e){};
              lineCount = 0;
    logDoc = initLogDoc();
    isPageAvailable = true;
    notifyAll();
         private Document initLogDoc() throws Exception{
         try{
         Document doc = logDb.createDocument();
         Item dtStart = doc.replaceItemValue(STDT_NAME, setDateToNow());
         Item title = doc.replaceItemValue(TITLE_NAME, logTitle);
         Item user = doc.replaceItemValue(USER_NAME, ObjectFactory.getSess().getUserName());
         rt = doc.createRichTextItem(RT_NAME);
         logCollection.addElement(doc);
         return doc;
         } catch (NotesException ne){
    throw new Exception(ne.text);
         private DateTime setDateToNow() throws NotesException{
         DateTime start = ObjectFactory.getSess().createDateTime("Today");
    start.setNow();
    return start;
         public void runNotes() throws NotesException{
              while (isLogOpen){ //loop round infinitely until log close method called
         saveDocument();
    try { sleep(5000); } catch (InterruptedException e){};
         public synchronized void close(){
         int pageCount = logCollection.size();
         isLogOpen = false;
         try{
                   while (isPageAvailable == false){
                        wait();     
              } catch (InterruptedException e){};      
         try {
    Item dtEnd = logDoc.replaceItemValue(ENDDT_NAME, setDateToNow()); //Set end date now log is complete
    logDoc.save(true);
    //since multiple log documents can be used, number them accordingly
    for(int i=0;i<pageCount;i++){
    Document currDoc = (Document)logCollection.elementAt(i);
    currDoc.replaceItemValue(PAGE, "" + (i+1) + " of " + pageCount + " pages.");
    currDoc.save(true);
    } catch (NotesException ne){
    System.out.println(ne.id + " " + ne.text);
    ne.printStackTrace();
    public void logError(String msg, int errCode, String stackTrace){
         try {
         Item errNum = logDoc.replaceItemValue(ERRCODE_NAME, "" + errCode);
    Item errMsg = logDoc.replaceItemValue(ERRMSG_NAME, msg);
    this.write(stackTrace);
         } catch (NotesException ne){
         System.out.println(ne.id + " " + ne.text);
    } catch (Exception ce){
         System.out.println("Could not write to log - " + ce.getMessage());

    Thanks for the response!
    I am using Websphere Studio Developer which is based on Eclipse, but not sure how to view the stack trace in debug. The code I am using to test the class is:
              for (int i=0;i<20000;i++){
                   log.write("Iteration " + i + " being written to the log");     
              log.close();It works fine if i = 6000 but fails when i = 20000 for instance. The console reports "createNewPage(): Waiting for page to be unlocked" as the last message.
    package com.keymed.java.utils;
    import java.util.Vector;
    import lotus.domino.*;
    import java.util.*;
    public class SimpleLog extends NotesThread {
         private final String RT_NAME = "Body";
         private final String STDT_NAME = "A$LOGTIME";
         private final String ENDDT_NAME = "A$LOGTIME_END";
         private final String ERRCODE_NAME = "A$ERRCODE";
         private final String ERRMSG_NAME = "A$ERRMSG";
         private final String TITLE_NAME = "A$PROGNAME";
         private final String USER_NAME = "A$USERNAME";
         private final String PAGE = "A$PAGE";
         private final int MAX_LINES = 3000;
         private Database logDb;
         private String logTitle;
         private Document logDoc;
         private RichTextItem rt;
         private int lineCount;
         private Vector logCollection = new Vector();
         private boolean logDocAvailable = false;
         private Session s;
         private boolean isPageAvailable;
         private boolean isLogOpen;
         public SimpleLog (String logServer, String logFileName, String logTitle) throws Exception{
             this.logTitle = logTitle;
             System.out.println(logServer + ":" + logFileName);
             s = ObjectFactory.getSess();
            logDb = ObjectFactory.getDatabase(logServer, logFileName);
            logDoc = initLogDoc();
            start();
         public SimpleLog (String logServer, String logFileName, String logTitle, Session s) throws Exception{
             this.logTitle = logTitle;
             System.out.println(logServer + ":" + logFileName);
             this.s = s;
            logDb = s.getDatabase(logServer, logFileName);
            logDoc = initLogDoc();
            start();
         public void write(String msg) throws Exception{
            try{
                 if (lineCount >= MAX_LINES){ createNewPage(); };
                rt.appendText(setDateToNow() + " - " + msg);
                rt.addNewLine();
                System.out.println(msg);
                lineCount++;
            } catch (NotesException ne){
                throw new Exception(ne.text);
         private synchronized void saveDocument() throws NotesException{
              try{
                   while (isPageAvailable == false){
                        System.out.println("saveDocument(): Waiting for page to be unlocked");
                        wait();
              } catch (InterruptedException e){};
              logDoc.save(true);
              isPageAvailable = false;
              notifyAll();          
         private synchronized void createNewPage() throws Exception{
              try{
                   while (isPageAvailable){
                        System.out.println("createNewPage(): Waiting for page to be unlocked");
                        wait();     
              } catch (InterruptedException e){};
              lineCount = 0;
            logDoc = initLogDoc();
            isPageAvailable = true;
            notifyAll();
         private Document initLogDoc() throws Exception{
             try{
                 Document doc = logDb.createDocument();
                    Item dtStart = doc.replaceItemValue(STDT_NAME, setDateToNow());
                    Item title = doc.replaceItemValue(TITLE_NAME, logTitle);
                    Item user = doc.replaceItemValue(USER_NAME, s.getUserName());
                    rt = doc.createRichTextItem(RT_NAME);
                    logCollection.addElement(doc);
                    return doc;
               } catch (NotesException ne){
               throw new Exception(ne.text);
         private DateTime setDateToNow() throws NotesException{
             DateTime start = s.createDateTime("Today");
            start.setNow();
            return start;
         public void runNotes() throws NotesException{
              while (isLogOpen){ //loop round infinitely until log close method called
                    saveDocument();
                try { sleep(5000); } catch (InterruptedException e){};
         public synchronized void close(){
             int pageCount = logCollection.size();
             isLogOpen = false;
             try{
                   while (isPageAvailable == false){
                        wait();     
              } catch (InterruptedException e){};         
             try {
                   Item dtEnd = logDoc.replaceItemValue(ENDDT_NAME, setDateToNow()); //Set end date now log is complete
                   logDoc.save(true);
                   //since multiple log documents can be used, number them accordingly
                   for(int i=0;i<pageCount;i++){
                        Document currDoc = (Document)logCollection.elementAt(i);
                        currDoc.replaceItemValue(PAGE, "" + (i+1) + " of " + pageCount + " pages.");
                        currDoc.save(true);
              } catch (NotesException ne){
                   System.out.println(ne.id + " " + ne.text);
                   ne.printStackTrace();
         public void logError(String msg, int errCode, String stackTrace){
              try {
                 Item errNum = logDoc.replaceItemValue(ERRCODE_NAME, "" + errCode);
                Item errMsg = logDoc.replaceItemValue(ERRMSG_NAME, msg);
                this.write(stackTrace);
                } catch (NotesException ne){
                 System.out.println(ne.id + " " + ne.text);
            } catch (Exception ce){
                 System.out.println("Could not write to log - " + ce.getMessage());
    }

  • Re-entrant Lock and concurrency manager

    Has anyone ported concurrency manager to use Re-entrant locks (jdk 1.5 constructs), would like to hear your experience.
    thanks

    Hello,
    I'm not sure what you mean. The ConcurrencyManager is designed so that it is never waiting for a lock it already holds. If it is waiting for a lock, it is because another thread is holding it, presumably because it is building the object associated to the cache key. What version are you using, and what is the lock waiting for? Using printIdentityMapLocks on the identitymapAccessor will show the locks involved on the associated session.
    Best Regards,
    Chris

  • How to create a thread safe and concurrent form that updates data to database.

    Hi ,
    I am creating an application which will store information from 4 or 5 text boxes in the database.
    At the same instance of time atleast 300 users will be trying to update to the  database.
    That is trying to execute the same code.
    I am worried if there will be any issue of object lockign or my page giving some error or performance issue.
    How can I solve this issue.
    Regards
    Vinod

    SQL Server manages simultaneous access to data itself, when it comes to executing a single query. It locks/unlocks tables/records automatically. So, if you are using a single UPDATE, INSERT or DELETE command, usually you won't need anything to take care
    of synchronization, but a problem named "Concurrency issue" which I explained a little ahead.
    However, if you are updating more than one table, you must use transactions, so that your changes are applied atomically. This can be done both in database level in T-SQL and also in application level in C#, VB, etc.
    In T-SQL you want to use BEGIN TRAN, COMMIT TRAN, ROLLBACK TRAN commands and in C# you want to use TransactionScope.
    You should pay attention that, transactions indeed have a hit on the performance of your database. But using them is indispensable. To prevent performance degradation, you have to tune your database and queries which itself is another big topic.
    One thing that is more important is a problem known as concurrency issue.
    If more than one user tries to update a single record, each one might overwrite the update of another user without being even notified of this. Suppose user A and B both try to update a record. They are not aware of each other working with the application.
    They open a record in edit mode in the application. Edit it and then click the "Save" button. When the application saves the record with the data provided by each user, one data will be lost definitely. Because it will be overwritten with the data
    another user has provided and his Save command, executes later than the first user.
    There are multiple ways to avoid concurrency issue. One of them is using Timestamp (old method) and RowVersion (newer method) column in a table. They can help you detect a change in a record since its last time read. But they are unable to detect what column
    or columns are changed.
    You can get better answers for this if you ask a solution for concurrency issue in a SQL Server forum.
    Regards
    Mansoor

Maybe you are looking for