You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by Kiran Ayyagari <ka...@apache.org> on 2018/09/11 09:53:06 UTC

[ApacheDS] converting PartitionReadTxn and PartitionWriteTxn to interfaces

I propose to convert the classes PartitionReadTxn and PartitionWriteTxn
to interfaces so that new Txn implementations need not be restricted to
Java inheritance's single parent restriction.

These classes currently do not hold any logic so making such a change will
not
break the existing code in the trunk.

Please let me know if there are any objections to this.

Thank you.

Kiran

Re: [ApacheDS] converting PartitionReadTxn and PartitionWriteTxn to interfaces

Posted by Emmanuel Lécharny <el...@gmail.com>.
Also forgot to mention that at some point a Read transaction may need to
be 'committed' : typically, in Mavibot, it releases the revision in use,
allowing the page collector to reclaim the associated pages.


Le 11/09/2018 à 11:53, Kiran Ayyagari a écrit :
> I propose to convert the classes PartitionReadTxn and PartitionWriteTxn
> to interfaces so that new Txn implementations need not be restricted to
> Java inheritance's single parent restriction.
> 
> These classes currently do not hold any logic so making such a change will
> not
> break the existing code in the trunk.
> 
> Please let me know if there are any objections to this.
> 
> Thank you.
> 
> Kiran
> 

-- 
Emmanuel Lecharny

Symas.com
directory.apache.org


Re: [ApacheDS] converting PartitionReadTxn and PartitionWriteTxn to interfaces

Posted by Kiran Ayyagari <ka...@apache.org>.
On Tue, Sep 11, 2018 at 3:49 PM, Emmanuel Lécharny <el...@gmail.com>
wrote:

>
>
> Le 11/09/2018 à 11:53, Kiran Ayyagari a écrit :
> > I propose to convert the classes PartitionReadTxn and PartitionWriteTxn
> > to interfaces so that new Txn implementations need not be restricted to
> > Java inheritance's single parent restriction.
> >
> > These classes currently do not hold any logic so making such a change
> will
> > not
> > break the existing code in the trunk.
> >
> > Please let me know if there are any objections to this.
>
> Actually, the problem is that the PartitionReadTxn class maydo nothing,
> but it has to be instanciated at some point, something thatis quite hard
> to do with an interface ;-)
>
>
> Now, the current logic is not necessarily the best.
>
> We could draw a better hierarchy, like :
>
> (PartitionTxn) o----------------- [[AbstractPartitionTxn]]
>       o                                     ^
>       |                                     |
>       +-- (PartitionReadTxn) <--- [PartitionReadTxnImpl]
>       |                                     ^
>       |                                     |
>       +-- (PartitionWriteTxn) <-- [PartitionWriteTxnImpl]
>
> where PartitionTxn, PartitionReadTxn, PartitionWriteTxn are interfaces,
> with an abstract class that implement the common methods and Impl for
> the needed instanciation.
>
> wdyt ?
>
I just created additional impl classes after converting them into
interfaces. I do however think that it would
be better to distinguish a read txn from a write txn my using an internal
flag, but that will be a bigger change and subject to another thread.

>
>
> --
> Emmanuel Lecharny
>
> Symas.com
> directory.apache.org
>
> Kiran

Re: [ApacheDS] converting PartitionReadTxn and PartitionWriteTxn to interfaces

Posted by Emmanuel Lécharny <el...@gmail.com>.

Le 11/09/2018 à 11:53, Kiran Ayyagari a écrit :
> I propose to convert the classes PartitionReadTxn and PartitionWriteTxn
> to interfaces so that new Txn implementations need not be restricted to
> Java inheritance's single parent restriction.
> 
> These classes currently do not hold any logic so making such a change will
> not
> break the existing code in the trunk.
> 
> Please let me know if there are any objections to this.

Actually, the problem is that the PartitionReadTxn class maydo nothing,
but it has to be instanciated at some point, something thatis quite hard
to do with an interface ;-)


Now, the current logic is not necessarily the best.

We could draw a better hierarchy, like :

(PartitionTxn) o----------------- [[AbstractPartitionTxn]]
      o                                     ^
      |                                     |
      +-- (PartitionReadTxn) <--- [PartitionReadTxnImpl]
      |                                     ^
      |                                     |
      +-- (PartitionWriteTxn) <-- [PartitionWriteTxnImpl]

where PartitionTxn, PartitionReadTxn, PartitionWriteTxn are interfaces,
with an abstract class that implement the common methods and Impl for
the needed instanciation.

wdyt ?


-- 
Emmanuel Lecharny

Symas.com
directory.apache.org