We're Hiring!

bridge is called twice

General and open developer discussion about using OMERO APIs from C++, Java, Python, Matlab and more! Please new questions at https://forum.image.sc/tags/omero
Please note:
Historical discussions about OMERO. Please look for and ask new questions at https://forum.image.sc/tags/omero

If you are having trouble with custom code, please provide a link to a public repository, ideally GitHub.

bridge is called twice

Postby bhcho » Mon Jul 18, 2011 9:16 pm

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
bhcho
 
Posts: 236
Joined: Mon Apr 05, 2010 2:15 pm

Re: bridge is called twice

Postby jmoore » Tue Jul 19, 2011 8:25 am

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.
User avatar
jmoore
Site Admin
 
Posts: 1591
Joined: Fri May 22, 2009 1:29 pm
Location: Germany

Re: bridge is called twice

Postby bhcho » Tue Jul 19, 2011 11:18 am

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
bhcho
 
Posts: 236
Joined: Mon Apr 05, 2010 2:15 pm

Re: bridge is called twice

Postby jmoore » Fri Jul 22, 2011 8:30 am

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.
User avatar
jmoore
Site Admin
 
Posts: 1591
Joined: Fri May 22, 2009 1:29 pm
Location: Germany


Return to Developer Discussion

Who is online

Users browsing this forum: Google [Bot] and 1 guest