[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

Re: [osgi-dev] OSGi connecting to SqlServer with Apache Aries

2018-12-09 Thread Tim Ward via osgi-dev
It sounds like you have done the right things, but my guess is that you don’t 
have a JDBC service implementation for SQLServer. H2 and Postgres have done the 
work to implement the OSGi standard (it’s pretty small), but quite a few other 
providers haven’t. 

You could either roll your own adapter in 100 lines of code, or grab one from 
Open Source, for example 
https://github.com/ops4j/org.ops4j.pax.jdbc/blob/master/pax-jdbc-mssql/pom.xml

This will register the DataSourceFactory service needed by Aries, and 
everything should work from there.

Best Regards,

Tim

Sent from my iPhone

> On 8 Dec 2018, at 18:05, Jim Rayburn via osgi-dev  
> wrote:
> 
> My environment is Eclipse and BND using Bndtools. I have an application, 
> providerapi, provider, persistenceapi and persistenceprovider bundles. I have 
> a configuration.json file in the application bundles 
> resource/OSGI-INF/configurator/ folder. I configured it to connect to a 
> postgres database. I provided eclipselink parameters in the persistence.xml 
> file to drop and create the database schema and tables. It all works using 
> the postgres database.
>  
> When I configure it to connect to a MS Sql Server (2012). I am using the 
> com.microsoft.sqlserver:mssql-jdbc:jar:7.1.3.jre8-preview bundle.
>  
> …
> "osgi.jdbc.driver.class": 
> "com.microsoft.sqlserver.jdbc.SqlServerDriver",
> "url": "jdbc:sqlserver://127.0.0.1:1433/db",
> …
>  
> I verified that I am using a sys_admin user so permissions should not be 
> causing an issue.
>  
> For postgres I see it using the zaxxer bundle (HikariPool) but I don’t get 
> the same output or even errors (that differ from accessing postgres) when 
> trying to connect to the SqlServer.
>  
> Thank you for any help you may be able to provide.
>  
> Jim
>  
> ___
> 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