Re: Ignite Queue

classic Classic list List threaded Threaded
3 messages Options
ilya.kasnacheev ilya.kasnacheev
Reply | Threaded
Open this post in threaded view
|

Re: Ignite Queue

Hello!

I think that "could not be fetched or created" hints that some error should happen to get an exception.

Returning null if an object does not exist is a common pattern in Ignite API so I suspect this is what is the norm here.

Maybe I'm missing something?

Regards,
--
Ilya Kasnacheev


вт, 18 авг. 2020 г. в 00:22, Humphrey <[hidden email]>:
According to the documentation (java doc) of ignite.queue():
Will get a named queue from cache and create one if it has not been created
yet and cfg is not null. If queue is present already, queue properties will
not be changed. Use collocation for CacheMode.PARTITIONED caches if you have
lots of relatively small queues as it will make fetching, querying, and
iteration a lot faster. If you have few very large queues, then you should
consider turning off collocation as they simply may not fit in a single
node's memory.

Params:
name – Name of queue.
cap – Capacity of queue, 0 for unbounded queue. Ignored if cfg is null.
cfg – Queue configuration if new queue should be created.
Returns:
Queue with given properties.
Throws:
org.apache.ignite.IgniteException – If queue could not be fetched or
created.

But when getting an non existing queue without QueueConfiguration the queue
is null and no exception is thrown.



Documentation should say that it returns a Queue or Null, but it doesn't. It
says that it will throw an exception if the queue could not be fetched or
created, but it doesn't. It just returns null.




--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Humphrey Humphrey
Reply | Threaded
Open this post in threaded view
|

Re: Ignite Queue

Yes the common pattern is not documented. So was expecting if no exception is
thrown that I'm getting a queue and can put something on it. But then if I
don't check for null I'll get a NullpointerException.



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Humphrey Humphrey
Reply | Threaded
Open this post in threaded view
|

Re: Ignite Queue