Page 1 of 1

bridge is called twice

PostPosted: Mon Jul 18, 2011 9:16 pm
by bhcho
As I posted in the http://openmicroscopy.org/community/viewtopic.php?f=6&t=649&p=2423&hilit=twice#p2346, my custom bridge is called twice (even though I don't do anything with the bridge). And it seems like they are triggered almost simultaneously.
I know one of them is creation and the other one is update.

I really want to distinguish the two. So I got the timing of creation and update like below

Code: Select all
     public void set(final String name, final Object value,
                     final Document document, final LuceneOptions _opts) {
          if (value instanceof Image) {
               final Image i = (Image) value;
               Long update = i.getDetails().getUpdateEvent().getTime().getTime();
               Long creation = i.getDetails().getCreationEvent().getTime().getTime();


but those two (update and creation) are the same.
from the java bridge code, how can i know whether it is called for creation or update?

bk

Re: bridge is called twice

PostPosted: Tue Jul 19, 2011 8:25 am
by jmoore
BK,

currently the EventLog which is being processed is not passed to the bridge. I've added ticket #6282 as a feature request. The only option for the moment is probably to filter out one of the two event logs before the bridge is called. I can explain how to go about doing that if it's critical.

Cheers,
~Josh.

Re: bridge is called twice

PostPosted: Tue Jul 19, 2011 11:18 am
by bhcho
Hi Josh,

thanks.
We are trying to trigger our feature calculation and update our DB file when an image is imported using the bridge.
But because the bridge is called twice almost at the same time, it's not easy to distinguish them and to prevent from updating our DB file twice.
So, please let me know how to distinguish them if it's possible without updating OMERO.server now.

best,
bk

Re: bridge is called twice

PostPosted: Fri Jul 22, 2011 8:30 am
by jmoore
You'll need to modify how the EventLogLoader is working. Currently, it stores a single EventLog id in the "configuration" table and pulls the next one out. Instead, you could have it operate event by event, and remove all the duplicate event logs in memory. There are several examples of event log loaders in 4.2 and 4.3. The ome.services.fulltext and ome.services.pixeldata package make use of them. The pixeldata load loader, for instance, loads one eventlog per user and stores them in memory before querying again.

Cheers,
~Josh.