You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by tinali612 <ti...@gmail.com> on 2013/08/13 05:06:36 UTC

default max threads for jax-rs in osgi bundle

Hi, 

I am using apache cxf 2.4.3 with servicemix 4.4.1. I'm trying to build a
rest service using jax-rs and deploy it as an osgi bundle. I'm concerned
about the maximum threads that I can have, is there any default value or it
depends on the memory heap? I have been searching cxf documents but couldn't
find an answer, thanks ahead! 

Here is my beans.xml: 
<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
  xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xmlns:util="http://www.springframework.org/schema/util"
  xmlns:jaxrs="http://cxf.apache.org/jaxrs"
xmlns:cxf="http://cxf.apache.org/core"
  xmlns:osgix="http://www.springframework.org/schema/osgi-compendium"
  xmlns:ctx="http://www.springframework.org/schema/context"


  xsi:schemaLocation="
      http://www.springframework.org/schema/jdbc
http://www.springframework.org/schema/jdbc/spring-jdbc-3.1.xsd
    http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
    http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
    http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-3.0.xsd
        http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
        http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
               http://www.springframework.org/schema/osgi-compendium 
              
http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd">

  <import resource="classpath:META-INF/cxf/cxf.xml" />
  <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />

  <context:property-placeholder
    location="classpath*:META-INF/spring/*.properties" />
  <context:annotation-config />
  <context:component-scan base-package="com.rest.test" />


  <bean name="create" class="com.rest.test.service.MktCreateUrl">
  </bean>
  <bean name="retrieve" class="com.rest.test.service.MktRetrieveUrl">
  </bean>

  <jaxrs:server id="rest-web-services" address="http://0.0.0.0:8282">
    <jaxrs:serviceBeans>
      <ref bean="create" />
      <ref bean="retrieve" />
    </jaxrs:serviceBeans>
  </jaxrs:server>
</beans>



--
View this message in context: http://cxf.547215.n5.nabble.com/default-max-threads-for-jax-rs-in-osgi-bundle-tp5732246.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: default max threads for jax-rs in osgi bundle

Posted by Freeman Fang <fr...@gmail.com>.
Hi,

What kind of thread you're talking about?

I assume it's transport level thread pool which can handle the incoming request, if so, you can configure it through jetty.

I noticed that you use address like

address="http://0.0.0.0:8282"
this will use standalone jetty transport which isn't recommended in OSGi container, in OSGi container you should use http-osgi transport(provided by OSGi http service), so change your address like
address="/myrest"
than you can invoke your service from url
http://localhost:8181/cxf/myrest 
with default SMX|CXF configuration.

And you can configure underlying jetty thread pool in $SMX_HOME/etc/jetty.xml
-------------
Freeman(Yue) Fang

Red Hat, Inc. 
FuseSource is now part of Red Hat
Web: http://fusesource.com | http://www.redhat.com/
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
http://blog.sina.com.cn/u/1473905042
weibo: @Freeman小屋



On 2013-8-13, at 上午11:06, tinali612 wrote:

