IFmsAuthServerContext threadsafeness?

I'm working on a authorize plugin for FMIS, and i'm wondering
if I need to be worried about threads etc when calling
IFmsAuthServerContext's onAuthorize/onNotify from other threads
inside my plugin (ie a thread pool, like the File plugin
example)?

No - it is not even slightly Thread safe. Completely
unsafe, in fact. You don't synchronize
anywhere.Hashtable has synchronisation.
>
The point behind something being Threadsafe is that as
one thread has finished executing one line, and before
it is executing the next, another Thread may have
changed the state of your object. eg.
if (dyn == null) {
//oh-no, another Thread has just loaded the dyn
n variable, if I read dyn now it wouldn't be nullI don't get this. The dyn is a local variable. Every thread has it's own dyn.
dynamicCache.put(intID, Boolean.FALSE);
//even worse, I've just over-written it, and now the
e other Thread is mysteriously getting back FALSEI assume that hashtable still has synchronization.
dyn.loadDynamicByID(id);
dynamicCache.put(intID, dyn);
//oh no, another Thread has just overwritten this
s because it isn't Thread-safe.
Don't mess aroundI'm not.
synchronized (dynamicCache) {
Dynamic dyn = dynamicCache.get(intID);
if (dyn == null)
dynamicCache.put(intID, loadDynamicByID(id));
}Don't try simple Double-checked-locking (DCL doesn't
work in the current Java memory model - see
http://www.javaworld.com) and Thread-local DCL is at
the moment still slower than full synchronization.The idea was to allow multible record loads at the time, but reach specially if the same record is loaded same time. The harddisk access is synchronized with Object hdAccess=new Object.
I might be wrong, but I still think that my code is threadsafe. Sorry for asking help and then arguing, but i do. Point to me that i'm wrong...

Similar Messages

  • How to make the server threadsafe (Please Help)

    Hi to all,
    I have urgent question, and any
    reply will be welcome.
    How i make my server that use rmi threadsafe,
    i want that each request from clients,the
    server will make a separate thread.
    the ejb use jndi to do this, how can i do this in rmi
    i want that a client will get a reference to a factory
    object in the server, the factory object will create a
    thread and will return the reference to the client.
    Thanks,
    dan

    Hi Bill,
    Thanks for your reply.
    at the rmi specification it said that :
    3.2 Thread Usage in Remote Method Invocations
    A method dispatched by the RMI runtime to a remote object implementation may or may not execute in a separate thread. The RMI runtime makes no guarantees with respect to mapping remote object invocations to threads. Since remote method invocation on the same remote object may execute concurrently, a remote object implementation needs to make sure its implementation is thread-safe.
    this is all what sun has to say about using
    threads with rmi.
    do you have any example for using rmi server
    that handle concurrent access?
    again,
    lots of thanks for your help.
    dan

  • Urgent: need threadsafe replacement for malloc

    Hi,
    I have a native library that is using GetDirectBufferAddress to create large chunks
    within the java memory model that I can use to subdivide and alloc from
    in the native code instead of using malloc. However, there are multiple threads
    using these chunks so I need a locking mechanism.
    The problem is that MonitorEntry/MonitorExit takes 250 nanoseconds, which is
    a huge price to pay for allocation and free, total = 500. My question is can I
    do whatever malloc does in the GNU library to make itself immune to jvm
    thread context switches, especially on multiple cpu machines. Spin locks,
    openmp mutexes? Does anyone know how malloc is made threadsafe to
    be ok to use within a JNI library? And how I can get my hands on the
    necessary code.
    Thanks,
    Andy

    Greetings Folks,
    Like the original poster I am trying to back up my HD info. Got the exact same error message and code:
    "The operation cannot be completed because one or
    more required items cannot be found.
    (Error code -43).
    Could not open the data fork of "<unable to get file path>" (-43)."
    I was able to trace the error code down on Apple's Support site under the heading: Mac OS X, Mac OS X Server: "Error -43" When Using Windows File Sharing (SMB). Yay...except I have never used Windows file sharing and can't figure how this pertains to my problem.
    I did type
    in the "<unable to get file path>" into spotlight and
    got several hits:
    Documents:
    core.html.html
    windows.html.html
    ssl_faq.html
    PDF Documents:
    About Xcode Tools.pdf
    I deleted the "Documents" files (same ones as OP) that came up when I searched <unable to get file path> Was this an oops?
    Anyway, the disc was only 50% complete. I got a
    "closing session 1" window and that stayed active on
    the desktop for a few minutes and then the dvd just
    spit out. I put the dvd back in to see what was on it
    and didn't even open for a minute or two, just heard
    some clicking sounds from the drive and never got a
    disc icon on the desktop to even look at what was on
    the dvd. I gave it another try but sam thing
    happened.
    Same thing happened here. I would really like to back up my files. I have already trashed several DVDs in my unsuccessful attempts.
    I don't see any replies to the OP--is there anyone with a few cogent thoughts on all this out there? The same thing has now happened to at least 2 Mac users, which makes it seem a lot less like it's all in my head.
    Thank you many times over.
    iMac G5 2GHz PPC   Mac OS X (10.4.7)   still miss my Indigo G3

  • PowerBuilder Classdefinition not threadsafe?

    Hi,
    I have an object that uses the Classdefinition variable to access the variablelist.
    This functionality runs fine in single task environment (if I simple CREATE the object). But if I run it in a separate task (as SharedObject) the results are sometimes unexpected. For instance I sometimes get empty variable names or the function call or the whole application hangs.
    May it be, that the access of Classdefinition is not threadsafe?
    I have tested it with a simple test application (no PFC or others).

    Additional information:
    To avoid the problem I now use a mutex to serialize the access. It works almost good!
    But now Powerbuilder crashes only sometimes at access of variablelist property:
    Microsoft Visual C++ Runtime Library
    Runtime Error!
    Program: C:\Program Files (x86)\Sybase\PowerBuilder 12.0\PB120.EXE
    R6025
    - pure virtual function call
    Any ideas what's the reason?

  • CheckThread static analysis tool, @ThreadSafe, @ThreadConfined

    Hello,
    I'm looking for feedback on CheckThread, a free and open source static analysis tool I created.
    By using a @ThreadConfined and @ThreadSafe annotation on methods and classes, this tool can catch certain types of threading bugs at compile time.
    To see examples, check out:
    http://www.checkthread.org/examples.html
    For example, when developing a Java Swing app, a Java developer must ensure that the Swing component is accessed only on the Event-Dispatch Thread after the component is realized. With large applications that are thousands of lines of code, simple thread confinement for Swing can be difficult to enforce and may result in wacky sporadic runtime behavior. CheckThread solves this problem using annotations and a static analysis Ant task - thread confinement problems are caught at compile time. An added benefit is that the threading model of Java code is well documented inline with the code.
    All feedback welcome!
    Thanks,
    Joe

    I recommend you to ask developers of FindBugs to add your feature to their project. FindBugs says that it already supports concurrency bugs finding (see jcip package), but that support is very poor (actually, it's not working). I'll try your program.

  • XMLNode.selectNodes() threadsafe?

    Running a multi-threaded application that hits the XMLNode.selectNodes()
    right at the same time doing a node.selectNodes("*") throws null pointer exceptions.
    This does not happen in a single threaded mode. (See exception below). Also,
    the same program produces inconsistent results running in a threaded mode using
    the selectNodes extensively. It seems that the code is not threadsafe. I know that
    the inputs to the call are not null, something in the xml parser code is having a problem.
    java.lang.NullPointerException
    at oracle.xml.parser.v2.XPathStep.getSelectedNodes(XPathStep.java:383)
    at oracle.xml.parser.v2.PathExpr.getSelectedNodes(XSLNodeSetExpr.java:549)
    at oracle.xml.parser.v2.XMLNode.selectNodes(XMLNode.java:694)
    at oracle.xml.parser.v2.XMLNode.selectNodes(XMLNode.java:665)
    at oracle.xml.parser.v2.XMLNode.selectNodes(XMLNode.java:723)
    at org.oclc.util.xml.oracle.XPathUtil.selectNodes(XPathUtil.java:49)
    at org.oclc.util.xml.XSLUtil.selectNodes(XSLUtil.java(Compiled Code))
    at org.oclc.xwc.data.recordloader.AbstractOracleRecordLoader.generateTerms(AbstractOracleRecordLoader.java(Compiled Code))
    at org.oclc.xwc.data.recordloader.LoadMDATA.loadRe[i]Long postings are being truncated to ~1 kB at this time.

    Do you have any thread updating the DOM at the same time?

  • Is "Easy I/O for daq" library threadsafe ?

    In my multithreaded application, a thread realizes data acquisition and another switches relays, on a multifunction daq board.
    Is "Easy I/O for daq" library threadsafe ?

    Hello Hopeula,
    The library "Easy I/O for daq" uses the DLL NI-DAQ which is threadsafe.
    Please see the link below for more information :
    http://digital.ni.com/public.nsf/websearch/E1C8492854855FA98625689E0072E832?OpenDocument
    I hope this help.
    Regards,
    Sanaa TAZI
    National Instruments France
    Sanaa T.
    National Instruments France
    #adMrkt{text-align: center;font-size:11px; font-weight: bold;} #adMrkt a {text-decoration: none;} #adMrkt a:hover{font-size: 9px;} #adMrkt a span{display: none;} #adMrkt a:hover span{display: block;}
    >> http://www.nidays.fr/images/081110_ban_nidays09_468X60.gif

  • Pls clarify me about threadsafe and servlet data member

    is this threadsafe if my servlet has data member but only initiated by init() and rest of the methods do read only on this data member.
    e.g.
    public class myServlet extends HttpServlet {
        private String someString;
        public void init() throws ServletException {
            // codes inti someString;
        // rest of methods
        // bleh ...
    }one more question: is that someString is so called servlet instance variable?

    Hi,
    you r going through a wrong way. Try this way
    TABLES: PA9180.
    git_pa9180 TYPE STANDARD TABLE OF pa9180.
    start-of-selection.
    SELECT * FROM PA9180 INTO TABLE GIT_PA9180
    WHERE ENDDA BETWEEN G_PRE_DATE AND SY-DATUM
    AND ZZCASE_NO LIKE 'E%'.
    END-OF-SELECTION.
    NOW LOOP AT THIS INTERNAL TABLE(GIT_PA9180) AND PROCESS IT FOR FURTHER RESULTS
    Hope this solves ur problem.
    Regards,
    Ibrar

  • How is it possible to make sure that LV uses the same thread for several threadsafe DLL calls?

    Hello,
    i have a thread safe DLL and most functions are called from serveral threads from the LV apllication without problems.
    In case of an error i have to call an error handler function in this DLL (like WinAPI: GetLastError()) from the same thread which has called the function that failed before.
    I can't use the user interface execution because some functions need a long execution time and i don't want to balk the user interface.
    All other executions than the user interface execution have more than one thread and in most cases the DLL function calls were executed from different threads - so the error handling doesn't work...
    Any idea?
    Thanks for your help!

    Hmmm....
    How about wrapping all of your dll calls in a single VI (or an Action Engine ) and make sure the VI's thread is NOT set for "Same as caller".
    "Threadconfig.vi" (sp?) will also let you dictate the number of threads associated with an execution system. Set your target thread for "1".
    Not sure on the above.
    Please correct me if this is wrong!
    Ben
    Message Edited by Ben on 07-19-2007 08:26 AM
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Possible threadsafe issues using Matlab scripts?

    Hi all,
    I'm developing an application in Labview 6.1 that makes extensive use
    of Matlab scripts.  The application executes the same set of
    scripts for multiple data sources, and keeps track of the inputs and
    outputs for each data source separately.  I've been noticing that
    the application produces the correct results when running only one data
    source, but that the results are often incorrect when I run it against
    multiple data sources.
    I've done some investigation, and have found that all Matlab scripts
    share a common memory workspace in Matlab.  That is to say that if
    I have ScriptA that takes variable X as an input, and ScriptB that does
    not, ScriptB nonetheless has access to variable X in its workspace
    (from the last time ScriptA was called).  This doesn't pose a
    problem to me directly, but it has made me wonder if there are
    potential threading issues in the scripts.
    Consider the following scenario with one script and two data
    sources.  I'm wondering if this scenario is possible in Labview:
    1.  Thread1 calls ScriptA, passing data from SourceX.
    2.  During Matlab execution (somewhere in the middle), Thread1 is suspended.
    3.  Thread2 calls ScriptA, passing data from SourceY (data have the same variable names, since it's the same script).
    4.  Thread2 finishes ScriptA execution uninterrupted with SourceY data.
    5.  Thread1 is reactivated, but now the Matlab workspace data has
    been replaced with SourceY.  So, Thread1 started with SourceX
    data, but finished with SourceY data.
    6.  An incorrect result for Thread1 is produced, because the wrong data was processed.
    Clearly I could get around this problem with a semaphore, but first I'd
    like to know if this scenario can even happen.  Are Matlab scripts
    treated as atomic operations in Labview, or can the threads be
    suspended midway through execution?
    Thanks for your help!
    cjb

    Hello,
    No. LabVIEW will definitely not compile a VI while it's running - I think that would be, even conceptually, impossible.  In fact, some properties (accessed via property nodes) are not editable at run-time for basically that reason, that a recompile would be necessary in order for the affect to take place, and the recompile can't take place at run-time!
    It is indeed strange behavior, particularly because it is intermittent (which does hint at a threading issue, or some factor outside the development environment).  Can you try moving the initialization to LabVIEW?  I have attached an example of a so-called functional global variable (a simple code module in this case).  It has two "states" (which are cases) - one is initialize and the other is the "usually executing case."  The initialize case is used to initialize the shift register to an array of 50 doubles, where the other case will compute the running average, min, and max across the 50 most recent random numbers generated.  The 50 data point code module.vi is the code module, and it is called by Use 50 data point code module.vi.  When you run Use 50 data point code module.vi, be sure to toggle the initialize boolean so that the initialize case executes once to allocate and initialize an array with 50 elements; when you toggle it back then it will execute the other case on each iteration, and begin computing the statistics noted by keeping an array with the 50 most recent random data points generated.
    I hope this helps and that you are able to incorporate a similar code module into your application to avoid the intermittent errant behavior!
    Best Regards, and feel free to post again with updates!
    JLS
    Best,
    JLS
    Sixclear
    Attachments:
    Use 50 data point code module.zip ‏27 KB

  • Is this threadsafe ?

    I have this code, just with to know , is it thread safe ?
    public class TestThreadSafe {
         private static final Object object = new Object();
         public static Object getInstance()
              return object;
    }

    sachin.tomar wrote:
    Thanks for the information.
    I read some where that some JVM's work like, they initialize the instance before all the fields are initialized and in this case it does not remain safe any more.What? I don't think getInstance will be called before the class is fully loaded and initialized. I'm not sure that I remember it correctly (it was a couple of years ago that I read an article about it), but I think you are talking about the problem where you are lazily initializing the attribute.

  • Threadsafe Modal Dialog

    Is there any way to do a thread safe, properly operating modal dialog panel?
    I want to issue popups from within a thread.  Using the standard MessagePopup() displays the dialog box, but it does not block events in the other threads.  Which is to say that one can click anything else on the main panel, putting the popup in the background. 
    Perhaps there is some kind of signalling that can be implemented between a function launched from the thread via PostDeferredCall(), so that the thread pauses until the popup is closed?

    hendra:
     If you just need a simple, standard dialog box, you can use the Windows SDK MessageBox function to create a system modal dialog box.  System modal dialogs stay on top of all other applications.  See my old example here: http://forums.ni.com/t5/LabWindows-CVI/MessagePopup-dissappears-behind-active-panel/m-p/182045#M1409...
    If you need a more custom dialog, as an experiment I created a CVI project which simulates a system modal dialog by taking back focus on a fast firing timer.  See my discussion and example here: http://forums.ni.com/t5/LabWindows-CVI/Make-panel-modal-from-a-CVI-dll/m-p/1316925#M50035

  • Is this threadSAFE ??? plz help

    25 threads keeps entering a method to check some stuff.. it is not synchronized...
    This is just a similar example..
    public checkme(Somestuff abc) {
    long time1 = System.currentTimeMillis(); // timers around method to check how much time it takes
    callmetoCheck(abc);
    long recordTime = System.currentTimeMillis() - time1; // would this time be accurate even if multiple threads are trying to access it..
    recordcheckingTime(recordTime);
    i have a method to accumulate all values of time taken to process callmetoCkeck() method... How can this be thread safe when different threads enter this method. is variable time1 thread safe ??
    public synchronized void recordcheckingTime(long time){
    accumulator += time;
    plz help guys...my last 4 months work is in jeopardy...
    Thank you..
    Edited by: javanewbie83 on Sep 23, 2008 8:47 PM

    time1 is local to each thread so it doesn't need to be thread safe.

  • Threadsafe servlet code?

    Hi,
    Im developing a sevlet accesing an enterprise system using HTTP. I am using the Apache HttpClient package and have a questing regarding thread safety. The classes are like below:
    EnterpriseClient.java:
    public class EnterpriseClient
    private HttpClient client;
    MultiThreadedHttpConnectionManager connectionManager = null;
    public void create()
    // create a thread safe HttpClient.
    connectionManager = new MultiThreadedHttpConnectionManager();
    client = new HttpClient(connectionManager);
    public String getEnterpriseData(String msisdn)
    PostMethod post = new PostMethod("....");
    String result = post.getResponseBodyAsString();
    return result;
    public String setEnterpriseData(String msisdn, Strign data)
    PostMethod post = new PostMethod("....");
    post.setMessageBody(data);
    String result = post.getResponseBodyAsString();
    return result;
    EnterpriseServlet.java:
    public class EnterpriseServlet extends HttpServlet {
    EnterpriseClient myClient = null;
    public void init() throws ServletException
    myClient = new EnterpriseClient ();
    myClient .create();
    public void doPost(...) {
    // get enterprise data
    String reply = myClient.getEnterpriseData(id);
    // analyze data
    // set enterprise data
    String reply = myClient.setEnterpriseData(id, data);
    Would this code qualify as thread safe? This is not the actual code, just used to illustrate the design.
    HttpClient docs: http://jakarta.apache.org/commons/httpclient/preference-api.html
    Any input would be appreciated.

    I don't know the design or intention of the HttpClient but the way you have it designed now is that all users and threads share the same myClient object. Is that what you expected?

  • Threadsafe servlet?

    Hi,
    Im developing a sevlet accesing an enterprise system using HTTP. I am using the Apache HttpClient package and have a questing regarding thread safety. The classes are like below:
    EnterpriseClient.java:
    public class EnterpriseClient
    private HttpClient client;
    MultiThreadedHttpConnectionManager connectionManager = null;
         public void create()
              // create a thread safe HttpClient.
              connectionManager =     new MultiThreadedHttpConnectionManager();
              client = new HttpClient(connectionManager);
         public String getEnterpriseData(String msisdn)
    PostMethod post = new PostMethod("....");
    String result = post.getResponseBodyAsString();
    return result;
         public String setEnterpriseData(String msisdn, Strign data)
    PostMethod post = new PostMethod("....");
    post.setMessageBody(data);
    String result = post.getResponseBodyAsString();
    return result;
    EnterpriseServlet.java:
    public class EnterpriseServlet extends HttpServlet {
         EnterpriseClient myClient = null;
         public void init() throws ServletException
              myClient = new EnterpriseClient ();
              myClient .create();
         public void doPost(...) {
              // get enterprise data
              String reply = myClient.getEnterpriseData(id);
    // analyze data
    // set enterprise data
    String reply = myClient.setEnterpriseData(id, data);
    Would this code qualify as thread safe? This is not the actual code, just used to illustrate the design.
    HttpClient docs: http://jakarta.apache.org/commons/httpclient/preference-api.html
    Any input would be appreciated.

    I don't know the design or intention of the HttpClient but the way you have it designed now is that all users and threads share the same myClient object. Is that what you expected?

Maybe you are looking for

  • Macbook Pro Retina (late 2013) sleep wake problems under Yosemite

    Hi, Ever since I installed Yosemite on my MBP (details in the screen shot below), I've been getting Sleep Wake problems.  At night, I simply close the lid of the laptop, leaving all applications running, and in the morning I wake it up.  This worked

  • SQL 'SELECT' statement

    I use LV7.1.1 to read/update an Access Database, using DB Toolset. When I use the Sql 'SELECT' query with LIKE operator, I do not get any results. (no error is returned). The statement is: SELECT Machine, System, AD, Query_Position, RefDesignator, De

  • Table in interactive froms - choices of flow content

    Hi SAP-Gurus, I try to create an interactive form that contains a dynamic table. I read in several threads that I have to choose the row table flow direction in a subform of flow content. But I have only the choice between 'top to bottom' and 'wester

  • Change a string to upcase

    Hi, How to change a string to all upcase. Thanks

  • Re: PanedWindow in Forte'

    Forgive me if I'm not replying to this correctly. I just got subscribed and I can't believe this question popped up. I'm involved in the building of a new imaging system using the Forte development environment. We are currently in the prototyping sta