Definitely a good idea, I've created this issue:

https://github.com/orientechnologies/orientdb/issues/2329

Lvc@



Lvc@


On 12 May 2014 13:36, Ted Smith <[email protected]> wrote:

>  using wrapper approach  would incur TL call for each db api call,
> even if they could all be in the same method and I already get db
> reference.
>
> If the performance overhead of doing so is neglible, then it would work
> well as it hides underneath details
> of thread and pooling (still configurable)  and would save some
> documentation work as well :-)
>
>
>
>
>
>
> On Monday, May 12, 2014 4:48:05 AM UTC-4, Lvc@ wrote:
>
>> Hi,
>> we could create something similar by using a new wrapper of database
>> instance where every time you call any API it sets the current database on
>> the thread local before to call the API against the wrapped instance.
>>
>> WDYT?
>>
>> Lvc@
>>
>>
>> On 12 May 2014 07:57, Artem Orobets <[email protected]> wrote:
>>
>>>  Hi Ted,
>>>
>>> There is no guarantee that acquire will set thread local instance, so
>>> call
>>>
>>> ODatabaseRecordThreadLocal.INSTANCE.set(dbA);
>>>
>>> after acquiring.
>>>
>>>
>>> Best regards,
>>> Artem Orobets
>>>
>>> * Orient Technologiesthe Company behind OrientDB*
>>>
>>>
>>> 2014-05-12 1:21 GMT+03:00 Ted Smith <[email protected]>:
>>>
>>>  What I am trying to do is, in the same thread
>>>> first call one method
>>>>
>>>> MethodA(){
>>>> dbA = GLobalPool.acquire()
>>>> }
>>>>
>>>> then call  (in the same thread)
>>>>
>>>> methodB(){
>>>>
>>>> dbB=ODatabaseRecordThreadLocal.INSTANCE.get()
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> Would dbB be the same instance as dbA?
>>>>
>>>>
>>>>
>>>>
>>>> On Saturday, May 10, 2014 9:29:59 PM UTC-4, Ted Smith wrote:
>>>>>
>>>>> Hi:
>>>>> If I use the following command to acquire a database instance in one
>>>>> particular thread
>>>>> ODatabaseDocumentPool.global().acquire(..
>>>>>
>>>>> Can I get the same database instance within the same thread using
>>>>>
>>>>> ODatabaseRecordThreadLocal.INSTANCE.get()
>>>>>
>>>>> The doc says below, does it apply acquire from the pool?
>>>>>
>>>>> Every time you create, open or acquire a database connection,
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> the database instance is *automatically* set into the current ThreadLocal 
>>>>> <http://download.oracle.com/javase/6/docs/api/java/lang/ThreadLocal.html> 
>>>>> space,
>>>>>
>>>>> Thanks
>>>>>
>>>>>  --
>>>>
>>>> ---
>>>> You received this message because you are subscribed to the Google
>>>> Groups "OrientDB" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to [email protected].
>>>>
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>  --
>>>
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "OrientDB" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>  --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "OrientDB" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to