> Hi, 
> 
> I am using apache cxf 2.4.3 with servicemix 4.4.1. I'm trying to build a
> rest service using jax-rs and deploy it as an osgi bundle. I'm concerned
> about the maximum threads that I can have, is there any default value or it
> depends on the memory heap? I have been searching cxf documents but couldn't
> find an answer, thanks ahead! 
> 
> Here is my beans.xml: 
> <?xml version="1.0" encoding="UTF-8"?>
> 
> <beans xmlns="http://www.springframework.org/schema/beans"
>  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:context="http://www.springframework.org/schema/context"
>  xmlns:jdbc="http://www.springframework.org/schema/jdbc"
> xmlns:util="http://www.springframework.org/schema/util"
>  xmlns:jaxrs="http://cxf.apache.org/jaxrs"
> xmlns:cxf="http://cxf.apache.org/core"
>  xmlns:osgix="http://www.springframework.org/schema/osgi-compendium"
>  xmlns:ctx="http://www.springframework.org/schema/context"
> 
> 
>  xsi:schemaLocation="
>      http://www.springframework.org/schema/jdbc
> http://www.springframework.org/schema/jdbc/spring-jdbc-3.1.xsd
>    http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
>    http://www.springframework.org/schema/context
> http://www.springframework.org/schema/context/spring-context-3.0.xsd
>    http://www.springframework.org/schema/util
> http://www.springframework.org/schema/util/spring-util-3.0.xsd
>        http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
>        http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
>               http://www.springframework.org/schema/osgi-compendium 
> 
> http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd">
> 
>  <import resource="classpath:META-INF/cxf/cxf.xml" />
>  <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
> 
>  <context:property-placeholder
>    location="classpath*:META-INF/spring/*.properties" />
>  <context:annotation-config />
>  <context:component-scan base-package="com.rest.test" />
> 
> 
>  <bean name="create" class="com.rest.test.service.MktCreateUrl">
>  </bean>
>  <bean name="retrieve" class="com.rest.test.service.MktRetrieveUrl">
>  </bean>
> 
>  <jaxrs:server id="rest-web-services" address="http://0.0.0.0:8282">
>    <jaxrs:serviceBeans>
>      <ref bean="create" />
>      <ref bean="retrieve" />
>    </jaxrs:serviceBeans>
>  </jaxrs:server>
> </beans>
> 
> 
> 
> --
> View this message in context: http://cxf.547215.n5.nabble.com/default-max-threads-for-jax-rs-in-osgi-bundle-tp5732246.html
> Sent from the cxf-user mailing list archive at Nabble.com.


Re: default max threads for jax-rs in osgi bundle

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi - this is something you may be able to control at SMX level, but I'm 
not sure
Cheers, Sergey
On 13/08/13 06:06, tinali612 wrote:
> Hi,
>
> I am using apache cxf 2.4.3 with servicemix 4.4.1. I'm trying to build a
> rest service using jax-rs and deploy it as an osgi bundle. I'm concerned
> about the maximum threads that I can have, is there any default value or it
> depends on the memory heap? I have been searching cxf documents but couldn't
> find an answer, thanks ahead!
>
> Here is my beans.xml:
> <?xml version="1.0" encoding="UTF-8"?>
>
> <beans xmlns="http://www.springframework.org/schema/beans"
>    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:context="http://www.springframework.org/schema/context"
>    xmlns:jdbc="http://www.springframework.org/schema/jdbc"
> xmlns:util="http://www.springframework.org/schema/util"
>    xmlns:jaxrs="http://cxf.apache.org/jaxrs"
> xmlns:cxf="http://cxf.apache.org/core"
>    xmlns:osgix="http://www.springframework.org/schema/osgi-compendium"
>    xmlns:ctx="http://www.springframework.org/schema/context"
>
>
>    xsi:schemaLocation="
>        http://www.springframework.org/schema/jdbc
> http://www.springframework.org/schema/jdbc/spring-jdbc-3.1.xsd
>      http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
>      http://www.springframework.org/schema/context
> http://www.springframework.org/schema/context/spring-context-3.0.xsd
>      http://www.springframework.org/schema/util
> http://www.springframework.org/schema/util/spring-util-3.0.xsd
>          http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
>          http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
>                 http://www.springframework.org/schema/osgi-compendium
>
> http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd">
>
>    <import resource="classpath:META-INF/cxf/cxf.xml" />
>    <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
>
>    <context:property-placeholder
>      location="classpath*:META-INF/spring/*.properties" />
>    <context:annotation-config />
>    <context:component-scan base-package="com.rest.test" />
>
>
>    <bean name="create" class="com.rest.test.service.MktCreateUrl">
>    </bean>
>    <bean name="retrieve" class="com.rest.test.service.MktRetrieveUrl">
>    </bean>
>
>    <jaxrs:server id="rest-web-services" address="http://0.0.0.0:8282">
>      <jaxrs:serviceBeans>
>        <ref bean="create" />
>        <ref bean="retrieve" />
>      </jaxrs:serviceBeans>
>    </jaxrs:server>
> </beans>
>
>
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/default-max-threads-for-jax-rs-in-osgi-bundle-tp5732246.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>