Re: [osgi-dev] PushStream Question

2018-12-10 Thread Clément Delgrange via osgi-dev
Thanks Tim for your help, I will raise the bug.

--
Clément Delgrange 

‐‐‐ Original Message ‐‐‐
On Monday 10 December 2018 12:52, Tim Ward  wrote:

> Hi Clément,
>
> You should raise a bug about the JavaDoc/implementation inconsistency in the 
> OSGi bugzilla. The StackOverflow question is now answered, hopefully to your 
> satisfaction.
>
> Best Regards,
>
> Tim
>
>> On 9 Dec 2018, at 21:35, Clément Delgrange via osgi-dev 
>>  wrote:
>>
>> Hi all,
>>
>> I have two questions related to the OSGi PushStream implementation. The 
>> first one is on 
>> [Stackoverflow.com](https://stackoverflow.com/questions/53692861/osgi-pushstream-is-slow);
>>  the second is the publish method of the SimplePushEventSource says that it 
>> throws a IllegalStateException if the source is closed:
>>
>>> /**
>>> * Asynchronously publish an event to this stream and all connected
>>> * {@link PushEventConsumer} instances. When this method returns there is no
>>> * guarantee that all consumers have been notified. Events published by a
>>> * single thread will maintain their relative ordering, however they may be
>>> * interleaved with events from other threads.
>>> *
>>> * @param t
>>> * @throws IllegalStateException if the source is closed
>>> */
>>>  void publish(T t);
>>
>> But in the implementation it only returns:
>>
>>> @Override
>>> public void publish(T t) {
>>> enqueueEvent(PushEvent.data(t));
>>> }
>>>
>>> private void enqueueEvent(PushEvent event) {
>>> synchronized (lock) {
>>> if (closed || connected.isEmpty()) {
>>> return;
>>> }
>>> }
>>>
>>> try {
>>> queuePolicy.doOffer(queue, event);
>>> boolean start;
>>> synchronized (lock) {
>>> start = !waitForFinishes && semaphore.tryAcquire();
>>>}
>>>if (start) {
>>>   startWorker();
>>>}
>>>} catch (Exception e) {
>>>close(PushEvent.error(e));
>>>throw new IllegalStateException("The queue policy threw an 
>>> exception", e);
>>>   }
>>> }
>>
>> When the exception is thrown? I have tested with the following code:
>>
>>> source.close();
>>> source.publish( 1 );
>>
>> and effectively it only returns.
>>
>> Thanks
>> --
>> Clément Delgrange 
>>
>> ___
>> OSGi Developer Mail List
>> osgi-dev@mail.osgi.org
>> https://mail.osgi.org/mailman/listinfo/osgi-dev___
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

Re: [osgi-dev] PushStream Question

2018-12-10 Thread Tim Ward via osgi-dev
Hi Clément,

You should raise a bug about the JavaDoc/implementation inconsistency in the 
OSGi bugzilla. The StackOverflow question is now answered, hopefully to your 
satisfaction.

Best Regards,

Tim

> On 9 Dec 2018, at 21:35, Clément Delgrange via osgi-dev 
>  wrote:
> 
> Hi all,
> 
> I have two questions related to the OSGi PushStream implementation. The first 
> one is on Stackoverflow.com 
> ; the 
> second is the publish method of the SimplePushEventSource says that it throws 
> a IllegalStateException if the source is closed:
> 
> /**
> * Asynchronously publish an event to this stream and all connected
> * {@link PushEventConsumer} instances. When this method returns there is no
> * guarantee that all consumers have been notified. Events published by a
> * single thread will maintain their relative ordering, however they may be
> * interleaved with events from other threads.
> *
> * @param t
> * @throws IllegalStateException if the source is closed
> */
>  void publish(T t);
> 
> But in the implementation it only returns:
> @Override
> public void publish(T t) {
> enqueueEvent(PushEvent.data(t));
> }
> 
> private void enqueueEvent(PushEvent event) {
> synchronized (lock) {
> if (closed || connected.isEmpty()) {
> return;
> }
> }
> 
> try {
> queuePolicy.doOffer(queue, event);
> boolean start;
> synchronized (lock) {
> start = !waitForFinishes && semaphore.tryAcquire();
>}
>if (start) {
>   startWorker();
>}
>} catch (Exception e) {
>close(PushEvent.error(e));
>throw new IllegalStateException("The queue policy threw an exception", 
> e);
>   }
> }
> 
> When the exception is thrown? I have tested with the following code:
> 
> source.close();
> source.publish( 1 );
> 
> and effectively it only returns. 
> 
> Thanks
> --
> Clément Delgrange  >
> 
> 
> ___
> OSGi Developer Mail List
> osgi-dev@mail.osgi.org
> https://mail.osgi.org/mailman/listinfo/osgi-dev

___
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

[osgi-dev] PushStream Question

2018-12-09 Thread Clément Delgrange via osgi-dev
Hi all,

I have two questions related to the OSGi PushStream implementation. The first 
one is on 
[Stackoverflow.com](https://stackoverflow.com/questions/53692861/osgi-pushstream-is-slow);
 the second is the publish method of the SimplePushEventSource says that it 
throws a IllegalStateException if the source is closed:

> /**
> * Asynchronously publish an event to this stream and all connected
> * {@link PushEventConsumer} instances. When this method returns there is no
> * guarantee that all consumers have been notified. Events published by a
> * single thread will maintain their relative ordering, however they may be
> * interleaved with events from other threads.
> *
> * @param t
> * @throws IllegalStateException if the source is closed
> */
>  void publish(T t);

But in the implementation it only returns:

> @Override
> public void publish(T t) {
> enqueueEvent(PushEvent.data(t));
> }
>
> private void enqueueEvent(PushEvent event) {
> synchronized (lock) {
> if (closed || connected.isEmpty()) {
> return;
> }
> }
>
> try {
> queuePolicy.doOffer(queue, event);
> boolean start;
> synchronized (lock) {
> start = !waitForFinishes && semaphore.tryAcquire();
>}
>if (start) {
>   startWorker();
>}
>} catch (Exception e) {
>close(PushEvent.error(e));
>throw new IllegalStateException("The queue policy threw an exception", 
> e);
>   }
> }

When the exception is thrown? I have tested with the following code:

> source.close();
> source.publish( 1 );

and effectively it only returns.

Thanks
--
Clément Delgrange ___
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev