我已经在 tomcat 中部署了应用程序,并且有很多线程很忙,没有像这样释放超过 700 个线程。
我捕获了文件位于 ufile.io/8zz1t 上的 thead 转储,我使用 fastthread.io阅读。你能检查一下你是否看到问题吗,我看到充气机有消耗 cpu 的线程。
S 188063346 ms 0 KB 0 KB 10.162.3.36 172.30.100.163 POST /ChiperService/rest/cs/Descifrar HTTP/1.1
S 280064346 ms 0 KB 0 KB 10.162.3.36 172.30.100.163 POST /ChiperService/rest/cs/Descifrar HTTP/1.1
S 185431144 ms 0 KB 0 KB 10.162.38.201 172.30.100.163 POST /ChiperService/rest/cs/Descifrar HTTP/1.1
S 267094596 ms 0 KB 0 KB 10.162.3.36 172.30.100.163 POST /ChiperService/rest/cs/Descifrar HTTP/1.1
S 261396699 ms 0 KB 0 KB 10.162.3.36 172.30.100.163 POST /ChiperService/rest/cs/Descifrar HTTP/1.1
这段代码的哪一部分会导致线程忙?我不知道放气器或充气器是否必须关闭。
在应用程序 ChiperService 的 tomcat 管理器中没有 Activity session 。
请帮助服务器在一天中崩溃了将近 5 次,因为 thead 繁忙和高 cpu 消耗。
这是休息服务:
package ChiperServicePkg;
import com.sun.jersey.api.core.ResourceConfig;
import java.io.IOException;
import javax.ws.rs.core.Context;
import javax.ws.rs.POST;
import javax.ws.rs.PathParam;
import javax.ws.rs.Path;
import javax.ws.rs.core.Response;
import principal.allus.com.co.SBCCypherModuleMain;
/**
* REST Web Service
*
* @author 1017200731
*/
@Path("/cs")
public class CiphersResource {
@Context ResourceConfig Config;
/**
* Creates a new instance of CiphersResource
*/
public CiphersResource() {
}
/**
*
* @param UUI
* @return
* @throws Exception
*/
@POST
@Path("Cifrar")
public String Cifrar(String UUI) throws Exception
{
String Key = (String) Config.getProperty("KeyCipher");
String dataEncrypted = null;
try
{
dataEncrypted= SBCCypherModuleMain.cifrar(UUI,Key );
}
catch(Exception ex)
{
if (ex instanceof IOException){
throw new IOException(ex);
}
else{
throw ex;
}
}
return dataEncrypted;
}
/**
*
* @param dataEncrypted
* @return
* @throws Exception
*/
@POST
@Path("Descifrar")
public Response Descifrar(String dataEncrypted) throws Exception
{
String Key = (String) Config.getProperty("KeyCipher");
String dataDecrypted= "";
try
{
dataDecrypted= SBCCypherModuleMain.descifrar(dataEncrypted, Key);
}
catch(Exception ex)
{
return Response.status(Response.Status.INTERNAL_SERVER_ERROR)
.entity(ex.getMessage()).type("text/plain").build();
}
return Response.ok(dataDecrypted).build();
}
/**
* Sub-resource locator method for {id}
*/
@Path("{id}")
public CipherResource getCipherResource(@PathParam("id") String id) {
return CipherResource.getInstance(id);
}
Descifrar 方法调用客户端提供的 jar,使用反编译器我可以提取以下代码:
public static String descifrar(String bytes, String llave)
throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException, Exception
{
byte[] vector = null;
String retorno = "";
retorno = SBCCypherModuleCompress.descomprimir(SBCCypherModuleCypher.descifrar(bytes, llave.substring(0, 16)));
return retorno;
}
SBCCypherModuleCompress 类如下:
public class SBCCypherModuleCompress
{
public static String comprimir(byte[] data)
throws IOException, Exception
{
BASE64Encoder b64e = new BASE64Encoder();
byte[] output = null;
String salida = "";
Deflater deflater = new Deflater();
deflater.setInput(data);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(data.length);
deflater.finish();
byte[] buffer = new byte['?'];
while (!deflater.finished())
{
int count = deflater.deflate(buffer);
outputStream.write(buffer, 0, count);
}
outputStream.close();
output = outputStream.toByteArray();
salida = b64e.encode(output);
return salida;
}
public static String descomprimir(String data)
throws DataFormatException, IOException, Exception
{
BASE64Encoder b64e = new BASE64Encoder();
BASE64Decoder b64d = new BASE64Decoder();
byte[] output = null;
String salida = "";
byte[] datad = null;
datad = b64d.decodeBuffer(data);
Inflater inflater = new Inflater();
inflater.setInput(datad);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(datad.length);
byte[] buffer = new byte['?'];
while (!inflater.finished())
{
int count = inflater.inflate(buffer);
outputStream.write(buffer, 0, count);
}
outputStream.close();
output = outputStream.toByteArray();
salida = b64e.encode(output);
return new String(output);
}
}
SBCCypherModuleCypher 类如下:
public class SBCCypherModuleCypher
{
public static String cifrar(String vector, String llaveSimetrica)
throws NoSuchAlgorithmException, InvalidKeyException, NoSuchPaddingException, IllegalBlockSizeException, BadPaddingException, Exception
{
BASE64Encoder b64e = new BASE64Encoder();
BASE64Decoder b64d = new BASE64Decoder();
byte[] datad = null;
String salida = "";
datad = b64d.decodeBuffer(vector);
SecretKeySpec key = new SecretKeySpec(llaveSimetrica.getBytes(), "AES");
byte[] campoCifrado = null;
Cipher cipher = Cipher.getInstance("AES");
cipher.init(1, key);
campoCifrado = cipher.doFinal(datad);
salida = b64e.encode(campoCifrado);
return salida;
}
public static String descifrar(String vector, String llaveSimetrica)
throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException, Exception
{
BASE64Encoder b64e = new BASE64Encoder();
BASE64Decoder b64d = new BASE64Decoder();
byte[] datad = null;
String salida = "";
datad = b64d.decodeBuffer(vector);
SecretKeySpec key = new SecretKeySpec(llaveSimetrica.getBytes(), "AES");
Cipher cipher = Cipher.getInstance("AES");
cipher.init(2, key);
byte[] datosDecifrados = cipher.doFinal(datad);
salida = b64e.encode(datosDecifrados);
return salida;
}
}
最佳答案
所有线程都在 SBCCypherModuleCompress.java 的第 92 行的 inflater.inflate(buffer) 中。
但是为什么要编写 new byte['?'] ?这是在下面的代码中:
byte[] buffer = new byte['?'];
while (!deflater.finished())
{
int count = deflater.deflate(buffer);
outputStream.write(buffer, 0, count);
}
还有下面的代码:
byte[] buffer = new byte['?'];
while (!inflater.finished())
{
int count = inflater.inflate(buffer);
outputStream.write(buffer, 0, count);
}
new byte['?'] 没有意义。
new byte[2048] 或者 new byte[8192] 可能比 new byte['?'] 更好。
关于java - Thread Busy apache tomcat解压数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53109004/
我主要使用Ruby来执行此操作,但到目前为止我的攻击计划如下:使用gemsrdf、rdf-rdfa和rdf-microdata或mida来解析给定任何URI的数据。我认为最好映射到像schema.org这样的统一模式,例如使用这个yaml文件,它试图描述数据词汇表和opengraph到schema.org之间的转换:#SchemaXtoschema.orgconversion#data-vocabularyDV:name:namestreet-address:streetAddressregion:addressRegionlocality:addressLocalityphoto:i
我真的很习惯使用Ruby编写以下代码:my_hash={}my_hash['test']=1Java中对应的数据结构是什么? 最佳答案 HashMapmap=newHashMap();map.put("test",1);我假设? 关于java-等价于Java中的RubyHash,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/22737685/
有时我需要处理键/值数据。我不喜欢使用数组,因为它们在大小上没有限制(很容易不小心添加超过2个项目,而且您最终需要稍后验证大小)。此外,0和1的索引变成了魔数(MagicNumber),并且在传达含义方面做得很差(“当我说0时,我的意思是head...”)。散列也不合适,因为可能会不小心添加额外的条目。我写了下面的类来解决这个问题:classPairattr_accessor:head,:taildefinitialize(h,t)@head,@tail=h,tendend它工作得很好并且解决了问题,但我很想知道:Ruby标准库是否已经带有这样一个类? 最佳
我正在尝试使用boilerpipe来自JRuby。我看过guide从JRuby调用Java,并成功地将它与另一个Java包一起使用,但无法弄清楚为什么同样的东西不能用于boilerpipe。我正在尝试基本上从JRuby中执行与此Java等效的操作:URLurl=newURL("http://www.example.com/some-location/index.html");Stringtext=ArticleExtractor.INSTANCE.getText(url);在JRuby中试过这个:require'java'url=java.net.URL.new("http://www
我只想对我一直在思考的这个问题有其他意见,例如我有classuser_controller和classuserclassUserattr_accessor:name,:usernameendclassUserController//dosomethingaboutanythingaboutusersend问题是我的User类中是否应该有逻辑user=User.newuser.do_something(user1)oritshouldbeuser_controller=UserController.newuser_controller.do_something(user1,user2)我
什么是ruby的rack或python的Java的wsgi?还有一个路由库。 最佳答案 来自Python标准PEP333:Bycontrast,althoughJavahasjustasmanywebapplicationframeworksavailable,Java's"servlet"APImakesitpossibleforapplicationswrittenwithanyJavawebapplicationframeworktoruninanywebserverthatsupportstheservletAPI.ht
我正在尝试使用Curbgem执行以下POST以解析云curl-XPOST\-H"X-Parse-Application-Id:PARSE_APP_ID"\-H"X-Parse-REST-API-Key:PARSE_API_KEY"\-H"Content-Type:image/jpeg"\--data-binary'@myPicture.jpg'\https://api.parse.com/1/files/pic.jpg用这个:curl=Curl::Easy.new("https://api.parse.com/1/files/lion.jpg")curl.multipart_form_
无论您是想搭建桌面端、WEB端或者移动端APP应用,HOOPSPlatform组件都可以为您提供弹性的3D集成架构,同时,由工业领域3D技术专家组成的HOOPS技术团队也能为您提供技术支持服务。如果您的客户期望有一种在多个平台(桌面/WEB/APP,而且某些客户端是“瘦”客户端)快速、方便地将数据接入到3D应用系统的解决方案,并且当访问数据时,在各个平台上的性能和用户体验保持一致,HOOPSPlatform将帮助您完成。利用HOOPSPlatform,您可以开发在任何环境下的3D基础应用架构。HOOPSPlatform可以帮您打造3D创新型产品,HOOPSSDK包含的技术有:快速且准确的CAD
本教程将在Unity3D中混合Optitrack与数据手套的数据流,在人体运动的基础上,添加双手手指部分的运动。双手手背的角度仍由Optitrack提供,数据手套提供双手手指的角度。 01 客户端软件分别安装MotiveBody与MotionVenus并校准人体与数据手套。MotiveBodyMotionVenus数据手套使用、校准流程参照:https://gitee.com/foheart_1/foheart-h1-data-summary.git02 数据转发打开MotiveBody软件的Streaming,开始向Unity3D广播数据;MotionVenus中设置->选项选择Unit
文章目录一、概述简介原理模块二、配置Mysql使用版本环境要求1.操作系统2.mysql要求三、配置canal-server离线下载在线下载上传解压修改配置单机配置集群配置分库分表配置1.修改全局配置2.实例配置垂直分库水平分库3.修改group-instance.xml4.启动监听四、配置canal-adapter1修改启动配置2配置映射文件3启动ES数据同步查询所有订阅同步数据同步开关启动4.验证五、配置canal-admin一、概述简介canal是Alibaba旗下的一款开源项目,Java开发。基于数据库增量日志解析,提供增量数据订阅&消费。Git地址:https://github.co