Lock and wait free data structures...???

Hi - I am developing an application that requires multi-threading. We are testing this on CentOS 5, 64 BIT, running on Intel Quad Core machines, with 8 GB RAM (3 of them). I am using a III party tool to create a datagrid, and have 2 more machines in the federation to monitor performance.
Java collections/synchronized collections has restriction on multithreading. If thread1 performs puts or removes objects in collection (Tree, Map, List, Set), thread2 cannot iterate. Thread2 can iterate only if it acquires synchronized lock on collection – this implies thread1 has to wait till iteration is over. This introduces latency. If without acquiring lock thread2 does iteration, then “concurrent modification thread exception” arises.
For real time application like financial markets (multiple thread based application) every microsecond/millisecond matters.
For workaround at present we have customized sun code by masking “modCount and expectedCount”. This means check for concurrent modification is disabled. But not quite sure this is correct approach. Other option was multiple buffering.
Other option is lock and waits free data structures – which I am interested.
Any ideas on this???
cheers - Murali

It depends on what is acceptable to you.
If you are only iterating and not removing any objects through the iterator, then there are two concerns;
1. Iterator skips some elements.
2. Iterator iterates to non-existent elements causing NPE.
You can also copy the datastructure. Then iterate over the copy.
You can also do "copy on write." This causes a copy only when the datastructure is modified and those iterators already created are not affected. This is the technique I use.
Eliminating locks is not the objective. Locking is very quick. Its the contention that you want to eliminate. COW can do this nicely in my experience. Depends on your requirements.
P.S. Try assigning duke dollars to the question and you will probably get more viewers.

