{"id":331116,"date":"2022-03-27T15:00:10","date_gmt":"2022-03-27T15:00:10","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=331116"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=331116","title":{"rendered":"<span>\u041d\u0435\u043e\u0431\u044b\u0447\u043d\u0430\u044f Java: StackTrace Extends\u00a0Throwable<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h4>\u041f\u0440\u043e\u0447\u0442\u0438\u0442\u0435 \u044d\u0442\u0443 \u0441\u0442\u0430\u0442\u044c\u044e \u0438 \u0443\u0437\u043d\u0430\u0439\u0442\u0435 \u043e \u043d\u0435\u043e\u0431\u044b\u0447\u043d\u044b\u0445 \u0432\u0435\u0449\u0430\u0445 \u0432 Java, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0443\u0434\u0438\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u043c\u0438.<\/h4>\n<p>\u0415\u0441\u0442\u044c \u0432\u0435\u0449\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0434\u0435\u043b\u0430\u0442\u044c \u0432 Java, \u043d\u043e \u0432\u044b \u0438\u0445 \u0440\u0435\u0434\u043a\u043e \u0432\u0438\u0434\u0438\u0442\u0435. \u0412 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u0432 \u043d\u0438\u0445 \u043d\u0435\u0442 \u0441\u043c\u044b\u0441\u043b\u0430.\u00a0\u041e\u0434\u043d\u0430\u043a\u043e \u0432 Java \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u043e\u0431\u044b\u0447\u043d\u044b\u0445 \u0432\u0435\u0449\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0443\u0434\u0438\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u043c\u0438.<\/p>\n<p><a href=\"https:\/\/chronicle.software\/\" rel=\"noopener noreferrer nofollow\">Chronicle Software<\/a>\u00a0\u043e\u0431\u044b\u0447\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0440\u044f\u0434 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432 \u0432 \u0441\u0432\u043e\u0438\u0445 \u043d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430\u0445, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u0435\u0442\u0441\u044f.<\/p>\n<p>\u041e\u0434\u0438\u043d \u0438\u0437 \u043d\u0438\u0445 \u2014 \u044d\u0442\u043e \u043a\u043b\u0430\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0435\u0442 Throwable, \u043d\u043e \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0448\u0438\u0431\u043a\u043e\u0439 \u0438\u043b\u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c.<\/p>\n<h2>StackTrace Extends Throwable<\/h2>\n<pre><code class=\"java\">package net.openhft.chronicle.core; \/** * Throwable created purely for the purposes of reporting a stack trace. * This is not an Error or an Exception and is not expected to be thrown or caught. *\/ public class StackTrace extends Throwable { \u00a0\u00a0\u00a0public StackTrace() { this(\"stack trace\"); } \u00a0\u00a0\u00a0public StackTrace(String message) { this(message, null); } \u00a0\u00a0\u00a0public StackTrace(String message, Throwable cause) { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0super(message + \" on \" + Thread.currentThread().getName(), cause); \u00a0\u00a0\u00a0}  \u00a0\u00a0\u00a0public static StackTrace forThread(Thread t) { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if (t == null) return null; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0StackTrace st = new StackTrace(t.toString()); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0StackTraceElement[] stackTrace = t.getStackTrace(); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0int start = 0; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if (stackTrace.length > 2) { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if (stackTrace[0].isNativeMethod()) { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0start++; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0} \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0} \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if (start > 0) { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0StackTraceElement[] ste2 = new StackTraceElement[stackTrace.length - start]; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0System.arraycopy(stackTrace, start, ste2, 0, ste2.length); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0stackTrace = ste2; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0st.setStackTrace(stackTrace); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return st; \u00a0\u00a0\u00a0} }<\/code><\/pre>\n<p>\u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u0430\u0436\u043d\u044b\u0435 \u043f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u044f, \u0447\u0442\u043e\u0431\u044b \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430: <\/p>\n<ul>\n<li>\n<p>\u042d\u0442\u043e \u043d\u0435 \u0442\u043e\u0442 \u043a\u043b\u0430\u0441\u0441 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u043e\u0435, \u043a\u0430\u043a \u044f \u00a0\u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u044e, \u043a\u043e\u0433\u0434\u0430-\u043b\u0438\u0431\u043e \u043c\u043e\u0436\u0435\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442\u044c. \u041a\u043b\u0430\u0441\u0441\u044b, \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u044e\u0449\u0438\u0435 Throwable, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0442\u0441\u044f, \u043a\u0430\u043a \u0438 Exception, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0432\u0430\u043c \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0442\u044c \u044d\u0442\u0443 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443. <\/p>\n<\/li>\n<li>\n<p>\u0422\u0440\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u043a\u0430 \u0441\u0442\u0435\u043a\u0430 Throwable \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 Throwable, \u0430 \u043d\u0435 \u0442\u0430\u043c, \u0433\u0434\u0435 \u043e\u043d\u0430 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442. \u041e\u0431\u044b\u0447\u043d\u043e \u044d\u0442\u043e \u043e\u0434\u043d\u0430 \u0438 \u0442\u0430 \u0436\u0435 \u0441\u0442\u0440\u043e\u043a\u0430, \u043d\u043e \u044d\u0442\u043e \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e. \u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u0440\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u043a\u0443 \u0441\u0442\u0435\u043a\u0430, Throwable \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435. <\/p>\n<\/li>\n<li>\n<p>\u041e\u0431\u044a\u0435\u043a\u0442\u044b \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0442\u0440\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u043a\u0438 \u0441\u0442\u0435\u043a\u0430 \u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u043e\u043d\u0438 \u043d\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u044e\u0442\u0441\u044f. \u0412\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043a \u0441\u0430\u043c\u043e\u043c\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u0443, \u0447\u0442\u043e\u0431\u044b \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c \u043d\u0430\u043a\u043b\u0430\u0434\u043d\u044b\u0435 \u0440\u0430\u0441\u0445\u043e\u0434\u044b, \u0430 \u043c\u0430\u0441\u0441\u0438\u0432 StackTraceElements \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438. <\/p>\n<\/li>\n<\/ul>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u044d\u0442\u043e\u0442 \u043a\u043b\u0430\u0441\u0441 \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e.\u00a0\u041a\u043b\u0430\u0441\u0441 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u0442\u0440\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u043a\u0443 \u0441\u0442\u0435\u043a\u0430, \u0433\u0434\u0435 \u043e\u043d \u0431\u044b\u043b \u0441\u043e\u0437\u0434\u0430\u043d, \u0442\u0430\u043a \u0438 \u043f\u043e\u0442\u043e\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0435\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u043b.\u00a0\u041f\u043e\u0437\u0436\u0435 \u0432\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u044d\u0442\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e.<\/p>\n<p>\u042d\u0442\u043e\u0442 \u043a\u043b\u0430\u0441\u0441 \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0442\u0440\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u043a\u0438 \u0441\u0442\u0435\u043a\u0430 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430.\u00a0<\/p>\n<p>\u0422\u0440\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u043a\u0430 \u0441\u0442\u0435\u043a\u0430 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430 \u0431\u0435\u0440\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e\u0433\u0434\u0430, \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u0442\u043e\u043a \u0434\u043e\u0441\u0442\u0438\u0433\u0430\u0435\u0442 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0438. \u042d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0442\u0438 \u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0432\u044b \u043f\u043e\u043f\u044b\u0442\u0430\u0435\u0442\u0435\u0441\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0435\u0433\u043e.\u00a0<\/p>\n<p>\u0421\u0432\u044f\u0437\u0430\u043d\u043e \u044d\u0442\u043e \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e JVM \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u043f\u043e\u0442\u043e\u043a, \u0438 \u043e\u0431\u044b\u0447\u043d\u043e JVM \u0436\u0434\u0443\u0442, \u0447\u0442\u043e\u0431\u044b \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u043f\u043e\u0442\u043e\u043a, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0441\u0442\u0435\u043a \u043f\u043e\u0442\u043e\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b \u043f\u044b\u0442\u0430\u0435\u0442\u0435\u0441\u044c \u0437\u0430\u0445\u0432\u0430\u0442\u0438\u0442\u044c. \u0422.\u0435. \u044d\u0442\u043e \u0438\u043c\u0435\u0435\u0442 \u0432\u044b\u0441\u043e\u043a\u0438\u0435 \u043d\u0430\u043a\u043b\u0430\u0434\u043d\u044b\u0435 \u0440\u0430\u0441\u0445\u043e\u0434\u044b, \u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u043c.<\/p>\n<h2>StackTrace \u043a\u0430\u043a \u043e\u0442\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u041c\u044b \u043d\u0435 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u043c, \u0447\u0442\u043e \u044d\u0442\u043e\u0442 Throwable \u043a\u043b\u0430\u0441\u0441 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u043d, \u043d\u043e \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u0438\u0447\u0438\u043d\u0443 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0432\u044b\u0437\u0432\u0430\u043d\u043e \u043f\u043e\u0437\u0436\u0435.<\/p>\n<h3>\u041f\u043e\u0447\u0435\u043c\u0443 \u0431\u044b\u043b \u0437\u0430\u043a\u0440\u044b\u0442 \u0440\u0435\u0441\u0443\u0440\u0441<\/h3>\n<pre><code class=\"java\">public class EgMain { \u00a0\u00a0\u00a0static class MyCloseable implements Closeable { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0protected transient volatile StackTrace closedHere;  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0@Override \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0public void close() { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0closedHere = new StackTrace(\"Closed here\"); \/\/ line 13  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0public void useThis() { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if (closedHere != null) \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0throw new IllegalStateException(\"Closed\", closedHere);  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}  \u00a0\u00a0}  \u00a0\u00a0\u00a0public static void main(String[] args) throws InterruptedException {\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0MyCloseable mc = new MyCloseable(); \/\/ line 27 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Thread t = new Thread(mc::close, \"closer\"); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0t.start(); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0t.join(); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0mc.useThis(); \u00a0\u00a0\u00a0} }<\/code><\/pre>\n<p>\u041f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043a\u043e\u0434 \u0432\u044b\u0434\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/308\/116\/abb\/308116abbd805c3be13a25ba85fd6b57.png\" width=\"2032\" height=\"290\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/308\/116\/abb\/308116abbd805c3be13a25ba85fd6b57.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041e\u0431\u044b\u0447\u043d\u043e \u0432\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 IllegalStateException \u0438 \u043c\u0435\u0441\u0442\u043e, \u0433\u0434\u0435 \u0432\u0430\u0448 \u043a\u043e\u0434 \u043f\u044b\u0442\u0430\u043b\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u043a\u0440\u044b\u0442\u044b\u0439 \u0440\u0435\u0441\u0443\u0440\u0441, \u043d\u043e \u044d\u0442\u043e \u043d\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u0432\u0430\u043c, \u043f\u043e\u0447\u0435\u043c\u0443 \u043e\u043d \u0431\u044b\u043b \u0437\u0430\u043a\u0440\u044b\u0442 \u0431\u0435\u0437 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438.<\/p>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 StackTrace \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f Throwable \u043a\u043b\u0430\u0441\u0441\u043e\u043c, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0435\u0433\u043e \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u0447\u0438\u043d\u044b \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0438\u043b\u0438 \u043e\u0448\u0438\u0431\u043a\u0438.\u00a0<\/p>\n<p>\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043f\u043e\u0442\u043e\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u043a\u0440\u044b\u043b \u0440\u0435\u0441\u0443\u0440\u0441. \u00a0\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0432\u044b \u0443\u0437\u043d\u0430\u0435\u0442\u0435, \u0447\u0442\u043e \u044d\u0442\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0438\u043b\u0438 \u043e\u0448\u0438\u0431\u043a\u0430 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e \u0432 \u0434\u0440\u0443\u0433\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u0435. \u0418 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0442\u0440\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u043a\u0443 \u0441\u0442\u0435\u043a\u0430 \u0441 \u043f\u0440\u0438\u0447\u0438\u043d\u043e\u0439, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043e\u043d \u0431\u044b\u043b \u0437\u0430\u043a\u0440\u044b\u0442.\u00a0\u042d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043c\u043e\u0447\u044c \u043e\u0447\u0435\u043d\u044c \u0431\u044b\u0441\u0442\u0440\u043e \u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0440\u0443\u0434\u043d\u043e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 \u043f\u0440\u0435\u0436\u0434\u0435\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u0435\u043c \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432.<\/p>\n<h3>\u041a\u0430\u043a\u043e\u0439 \u0440\u0435\u0441\u0443\u0440\u0441 \u0431\u044b\u043b \u0437\u0430\u043a\u0440\u044b\u0442?<\/h3>\n<p>\u0414\u043e\u043b\u0433\u043e\u0436\u0438\u0432\u0443\u0449\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b Closeable \u043c\u043e\u0433\u0443\u0442 \u0438\u043c\u0435\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u044b\u0439 \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u044b\u0439 \u0446\u0438\u043a\u043b, \u0438 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u0435 \u0438\u0445 \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u044f, \u043a\u043e\u0433\u0434\u0430 \u044d\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e, \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0442\u0440\u0443\u0434\u043d\u043e \u043e\u0442\u0441\u043b\u0435\u0434\u0438\u0442\u044c. \u0427\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u0443\u0442\u0435\u0447\u043a\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432.\u00a0<\/p>\n<p>\u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b \u043d\u0435 \u0443\u0434\u0430\u043b\u044f\u044e\u0442\u0441\u044f, \u043a\u043e\u0433\u0434\u0430 GC \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u0431\u044a\u0435\u043a\u0442 RandomAccessFile \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0430\u0435\u0442\u0441\u044f \u0432 GC \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0444\u0430\u0439\u043b\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u043d \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442, \u0438 \u043d\u0435 \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u043f\u043e\u043a\u0430 \u0432\u044b \u0435\u0433\u043e \u043d\u0435 \u0437\u0430\u043a\u0440\u043e\u0435\u0442\u0435, \u0447\u0442\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0443\u0442\u0435\u0447\u043a\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0445 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u043e\u0432.  <\/p>\n<pre><code class=\"java\">public class CreatedMain { \u00a0\u00a0\u00a0static class MyResource implements Closeable { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0private final transient StackTrace createdHere = new StackTrace(\"Created here\"); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0volatile transient boolean closed;  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0@Override \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0public void close() throws IOException { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0closed = true; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0@Override \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0protected void finalize() throws Throwable { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0super.finalize(); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if (!closed) \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Logger.getAnonymousLogger().log(Level.WARNING, \"Resource discarded but not closed\", createdHere); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0} \u00a0\u00a0\u00a0}  \u00a0\u00a0\u00a0public static void main(String[] args) throws InterruptedException { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0new MyResource(); \/\/ line 27 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0System.gc(); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Thread.sleep(1000); \u00a0\u00a0\u00a0} }<\/code><\/pre>\n<p>\u041a\u043e\u0434 \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/bcd\/127\/798\/bcd1277989f39ee24c857f4cd7ba9274.png\" width=\"1500\" height=\"292\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/bcd\/127\/798\/bcd1277989f39ee24c857f4cd7ba9274.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0427\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u0430\u043c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u0438\u0434\u0435\u0442\u044c, \u0433\u0434\u0435 \u0431\u044b\u043b \u0441\u043e\u0437\u0434\u0430\u043d \u0440\u0435\u0441\u0443\u0440\u0441, \u0447\u0442\u043e \u0434\u0430\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c, \u043f\u043e\u0447\u0435\u043c\u0443 \u043e\u043d \u043d\u0435 \u0431\u044b\u043b \u0437\u0430\u043a\u0440\u044b\u0442, \u043d\u043e \u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u0435\u0441\u0442\u0438 \u043b\u043e\u0433 \u0442\u0430\u043a, \u043a\u0430\u043a \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442 \u0432\u0430\u0448\u0430 IDE. \u042d\u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u0432\u0430\u0448 \u043e\u0431\u044a\u0435\u043a\u0442 Logger \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u0432\u044b\u0434\u0430\u0447\u0443 \u0442\u0440\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u043a\u0438 \u0441\u0442\u0435\u043a\u0430.\u00a0\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043a\u043b\u0438\u043a\u043d\u0443\u0442\u044c \u043f\u043e \u043d\u043e\u043c\u0435\u0440\u0443 \u0441\u0442\u0440\u043e\u043a\u0438, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043a\u043e\u0434, \u0441\u043e\u0437\u0434\u0430\u0432\u0448\u0438\u0439 \u0435\u0435.<\/p>\n<h2>\u041c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430 \u0432 \u0440\u0430\u0431\u043e\u0447\u0435\u0439 \u0441\u0440\u0435\u0434\u0435<\/h2>\n<p>\u0412 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u0440\u0435\u0434\u0430\u0445 \u0432\u0430\u043c \u043d\u0443\u0436\u0435\u043d \u0441\u043f\u043e\u0441\u043e\u0431 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u043a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0432 \u0440\u0430\u0431\u043e\u0447\u0435\u0439 \u0441\u0440\u0435\u0434\u0435 \u0441 \u043d\u0438\u0437\u043a\u0438\u043c\u0438 \u0438\u0437\u0434\u0435\u0440\u0436\u043a\u0430\u043c\u0438 \u0431\u0435\u0437 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0430.\u00a0<\/p>\n<p>\u042d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f, \u0432\u043a\u043b\u044e\u0447\u0438\u0432 \u0441\u0432\u043e\u0439 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c \u0442\u0440\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u043a\u0443 \u0441\u0442\u0435\u043a\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e\u0433\u0434\u0430, \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u0435\u0432\u044b\u0448\u0435\u043d \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0440\u043e\u0433.\u00a0\u042d\u0442\u043e \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u0439\u0442\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438 \u0432 \u0441\u0440\u0435\u0434\u0435 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u043b\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0431\u0435\u0441\u0446\u0435\u043d\u043d\u043e.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e \u043a\u0430\u043a \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u044d\u0442\u0443 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432 \u043d\u0430\u0448\u0443 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443, \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043c\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0437\u0430\u0434\u0435\u0440\u0436\u0435\u043a, \u043e \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043e\u043e\u0431\u0449\u0438\u043b\u0438 \u043d\u0430\u043c \u043d\u0430\u0448\u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u044b, \u0440\u0435\u0437\u043a\u043e \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u043b\u043e\u0441\u044c, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u044b \u043c\u043e\u0433\u043b\u0438 \u0441\u0430\u043c\u0438 \u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u043f\u043e \u0442\u0440\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u043a\u0435 \u0441\u0442\u0435\u043a\u0430.<\/p>\n<pre><code class=\"java\">public class JitteryMain implements Runnable { \u00a0\u00a0\u00a0volatile long loopStartMS = Long.MIN_VALUE; \u00a0\u00a0\u00a0volatile boolean running = true;  \u00a0\u00a0\u00a0@Override \u00a0\u00a0\u00a0public void run() { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0while (running) { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0loopStartMS = System.currentTimeMillis(); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0doWork(); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0loopStartMS = Long.MIN_VALUE; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0} \u00a0\u00a0\u00a0}  \u00a0\u00a0\u00a0private void doWork() { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0int loops = new Random().nextInt(100); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0for (int i = 0; i &lt; loops; i++) \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0pause(1); \/\/ line 24 \u00a0\u00a0\u00a0}  \u00a0\u00a0\u00a0static void pause(int ms) { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0try { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Thread.sleep(ms); \/\/ line 29 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0} catch (InterruptedException e) { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0throw new AssertionError(e); \/\/ shouldn't happen \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0} \u00a0\u00a0\u00a0}  \u00a0\u00a0\u00a0public static void main(String[] args) { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0final JitteryMain jittery = new JitteryMain(); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Thread thread = new Thread(jittery, \"jitter\"); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0thread.setDaemon(true); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0thread.start();  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ monitor loop \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0long endMS = System.currentTimeMillis() + 1_000; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0while (endMS > System.currentTimeMillis()) { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0long busyMS = System.currentTimeMillis() - jittery.loopStartMS; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if (busyMS > 100) { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Logger.getAnonymousLogger() \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0.log(Level.INFO, \"Thread spent longer than expected here, was \" + busyMS + \" ms.\", \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0StackTrace.forThread(thread)); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0} \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0pause(50); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0} \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0jittery.running = false; \u00a0\u00a0\u00a0} }<\/code><\/pre>\n<p>\u0412\u044b\u0432\u043e\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0438 \u043e\u043f\u044f\u0442\u044c \u0436\u0435, \u043a\u0430\u043a \u0432\u044b \u0432\u0438\u0434\u0438\u0442\u0435, \u043c\u043e\u0436\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f \u043f\u043e \u0441\u0442\u0435\u043a\u0443 \u0432 \u0432\u0430\u0448\u0435\u0439 IDE.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/147\/448\/25d\/14744825d2d03087ce94529196f77bb0.png\" width=\"1988\" height=\"358\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/147\/448\/25d\/14744825d2d03087ce94529196f77bb0.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0412\u0430\u043c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u043f\u043e\u0447\u0435\u043c\u0443 \u044d\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435.\u00a0\u041d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u0430\u044f \u043f\u0440\u0438\u0447\u0438\u043d\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u00a0<em>Thread.sleep(time)<\/em>\u00a0\u0441\u043f\u0438\u0442 \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e, \u0430 \u043d\u0435 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0430 \u0432 Windows \u0441\u043f\u044f\u0449\u0438\u0439 \u0440\u0435\u0436\u0438\u043c 1 \u043c\u0441 \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u043e\u043a\u043e\u043b\u043e 1,9 \u043c\u0441.<\/p>\n<h2>\u041e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043e\u0434\u043d\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u043c\u0443 \u0440\u0435\u0441\u0443\u0440\u0441\u0443 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u043f\u043e\u0442\u043e\u043a\u0430\u043c\u0438<\/h2>\n<pre><code class=\"java\">package net.openhft.chronicle.core;  public class ConcurrentUsageMain { \u00a0\u00a0\u00a0static class SingleThreadedResource { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0private StackTrace usedHere; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0private Thread usedByThread;  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0public void use() { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0checkMultithreadedAccess(); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ BLAH \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0private void checkMultithreadedAccess() { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if (usedHere == null || usedByThread == null) { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0usedHere = new StackTrace(\"First used here\"); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0usedByThread = Thread.currentThread(); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0} else if (Thread.currentThread() != usedByThread) { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0throw new IllegalStateException(\"Used two threads \" + Thread.currentThread() + \" and \" + usedByThread, usedHere); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0} \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0} \u00a0\u00a0\u00a0}  \u00a0\u00a0\u00a0public static void main(String[] args) throws InterruptedException { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0SingleThreadedResource str = new SingleThreadedResource(); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0final Thread thread = new Thread(() -> str.use(), \"Resource user\"); \/\/ line 25 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0thread.start(); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0thread.join();  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0str.use(); \/\/ line 29 \u00a0\u00a0\u00a0} }<\/code><\/pre>\n<p>\u0412\u044b\u0432\u043e\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/9cb\/2d8\/6b6\/9cb2d86b67ab26d5741b00fe958ec1a2.png\" width=\"1930\" height=\"282\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/9cb\/2d8\/6b6\/9cb2d86b67ab26d5741b00fe958ec1a2.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0440\u0435\u0441\u0443\u0440\u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u0434\u0432\u0443\u043c\u044f \u043f\u043e\u0442\u043e\u043a\u0430\u043c\u0438 \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0438\u043c\u0435\u043d\u0430\u043c\u0438, \u043e\u0434\u043d\u0430\u043a\u043e \u0432\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u0438\u0434\u0435\u0442\u044c, \u0433\u0434\u0435 \u0432 \u0441\u0442\u0435\u043a\u0435 \u043e\u043d\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438\u0441\u044c, \u0447\u0442\u043e\u0431\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u0443\u044e \u043f\u0440\u0438\u0447\u0438\u043d\u0443.<\/p>\n<h2>\u041e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0439 \u0442\u0440\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u043a\u0438<\/h2>\n<p>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 StackTrace \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0432\u043b\u0438\u044f\u043d\u0438\u0435 \u043d\u0430 \u043f\u043e\u0442\u043e\u043a \u0438, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043d\u0430 JVM.\u00a0\u041e\u0434\u043d\u0430\u043a\u043e \u0435\u0433\u043e \u043b\u0435\u0433\u043a\u043e \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0435\u0433\u043e \u0444\u043b\u0430\u0433\u0430, \u0442\u0430\u043a\u043e\u0433\u043e \u043a\u0430\u043a \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e, \u0438 \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0435\u0433\u043e\u00a0<em>\u043d\u0443\u043b\u0435\u0432\u044b\u043c\u00a0<\/em>\u00a0\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c.<\/p>\n<pre><code class=\"java\">createdHere = Jvm.isResourceTracing()  \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 ? new StackTrace(getClass().getName() + \" created here\") \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 : null;<\/code><\/pre>\n<p>\u042d\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 <em>\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f null <\/em>\u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 logger  \u0431\u0443\u0434\u0435\u0442 \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c Throwable, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u043c\u0435\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u00a0<em>null<\/em>, \u0438 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u044c <em>null \u043a\u0430\u043a <\/em>\u043f\u0440\u0438\u0447\u0438\u043d\u0443 \u0434\u043b\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f, \u0438 \u044d\u0442\u043e \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435, \u0447\u0442\u043e \u0438 \u043d\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0435\u0435.<\/p>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0425\u043e\u0442\u044f \u043a\u043b\u0430\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0435\u0442 Throwable, \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u0442\u0440\u0430\u043d\u043d\u043e, \u043e\u043d \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d.<\/p>\n<p>\u0411\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e \u043e\u043d \u0443\u0434\u0438\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u043b\u0435\u0437\u0435\u043d \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u043e\u043c \u0446\u0438\u043a\u043b\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u0430 \u0438\u043b\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0432 \u0440\u0430\u0431\u043e\u0447\u0435\u0439 \u0441\u0440\u0435\u0434\u0435.<\/p>\n<h2>\u0421\u0441\u044b\u043b\u043a\u0438<\/h2>\n<p><a href=\"https:\/\/chronicle.software\/open-hft\/\" rel=\"noopener noreferrer nofollow\">Chronicle Open Source<\/a>  <\/p>\n<p><a href=\"https:\/\/github.com\/OpenHFT\/Chronicle-Core\" rel=\"noopener noreferrer nofollow\">OpenHFT Chronicle Core<\/a>  <\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/655259\/\"> https:\/\/habr.com\/ru\/post\/655259\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h4>\u041f\u0440\u043e\u0447\u0442\u0438\u0442\u0435 \u044d\u0442\u0443 \u0441\u0442\u0430\u0442\u044c\u044e \u0438 \u0443\u0437\u043d\u0430\u0439\u0442\u0435 \u043e \u043d\u0435\u043e\u0431\u044b\u0447\u043d\u044b\u0445 \u0432\u0435\u0449\u0430\u0445 \u0432 Java, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0443\u0434\u0438\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u043c\u0438.<\/h4>\n<p>\u0415\u0441\u0442\u044c \u0432\u0435\u0449\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0434\u0435\u043b\u0430\u0442\u044c \u0432 Java, \u043d\u043e \u0432\u044b \u0438\u0445 \u0440\u0435\u0434\u043a\u043e \u0432\u0438\u0434\u0438\u0442\u0435. \u0412 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u0432 \u043d\u0438\u0445 \u043d\u0435\u0442 \u0441\u043c\u044b\u0441\u043b\u0430.\u00a0\u041e\u0434\u043d\u0430\u043a\u043e \u0432 Java \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u043e\u0431\u044b\u0447\u043d\u044b\u0445 \u0432\u0435\u0449\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0443\u0434\u0438\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u043c\u0438.<\/p>\n<p><a href=\"https:\/\/chronicle.software\/\" rel=\"noopener noreferrer nofollow\">Chronicle Software<\/a>\u00a0\u043e\u0431\u044b\u0447\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0440\u044f\u0434 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432 \u0432 \u0441\u0432\u043e\u0438\u0445 \u043d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430\u0445, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u0435\u0442\u0441\u044f.<\/p>\n<p>\u041e\u0434\u0438\u043d \u0438\u0437 \u043d\u0438\u0445 \u2014 \u044d\u0442\u043e \u043a\u043b\u0430\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0435\u0442 Throwable, \u043d\u043e \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0448\u0438\u0431\u043a\u043e\u0439 \u0438\u043b\u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c.<\/p>\n<h2>StackTrace Extends Throwable<\/h2>\n<pre><code class=\"java\">package net.openhft.chronicle.core; \/** * Throwable created purely for the purposes of reporting a stack trace. * This is not an Error or an Exception and is not expected to be thrown or caught. *\/ public class StackTrace extends Throwable { \u00a0\u00a0\u00a0public StackTrace() { this(\"stack trace\"); } \u00a0\u00a0\u00a0public StackTrace(String message) { this(message, null); } \u00a0\u00a0\u00a0public StackTrace(String message, Throwable cause) { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0super(message + \" on \" + Thread.currentThread().getName(), cause); \u00a0\u00a0\u00a0}  \u00a0\u00a0\u00a0public static StackTrace forThread(Thread t) { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if (t == null) return null; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0StackTrace st = new StackTrace(t.toString()); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0StackTraceElement[] stackTrace = t.getStackTrace(); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0int start = 0; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if (stackTrace.length > 2) { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if (stackTrace[0].isNativeMethod()) { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0start++; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0} \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0} \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if (start > 0) { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0StackTraceElement[] ste2 = new StackTraceElement[stackTrace.length - start]; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0System.arraycopy(stackTrace, start, ste2, 0, ste2.length); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0stackTrace = ste2; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0st.setStackTrace(stackTrace); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return st; \u00a0\u00a0\u00a0} }<\/code><\/pre>\n<p>\u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u0430\u0436\u043d\u044b\u0435 \u043f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u044f, \u0447\u0442\u043e\u0431\u044b \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430: <\/p>\n<ul>\n<li>\n<p>\u042d\u0442\u043e \u043d\u0435 \u0442\u043e\u0442 \u043a\u043b\u0430\u0441\u0441 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u043e\u0435, \u043a\u0430\u043a \u044f \u00a0\u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u044e, \u043a\u043e\u0433\u0434\u0430-\u043b\u0438\u0431\u043e \u043c\u043e\u0436\u0435\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442\u044c. \u041a\u043b\u0430\u0441\u0441\u044b, \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u044e\u0449\u0438\u0435 Throwable, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0442\u0441\u044f, \u043a\u0430\u043a \u0438 Exception, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0432\u0430\u043c \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0442\u044c \u044d\u0442\u0443 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443. <\/p>\n<\/li>\n<li>\n<p>\u0422\u0440\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u043a\u0430 \u0441\u0442\u0435\u043a\u0430 Throwable \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 Throwable, \u0430 \u043d\u0435 \u0442\u0430\u043c, \u0433\u0434\u0435 \u043e\u043d\u0430 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442. \u041e\u0431\u044b\u0447\u043d\u043e \u044d\u0442\u043e \u043e\u0434\u043d\u0430 \u0438 \u0442\u0430 \u0436\u0435 \u0441\u0442\u0440\u043e\u043a\u0430, \u043d\u043e \u044d\u0442\u043e \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e. \u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u0440\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u043a\u0443 \u0441\u0442\u0435\u043a\u0430, Throwable \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435. <\/p>\n<\/li>\n<li>\n<p>\u041e\u0431\u044a\u0435\u043a\u0442\u044b \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0442\u0440\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u043a\u0438 \u0441\u0442\u0435\u043a\u0430 \u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u043e\u043d\u0438 \u043d\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u044e\u0442\u0441\u044f. \u0412\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043a \u0441\u0430\u043c\u043e\u043c\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u0443, \u0447\u0442\u043e\u0431\u044b \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c \u043d\u0430\u043a\u043b\u0430\u0434\u043d\u044b\u0435 \u0440\u0430\u0441\u0445\u043e\u0434\u044b, \u0430 \u043c\u0430\u0441\u0441\u0438\u0432 StackTraceElements \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438. <\/p>\n<\/li>\n<\/ul>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u044d\u0442\u043e\u0442 \u043a\u043b\u0430\u0441\u0441 \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e.\u00a0\u041a\u043b\u0430\u0441\u0441 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u0442\u0440\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u043a\u0443 \u0441\u0442\u0435\u043a\u0430, \u0433\u0434\u0435 \u043e\u043d \u0431\u044b\u043b \u0441\u043e\u0437\u0434\u0430\u043d, \u0442\u0430\u043a \u0438 \u043f\u043e\u0442\u043e\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0435\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u043b.\u00a0\u041f\u043e\u0437\u0436\u0435 \u0432\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u044d\u0442\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e.<\/p>\n<p>\u042d\u0442\u043e\u0442 \u043a\u043b\u0430\u0441\u0441 \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0442\u0440\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u043a\u0438 \u0441\u0442\u0435\u043a\u0430 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430.\u00a0<\/p>\n<p>\u0422\u0440\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u043a\u0430 \u0441\u0442\u0435\u043a\u0430 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430 \u0431\u0435\u0440\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e\u0433\u0434\u0430, \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u0442\u043e\u043a \u0434\u043e\u0441\u0442\u0438\u0433\u0430\u0435\u0442 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0438. \u042d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0442\u0438 \u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0432\u044b \u043f\u043e\u043f\u044b\u0442\u0430\u0435\u0442\u0435\u0441\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0435\u0433\u043e.\u00a0<\/p>\n<p>\u0421\u0432\u044f\u0437\u0430\u043d\u043e \u044d\u0442\u043e \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e JVM \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u043f\u043e\u0442\u043e\u043a, \u0438 \u043e\u0431\u044b\u0447\u043d\u043e JVM \u0436\u0434\u0443\u0442, \u0447\u0442\u043e\u0431\u044b \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u043f\u043e\u0442\u043e\u043a, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0441\u0442\u0435\u043a \u043f\u043e\u0442\u043e\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b \u043f\u044b\u0442\u0430\u0435\u0442\u0435\u0441\u044c \u0437\u0430\u0445\u0432\u0430\u0442\u0438\u0442\u044c. \u0422.\u0435. \u044d\u0442\u043e \u0438\u043c\u0435\u0435\u0442 \u0432\u044b\u0441\u043e\u043a\u0438\u0435 \u043d\u0430\u043a\u043b\u0430\u0434\u043d\u044b\u0435 \u0440\u0430\u0441\u0445\u043e\u0434\u044b, \u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u043c.<\/p>\n<h2>StackTrace \u043a\u0430\u043a \u043e\u0442\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u041c\u044b \u043d\u0435 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u043c, \u0447\u0442\u043e \u044d\u0442\u043e\u0442 Throwable \u043a\u043b\u0430\u0441\u0441 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u043d, \u043d\u043e \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u0438\u0447\u0438\u043d\u0443 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0432\u044b\u0437\u0432\u0430\u043d\u043e \u043f\u043e\u0437\u0436\u0435.<\/p>\n<h3>\u041f\u043e\u0447\u0435\u043c\u0443 \u0431\u044b\u043b \u0437\u0430\u043a\u0440\u044b\u0442 \u0440\u0435\u0441\u0443\u0440\u0441<\/h3>\n<pre><code class=\"java\">public class EgMain { \u00a0\u00a0\u00a0static class MyCloseable implements Closeable { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0protected transient volatile StackTrace closedHere;  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0@Override \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0public void close() { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0closedHere = new StackTrace(\"Closed here\"); \/\/ line 13  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0public void useThis() { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if (closedHere != null) \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0throw new IllegalStateException(\"Closed\", closedHere);  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}  \u00a0\u00a0}  \u00a0\u00a0\u00a0public static void main(String[] args) throws InterruptedException {\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0MyCloseable mc = new MyCloseable(); \/\/ line 27 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Thread t = new Thread(mc::close, \"closer\"); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0t.start(); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0t.join(); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0mc.useThis(); \u00a0\u00a0\u00a0} }<\/code><\/pre>\n<p>\u041f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043a\u043e\u0434 \u0432\u044b\u0434\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041e\u0431\u044b\u0447\u043d\u043e \u0432\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 IllegalStateException \u0438 \u043c\u0435\u0441\u0442\u043e, \u0433\u0434\u0435 \u0432\u0430\u0448 \u043a\u043e\u0434 \u043f\u044b\u0442\u0430\u043b\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u043a\u0440\u044b\u0442\u044b\u0439 \u0440\u0435\u0441\u0443\u0440\u0441, \u043d\u043e \u044d\u0442\u043e \u043d\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u0432\u0430\u043c, \u043f\u043e\u0447\u0435\u043c\u0443 \u043e\u043d \u0431\u044b\u043b \u0437\u0430\u043a\u0440\u044b\u0442 \u0431\u0435\u0437 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438.<\/p>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 StackTrace \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f Throwable \u043a\u043b\u0430\u0441\u0441\u043e\u043c, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0435\u0433\u043e \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u0447\u0438\u043d\u044b \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0438\u043b\u0438 \u043e\u0448\u0438\u0431\u043a\u0438.\u00a0<\/p>\n<p>\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043f\u043e\u0442\u043e\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u043a\u0440\u044b\u043b \u0440\u0435\u0441\u0443\u0440\u0441. \u00a0\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0432\u044b \u0443\u0437\u043d\u0430\u0435\u0442\u0435, \u0447\u0442\u043e \u044d\u0442\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0438\u043b\u0438 \u043e\u0448\u0438\u0431\u043a\u0430 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e \u0432 \u0434\u0440\u0443\u0433\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u0435. \u0418 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0442\u0440\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u043a\u0443 \u0441\u0442\u0435\u043a\u0430 \u0441 \u043f\u0440\u0438\u0447\u0438\u043d\u043e\u0439, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043e\u043d \u0431\u044b\u043b \u0437\u0430\u043a\u0440\u044b\u0442.\u00a0\u042d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043c\u043e\u0447\u044c \u043e\u0447\u0435\u043d\u044c \u0431\u044b\u0441\u0442\u0440\u043e \u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0440\u0443\u0434\u043d\u043e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 \u043f\u0440\u0435\u0436\u0434\u0435\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u0435\u043c \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432.<\/p>\n<h3>\u041a\u0430\u043a\u043e\u0439 \u0440\u0435\u0441\u0443\u0440\u0441 \u0431\u044b\u043b \u0437\u0430\u043a\u0440\u044b\u0442?<\/h3>\n<p>\u0414\u043e\u043b\u0433\u043e\u0436\u0438\u0432\u0443\u0449\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b Closeable \u043c\u043e\u0433\u0443\u0442 \u0438\u043c\u0435\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u044b\u0439 \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u044b\u0439 \u0446\u0438\u043a\u043b, \u0438 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u0435 \u0438\u0445 \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u044f, \u043a\u043e\u0433\u0434\u0430 \u044d\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e, \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0442\u0440\u0443\u0434\u043d\u043e \u043e\u0442\u0441\u043b\u0435\u0434\u0438\u0442\u044c. \u0427\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u0443\u0442\u0435\u0447\u043a\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432.\u00a0<\/p>\n<p>\u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b \u043d\u0435 \u0443\u0434\u0430\u043b\u044f\u044e\u0442\u0441\u044f, \u043a\u043e\u0433\u0434\u0430 GC \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u0431\u044a\u0435\u043a\u0442 RandomAccessFile \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0430\u0435\u0442\u0441\u044f \u0432 GC \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0444\u0430\u0439\u043b\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u043d \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442, \u0438 \u043d\u0435 \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u043f\u043e\u043a\u0430 \u0432\u044b \u0435\u0433\u043e \u043d\u0435 \u0437\u0430\u043a\u0440\u043e\u0435\u0442\u0435, \u0447\u0442\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0443\u0442\u0435\u0447\u043a\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0445 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u043e\u0432.  <\/p>\n<pre><code class=\"java\">public class CreatedMain { \u00a0\u00a0\u00a0static class MyResource implements Closeable { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0private final transient StackTrace createdHere = new StackTrace(\"Created here\"); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0volatile transient boolean closed;  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0@Override \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0public void close() throws IOException { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0closed = true; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0@Override \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0protected void finalize() throws Throwable { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0super.finalize(); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if (!closed) \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Logger.getAnonymousLogger().log(Level.WARNING, \"Resource discarded but not closed\", createdHere); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0} \u00a0\u00a0\u00a0}  \u00a0\u00a0\u00a0public static void main(String[] args) throws InterruptedException { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0new MyResource(); \/\/ line 27 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0System.gc(); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Thread.sleep(1000); \u00a0\u00a0\u00a0} }<\/code><\/pre>\n<p>\u041a\u043e\u0434 \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0427\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u0430\u043c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u0438\u0434\u0435\u0442\u044c, \u0433\u0434\u0435 \u0431\u044b\u043b \u0441\u043e\u0437\u0434\u0430\u043d \u0440\u0435\u0441\u0443\u0440\u0441, \u0447\u0442\u043e \u0434\u0430\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c, \u043f\u043e\u0447\u0435\u043c\u0443 \u043e\u043d \u043d\u0435 \u0431\u044b\u043b \u0437\u0430\u043a\u0440\u044b\u0442, \u043d\u043e \u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u0435\u0441\u0442\u0438 \u043b\u043e\u0433 \u0442\u0430\u043a, \u043a\u0430\u043a \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442 \u0432\u0430\u0448\u0430 IDE. \u042d\u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u0432\u0430\u0448 \u043e\u0431\u044a\u0435\u043a\u0442 Logger \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u0432\u044b\u0434\u0430\u0447\u0443 \u0442\u0440\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u043a\u0438 \u0441\u0442\u0435\u043a\u0430.\u00a0\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043a\u043b\u0438\u043a\u043d\u0443\u0442\u044c \u043f\u043e \u043d\u043e\u043c\u0435\u0440\u0443 \u0441\u0442\u0440\u043e\u043a\u0438, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043a\u043e\u0434, \u0441\u043e\u0437\u0434\u0430\u0432\u0448\u0438\u0439 \u0435\u0435.<\/p>\n<h2>\u041c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430 \u0432 \u0440\u0430\u0431\u043e\u0447\u0435\u0439 \u0441\u0440\u0435\u0434\u0435<\/h2>\n<p>\u0412 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u0440\u0435\u0434\u0430\u0445 \u0432\u0430\u043c \u043d\u0443\u0436\u0435\u043d \u0441\u043f\u043e\u0441\u043e\u0431 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u043a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0432 \u0440\u0430\u0431\u043e\u0447\u0435\u0439 \u0441\u0440\u0435\u0434\u0435 \u0441 \u043d\u0438\u0437\u043a\u0438\u043c\u0438 \u0438\u0437\u0434\u0435\u0440\u0436\u043a\u0430\u043c\u0438 \u0431\u0435\u0437 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0430.\u00a0<\/p>\n<p>\u042d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f, \u0432\u043a\u043b\u044e\u0447\u0438\u0432 \u0441\u0432\u043e\u0439 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c \u0442\u0440\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u043a\u0443 \u0441\u0442\u0435\u043a\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e\u0433\u0434\u0430, \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u0435\u0432\u044b\u0448\u0435\u043d \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0440\u043e\u0433.\u00a0\u042d\u0442\u043e \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u0439\u0442\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438 \u0432 \u0441\u0440\u0435\u0434\u0435 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u043b\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0431\u0435\u0441\u0446\u0435\u043d\u043d\u043e.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e \u043a\u0430\u043a \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u044d\u0442\u0443 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432 \u043d\u0430\u0448\u0443 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443, \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043c\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0437\u0430\u0434\u0435\u0440\u0436\u0435\u043a, \u043e \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043e\u043e\u0431\u0449\u0438\u043b\u0438 \u043d\u0430\u043c \u043d\u0430\u0448\u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u044b, \u0440\u0435\u0437\u043a\u043e \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u043b\u043e\u0441\u044c, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u044b \u043c\u043e\u0433\u043b\u0438 \u0441\u0430\u043c\u0438 \u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u043f\u043e \u0442\u0440\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u043a\u0435 \u0441\u0442\u0435\u043a\u0430.<\/p>\n<pre><code class=\"java\">public class JitteryMain implements Runnable { \u00a0\u00a0\u00a0volatile long loopStartMS = Long.MIN_VALUE; \u00a0\u00a0\u00a0volatile boolean running = true;  \u00a0\u00a0\u00a0@Override \u00a0\u00a0\u00a0public void run() { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0while (running) { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0loopStartMS = System.currentTimeMillis(); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0doWork(); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0loopStartMS = Long.MIN_VALUE; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0} \u00a0\u00a0\u00a0}  \u00a0\u00a0\u00a0private void doWork() { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0int loops = new Random().nextInt(100); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0for (int i = 0; i &lt; loops; i++) \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0pause(1); \/\/ line 24 \u00a0\u00a0\u00a0}  \u00a0\u00a0\u00a0static void pause(int ms) { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0try { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Thread.sleep(ms); \/\/ line 29 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0} catch (InterruptedException e) { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0throw new AssertionError(e); \/\/ shouldn't happen \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0} \u00a0\u00a0\u00a0}  \u00a0\u00a0\u00a0public static void main(String[] args) { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0final JitteryMain jittery = new JitteryMain(); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Thread thread = new Thread(jittery, \"jitter\"); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0thread.setDaemon(true); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0thread.start();  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ monitor loop \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0long endMS = System.currentTimeMillis() + 1_000; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0while (endMS > System.currentTimeMillis()) { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0long busyMS = System.currentTimeMillis() - jittery.loopStartMS; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if (busyMS > 100) { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Logger.getAnonymousLogger() \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0.log(Level.INFO, \"Thread spent longer than expected here, was \" + busyMS + \" ms.\", \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0StackTrace.forThread(thread)); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0} \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0pause(50); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0} \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0jittery.running = false; \u00a0\u00a0\u00a0} }<\/code><\/pre>\n<p>\u0412\u044b\u0432\u043e\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0438 \u043e\u043f\u044f\u0442\u044c \u0436\u0435, \u043a\u0430\u043a \u0432\u044b \u0432\u0438\u0434\u0438\u0442\u0435, \u043c\u043e\u0436\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f \u043f\u043e \u0441\u0442\u0435\u043a\u0443 \u0432 \u0432\u0430\u0448\u0435\u0439 IDE.<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0412\u0430\u043c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u043f\u043e\u0447\u0435\u043c\u0443 \u044d\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435.\u00a0\u041d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u0430\u044f \u043f\u0440\u0438\u0447\u0438\u043d\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u00a0<em>Thread.sleep(time)<\/em>\u00a0\u0441\u043f\u0438\u0442 \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e, \u0430 \u043d\u0435 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0430 \u0432 Windows \u0441\u043f\u044f\u0449\u0438\u0439 \u0440\u0435\u0436\u0438\u043c 1 \u043c\u0441 \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u043e\u043a\u043e\u043b\u043e 1,9 \u043c\u0441.<\/p>\n<h2>\u041e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043e\u0434\u043d\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u043c\u0443 \u0440\u0435\u0441\u0443\u0440\u0441\u0443 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u043f\u043e\u0442\u043e\u043a\u0430\u043c\u0438<\/h2>\n<pre><code class=\"java\">package net.openhft.chronicle.core;  public class ConcurrentUsageMain { \u00a0\u00a0\u00a0static class SingleThreadedResource { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0private StackTrace usedHere; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0private Thread usedByThread;  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0public void use() { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0checkMultithreadedAccess(); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ BLAH \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0private void checkMultithreadedAccess() { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if (usedHere == null || usedByThread == null) { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0usedHere = new StackTrace(\"First used here\"); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0usedByThread = Thread.currentThread(); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0} else if (Thread.currentThread() != usedByThread) { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0throw new IllegalStateException(\"Used two threads \" + Thread.currentThread() + \" and \" + usedByThread, usedHere); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0} \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0} \u00a0\u00a0\u00a0}  \u00a0\u00a0\u00a0public static void main(String[] args) throws InterruptedException { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0SingleThreadedResource str = new SingleThreadedResource(); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0final Thread thread = new Thread(() -> str.use(), \"Resource user\"); \/\/ line 25 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0thread.start(); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0thread.join();  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0str.use(); \/\/ line 29 \u00a0\u00a0\u00a0} }<\/code><\/pre>\n<p>\u0412\u044b\u0432\u043e\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0440\u0435\u0441\u0443\u0440\u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u0434\u0432\u0443\u043c\u044f \u043f\u043e\u0442\u043e\u043a\u0430\u043c\u0438 \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0438\u043c\u0435\u043d\u0430\u043c\u0438, \u043e\u0434\u043d\u0430\u043a\u043e \u0432\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u0438\u0434\u0435\u0442\u044c, \u0433\u0434\u0435 \u0432 \u0441\u0442\u0435\u043a\u0435 \u043e\u043d\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438\u0441\u044c, \u0447\u0442\u043e\u0431\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u0443\u044e \u043f\u0440\u0438\u0447\u0438\u043d\u0443.<\/p>\n<h2>\u041e\u0442<\/h><\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-331116","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/331116","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=331116"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/331116\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=331116"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=331116"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=331116"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}