Hi,

I tried to use the new IDBroker and I ran into some trouble.  I used 
NewGenerateMapBuilderTask to generate Peers and MapBuilders for
my application's tables and I used the built-in Turbine Peers and MapBuilder 
(TurbineMapBuilder) to manage the security.  The
id_table is also part of the Turbine tables.  I got a NullPointerException when I 
tried to use IDBroker to generate an id for one of
my tables in the following way:

DatabaseMap dbMap = DBBroker.getInstance().getDatabaseMap("default");
IDBroker idb = dbMap.getIDBroker();
entityid = idb.getNextId ("Entity").intValue();

The problem turned out to be that IDBroker tries to synchronize on the table map for 
which your are trying to generate an id.
Because I have my own MapBuilder for my tables the TurbineMapBuilder does not have 
this table and throws the exception.  Am I using
this in the wrong way - should I have *one* MapBuilder for the whole app?  Am I right 
if I say that I can't add the id_table to each
of the MapBuilders because of synchronization problems?

At the moment I use a very simple workaround in storeIDs() , although this is not the 
most elegant code:

    DatabaseMap dbMap = tableMap.getDatabaseMap();
    Object tMap = dbMap.getTable(tableName);
    if (tMap == null) tMap = this;
    synchronized(tMap)

Any other thoughts on this?

~ Leon



------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?:           [EMAIL PROTECTED]

Reply via email to