Question: I've got a problem where I generated a Quicktime plgin using the AC\_Quicktime plugin, and then drop this into a using jquery. In Firefox I can then reference the created plugin using it's objectid, but in IE 6.0 this doesn't seem to work.

I've tried using jquery to reference the plugin... but can't seem to do so.

Here's the code that generates the plugin parameters:-

```
var movie1 = QT_GenerateOBJECTText(
        currentfile, playerwidth, playerheight, "",
        "controller","false",
        "obj#id", "movie1",
        "emb#id","qt_movie1",
        "postdomevents","True",
        "emb#NAME","movie1",
            "enablejavascript","true",
        "autoplay",boolplaying,
        "scale","aspect",
        "pluginspage","http://www.apple.com/quicktime/download/"
            );

            $("#player").html(movie1);

```

I then check that the plugin has been generated using this, and then do some stuff with it:-

```
if ($("#qt_movie1").length > 0)
            {
              alert('clip loaded up');
            //clip with embedded id 'qt_movie1' must be loaded so wait a bit then run timecode()
            //showEvents('now run timecode');

            //calculate duration
            Id = window.setTimeout("timecode()",500);
            }

```

In Firefox the alert (for debug purposes) fires off but it doesn't in IE. In another simple function I stop the movie using this:-

```
function stopmovie()
{

  document.movie1.Stop();
  boolplaying = false;

}

```

Again 'document.movie1' works to reference the movie in Firefox, but not IE.

Is there a jquery selector I can use for the quicktime plugin? Or is there another way to reference the plugin?

Cheers.

Jon

Answer: 
Yes, assuming you really want to see the most recently calculated prime on any thread, it should either be volatile or be accessed in a thread-safe way via `synchronized` blocks/methods. Additionally, as pointed out in the comments, non-volatile long variables may not be updated atomically - so you could see the top 32 bits of an old value and the bottom 32 bits of a new value (or vice versa). 

I forgot about the atomicity side of things earlier because it's almost *always* solved automatically by when you make sure you get the most recently published value, and make sure you fully publish new values. In practice this is almost always what you want, so atomicity becomes a non-issue if your code is working properly to start with.

It's not a `SingleThreadModel` servlet is it? That would obviously make a difference.

Another alternative would have been to use [`AtomicLong`](http://java.sun.com/javase/6/docs/api/java/util/concurrent/atomic/AtomicLong.html).
Semantics of volatile variable in Java are not strong enough to make the increment operation (lastprime++) atomic, unless you can guarantee that the variable is written only from a single thread - not in servlet's case

On the other hand, using AtomicXXX variables is thread-safe, as long as no compounded operations are performed. There will be window of vulnerability when updating more than one atomic variables, even though each call to is atomic.