小编Fri*_*izz的帖子

什么是Apache Karaf?

我对Apache Karaf究竟是什么感到有些困惑.

你能否说Apache Karaf包含以下内容:

  • Apache Felix(这是OSGi 4.2框架的一个实现)
  • Apache Aries(蓝图标准的实现)

osgi apache-felix apache-karaf aries

64
推荐指数
2
解决办法
5万
查看次数

OSGi:Blueprint vs. Spring DM

我对Blueprint和Spring DM有点困惑:

从我的想法是真的:

  • Spring DM是Spring Source定义的框架
  • 蓝图是OSGi联盟定义的框架
  • Blueprint已经从Spring DM中"获取"了许多想法

没有?

我们可以期望这两个框架在未来成为一个(合并)吗?如果没有,哪一个将是最具前瞻性的?

osgi blueprint spring-dm

36
推荐指数
4
解决办法
2万
查看次数

Docker:组合多个图像

Docker可以将两个图像组合成一个吗?

像这样:

genericA --
            \
             ---> specificAB
            /
genericB --
Run Code Online (Sandbox Code Playgroud)

例如,有一个Java图像和一个MySQL图像.

我想要一个带有Java MySQL 的图像.

java mysql linux docker

25
推荐指数
2
解决办法
9242
查看次数

Apache Spark如何了解HDFS数据节点?

想象一下,我在HDFS托管的文件上做了一些Spark操作.像这样的东西:

var file = sc.textFile("hdfs://...")
val items = file.map(_.split('\t'))
...
Run Code Online (Sandbox Code Playgroud)

因为在Hadoop世界中,代码应该放在数据所在的位置,对吧?

所以我的问题是:Spark工作人员如何知道HDFS数据节点?Spark如何知道执行代码的数据节点?

hadoop hdfs apache-spark

17
推荐指数
1
解决办法
4854
查看次数

Maven - 具有不同版本的传递依赖项

  • 让我们假设我的应用程序需要foo.jarbar.jar
  • foo.jar 需要版本1.0的 c.jar
  • bar.jar 需要版本2.0的 c.jar

Maven如何解决这场冲突?c.jar将使用哪个版本?

version maven transitive-dependency

15
推荐指数
1
解决办法
3697
查看次数

条件弹簧配置

是否可以在Spring配置中使用条件表达式?

例如,我想定义两个不同的连接器,如下所示:

连接器1:

<spring:bean id="MyConnector" class="org.test.provider.DBConnector">
    <spring:property name="host" value="${my.config.host}"/>
    <spring:property name="user" value="${my.config.user}"/>
    <spring:property name="password" value="${my.config.password}"/>
</spring:bean>
Run Code Online (Sandbox Code Playgroud)

连接器2:

<spring:bean id="MyConnector" class="org.test.provider.FileSystemConnector">
    <spring:property name="path" value="${my.config.path}"/>
</spring:bean>
Run Code Online (Sandbox Code Playgroud)

然后,稍后使用以下其中一个:

<spring:bean id="LookupCommand" class="org.test.lookup.LookupCommand"
    scope="prototype">
    <spring:property name="connector" ref="MyConnector"/>
</spring:bean>
Run Code Online (Sandbox Code Playgroud)

根据${my.config.connectorType}我的.cfg文件,我想选择/激活其中一个:

if ${my.config.connectorType} == DB then

    <spring:bean id="MyConnector" class="org.test.provider.DBConnector">
        <spring:property name="host" value="${my.config.host}"/>
        <spring:property name="user" value="${my.config.user}"/>
        <spring:property name="password" value="${my.config.password}"/>
    </spring:bean>

else

    <spring:bean id="MyConnector" class="org.test.provider.FileSystemConnector">
        <spring:property name="path" value="${my.config.path}"/>
    </spring:bean>
end
...
<spring:bean id="LookupCommand" class="org.test.lookup.LookupCommand"
    scope="prototype">
    <spring:property name="connector" ref="MyConnector"/>
</spring:bean>
Run Code Online (Sandbox Code Playgroud)

java spring

12
推荐指数
2
解决办法
2万
查看次数

多线程执行,保留已完成工作项的顺序

我有一个工作单元流,我们称之为"工作项",按顺序处理(现在).我想通过多线程工作加快处理速度.

约束:这些工作项按特定顺序排列,在处理过程中订单不相关 - 但一旦处理完成,订单必须恢复.

像这样的东西:

   |.|
   |.|
   |4|
   |3|
   |2|    <- incoming queue
   |1|
  / | \
 2  1  3  <- worker threads
  \ | /
   |3|
   |2|    <- outgoing queue
   |1|
Run Code Online (Sandbox Code Playgroud)

我想在Java中解决这个问题,最好不要使用Executor Services,Futures等,而是使用基本的并发方法,如wait(),notify()等.

原因是:我的工作项目非常小且细粒度,它们在每个约0.2毫秒内完成处理.所以我担心使用来自java.util.concurrent.*的东西可能会引入很多开销并减慢我的代码速度.

到目前为止我发现的例子都保留了处理过程中的顺序(这与我的情况无关),并且在处理后并不关心顺序(在我的情况下这是至关重要的).

java concurrency performance multithreading java.util.concurrent

12
推荐指数
2
解决办法
653
查看次数

如何实施OAuth 2.0授权服务器?

我了解如何为客户端编写Running OAuth 2.0代码.

使用像Google这样的现有授权服务器似乎并不太复杂.

问题是:如何实现我自己的授权服务器?

由于许多公司拥有自己的用户/权限系统,基于LDAP(例如Active Directory)等 - 他们必须拥有自己的授权服务器.

是否有框架,库等?或者我是否必须从头开始编写代码?

authorization oauth-2.0

7
推荐指数
1
解决办法
2万
查看次数

XML模式/命名空间

我经常在XML模式文件中看到类似下面的代码.据我所知,xmlns是定义一个新的命名空间.但是,跟随xmlns的长URL是否真的有必要?我的意思是程序,解析器,还是真正调用的,例如"http://www.springframework.org/schema/beans"?或者这条线就像这样:

<beans xmlns="beansNamespace">
Run Code Online (Sandbox Code Playgroud)

这是其中之一

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:osgi="http://www.springframework.org/schema/osgi"
xsi:schemaLocation="
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
    http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd
    http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
    http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
"
>
Run Code Online (Sandbox Code Playgroud)

xml xsd xml-namespaces

4
推荐指数
1
解决办法
360
查看次数