参商

参商 查看完整档案

填写现居城市  |  填写毕业院校  |  填写所在公司/组织填写个人主网站
编辑
_ | |__ _ _ __ _ | '_ \| | | |/ _` | | |_) | |_| | (_| | |_.__/ \__,_|\__, | |___/ 个人简介什么都没有

个人动态

参商 提出了问题 · 2019-12-11

Elasticsearch 刷大量数据的时候,之前存在的数据,这时候更新,为什么不能查询到。

之前的数据找不到是不是因为它会把之前的数据删掉,然后再建立新的数据索引,这时候如果新数据的索引还没建立,那它就会查询不到。是这样的数据流程吗?

关注 2 回答 1

参商 提出了问题 · 2019-11-01

解决Rocketmq 消息拉取方式

Rocketmq 默认拉取消息方式采用长轮询,为什么不直接使用长连接?

关注 1 回答 1

参商 提出了问题 · 2019-06-17

通过动态编译的类,如何让spring扫描该类,能通过@Autowired依赖其它的类.

通过Javassist动态编译的类,想要通过@Autowired使用其它类的功能,或者使用spirng的其它注解共呢能,如事务注解.有办法实现吗?

关注 2 回答 1

参商 提出了问题 · 2019-05-24

java缓存行对齐

这是JDK在对象头后面自动填充的132个字节,却没有对value字段进行右填充.
图片描述

图片描述

这是我手动填充的,64字节大小的缓存行,不应该是左边填充56个字节,右边56个字节进行填充吗?
图片描述

关注 1 回答 0

参商 提出了问题 · 2018-04-27

mysql空间运算为什么有时会报错, 有时却可以.

st_contains(t1.`geometry_gaode`,ST_GEOMFROMTEXT('POINT(121.48553601066067 31.371318365167735)',4326));

加上4326参数之后,有时能成功,有时报错是什么原因?

图片描述

同样的sql,一字未改, 难道运行全靠脸?
报错提示:

Error Code: 3033. Binary geometry function st_contains given two geometries of different srids: 0 and 4326, which should have been identical.

关注 2 回答 0

参商 提出了问题 · 2018-03-30

解决JAVA正则

问题:输入两个任意整数的参数,如:88-3333,返回能匹配该范围所有数值的正则表达式.
起初看起来挺简单的问题,之后发现实现太过复杂(不确定对不对),有什么简约的方式?

关注 2 回答 1

参商 提出了问题 · 2018-02-02

解决docker 容器无法连接宿主机服务

在宿主机上运行 netty 源代码中的 EchoServer, 然后运行一个容器, 配置端口, 安装好 telnet, 通过 telnet 无法访问到 宿主机.
图片描述

测试发现, 容器可以 ping 宿主机 172.17.0.1, 宿主机 ping 不了容器.

容器配置如下:
图片描述

图片描述

有什么办法能够使 docker 容器访问宿主机的 EchoServer?

关注 3 回答 1

参商 提出了问题 · 2018-01-15

解决处理IO时,如何定义缓冲区大小?

public static int KB = 1024;
public static int MB = 1024 * KB;

private static final int CAPACITY_SMALL  =   4  * KB;
private static final int CAPACITY_MEDIUM = 128  * KB;
private static final int CAPACITY_LARGE  = 1024 * KB;

//package scope (default) - so they can be accessed from unit tests.
byte[]  smallMessageBuffer  = new byte[1024 *   4 * KB];   //1024 x   4KB messages =  4MB.
byte[]  mediumMessageBuffer = new byte[128  * 128 * KB];   // 128 x 128KB messages = 16MB.
byte[]  largeMessageBuffer  = new byte[16   *   1 * MB];   //  16 *   1MB messages = 16MB.

经常看见缓存的大小都是以位的大小定义,是因为习惯,还是因为什么原因?在实际项目中是否有什么策略根据自己需求来定义最优的值来处理IO?

关注 3 回答 2

参商 提出了问题 · 2017-11-09

解决Java栈信息

private static final String FQCN = Util.class.getName();

StackTraceElement[] stack = new Throwable().getStackTrace();
String sourceClassName = null;
String sourceMethodName = null;
boolean found = false;
for (StackTraceElement element : stack) {
    String className = element.getClassName();
    if (FQCN.equals(className)) {
        found = true;
    } else if (found) {
        sourceClassName = className;
        sourceMethodName = element.getMethodName();
        break;
    }
}
setSourceClassName(sourceClassName);
setSourceMethodName(sourceMethodName);

StackTraceElement[] stack = new Throwable().getStackTrace();
String sourceClassName = null;
String sourceMethodName = null;
for (StackTraceElement element : stack) {
    String className = element.getClassName();
    if (FQCN.equals(className)) {
        sourceClassName = className;
        sourceMethodName = element.getMethodName();
        break;
    }
}
setSourceClassName(sourceClassName);
setSourceMethodName(sourceMethodName);