Similar Messages

  • T-mobile Iphone is LOCKED and Contract Free.

    I am looking at buying an iphone online from apple for my wife but there is a lot of confusion on the Communities as to whether the Iphone with a Tmobile SIM is unlocked or not.  I spoke with Customer service and they informed me that the Iphone with a T-mobile SIM is "unlocked in that it is contract free"  I asked her point blank if the Tmobile Iphone could be used with a SIM card from another carrier and she said it could not.  She did tell me that I could use the unlocked Iphone on Tmobiles network I would just have to purchase a T-mobile SIM to use with it.  This means that the Iphone which ships with a T-mobile SIM is Contract Free and LOCKED to T-mobile.  I would recommend that Apple change the wording on their website and sell the T-mobile Iphone for what it really is: Locked and Contract free.  A truly unlocked phone is not tied to one network.

    I just got my wife a 5s, unlocked, with a T-Mobile SIM from Apple.  When it arrived, I activated it on T-Mobile ($50/month plan, no contract) and it worked fine.  Yesterday I went to the AT&T store and got a free AT&T SIM, removed the T-Mobile SIM, and activated it on AT&T ($60/month plan)(month-to-month, no contract).  I want to compare coverage and reception.  It works fine on AT&T, so I can tell you for 100% certain that the iPhone I bought was not locked on T-Mobile.  I have no reason to believe that when I put the T-Mobile SIM back in that it won't work just fine on T-Mobile.
    I did a lot of research before buying and without exception, everyone told me that if I got it from Apple, unlocked, with a T-Mobile SIM, that it would work fine with other carriers.  It does!

  • Concurrency with locks and wait/signal. Is it ok?

    Hello,
    I'm relatively new in concurrency. I've write this code that seems to work, but I'm not sure if there is any error (the concurrency concepts are not still clear for me).
    In the following class "diskFile", I'll start 10 threads executing the class "diskCacheDataOneCall". The question is that the "populateCacheFromDisk" method should wait until 10 threads are finished and, if any thread produces an error, interrupt all threads and finish.
    The code seems to work, but I have some questions like if I should synchronize the static variables Lock and Condition before using them.
    Anyway, I'd like that an "expert" on concurrency tells me if this code is acceptable, or what kind of improvements can do (or, if there is some mistake, how to correct it).
    I've spent many time reading tutorials about concurrency, and this is the result. Really, I'm not sure if I'm doing the things well, that's why I need the opinion of an expert in order to get better on concurrency.
    Thanks in advance.
    public class diskFile
    // Static variables for threading.
    public static Lock lock = null;
    public static Condition cdFinished = null;
    public static int numActiveThreads = 0;
    public static Exception loadException = null;
    // Main function
    public static void populateCacheFromDisk() throws cacheServletException
    ArrayList<Thread> arrThread = new ArrayList<Thread>();
    // Init static variables.
    lock      = new ReentrantLock();
    cdFinished      = lock.newCondition();     
    numActiveThreads = 0;
    loadException = null;
    try
    // Iterate 10 times (for simplicity) ...
    for (int i = 0; i < 10; i++)
    // Create THREAD and store its reference
    Thread thr = new Thread(new diskCacheDataOneCall());
    thr.start();
    arrThread.add(thr);
    // Increment "numActiveThreads"
    lock.lock();
    numActiveThreads++;
    lock.unlock();
    // Her we wait while no error happens and still active threads
    lock.lock();
    while ( (loadException == null) && (numActiveThreads > 0) )
    cdFinished.await();
    // If an error happens in any thread, then interrupt every active thread.
    if (loadException != null)
    for (int i = 0; i < arrThread.size(); i++)
    Thread thr = arrThread.get(i);
    if (thr.isAlive()) thr.interrupt();
    throw loadException;
    catch (Exception e) { throw new cacheServletException(); }
    finally { lock.unlock(); }
    public class diskCacheDataOneCall implements Runnable
    public diskCacheDataOneCall() {}     
    public void run()
    try
         diskFile.getCacheDataFromDiskOneCall(); // Load data from disk.
    // Decrement "numActiveThreads"
         diskFile.lock.lock();
         diskFile.numActiveThreads--;
    catch (Exception e)
    diskFile.lock.lock();
    diskFile.loadException = e;
    finally
    // Always signal and unlock.
    diskFile.cdFinished.signal();
    diskFile.lock.unlock();
    }

    Hello David,
    Sorry but the code does not work. An IllegalMonitorStateException is throwed. Here I show you a simplified version (now with ThreadPoolExecutor):
       // Main class (it triggers "maxActive" threads)
       Lock lock  = new ReentrantLock();
       Condition cdFinished = lock.newCondition();       
       numActiveThreads = 0;
       loadException = null;
       try
        ExecutorService ex = Executors.newFixedThreadPool(numActiveThreads);
        for (int i = 0; i < numActiveThreads; i++) ex.execute(arrTasks.get(i));
        lock.lock();
        while ( (loadException == null) && (numActiveThreads > 0) )
                   cdFinished.await();
        ex.shutdown();
       catch (Exception e) { throw e; }
       finally { lock.unlock(); }
      // Every thread.
      public void run()
       try
        doSomething();
        diskFile.lock.lock();
        diskFile.numActiveThreads--;
       catch (Exception e)
        diskFile.lock.lock();
        diskFile.loadException = cse;
       finally
        diskFile.cdFinished.signal();
        diskFile.lock.unlock();
      }The exception is:
    // Fail in the "signal" (finally section)
    Exception in thread "pool-1-thread-1" java.lang.IllegalMonitorStateException
    at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.signal(AbstractQueuedSynchronizer.java:1666)
    at com.vcfw.cache.cache.disk.diskCacheDataOneCall.run(diskCacheDataOneCall.java:44)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
    at java.lang.Thread.run(Thread.java:595)
    // Fail in the "unlock" (finally section)
    Exception in thread "pool-1-thread-2" java.lang.IllegalMonitorStateException
    at java.util.concurrent.locks.ReentrantLock$Sync.tryRelease(ReentrantLock.java:125)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer.release(AbstractQueuedSynchronizer.java:1102)
    at java.util.concurrent.locks.ReentrantLock.unlock(ReentrantLock.java:431)
    at com.vcfw.cache.cache.disk.diskCacheDataOneCall.run(diskCacheDataOneCall.java:43)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
    at java.lang.Thread.run(Thread.java:595)
    Some threads fail executing the signal, and some threads fail executing ythe unlock. An IllegalMonitorStateException seems to mean that the lock was not acquired by the thread, but I'm not able to see the mistake.
    Can you help me?
    Thanks.

  • Bit shifting tricks and speeding up data structure

    I'm pretty new to working directly with bits, but it is a lot of fun. I'm converting a javascript data structure to Flash.
    So I'm thinking that Math.floor(uint/32) is the same as uint >> 5, right?
    And that uint % 32 is the same as uint & 31 ? Evidently this works for modulos that are powers of 2, what a cool trick.
    Using both of those cut the time needed for storing and retrieving data about in half.
    But it is still takes about three times longer that just using the native Object. This is in reference to my previous post http://forums.adobe.com/message/5001353#5001353 but that didn't get very far.
    So if anybody has any suggestions on how else to speed this up it would be very helpful:
    package {
              public class BloomFilter {
                        private var _m:uint;
                        private var _k:int;
                        private var _locations:Vector.<uint>;
                        public var _buckets:Vector.<uint>;
                        public function BloomFilter(m:uint,k:int) {
                                  _m=m;
                                  _k=k;
                                  _locations=new Vector.<uint>  ;
                                  _buckets=new Vector.<uint>  ;
                                  var n:uint=Math.ceil(m/32);
                                  var i:int=-1;
                                  while (++i<n) {
                                            _buckets[i]=0;
                        private function hash(v:String) {
                                  var i:int=-1;
                                  var X:uint;
                                  var a,b:uint;
                                  a=fnv_1a(v);
                                  b=fnv_1a_b(a);
                                  X=a%_m;
                                  while (++i<_k) {
                                            _locations[i]=X<0? (X+_m) : X;
                                            X=(X+b)%_m;
                        public function add(v:String) {
                                  hash(v);
                                  var i:int=-1;
                                  while (++i<_k) {
                                            _buckets[_locations[i]>>5]|=1<<(_locations[i]&31);
                        public function test(v:String):Boolean {
                                  hash(v);
                                  var i:int=-1;
                                  var b:uint;
                                  while (++i<_k) {
                                            b=_locations[i];
                                             if ((_buckets[b>>5] & (1 << (b&31))) === 0) {
                                                      return false;
                                  return true;
                        // Fowler-Noll-Vo hash
                        private function fnv_1a(v:String):uint {
                                  var n:int=v.length;
                                  var a:uint=2166136261;
                                  var c,d:uint;
                                  var i:int=-1;
                                  while (++i<n) {
                                            c=v.charCodeAt(i);
                                            if (d=c&0xff000000) {
                                                      a^=d>>24;
                                                      a+=(a<<1) + (a<<4) + (a<<7) + (a<<8)+ (a<<24);
                                            if (d=c&0xff0000) {
                                                      a^=d>>16;
                                                      a+=(a<<1) + (a<<4) + (a<<7) + (a<<8)+ (a<<24);
                                            if (d=c&0xff00) {
                                                      a^=d>>8;
                                                      a+=(a<<1) + (a<<4) + (a<<7) + (a<<8)+ (a<<24);
                                            a^=c&0xff;
                                            a+=(a<<1) + (a<<4) + (a<<7) + (a<<8)+ (a<<24);
                                  a+=a<<13;
                                  a^=a>>7;
                                  a+=a<<3;
                                  a^=a>>17;
                                  a+=a<<5;
                                  return a&0xffffffff;
                        // One additional iteration of FNV
                        private function fnv_1a_b(a:uint):uint {
                                  a+=(a<<1) + (a<<4) + (a<<7) + (a<<8)+ (a<<24);
                                  a+=a<<13;
                                  a^=a>>7;
                                  a+=a<<3;
                                  a^=a>>17;
                                  a+=a<<5;
                                  return a&0xffffffff;

    the math shortcuts, as mentioned above, have a greater benefit.  (and thanks.  yes, that's from a book i wrote,
    Flash Game Development: In A Social, Mobile and 3D World
    Math Class Shortcuts
    These methods actually do provide a benefit and that benefit can be significant even without needing millions of operations to realize. They are listed in alphabetical order starting with Math.abs. (See support files/Chapter 07/math_class/Math.abs_v_conditional.fla, support files/Chapter 07/math_class/Math.floor_v_int.fla etc.)
    Math.abs
    Using
    x = (y<0) ? -y: y;
    instead of
    x = Math.abs(y)
    is about twice as fast. Unless you are using millions of Math.abs operations, you should not expect a noticeable benefit from using the inline code. In addition, the inline code is cumbersome.
    var xx:int;
    var n:int = 10000000;
    var n2:int = n/2;
    var i:int;
    var startTime:int = getTimer();
    //// Math.abs duration: 1016
    for(i=0;i<n;i++){
           xx = Math.abs(n2-i);
    trace("Math.abs duration:",getTimer()-startTime);
    // conditional duration: 445
    startTime = getTimer();
    for(i=0;i<n;i++){
            xx = (n2-i<0) ? i-n2 : n2-i;
    trace("conditional duration:",getTimer()-startTime);
    Math.ceil and Math.floor
    Using
    x = int(y);
    Instead of
    x = Math.floor(y); // y>=0
    x = Math.ceil(y); // y<=0
    Is about twice as fast. Unless you are using millions of Math.floor operations (with non-negative numbers), you should not expect a noticeable benefit.
    var i:int;
    var n:int = 10000000;
    var xx:int;
    var startTime:int = getTimer();
    // Math.floor duration: 1105
    for(i=0;i<n;i++){
           xx = Math.floor(i/n);
    trace("Math.floor duration:",getTimer()-startTime);
    // int duration: 479
    startTime = getTimer();
    for(i=0;i<n;i++){
           xx = int(i/n);
    trace("int duration:",getTimer()-startTime);
    Math.max
    Using
    x = (i>j) ? i : j;
    instead of
    x = Math.max(i,j);
    is about twice as fast.
    This shortcut is also cumbersome but has the greatest benefit (along with Math.min) of all those listed in this section. Notice the difference in time required to execute the code blocks and how few iterations are needed to demonstrate that difference.
    var xx:int;
    var n:int = 1000;
    var i:int;
    var j:int;
    var startTime:int;
    // Math.max duration: 109
    startTime = getTimer();
    for(i=n-1;i>=0;i--){
           for(j=n-1;j>-0;j--){
                  xx = Math.max(i,j);
    trace("Math.max duration:",getTimer()-startTime);
    // conditional duration 43
    startTime = getTimer();
    for(i=n-1;i>=0;i--){
           for(j=n-1;j>-0;j--){
                   xx = (i>j) ? i : j;
    trace("conditional duration",getTimer()-startTime);
    Math.min
    Using
    x = (i<j) ? i : j;
    instead of
    x = Math.min(i,j);
    is about twice as fast.
    This shortcut is also cumbersome but has the greatest benefit (along with Math.max) of all those listed in this section. Notice the difference in time required to execute the code blocks and how few iterations are needed to demonstrate that difference.
    var xx:int;
    var n:int = 1000;
    var i:int;
    var j:int;
    var startTime:int;
    // Duration Math.min 121
    startTime = getTimer();
    for(i=0;i<n;i++){
           for(j=0;j<n;j++){
                  xx = Math.min(i,j);
    trace("Duration Math.min",getTimer()-startTime);
    // Duration conditional 43
    startTime = getTimer();
    for(i=0;i<n;i++){
           for(j=0;j<n;j++){
                   xx = (i<j) ? i : j;
    trace("Duration conditional",getTimer()-startTime);
    Math.pow
    It is two to three times faster to explicitly multiply a number variable compared to using Math.pow. That benefit even extends a little beyond integer exponents because Math.sqrt(i) is about twice as fast as Math.pow(i,.5).
    var i:int;
    var n:int = 10000000;
    var xx:int;
    var startTime:int;
    // exp .5: 2020, exp 2: 1533, exp 3: 1617, exp 4: 1427, exp 5: 1381, exp 10: 1391
    startTime = getTimer();
    for(i=0;i<n;i++){
           xx = Math.pow(i,.5);
    trace("Duration Math.pow",getTimer()-startTime);
    // exp .5: 1064, exp 2: 427, exp 3: 778, exp 4: 557, exp 5: 501, exp 10: 586
    startTime = getTimer();
    for(i=0;i<n;i++){
           xx = Math.sqrt(i);
    trace("Duration iteration",getTimer()-startTime);

  • How can I set the Lock Model and data structure ?

    Hi ,
    I just have two questions about JE:
    1) Is there some method for me to set the lock mode level , such as record lock, page lock and database lock in JE?
    2) I learned that there are Btree and Hash,etc , data structures , How can I set the data structure when using JE ?
    Thanks in advance !
    Chris

    I think you're confusing our DB (C-based product) with JE. JE does not have lock mode levels, page locks (it does not have pages), or database locks. JE only has the BTREE method, it does not have the HASH method. For JE, please be sure to reference the JE doc page:
    http://www.oracle.com/technology/documentation/berkeley-db/je/index.html
    --mark                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Relationship between Dynamic Memory Heap and Heap Data Structure

    This question is not strictly related to Java, but rather to programming in general, and I tend to get better answers from this community than any where else.
    Somehow, my school and industry experience have somehow not given me the opportunity to explore and understand heaps (the data structure), so I'm investigating them now, and in particular, I've been looking at applications. I know they can be used for priority queues, heap sorts, and shortest path searches. However, I would have thought that, obviously, there must be some sort of relationship between the heap data structure, and the dynamic memory heap. Otherwise, I can think of no good reason why the dynamic memory heap would be named "heap". Surprisingly, after searching the web for 90 minutes or so, I've seen vague references, but nothing conclusive (trouble seems to be that it's hard to get Google to understand that I'm using the word "heap" in two different contexts, and similarly, it would not likely understand that web authors would use the word in two different contexts).
    The Java Virtual Machine Spec is silent on the subject, as "The Java virtual machine assumes no particular type of automatic storage management system, and the storage management technique may be chosen according to the implementor's system requirements."
    I've seen things like:
    [of dynamic memory] "All the blocks of a particular size are kept in a sorted linked list or tree (I extrapolate that sorted tree could imply heap)"
    [of dynamic memory] "The free and reserved areas of memory are maintained in a data structure similar to binary trees called a heap"
    [of dynamic memory] "This is not related to the heap data structure"
    [of dynamic memory] "Not to be confused with the data structure known as a "heap"
    [of data structure] "Not to be confused with the dynamic memory pool, often known as TheHeap"
    At this point, I've come to surmise that some (but not all) memory management algorithms use heaps to track which (pages? blocks? bytes?) of memory are used, and which are not. However, the point of a heap is to store data so that the max (or min) key is at the root of the heap. But we might want to allocate memory of different sizes at different times, so it wouldn't make sense to key on the amount of available memory in a particular region of the free store.
    I must assume then that there would be a different heap maintained for each size of memory block that can be allocated, and the key must have something to do with the attractiveness of the particular memory block in the heap (perhaps the lowest address, resulting, hopefully, in growing the free store space less often, leaving more space for the stack to grow, or perhaps keyed based on the fragmentation, to hopefully result in less fragmentation, and therefore more efficient use of the memory space, or perhaps based on page boundaries, keeping as much data in the same page as possible, etc).
    So at this point, I have a few questions I've been unable to resolve completely:
    1. Am I correct that the heap was so named because (perhaps at one point in time), a heap is/was commonly used to track the available memory in the free store?
    2. If so, would it be correct that there would be a heap per standard block size?
    3. Also, at what level of granularity would a heap typically be used (memory page, memory blocks, individual words (4-bytes))?
    4. What would be the most likely property one would use as a key. That is, what makes the root item on the heap ideal?
    5. Would a industrial strength system like the jvm use a (perhaps modified or tuned) heap for this sort of task, or would this typically be too naive for an real world solution today?
    Any insight would be awesome!
    Thanks,
    A.

    jschell wrote:
    I think you are not only mixing terms but domains.
    For starters the OS allocs memory. Applications, regardless of language, request memory from the OS and use it in various ways.
    There are many variations of the term "heap" like the following.
    [http://en.wikipedia.org/wiki/Heap_(data_structure)]
    [http://en.wikipedia.org/wiki/Dynamic_memory_allocation]
    A java VM will request memory from the OS (from a 'heap') and use it in its application 'heap' (C/C++) and then create the Java 'heap'. There can be variations of that along the way that can and likely will include variations of how each heap is used, potentially code that creates its own heap, and potentially other allocators which use something which is not a heap.This last part, I find a bit confusing. By "use something which is not a heap", do you mean the heap data structure, or the dynamic memory pool meaning of heap? If the former, then you would be implying that it would be common for a heap data structure to be used to manage the heap dynamic memory pool. If the latter, what would this "something which is not a heap" be? The best definition of "heap" I've found simply states that it is a pool of memory that can be dynamically allocated. If there is some other way of allocating dynamic memory, then it would suggest that the previous definition of "heap" is incomplete.
    >
    So to terms.
    1. Am I correct that the heap was so named because (perhaps at one point in time), a heap is/was commonly used to track the available memory in the free store?Which 'heap'? The VM one? It is probably named that because the implementors of the Sun VM were familar with how C++ and Smalltalk allocated memory.Okay, but that begs the question, was the heap in C++ and/or Smalltalk so named for the above queried reason?
    >
    2. If so, would it be correct that there would be a heap per standard block size?Not sure what you are referring to but probably a detail of the implementation. And since there are different levels the question doesn't mean much.
    However OS allocations are always by block if that helps. After that it requires making the question much, much more specific.
    3. Also, at what level of granularity would a heap typically be used (memory page, memory blocks, individual words (4-bytes))?Again not specific enough. A typical standard implementation of heap could not be at the word level. And it is unlikely, but not impossible, that variations would support word size allocations.
    The VM heap might use word boundaries (but not size), where the application heap certainly does (word boundary.)My understanding of it is that the application would request blocks from the OS, and then something like malloc would manage the memory within the allocated blocks. malloc (or whatever equivalent Java uses) would have to keep track of the memory it has allocated somehow, and I would think it would have to do this at the word level, since it's most commonly going to allocate memory at the word level to be references to other objects, etc.
    So I guess my question here would really be, if the dynamic memory heap is so named because there has been a memory management strategy that relied upon a heap data structure (which I've found no proof, but have found some suggestive literature), then would that probably have applied at the OS Page Fault level, tracking allocated blocks, or would that have applied at the malloc level, allocating individual words as necessary?
    >
    4. What would be the most likely property one would use as a key. That is, what makes the root item on the heap ideal?"Key" is not a term that will apply in this discussion.
    You appear to be referring to strategies for effective allocation of memory such as allocations from different regions by size comparison.
    It is possible that all levels might use such an allocator. General purpose applications do not sort allocations though (as per your one reference that mentions 'key'.) Sorry, I got the term "key" from an article I read regarding heaps, that indicates that a "key" is used to sort the elements, which I guess would be a more generalized way to make a heap than assuming a natural ordering on the elements in the heap. I'm not sure if the terminology is standard.
    >
    5. Would a industrial strength system like the jvm use a (perhaps modified or tuned) heap for this sort of task, or would this typically be too naive for an real world solution today?Again too indefinite. The Sun VM uses a rather complicated allocator, the model for which originated after years of proceeding research certainly in Smalltalk and in Lisp as well, both commercially and academically.
    I am sure the default is rules driven either explicitly or implicitly as well. So it is self tuning.
    There are command line options that allow you to change how it works as well.I guess perhaps I could attempt to clarify my initial question a bit.
    There is a 1:1 correspondence between the runtime stack, and a stack data structure. That is, when you call a function, it pushes a stack frame onto the runtime stack. When you return from a function, it pops a stack frame from the runtime stack. This is almost certainly the reasons the runtime stack is named as it is.
    The question is, is there or has there ever been a 1:1 correspondence between some aspect of the dynamic memory heap or how it is managed, and a heap data structure? If so, it would explain the name, but I'm a bit puzzled as to how a heap data structure would be of assistance in creating or managing the dynamic memory heap. If not, on the other hand, then does anybody know where the name "heap" came from, as it applies to the dynamic memory pool?
    A.

  • Essbase - Is there a way to tell who locked and sent a certain data point?

    Hi Experts!
    Is there a way in Essbase (ie. query log) that can tell the administrators who locked and sent a certain data point? Example, who was the last person who loaded the Plan for Revenues for January 2010 for the Northeast location.
    Thank you!

    user9952742 wrote:
    I was able to successfully see the 2 files (.atx and .alg) via SSAUDIT. However, is there a way where we can see the user, time he locked and sent the data, combined with the data he locked and sent? Those files are separated so you can't really see by whom and when the data was sent. In Dodeca, we evaluate the send operations on our server and store an audit log in a relational database so you can see the user, workstation, date, server, application, database, old value and new value, along with the datapoint information, very easily. I can show you that functionality in a webcast.
    http://www.appliedolap.com/products/dodeca
    Tim Tow
    Applied OLAP, Inc

  • Lock and semaphore, what's better method for my case

    Hi all,
    I'm implementing a classic case: a consumption queue with infinite capacity. That's say I have a queue of infinity capacity, a thread to put objects into the queue, another thread take it out. Pseudo code is smth like below:
    void put(Object o) {
    put message into the queue
    if (consume thread is waiting) {
    lock();
    signal();
    unlock();
    void eat() {
    if (queue not empty)
    take object out;
    else
    lock;
    wait for signal from producer;
    wake up and take object out;
    unlock;
    I don't know if I should use semaphore or Lock interface to get the job done. Do you know which one is better in my case? I'm writing an apps which is very sensitive in latency so basically I want the eater to get the object as soon as possible. Any advices?
    Message was edited by:
    principles

    Blocking queue doesn't work for me as it is too slow.
    I don't need to lock the data because one thread
    adds too the tail, one thread consumes the head, so
    why bother?LinkedBlockingQueue allows concurrent access to the head and tail ie it uses two different locks.
    A Lock is a mechanism for mutual exclusion. It generally has a notion of ownership and so the thread that locks must be the thread that unlocks.
    A Semaphore is a resource counter. There are no constraints on which thread signals() after await(). It is only a protocol that you establish in your code that allows it to be used for exclusion.
    A bounded-buffer generally needs two synchronization aids:
    a) an exclusion control to ensure the data structure is not corrupted by concurrent access
    b) a coordination control to allow consumers to block when the buffer is empty, or producers to block when the buffer is full.
    These two can be combined by using "synchronized" methods and wait/notify. Or by using Lock and associated Condition objects. Or you can use "synchronized" blocks or Lock for exclusion, and handle the coordination using a seperate semaphore (which must use some form of internal synchronization too - but perhaps more efficient.)
    If you have a lock-free data structure, such as ConcurrentLinkedQueue then you don't need anything for (a) and so you only need coordination. So try using a Semaphore: put() increments it and take() decrements it.
    But the Semaphore still becomes a serialization point in your code.

  • Waiting for data on a socket

    If I perform a wait() on while locking a Socket object will this halt my thread until data arrives at the socket? If not, how can I halt my thread and wait for data to arrive at the socket?
    Thanks.

    Unfortunately, chuanhaochiu is quite right: read/write operations are blocking the socket's thread.
    The inputStream.read(buffer) or inputStream.read() method return after filling the buffer and respectively after reading one character and meanwhile the thread is blocked. If there is no network activity, the read method will return after a timeout set with the SO_TIMEOUT constant value.
    So if your code looks smth like:
    while (len = inputStream.read(buffer) > -1)
       ... do something with the len bytes read from buffer
    }the thread will keep staying in this loop. (Also try enclosing it in a try - catch block)

  • CRMXIF_ORDER_SAVE Data structure information

    The BAPI CRMXIF_ORDER_SAVE has one input Parameter of type CRMXIF_BUSTRANS. This paramter is quite a complex data structure made upof many data structures; which themselves are complex and contain more data structures.
    I am a first time user of this BAPI and I calling this BAPI (exposed as an RFC web service) via .net 2.0. I am not able to find an documentation for this BAPI and it data structures. I am looking for an explanation of the data structures and what and how they relate to/in SAP.
    Where can I find such information.
    Any help is appreciated.
    -Jawahar

    hi Jawahar,
    how are you doing ?
    here is a discussion on sdn on the same bapi
    CRMXIF_ORDER_SAVE to create orders
    i am not aware of the internal data structure, but am interested to know the results you get, please update the thread when possible
    with respect,
    amit

  • Source and destination are deep structures.. can't seem to map the detail table

    So, both my source data structure and my destination structure are very similarly built:
    They both have a HEADER and BODY component. The HEADER has the standard AIF fields (MSGGUID, NS, IFNAME, IFVER).
    I have defined the BODY as a deep structure composed of a Header Structure + a Detail Table. Each row in the BODY has a structure with a few header fields, then a table of detail data attached to it.
    In my Structure Mappings, I've created 2 rows:
    The first to map BODY-HEADER to my header structure.
    The second to map BODY-DETAILS to my details table. Here, I've chosen "Indirect Mapping".
    Selecting that row and navigating to "Define Field Mappings", I choose my destination table (DTL) and enter the Sub-table from my source structure.
    At this point, I only have 1 action - to save the data in Ztables. I'm seeing that the header data is passed in fine. But there aren't any detail lines coming through.
    Any ideas?
    thanks alot.
    RP.

    Christoph,
    In your reply, I only have the ability to perform the First Structure Mapping (please see the below screenshots):
    Source Structure; BODY
    Destination Structure: BODY
    Field Mapping:
    1. Field in Dest.Struc=HDR, Sub-Table = SCH_HEADER
    2. Field in Dest.Struc=DTL,  Sub Table = SCH_DETAILS
    I presume I'm following your suggestion, but when I try to create the other two structure mappings, I only have HEADER or BODY as available options to choose from: I've attached screenshots of the F4 dropdown of the Source Structure and also the Destination Structure fields.
    I believe this is because my Interface Definition is defined as a HEADER and BODY:
    Source Data Structure
    Destination Data Structure

  • Dynamic subject based on data structure (JD Edwards)

    In JD EDwards TR 8.98.3.0 it should be possible to create a dynamic email subject based on a data structure that is connected to a report definition. I have managed to create the data strucure with two elements (DOCO and DESC), this data structure is connected to a report definition in which I have stated that the subject must contain the first element (DOCO): Purchase order &1.
    In the report definition I mapped the element DOCO from the data structure to the XML-element that contains the order number.
    Unfortunately the e-mail does contain the statis text "purchase order" but it doesn't contain the order number (DOCO) from the XML-file.
    Can anyone give me a hint for what I have done wrong?

    In JD EDwards TR 8.98.3.0 it should be possible to create a dynamic email subject based on a data structure that is connected to a report definition. I have managed to create the data strucure with two elements (DOCO and DESC), this data structure is connected to a report definition in which I have stated that the subject must contain the first element (DOCO): Purchase order &1.
    In the report definition I mapped the element DOCO from the data structure to the XML-element that contains the order number.
    Unfortunately the e-mail does contain the statis text "purchase order" but it doesn't contain the order number (DOCO) from the XML-file.
    Can anyone give me a hint for what I have done wrong?

  • Modelling complex data structures

    Hello all,
    I'm trying to understand how to model and design a scenario where the data is non-flat (specifically purchase orders).  As far as I understand Duet Enterprise does not handle non-flat structures (without custom coding in SharePoint).
    What are some options that other people have used to address this?
    The two that I thought of are:
    1.  Model the header and line item data structures separately and then somehow link them in SharePoint
    2.  Don't use the external list external content type in SharePoint and develop something custom
    Does anybody else have any other ideas?  Do you have any examples or starting points?
    Thank you.

    You should avoided passing complex data structure across the JNI boundary. It is slow and it is very difficult to get right. Either make your JNI code so simple that its parameters are primitives or very simple objects, or make your Java code so simple ditto.

  • Java data structure

    H!!
    I am looking for a good on line tutorial about
    Java Data structure. please help me.
    peter

    Hi again!
    This is my first time that I want to learn
    about : stack, list, linked list, queue, tree..
    . whit Java.Stack, list, linked list, queue and trees are data structures which are the same independent of the programming language. They are more of a concept.
    The best way to find more information is to google on the structure you want more information on. Here's an explanation on how a linked list works:
    http://encyclopedia.lockergnome.com/s/b/Linked_list
    /Kaj

  • Data lock even after commit work and wait

    Hi Experts,
    Data is still locked even after commit work and wait step has run, which made me very confusing.
    The following are the details:
    These steps are in a FOP.
    Step1: Change Move-in Date of a move-in document in background after get the new move-date from user.
    Step2: Run BAPI_TRANSACTION_COMMIT and pass the wait parameter.
    Step3: Bring move-in document transaction to the user for other information changes.
               After the user confirms the changes and presses SAVE button, error message shows that the move-in document is still locked. But no other transaction is opened for the specified move-doc changing.
    Does any1 have any idea on this? How can I solve this issue?
    Thanks in advance and points will be rewarded.
    Vincent

    Hi,
    Normally every BAPI will work on Update task so that the data will be updated once the commit work is done. For the commit work, we will normally call the bapi function module - BAPI_TRANSACTION_COMMIT. It should work.
    In your case, just try the below option:
    Please call the bapi - BAPI_ACC_DOCUMENT_POST & BAPI_TRANSACTION_COMMIT in a seperate function module and call this function module in your program (just pass the import / export / table parameters accordingly).
    For the information, I had once a similar type of issue and it got solved once I did like the above.
    Regards,
    Selva K.

Maybe you are looking for

  • Field explorer does not open on my terminal services profile

    Dear Sirs, For some reason I am unable to open my field explorer in any crystal report on my terminal services profile. I have checked with other profiles and the problem does not exist. The problem is specific to my profile. I can also create new re

  • Problems with the items (control) in forms 9i (Re)

    Hello, I write this problem in a other post and but don't have any feedback about it(So I will give another try:-) ) The problem that I will describe don't happen all the time and is very rare but I want to know if it's a normal bug of forms or somet

  • Why does my iPad cut out while using Facebook?

    My iPad cuts out when using Facebook. Why?   What can I do to fix this?

  • Help with operator precedence.

    I'm having trouble telling whether + and - signs are unary or binary in figuring out operator precedence. I understand that the unary makes things positive and negative and that the binary is addition and subtraction. here is an example from my notes

  • APEX4: Populating fields from database based on the SelectList value

    Hi, I've a Select List and 4 Text Fields on a form. On selecting a value on the Select List, I've to populate the Text Fields by fetching its values from the database by using the Select List value as the primary key. How can I do this in APEX 4? Tha