似乎Oracle的可用下载列表中没有32位下载包.
UPDATE
可以在这里下载:
wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/9+181/jdk-9_windows-x86_bin.exe
Run Code Online (Sandbox Code Playgroud) 我编写了一个用于回退的Appender并将日志保存到ElasticSearch中,然后将此appender添加到logback.xml.我将它应用到一个应用程序中,我从ES获取日志.
但是当我将它应用到另一个应用程序时,logback显示以下错误:
16:18:26,040 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [com.dcf.iqunxing.fx.dashcam.agent.log.appender.logback.DashcamAppender]
16:18:26,062 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [dashcamAppender]
16:18:26,078 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@110:12 - no applicable action for [encoder], current ElementPath is [[configuration][appender][encoder]]
16:18:26,080 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@111:13 - no applicable action for [Pattern], current ElementPath is [[configuration][appender][encoder][Pattern]]
Run Code Online (Sandbox Code Playgroud)
我的logback.xml是:
...
<appender name="dashcamAppender"
class="com.dcf.iqunxing.fx.dashcam.agent.log.appender.logback.DashcamAppender">
<encoder>
<Pattern>.%d{HH:mm:ss.SSS} [%thread] %-5level %logger{35} - %msg %n</Pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>TRACE</level>
</filter>
</appender>
...
Run Code Online (Sandbox Code Playgroud)
丢失一些动作(或如何添加它们)进行回溯?
我的 API 接收以下参数:
http://hostname/api?tag_1=<value1>&tag_2=<value2>
Run Code Online (Sandbox Code Playgroud)
所以我的 Servlet 看起来像:
protected doGet(HttpServletRequest req, HttpServletResponse resp) {
Map<Integer, String> paramMap = new HashMap<>();
Enumeration<String> en = req.getParameterNames();
while (en.hasMoreElements()) {
String name = en.nextElement();
if (name.startsWith("tag_")) {
paramMap.put(Integer.parseInt(name.substring(4)), req.getParameter(name));
}
}
...
}
Run Code Online (Sandbox Code Playgroud)
如何将 Swagger 集成到这个 Servlet 中?
据Javadoc说,
它仅在选择了至少一个通道后才会返回,此选择器的唤醒方法被调用,当前线程被中断,或者给定的超时时间到期,以先到者为准.
但有时它会在没有任何这四种情况下返回:
wakeup
不调用更新2016-03-15
在第392行和第402行的源代码中,我添加了一些日志:https: //github.com/xqbase/tuna/blob/debug/core/src/main/java/com/xqbase/tuna/ConnectorImpl.java
public boolean doEvents(long timeout) {
Log.v("Before Select: " + timeout);
int keySize;
try {
keySize = timeout == 0 ? selector.selectNow() :
timeout < 0 ? selector.select() : selector.select(timeout);
} catch (IOException e) {
throw new RuntimeException(e);
}
Set<SelectionKey> selectedKeys = selector.selectedKeys();
if (keySize == 0) {
Log.v("After Select(0): selectedKeys=" + selectedKeys.size() + ", " +
"interrupt=" + Thread.interrupted());
invokeQueue();
return false; …
Run Code Online (Sandbox Code Playgroud) 类似的问题请参阅:如何使HashMap与数组一起使用?
但我需要TreeMap ((int key1, int key2) -> String)
,key1
然后比较key2
.
我的解决方案是:
Map<int[], String> map = new TreeMap<>(Comparator.
<int[]>comparingInt(key -> key[0]).thenComparingInt(key -> key[1]));
Run Code Online (Sandbox Code Playgroud)
但是当我需要时((int key1, int key2, int key3) -> String
,我必须写更多.
有没有办法为任意长度的数组生成Comparator?
我正在使用 spring-boot 2.1.6 并且有一个 API 可以接受包含日期的表单,例如:
@Data
public class MyForm {
private LocalDate date;
...
}
@Controller
public class MyController {
@PostMapping("...")
public ResponseEntity<...> post(@RequestBody MyForm myForm) {
...
}
}
Run Code Online (Sandbox Code Playgroud)
默认情况下,spring MVC 接受这种 JSON 格式:
{
"date": [2020, 6, 17],
...
}
Run Code Online (Sandbox Code Playgroud)
所以在前端,我的 JavaScript 代码只是提交一个这样的表单,即 JS 会将日期转换为数组。
但是当我运行 spring-boot 测试时,这个序列化不起作用,代码如下:
private ObjectMapper mapper = new ObjectMapper();
@Autowired
private MockMvc mockMvc;
@Test
public void doTest() {
MyForm form = ...
MvcResult result = mockMvc.perform(MockMvcRequestBuilders.post("/...").
contentType("application/json").content(mapper.writeValueAsString(form)).andReturn();
...
}
Run Code Online (Sandbox Code Playgroud)
这是因为 Jackson 默认将 …
jmap帮助显示:
...
Run Code Online (Sandbox Code Playgroud)-dump:<dump-options> to dump java heap in hprof binary format dump-options: live dump only live objects; if not specified, all objects in the heap are dumped.
...
一旦我转储了一个 Tomcat(使用 java param -Xmx384m)堆:
jmap -dump:file=dump.bin <pid>
Run Code Online (Sandbox Code Playgroud)
我得到了一个 ~300M 的转储文件。
当我只用活动对象转储它的堆时:
jmap -dump:live,file=live-dump.bin <pid>
Run Code Online (Sandbox Code Playgroud)
我得到了一个 ~120M 的转储文件。
我对活动对象的猜测可能是:
年轻代中的对象;
已使用/引用/可访问且不会被收集的对象。
哪一个是对的?
更新
我的猜测 #2 似乎是正确的,感谢 Alexey Ragozin 的解释(live
选项将导致完整的 GC)。我按照他的提示再次测试:
jmap -dump:file=dump.hprof <pid>
jmap -dump:live,file=live-dump.hprof <pid>
jmap -dump:file=after-live-dump.hprof <pid>
Run Code Online (Sandbox Code Playgroud)
这 3 个文件的大小是:
dump.hprof ~190MB
live-dump.hprof …
Run Code Online (Sandbox Code Playgroud) 更新操作上的更改流事件仅返回更改的文档,与 oplog 相同。我可以在更新之前获取文档(或一些更新的值)吗?
MySQL 基于行的 binlog 可以使用完整的binlog_row_image 来完成此操作。
我无法找到直接的API(即总位数,以字节为单位的内存大小应该是total_bits / 8)。我发现的唯一方法是序列化为字节数组,但这可能会占用更多内存:
BloomFilter<String> bloomFilter = BloomFilter.create(Funnels.
stringFunnel(StandardCharsets.UTF_8), 100_000_000);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bloomFilter.writeTo(baos);
System.out.println(baos.toByteArray().length);
Run Code Online (Sandbox Code Playgroud)
有没有有效的方法来做到这一点?