这两段代码在意义上有什么区别?第一段代码,如果只有当前类的话,不永远进不了第二个判断里面,这样有做的意义在哪里?

关注 2 回答 1

参商 提出了问题 · 2017-09-27

使用httpClient上传二进制文件时出现异常

用httpClient做了一个文件上传的请求,奇怪的是有些文件会出现该异常:

org.apache.http.NoHttpResponseException: x.x.x.x failed to respond
    at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:141)
    at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:56)
    at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:259)
    at org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:163)
    at org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:165)
    at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:273)
    at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125)
    at com.codahale.metrics.httpclient.InstrumentedHttpRequestExecutor.execute(InstrumentedHttpRequestExecutor.java:44)
    at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:272)
    at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185)
    at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
    at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:111)
    at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:72)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:221)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:165)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:140)
    at net.yto.rendu.module.util.TFSUtils.write(TFSUtils.java:93)
    at net.yto.rendu.module.util.TFSUtils.imageUpload(TFSUtils.java:55)
    at net.yto.rendu.module.qas.exception.server.service.impl.ErrorInfoService.addErrorInfo(ErrorInfoService.java:145)
    at net.yto.rendu.module.qas.exception.server.service.impl.ErrorInfoService$$FastClassBySpringCGLIB$$fbb928.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:721)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
    at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
    at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:656)
    at net.yto.rendu.module.qas.exception.server.service.impl.ErrorInfoService$$EnhancerBySpringCGLIB$$b09cf7b0.addErrorInfo(<generated>)
    at net.yto.rendu.module.qas.exception.server.controller.ErrorInfoController.errorInfoAdd(ErrorInfoController.java:119)
    at net.yto.rendu.module.qas.exception.server.controller.ErrorInfoController$$FastClassBySpringCGLIB$$4cdb21ac.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:721)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:173)
    at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:656)
    at net.yto.rendu.module.qas.exception.server.controller.ErrorInfoController$$EnhancerBySpringCGLIB$$aa1f29d3.errorInfoAdd(<generated>)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133)
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:116)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.springframework.boot.web.filter.ApplicationContextHeaderFilter.doFilterInternal(ApplicationContextHeaderFilter.java:55)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at net.yto.framework.log.filter.LogFilter.doFilterInternal(LogFilter.java:96)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at net.yto.framework.web.filter.DefaultFilter.doFilter(DefaultFilter.java:22)
    at net.yto.framework.web.filter.FrameworkFilter.doFilter(FrameworkFilter.java:129)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:123)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.jasig.cas.client.util.AssertionThreadLocalFilter.doFilter(AssertionThreadLocalFilter.java:50)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.jasig.cas.client.util.HttpServletRequestWrapperFilter.doFilter(HttpServletRequestWrapperFilter.java:71)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.springframework.boot.actuate.trace.WebRequestTraceFilter.doFilterInternal(WebRequestTraceFilter.java:108)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:105)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.springframework.session.web.http.SessionRepositoryFilter.doFilterInternal(SessionRepositoryFilter.java:167)
    at org.springframework.session.web.http.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:80)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.springframework.cloud.sleuth.instrument.web.TraceFilter.doFilter(TraceFilter.java:145)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.springframework.boot.actuate.autoconfigure.MetricsFilter.doFilterInternal(MetricsFilter.java:106)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.springframework.boot.web.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:115)
    at org.springframework.boot.web.support.ErrorPageFilter.access$000(ErrorPageFilter.java:59)
    at org.springframework.boot.web.support.ErrorPageFilter$1.doFilterInternal(ErrorPageFilter.java:90)

代码:

HttpPost httpPost = new HttpPost(tfsUrl);
InputStream inputStream = new ByteArrayInputStream(buff);
InputStreamEntity reqEntity = new InputStreamEntity(inputStream);
reqEntity.setContentType("binary/octet-stream");
reqEntity.setChunked(true);
httpPost.setEntity(reqEntity);

String response = httpClient.execute(httpPost, new BasicResponseHandler()); // 这里会报异常(并不是所有文件都有)

用Postman测试过接口是没有问题的,找了很多原因,最终定位应该是httpClient做了什么处理导致有些字节处理请求并没有发送出去就报了这个异常.

关注 3 回答 2

认证与成就

  • 获得 6 次点赞
  • 获得 124 枚徽章 获得 7 枚金徽章, 获得 39 枚银徽章, 获得 78 枚铜徽章

擅长技能
编辑

(゚∀゚ )
暂时没有

开源项目 & 著作
编辑

(゚∀゚ )
暂时没有

注册于 2015-05-14
个人主页被 754 人浏览