小编Erk*_*rol的帖子

对象未在onPostExecute中的notify()之前被线程锁定

我尝试在onPostExecute中通知适配器的主类列表视图,但是我收到错误:java.lang.IllegalMonitorStateException:对象在notify()之前没有被线程锁定

@Override
protected void onPostExecute(String result) {
    popularfragment.adapter.notifyDataSetChanged();
    recentfragment.adapter.notifyDataSetChanged();
} 
Run Code Online (Sandbox Code Playgroud)

java multithreading android

41
推荐指数
1
解决办法
6万
查看次数

为什么具有相同选择器的两个 Kubernetes ReplicaSet 不会相互冲突?

副本集1

apiVersion: apps/v1
kind: ReplicaSet
metadata:
  labels:
    app: nginx
  name: rs-1
spec:
  replicas: 3
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
        version: 1.7.1
    spec:
      containers:
      - image: nginx:1.7.1
        name: nginx-1
      restartPolicy: Always
Run Code Online (Sandbox Code Playgroud)

副本集2

apiVersion: apps/v1
kind: ReplicaSet
metadata:
  labels:
    app: nginx
  name: rs-2
spec:
  replicas: 3
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
        version: 1.7.9
    spec:
      containers:
      - image: nginx:1.7.9
        name: nginx-1
      restartPolicy: Always
Run Code Online (Sandbox Code Playgroud)

当我创建这两个 ReplicaSet 时,其中一个会忽略另一个创建的 pod。

C02T30K2GTFM:ask erkanerol$ kubectl get pods --show-labels
NAME         READY …
Run Code Online (Sandbox Code Playgroud)

replicaset kubernetes

6
推荐指数
1
解决办法
1631
查看次数

如何编写相似字符的 JPQL 查询

我有一个查询从数据库中选择类似的实体。

\n\n
Query query = entityManager.createQuery("select c from Case c where c.lastName = :lastName");\n
Run Code Online (Sandbox Code Playgroud)\n\n

但我有一个问题。

\n\n

数据库中实体的“lastname”值为“SA\xc4\x9eLAM”,查询的参数为“SAGLAM”,反之亦然。所以查询没有给出实体。

\n\n

这种情况发生在 C/\xc3\x87、S/\xc5\x9e、G/\xc4\x9e、O/\xc3\x96、U/\xc3\x9c、I/\xc4\xb0 中。

\n\n

我怎么解决这个问题?我可以写一个正则表达式吗?

\n

regex hibernate jpa jpql

5
推荐指数
1
解决办法
1376
查看次数

如何使用Kubernetes在Mac版Docker中启用网络策略

有没有一种简单的方法可以Network PoliciesMacsingle-node k8s clusterDocker Desktop管理中启用?

kubernetes docker-for-mac kubernetes-networkpolicy docker-desktop

5
推荐指数
1
解决办法
135
查看次数

使用 JUnitParams 的 @FileParameters 时如何为参数赋予空值

我尝试使用 JUnitParamsRunner 的 FileParameters 注释。我不能给一个变量 null。代码和测试文件如下。

@RunWith(JUnitParamsRunner.class)
public class PasswordCheckerFileParameterizedTest {


    @Test
    @FileParameters("src/test/resources/testScenarios.csv")
    public void checkPasswordIsValid_checkMultipleCase(String password,boolean expectedResult){
        PasswordChecker passwordChecker = new PasswordChecker();
        assertEquals(expectedResult,passwordChecker.checkPasswordIsValid(password));
    }
}
Run Code Online (Sandbox Code Playgroud)

测试场景.csv

,false
sD1.,false
ssfdsdfsdf234.,false
SEWERWER234.,false
ssfdsdfsdSDFSDF.,false
ssfdsdfsdSDFSDF3234,false
ssfdsdfsdSDFSDF23.,true
Run Code Online (Sandbox Code Playgroud)

java junit junitparams

3
推荐指数
2
解决办法
3052
查看次数

io.netty.util.IllegalReferenceCountException:Netty中的refCnt:0

我尝试创建一个代理,然后传递Netty中的所有trafic其他处理程序.我知道我应该管理对ByteBuf的引用,但我无法理解如何做到这一点.我的例子和例外如下.

初始化:

public class HexDumpProxyInitializer extends ChannelInitializer<SocketChannel> {

    private final SslContext sslCtx;

    private final String remoteHost;

    private final int remotePort;

    public HexDumpProxyInitializer(SslContext sslCtx, String remoteHost, int remotePort) {
        this.remoteHost = remoteHost;
        this.remotePort = remotePort;
        this.sslCtx = sslCtx;
    }

    public HexDumpProxyInitializer(String remoteHost, int remotePort) {
        this.remoteHost = remoteHost;
        this.remotePort = remotePort;
        this.sslCtx = null;
    }

    @Override
    public void initChannel(SocketChannel ch) {
        ChannelPipeline p = ch.pipeline();
        if (sslCtx != null) {
            p.addLast(sslCtx.newHandler(ch.alloc()));
        }

        p.addLast(new HexDumpProxyFrontendHandler(remoteHost, remotePort));
        p.addLast(new InboundPrinterHandler());
    }
}
Run Code Online (Sandbox Code Playgroud)

HexDumpProxyFrontendHandler

public …
Run Code Online (Sandbox Code Playgroud)

java netty

3
推荐指数
1
解决办法
5364
查看次数