You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by ol...@ppi.de on 2003/05/07 08:05:50 UTC

Writing own SequenceManager

Hello,

I want to write my own sequence manager. It shall work as follows:
The value returned by getUniqueLong(field)contains a 16-bit 
classId (unique for the specified class) on the most significant 
bits. The value of the remaining 48 bits is the one higher than 
the maximum available in the table of the specified class.

As far as that maximum is concerned, I want to
do it similarly as the SequenceManagerInMemoryImpl does.

For this purpose, it would be convenient to have access to 
the private methods of SequenceManagerHelper, in particular
	private static long getMaxIdForClass

What do you think: Could be make that public?

Do you like that idea?  

Has anybody done something similar?


For those of you who are interested:

I am going to exploit the fact that the real class is included
in the uid in the PersistenceBroker: I write
my own implementation for it which extends PersistenceBrokerImpl, 
but I overide getObjectByIdentity as follows: 

public Object getObjectByIdentity(Identity id) throws
PersistenceBrokerException
{
  if (id.getObjectsRealClass() == null)
  {
    short ci = getClassId(id);
    Class realClass = classToIdMapper.idToClass(ci); // classToIdMapper is a
helper 
    id.setObjectsRealClass(realClass);  // hint to search in the right
table.
  }
  return super.getObjectByIdentity(id);
}

This leads to a significant improvement when traversing references to
very polymorphic classes.

Olli

-- 
  Dr. Oliver Matz
  ppi Media GmbH
  Deliusstraße 10
  D-24114 Kiel
  phone	+49 (0) 43 1-53 53-422
  fax     	+49 (0) 43 1-53 53-2 22
  email	mailto:oliver.matz@ppi.de
  web	www.ppi.de


Re: Writing own SequenceManager

Posted by Armin Waibel <ar...@code-au-lait.de>.
Hi Oliver,

> the private methods of SequenceManagerHelper, in particular
> private static long getMaxIdForClass
> What do you think: Could be make that public?

No problem, is in CVS now.

> This leads to a significant improvement when traversing references to
> very polymorphic classes.

Sounds like a smart improvement. What about the
performance gain?


regards,
Armin


----- Original Message -----
From: <ol...@ppi.de>
To: <oj...@db.apache.org>
Sent: Wednesday, May 07, 2003 8:05 AM
Subject: Writing own SequenceManager


Hello,

I want to write my own sequence manager. It shall work as follows:
The value returned by getUniqueLong(field)contains a 16-bit
classId (unique for the specified class) on the most significant
bits. The value of the remaining 48 bits is the one higher than
the maximum available in the table of the specified class.

As far as that maximum is concerned, I want to
do it similarly as the SequenceManagerInMemoryImpl does.

For this purpose, it would be convenient to have access to
the private methods of SequenceManagerHelper, in particular
private static long getMaxIdForClass

What do you think: Could be make that public?

Do you like that idea?

Has anybody done something similar?


For those of you who are interested:

I am going to exploit the fact that the real class is included
in the uid in the PersistenceBroker: I write
my own implementation for it which extends PersistenceBrokerImpl,
but I overide getObjectByIdentity as follows:

public Object getObjectByIdentity(Identity id) throws
PersistenceBrokerException
{
  if (id.getObjectsRealClass() == null)
  {
    short ci = getClassId(id);
    Class realClass = classToIdMapper.idToClass(ci); // classToIdMapper
is a
helper
    id.setObjectsRealClass(realClass);  // hint to search in the right
table.
  }
  return super.getObjectByIdentity(id);
}

This leads to a significant improvement when traversing references to
very polymorphic classes.

Olli

--
  Dr. Oliver Matz
  ppi Media GmbH
  Deliusstraße 10
  D-24114 Kiel
  phone +49 (0) 43 1-53 53-422
  fax     +49 (0) 43 1-53 53-2 22
  email mailto:oliver.matz@ppi.de
  web www.ppi.de


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org