{"id":444992,"date":"2025-01-14T21:01:15","date_gmt":"2025-01-14T21:01:15","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=444992"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=444992","title":{"rendered":"<span>Apache Flink: \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/8fe\/fee\/3e1\/8fefee3e16ee0fa6e7a605e50c6fa93a.png\" width=\"1920\" height=\"1080\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8fe\/fee\/3e1\/8fefee3e16ee0fa6e7a605e50c6fa93a.png\"\/><\/figure>\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! \u041d\u0430 \u0441\u0432\u044f\u0437\u0438 \u0410\u043b\u0435\u043a\u0441\u0430\u043d\u0434\u0440 \u0411\u043e\u0431\u0440\u044f\u043a\u043e\u0432, \u0442\u0435\u0445\u043b\u0438\u0434 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u041c\u0422\u0421 \u0410\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0430. \u042d\u0442\u043e \u043c\u043e\u0439 \u043e\u0434\u0438\u043d\u043d\u0430\u0434\u0446\u0430\u0442\u044b\u0439 \u043f\u043e\u0441\u0442 \u043f\u0440\u043e Apache Flink. \u0412 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u043e Flink, \u043d\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0449\u0438\u0439 \u044d\u0432\u043e\u043b\u044e\u0446\u0438\u044e \u0441\u0445\u0435\u043c\u044b \u0434\u043b\u044f Flink-\u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0432 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0435 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 Jackson. <\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043c\u044b \u043d\u0430\u0443\u0447\u0438\u043c\u0441\u044f \u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0435\u0441\u0442\u044b \u043d\u0430 \u044d\u0432\u043e\u043b\u044e\u0446\u0438\u044e \u0441\u0445\u0435\u043c\u044b \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0441\u0432\u043e\u0435\u0433\u043e \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430.<\/p>\n<p>\u0412\u0435\u0441\u044c \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0435\u043c\u044b\u0439 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 <a href=\"https:\/\/github.com\/AlexanderBobryakov\/flink-spring\">AlexanderBobryakov\/flink-spring<\/a>. \u0412 master-\u0432\u0435\u0442\u043a\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u0438\u0442\u043e\u0433\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u043f\u043e \u0432\u0441\u0435\u0439 \u0441\u0435\u0440\u0438\u0438. \u042d\u0442\u043e\u0442 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0440\u0435\u043b\u0438\u0437\u043d\u043e\u0439 \u0432\u0435\u0442\u043a\u0435 \u0441 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c <a href=\"https:\/\/github.com\/AlexanderBobryakov\/flink-spring\/tree\/release\/10_test_JacksonStateSerializer\">release\/10_test_JacksonStateSerializer<\/a>. <\/p>\n<p>\u041f\u043e \u043c\u0435\u0440\u0435 \u0432\u044b\u0445\u043e\u0434\u0430 \u043d\u043e\u0432\u044b\u0445 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u043e\u0432 \u043d\u0430 \u0425\u0430\u0431\u0440\u0435 \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u043d\u0438\u0445 \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u043d\u0438\u0436\u0435.<\/p>\n<details class=\"spoiler\">\n<summary>\u0421\u043f\u0438\u0441\u043e\u043a \u043c\u043e\u0438\u0445 \u043f\u043e\u0441\u0442\u043e\u0432 \u043f\u0440\u043e Flink:<\/summary>\n<div class=\"spoiler__content\">\n<ol>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/companies\/ru_mts\/articles\/772898\/\">\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432 Apache Flink: \u043e\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u043c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u043d\u0430 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/companies\/ru_mts\/articles\/775970\/\">\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u043e\u0434 Apache Flink: \u0441 \u0447\u0435\u0433\u043e \u043d\u0430\u0447\u0430\u0442\u044c?<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/companies\/ru_mts\/articles\/786012\/\">Apache Flink. \u041a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0434\u0435\u0434\u0443\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u043f\u043e\u0442\u043e\u043a\u0435 Kafka-to-Kafka?<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/companies\/ru_mts\/articles\/798667\/\">\u0414\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0442\u043e\u043f\u0438\u043a\u0430<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/companies\/ru_mts\/articles\/801693\/\">\u041a\u0430\u043a \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 unit-\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 Flink-\u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432: Test Harness<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/companies\/ru_mts\/articles\/812905\/\">Unit-\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 Flink-\u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432, Job: Flink MiniCluster<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/companies\/ru_mts\/articles\/819681\/\">E2E-\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 Flink Job \u0441 Kafka<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/companies\/ru_mts\/articles\/839520\/\">\u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0439 \u043f\u043e \u0442\u0430\u0439\u043c\u0435\u0440\u0443 \u0432 Apache Flink<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/companies\/ru_mts\/articles\/853200\/\">Unit \u0438 E2E-\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0441 \u0442\u0430\u0439\u043c\u0435\u0440\u0430\u043c\u0438 \u0432 Apache Flink<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/companies\/ru_mts\/articles\/856774\/\">Apache Flink: \u0421\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0438 JacksonStateSerializer<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/companies\/ru_mts\/articles\/873436\/\"><strong>Apache Flink: \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f<\/strong><\/a><\/p>\n<\/li>\n<\/ol>\n<\/div>\n<\/details>\n<p><strong>\u041e\u0433\u043b\u0430\u0432\u043b\u0435\u043d\u0438\u0435:<\/strong><\/p>\n<ul>\n<li>\n<p><a href=\"#1\">\u0412\u0432\u043e\u0434\u043d\u044b\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#2\">\u0422\u0435\u0441\u0442 \u044d\u0432\u043e\u043b\u044e\u0446\u0438\u0438 \u0441\u0445\u0435\u043c\u044b \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#3\">\u0421\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u0442\u0435\u0441\u0442\u0430<\/a><\/p>\n<ul>\n<li>\n<p><a href=\"#4\">\u041f\u0435\u0440\u0432\u044b\u0439 \u044d\u0442\u0430\u043f: \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0442\u043e\u0447\u043a\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#5\">\u0412\u0442\u043e\u0440\u043e\u0439 \u044d\u0442\u0430\u043f: \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0439 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u0438<\/a><\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><a href=\"#6\">\u0412\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u0442\u0435\u0441\u0442\u0430<\/a><\/p>\n<ul>\n<li>\n<p><a href=\"#7\">MiniClusterUtils<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#8\">TestStatefulMapCounter<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#9\">ObjectTypeClassLoaderDto<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#10\">StateClassLoadingUtil<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#11\">ClassLoaderUtils<\/a><\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><a href=\"#12\">\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0442\u0435\u0441\u0442\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u044d\u0432\u043e\u043b\u044e\u0446\u0438\u0438 \u0441\u0445\u0435\u043c\u044b<\/a><\/p>\n<\/li>\n<\/ul>\n<p><a class=\"anchor\" name=\"1\" id=\"1\"><\/a><\/p>\n<h2>\u0412\u0432\u043e\u0434\u043d\u044b\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430<\/h2>\n<p>\u0412 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u0441\u0432\u043e\u0439 JacksonStateSerializer, \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 TypeSerializer. \u041e\u043d \u0434\u043e\u043b\u0436\u0435\u043d \u0443\u043c\u0435\u0442\u044c \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0438 \u0434\u0435\u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 ValueState. \u0415\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u043b\u044f stateful-\u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0441 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u043c \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:<\/p>\n<pre><code class=\"java\">private ValueState&lt;AlertState&gt; state;  @Override public void open(Configuration parameters) {    final var descriptor = new ValueStateDescriptor&lt;&gt;(\"state\", new JacksonStateSerializer&lt;&gt;(AlertState.class));    state = getRuntimeContext().getState(descriptor); }<\/code><\/pre>\n<p>\u041e\u0434\u043d\u0430 \u0438\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u2014 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u044d\u0432\u043e\u043b\u044e\u0446\u0438\u044e \u0441\u0445\u0435\u043c\u044b. \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e:<\/p>\n<ol>\n<li>\n<p>\u041c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b\u0438 \u0441\u0445\u0435\u043c\u0443 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0443\u0436\u0435 \u0434\u043e\u043b\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0431\u044a\u0435\u043a\u0442\u044b \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0442\u0441\u044f \u0432 \u0431\u044d\u043a\u0435\u043d\u0434 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0441\u0445\u0435\u043c\u0435.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0432\u0441\u0435\u0433\u043e \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u0441\u0445\u0435\u043c\u0443 \u043f\u043e \u0431\u0438\u0437\u043d\u0435\u0441-\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044e (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0443\u0434\u0430\u043b\u044f\u0435\u043c \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u043e\u043b\u044f).<\/p>\n<\/li>\n<\/ol>\n<p>\u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0443\u0436\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u0441\u0442\u0430\u0440\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0431\u0435\u0437 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0434\u0435\u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b\u0438\u0441\u044c \u0432 \u043d\u043e\u0432\u0443\u044e \u0441\u0445\u0435\u043c\u0443. \u0414\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0432\u043e\u0437\u044c\u043c\u0435\u043c \u044d\u0432\u043e\u043b\u044e\u0446\u0438\u044e \u0441\u0445\u0435\u043c\u044b \u043a\u043b\u0430\u0441\u0441\u0430 TestEvolvedClass <a href=\"https:\/\/habr.com\/ru\/companies\/ru_mts\/articles\/856774\/#TestEvolvedClass\">\u0438\u0437 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u0442\u0435\u043a\u0441\u0442\u0430<\/a>:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/3a6\/6da\/3d2\/3a66da3d284939a674913a98f6246793.png\" width=\"1263\" height=\"838\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3a6\/6da\/3d2\/3a66da3d284939a674913a98f6246793.png\"\/><\/figure>\n<p>\u0412\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0443\u0434\u0430\u043b\u0438\u043b\u043e\u0441\u044c \u0441\u0442\u0430\u0440\u043e\u0435 \u043f\u043e\u043b\u0435 intField, \u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u043e\u0441\u044c \u043d\u043e\u0432\u043e\u0435 \u2014 newField. \u0415\u0433\u043e \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432\u044b\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435 \u043a\u043b\u0430\u0441\u0441\u0430. \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 @JsonIgnoreProperties(ignoreUnknown = true) \u043c\u044b \u043e\u0436\u0438\u0434\u0430\u0435\u043c, \u0447\u0442\u043e \u0434\u0435\u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043a\u043b\u0430\u0441\u0441\u0430 v1 \u0432 \u043d\u043e\u0432\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e v2 \u0434\u043e\u043b\u0436\u043d\u0430 \u043f\u0440\u043e\u0439\u0442\u0438 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u043f\u0440\u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0438 intField, \u0430 \u043d\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u0435 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432 \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 default_value.<\/p>\n<p><a class=\"anchor\" name=\"2\" id=\"2\"><\/a><\/p>\n<h2>\u0422\u0435\u0441\u0442 \u044d\u0432\u043e\u043b\u044e\u0446\u0438\u0438 \u0441\u0445\u0435\u043c\u044b \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f<\/h2>\n<p><a class=\"anchor\" name=\"3\" id=\"3\"><\/a><\/p>\n<h3>\u0421\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u0442\u0435\u0441\u0442\u0430<\/h3>\n<p><a class=\"anchor\" name=\"4\" id=\"4\"><\/a><\/p>\n<h4>\u041f\u0435\u0440\u0432\u044b\u0439 \u044d\u0442\u0430\u043f: \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0442\u043e\u0447\u043a\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f<\/h4>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/3a6\/875\/43e\/3a687543ee5cd89157fc6393de92c33f.png\" width=\"2048\" height=\"952\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3a6\/875\/43e\/3a687543ee5cd89157fc6393de92c33f.png\"\/><\/figure>\n<ol>\n<li>\n<p>\u0411\u0435\u0440\u0435\u043c Jackson-\u0441\u0445\u0435\u043c\u0443 v1 \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0432 stateful-\u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0435.<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c Flink MiniCluster, \u043f\u043e\u0434\u043b\u043e\u0436\u0438\u0432 \u0432 classpath \u0441\u0445\u0435\u043c\u0443 v1.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u043e\u0433\u043e\u043d\u044f\u0435\u043c \u043e\u0434\u043d\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0432 \u043f\u043e\u0442\u043e\u043a\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f (\u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438) \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p>\u0421\u043d\u0438\u043c\u0430\u0435\u043c \u0442\u043e\u0447\u043a\u0443 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f savepoint.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043a\u043b\u0430\u0441\u0442\u0435\u0440.<\/p>\n<\/li>\n<\/ol>\n<p><a class=\"anchor\" name=\"5\" id=\"5\"><\/a><\/p>\n<h4>\u0412\u0442\u043e\u0440\u043e\u0439 \u044d\u0442\u0430\u043f: \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0439 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u0438<\/h4>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/ca6\/649\/cc4\/ca6649cc49edf74cd748c4b131e829ca.png\" width=\"2048\" height=\"1018\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ca6\/649\/cc4\/ca6649cc49edf74cd748c4b131e829ca.png\"\/><\/figure>\n<ol>\n<li>\n<p>\u0411\u0435\u0440\u0435\u043c Jackson-\u0441\u0445\u0435\u043c\u0443 v2 \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c stateful-\u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0435.<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c Flink MiniCluster \u0438\u0437 \u0441\u043d\u044f\u0442\u043e\u0439 \u0442\u043e\u0447\u043a\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f, \u043f\u043e\u0434\u043b\u043e\u0436\u0438\u0432 \u0432 classpath \u0441\u0445\u0435\u043c\u0443 v2.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u043e\u0433\u043e\u043d\u044f\u0435\u043c \u043e\u0434\u043d\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0432 \u043f\u043e\u0442\u043e\u043a\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u0434\u0435\u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0441\u0445\u0435\u043c\u044b \u0432\u0435\u0440\u0441\u0438\u0438 v1 (\u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u043d\u043e\u0433\u043e \u0440\u0430\u043d\u0435\u0435 \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438) \u0443\u0436\u0435 \u0432 \u0441\u0445\u0435\u043c\u0443 \u0432\u0435\u0440\u0441\u0438\u0438 v2.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u043e\u0431\u044a\u0435\u043a\u0442 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0434\u0435\u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u0432 \u0441\u0445\u0435\u043c\u0443 \u0432\u0435\u0440\u0441\u0438\u0438 v2.<\/p>\n<\/li>\n<\/ol>\n<p><a class=\"anchor\" name=\"6\" id=\"6\"><\/a><\/p>\n<h3>\u0412\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u0442\u0435\u0441\u0442\u0430<\/h3>\n<p>\u0414\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043b\u043e\u0433\u0438\u043a\u0438 \u0442\u0435\u0441\u0442\u0430 \u043f\u043e \u0441\u0445\u0435\u043c\u0435 \u0432\u044b\u0448\u0435 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0438:<\/p>\n<p><a class=\"anchor\" name=\"7\" id=\"7\"><\/a><\/p>\n<h4>MiniClusterUtils<\/h4>\n<p>\u0412 \u0442\u0435\u0441\u0442\u0435 \u043c\u044b \u0434\u0432\u0430 \u0440\u0430\u0437\u0430 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c Flink MiniCluster, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u044b\u043d\u0435\u0441\u0435\u043c \u0435\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 createMiniCluster(). \u0412 \u043d\u0435\u043c \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0432\u0441\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438: \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0437\u043c, \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e TaskManager \u0438 \u0442.\u00a0\u0434.<\/p>\n<pre><code class=\"java\">@UtilityClass public class MiniClusterUtils {     @NotNull    public static MiniClusterWithClientResource createMiniCluster() {        final var configuration = new Configuration();        configuration.set(CoreOptions.DEFAULT_PARALLELISM, 2);        return new MiniClusterWithClientResource(                new MiniClusterResourceConfiguration.Builder()                        .setConfiguration(configuration)                        .setNumberTaskManagers(2)                        .setNumberSlotsPerTaskManager(1)                        .build());    }     @SneakyThrows    public static void startMiniClusterWithClasspath(MiniClusterWithClientResource cluster, Collection&lt;URL&gt; classpath) {        cluster.before();        TestStreamEnvironment.setAsContext(cluster.getMiniCluster(), 1, emptyList(), classpath);    }     @NotNull    public static StreamExecutionEnvironment createEnvironmentWithRockDb(File rocksDbStoragePath) {        final var env = StreamExecutionEnvironment.getExecutionEnvironment();        final var rocksDb = new EmbeddedRocksDBStateBackend(false);        rocksDb.setDbStoragePath(rocksDbStoragePath.toString());        env.setStateBackend(rocksDb);        env.getConfig().disableForceKryo();        env.setMaxParallelism(2);        env.setParallelism(2);        return env;    } }<\/code><\/pre>\n<p>\u041e\u0434\u043d\u0430 \u0438\u0437 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0437\u0434\u0435\u0441\u044c \u2014 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0434\u0432\u0443\u0445 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u0439 \u043a\u043b\u0430\u0441\u0441\u0430 TestEvolvedClass. \u0412\u0441\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u0432 Java \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043a\u043b\u0430\u0441\u0441\u0430 \u0437\u0430\u0434\u0430\u0435\u0442\u0441\u044f \u043f\u043e \u0441\u0432\u044f\u0437\u0438 \u043f\u043e\u043b\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u0441 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c\u044b\u043c \u0435\u0433\u043e ClassLoader. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u0442\u0435\u0441\u0442\u0430 \u0434\u0432\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 \u043e\u0434\u043d\u043e\u0433\u043e TestEvolvedClass, \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0432 \u0438\u0445 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 ClassLoader. \u0414\u0430\u043b\u0435\u0435 \u044d\u0442\u0438 \u043a\u043b\u0430\u0441\u0441\u044b \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u043f\u043e\u0434\u043a\u0438\u0434\u044b\u0432\u0430\u0442\u044c \u0432\u043e Flink MiniCluster. \u041a\u0430\u043a \u0440\u0430\u0437 \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u043c\u0435\u0442\u043e\u0434 startMiniClusterWithClasspath(), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 MiniCluster, \u0443\u043a\u0430\u0437\u0430\u0432 \u0435\u043c\u0443 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 classpath \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u043a\u043b\u0430\u0441\u0441\u043e\u0432. <\/p>\n<p>TestStreamEnvironment.setAsContext \u2014 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434. \u0412 \u043d\u0435\u043c \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0443\u0442\u044c \u0434\u043b\u044f classpaths, \u043d\u043e \u0438 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 jar-\u043f\u0430\u043a\u0435\u0442\u044b: <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/501\/67c\/c14\/50167cc142d1dc42b221d24d581d5748.png\" width=\"649\" height=\"249\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/501\/67c\/c14\/50167cc142d1dc42b221d24d581d5748.png\"\/><\/figure>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0432 \u043d\u0430\u0448\u0435\u043c MiniClusterUtils \u0435\u0441\u0442\u044c \u043c\u0435\u0442\u043e\u0434 createEnvironmentWithRockDb(). \u041e\u043d \u043d\u0443\u0436\u0435\u043d \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f TestStreamEnvironment \u0441 RocksDB, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043d\u0430 \u043f\u0440\u043e\u0434\u0435. \u0422\u0430\u043a \u043c\u044b \u0443\u0434\u043e\u0441\u0442\u043e\u0432\u0435\u0440\u0438\u043c\u0441\u044f \u0432 \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c\u043e\u0433\u043e \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u0445. \u041d\u0430 \u0432\u0445\u043e\u0434 \u043c\u0435\u0442\u043e\u0434 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e, \u0433\u0434\u0435 \u0431\u0443\u0434\u0443\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c\u0441\u044f \u0432\u0441\u0435 \u0444\u0430\u0439\u043b\u044b \u0434\u043b\u044f RocksDB, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435.<\/p>\n<p><a class=\"anchor\" name=\"8\" id=\"8\"><\/a><\/p>\n<h4>TestStatefulMapCounter<\/h4>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043f\u043e \u0441\u0445\u0435\u043c\u0435 \u043d\u0430\u043c \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 stateful-\u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c\u043e\u0433\u043e \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0441\u0442\u044c \u0434\u0435\u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0442\u0430\u043a\u043e\u0433\u043e \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0439 \u043c\u0430\u043f\u043f\u0435\u0440:<\/p>\n<pre><code class=\"java\">public class TestStatefulMapCounter&lt;T&gt; extends RichFlatMapFunction&lt;T, T&gt; {    private static final long serialVersionUID = 1L;    private static final AtomicInteger statefulCounter = new AtomicInteger(0);    private TypeSerializer&lt;T&gt; stateSerializer;    private Class&lt;T&gt; classType;     private ValueState&lt;T&gt; state;     public TestStatefulMapCounter(TypeSerializer&lt;T&gt; stateSerializer) {        this.stateSerializer = stateSerializer;    }     public TestStatefulMapCounter(Class&lt;T&gt; classType) {        this.classType = classType;    }     @Override    public void open(Configuration parameters) {        final var descriptor = stateSerializer != null                ? new ValueStateDescriptor&lt;&gt;(\"state\", stateSerializer)                : new ValueStateDescriptor&lt;&gt;(\"state\", classType);        state = getRuntimeContext().getState(descriptor);    }     @Override    public void flatMap(T value, Collector&lt;T&gt; out) throws Exception {        final var stateElement = state.value();        if (stateElement != null) {            statefulCounter.incrementAndGet();        } else {            state.update(value);        }        out.collect(value);    }     @Override    public void close() {        statefulCounter.set(0);    }     public int getStatefulCounter() {        return statefulCounter.get();    } }<\/code><\/pre>\n<p>\u0412 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u043c \u0441\u0430\u043c \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u0430 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f. \u0412\u043d\u0443\u0442\u0440\u0438 flatMap-\u043c\u0435\u0442\u043e\u0434\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441\u0430\u043c\u043e\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435. \u0415\u0441\u043b\u0438 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0438\u0437 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f, \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u044f \u0441\u0447\u0435\u0442\u0447\u0438\u043a, \u0442\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0441 \u0442\u0430\u043a\u0438\u043c \u0436\u0435 \u043a\u043b\u044e\u0447\u043e\u043c \u0443\u0436\u0435 \u0431\u044b\u043b\u043e \u0440\u0430\u043d\u044c\u0448\u0435. \u0415\u0441\u043b\u0438 \u043d\u0435\u0442, \u0442\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0435\u0433\u043e \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435. \u0422\u0430\u043a\u0436\u0435 \u0435\u0441\u0442\u044c \u043c\u0435\u0442\u043e\u0434 getStatefulCounter \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435 \u0432 \u0441\u0430\u043c\u0438\u0445 \u0442\u0435\u0441\u0442\u0430\u0445. \u042d\u0442\u043e\u0442 \u043c\u0430\u043f\u043f\u0435\u0440 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0441 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u043e\u0439 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u043f\u043e\u043b\u0435\u0439.<\/p>\n<p><a class=\"anchor\" name=\"9\" id=\"9\"><\/a><\/p>\n<h4>ObjectTypeClassLoaderDto<\/h4>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u0441\u0430\u043c\u043e\u043c\u0443 \u0441\u043b\u043e\u0436\u043d\u043e\u043c\u0443 \u2014 \u043d\u0430\u0443\u0447\u0438\u043c\u0441\u044f \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441\u044b \u0440\u0430\u0437\u043d\u044b\u043c\u0438 classLoaders. \u041d\u0430 \u0441\u0442\u0430\u0440\u0442\u0435 \u0442\u0435\u0441\u0442\u0430 \u043a\u043b\u0430\u0441\u0441\u044b \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u044b, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043c \u0434\u0432\u0435 \u043d\u0430\u0448\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u0438 TestEvolvedClass \u0432 \u0432\u0438\u0434\u0435 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 \u0432 \u0440\u0435\u0441\u0443\u0440\u0441\u044b:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/afa\/94d\/38d\/afa94d38d776066b45d2d01215f5b8c1.png\" width=\"670\" height=\"230\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/afa\/94d\/38d\/afa94d38d776066b45d2d01215f5b8c1.png\"\/><\/figure>\n<p>\u0412\u0430\u0436\u043d\u043e: \u043f\u0430\u043f\u043a\u0443 \u0431\u0443\u0434\u0435\u043c \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043f\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044e \u043a\u043b\u0430\u0441\u0441\u0430, \u0430 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 \u044d\u0432\u043e\u043b\u044e\u0446\u0438\u0438 \u0441\u0445\u0435\u043c\u044b \u2014 \u043f\u043e \u043d\u043e\u043c\u0435\u0440\u0443 \u0432\u0435\u0440\u0441\u0438\u0438. <\/p>\n<p>\u0417\u0430\u0442\u0435\u043c \u0443\u0434\u043e\u0431\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0435\u0439:<\/p>\n<pre><code class=\"java\">@Getter @RequiredArgsConstructor public final class ObjectTypeClassLoaderDto&lt;T&gt; {    private final T object;    private final Class&lt;T&gt; type;    private final URLClassLoader classLoader; }<\/code><\/pre>\n<p>\u0415\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 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0432 \u043f\u043e\u043b\u0435 object. \u0415\u0433\u043e \u0431\u0443\u0434\u0435\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u043d\u0430 \u0432\u0445\u043e\u0434 \u0442\u0435\u0441\u0442\u0443 \u0432 source. \u041a\u043b\u0430\u0441\u0441 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 type \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0432\u0435\u043d TestEvolvedClass, \u043d\u043e \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u0441\u044f \u0440\u0430\u0437\u043d\u044b\u043c\u0438 ClassLoaders \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043f\u0435\u0440\u0432\u043e\u0439 \u0438\u043b\u0438 \u0432\u0442\u043e\u0440\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u043a\u043b\u0430\u0441\u0441\u0430. \u0421\u0430\u043c ClassLoader \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438\u0437 \u043f\u043e\u043b\u044f classLoader. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 ClassLoader \u0443\u0434\u043e\u0431\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c URLClassLoader, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b TestEvolvedClass \u043d\u0443\u0436\u043d\u043e \u043a\u0443\u0434\u0430-\u043d\u0438\u0431\u0443\u0434\u044c \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0430 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043d\u0438\u043c \u0441\u0440\u0430\u0437\u0443 \u0441\u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u043e \u0438\u0445 URL.<\/p>\n<p><a class=\"anchor\" name=\"10\" id=\"10\"><\/a><\/p>\n<h4>StateClassLoadingUtil<\/h4>\n<p>\u042d\u0442\u043e\u0442 \u043a\u043b\u0430\u0441\u0441 \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043d\u0430\u0448\u0435\u0439 \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0434\u0442\u043e ObjectTypeClassLoaderDto. \u0415\u0433\u043e \u043a\u043e\u0434 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"java\">@UtilityClass public class StateClassLoadingUtil {     @NotNull    @SneakyThrows    @SuppressWarnings(\"unchecked\")    public static &lt;E&gt; ObjectTypeClassLoaderDto&lt;E&gt; compileStateClass(String className, int version) {        final var tmpPath = Path.of(System.getProperty(\"java.io.tmpdir\"));        final var baseGeneratedClassesPath = tmpPath.resolve(\"generatedClasses\").resolve(UUID.randomUUID().toString()).toFile();        if (!baseGeneratedClassesPath.mkdirs()) {            throw new IllegalStateException(format(\"Failed to create temporary directory: [%s]\", List.of(baseGeneratedClassesPath)));        }        final var generatedClassPath = baseGeneratedClassesPath.toPath().resolve(className).resolve(UUID.randomUUID().toString());        @Cleanup final var classLoader = ClassLoaderUtils.writeAndCompile(                generatedClassPath.toFile(),                className,                loadStateClassContentFromResources(className, version));         final var aClass = (Class&lt;E&gt;) classLoader.loadClass(className);        final var obj = (E) createEasyRandom().nextObject(aClass);        return new ObjectTypeClassLoaderDto&lt;&gt;(obj, aClass, classLoader);    }     @SneakyThrows    public static String loadStateClassContentFromResources(String className, int version) {        final var stateClassFile = getResourceByName(\"state\/\" + className + \"\/v\" + version + \".txt\");        return FileUtils.readFileToString(stateClassFile, StandardCharsets.UTF_8);    }     @SneakyThrows    public static File getResourceByName(String name) {        final var fileUrl = StateClassLoadingUtil.class.getClassLoader().getResource(name);        if (fileUrl == null) {            throw new FileNotFoundException(format(\"Resource file '%s' not found\", name));        }        return new File(fileUrl.getFile());    }     private static EasyRandom createEasyRandom() {        \/\/ Important: create new EasyRandomParameters, because it caches classes        final var easyRandomParameters = new EasyRandomParameters();        easyRandomParameters.setRandomizationDepth(1);        easyRandomParameters.setStringLengthRange(new EasyRandomParameters.Range&lt;&gt;(1, 5));        easyRandomParameters.setCollectionSizeRange(new EasyRandomParameters.Range&lt;&gt;(1, 2));        easyRandomParameters.randomize(Integer.class, new IntegerRangeRandomizer(0, 1000));        return new EasyRandom(easyRandomParameters);    } }<\/code><\/pre>\n<p>\u041f\u0435\u0440\u0432\u044b\u043c \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u043c \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f compileStateClass, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0438\u0439 ObjectTypeClassLoaderDto \u043f\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044e \u043a\u043b\u0430\u0441\u0441\u0430 TestEvolvedClass \u0438 \u0435\u0433\u043e \u0432\u0435\u0440\u0441\u0438\u0438. \u042d\u0442\u043e \u043a\u0430\u043a \u0440\u0430\u0437 \u0442\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0437\u0430\u043b\u043e\u0436\u0435\u043d\u044b \u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 \u043d\u0430\u0448\u0438\u0445 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0432 \u043f\u0430\u043f\u043a\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u0435\u0442\u043e\u0434 compileStateClass \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e baseGeneratedClassesPath \u0432\u0438\u0434\u0430 &lt;java.io.tmpdir&gt;\/generatedClasses\/&lt;random_uuid&gt;, \u0433\u0434\u0435 \u043c\u044b \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u043c \u0432\u0441\u0435 \u043d\u0430\u0448\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f. <\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043f\u043e \u043a\u043e\u0434\u0443 \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u044e\u044e \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e generatedClassPath, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0443\u0442 \u043b\u0435\u0436\u0430\u0442\u044c \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b. \u041e\u0441\u043d\u043e\u0432\u043d\u044b\u043c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435\u043c \u0438\u0434\u0435\u0442 \u0432\u044b\u0437\u043e\u0432 \u043c\u0435\u0442\u043e\u0434\u0430 ClassLoaderUtils.writeAndCompile \u2014 \u044d\u0442\u043e \u043d\u0430\u0448 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441, \u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u0434\u0430\u043b\u0435\u0435. \u0412\u0430\u0436\u043d\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c, \u0447\u0442\u043e \u043e\u043d \u043d\u0430 \u0432\u0445\u043e\u0434 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0440\u0430\u0431\u043e\u0447\u0443\u044e \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e, \u0438\u043c\u044f \u043a\u043b\u0430\u0441\u0441\u0430 \u0438 \u0435\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0432 \u0432\u0438\u0434\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u2014 \u043a\u0430\u043a \u0440\u0430\u0437 \u0442\u043e, \u0447\u0442\u043e \u043b\u0435\u0436\u0438\u0442 \u0432 \u043d\u0430\u0448\u0438\u0445 txt-\u0444\u0430\u0439\u043b\u0430\u0445. \u041d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u0438\u0437 \u043c\u0435\u0442\u043e\u0434\u0430 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u043e\u0432\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 classloader, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0434\u043b\u044f \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0438\u0441\u043a\u043e\u043c\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u0438 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u0434\u0442\u043e ObjectTypeClassLoaderDto. <\/p>\n<p>\u0418\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u2014 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043a\u043b\u0430\u0441\u0441\u0430. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <a href=\"https:\/\/www.baeldung.com\/java-easy-random\">EasyRandom<\/a> \u2014 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0430\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043b\u044e\u0431\u043e\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u043f\u043e \u0435\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0443 \u0441\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0439 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439. \u041a\u0430\u043a \u0440\u0430\u0437 \u044d\u0442\u043e \u043c\u044b \u0434\u0435\u043b\u0430\u0435\u043c \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 createEasyRandom() \u0438 \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u0432\u044b\u0437\u043e\u0432\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 nextObject(aClass). \u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u043c\u043e\u0436\u043d\u043e \u0447\u0435\u0440\u0435\u0437 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c:<\/p>\n<pre><code>testImplementation \"org.jeasy:easy-random-core:5.0.0\"<\/code><\/pre>\n<p>\u0412\u0430\u0436\u043d\u043e \u043f\u043e\u043c\u043d\u0438\u0442\u044c, \u0447\u0442\u043e <strong>EasyRandom \u043a\u044d\u0448\u0438\u0440\u0443\u0435\u0442 \u043d\u0430\u0448\u0438 \u043a\u043b\u0430\u0441\u0441\u044b. <\/strong>\u041d\u0443\u0436\u043d\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 EasyRandom, \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u0443\u0432\u0438\u0434\u0435\u043b \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0441\u0445\u0435\u043c\u044b TestEvolvedClass \u0441 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u043c \u0438\u043c\u0435\u043d\u0435\u043c, \u043d\u043e \u0432\u0435\u0440\u0441\u0438\u0438 v2. <\/p>\n<p>\u041e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u043d\u0430\u0448\u0435\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 loadStateClassContentFromResources() \u0438 getResourceByName() \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u043c\u0438 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043d\u0430\u0448\u0438\u0445 txt-\u0444\u0430\u0439\u043b\u043e\u0432 \u0438\u0437 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u0438 \u0438\u0445 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0432\u044b\u0437\u043e\u0432\u0430 \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 compileStateClass() \u043d\u0430\u0434 TestEvolvedClass \u0441 \u0432\u0435\u0440\u0441\u0438\u044f\u043c\u0438 v1 \u0438 v2 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u043f\u0430\u043f\u043e\u043a \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438:<\/p>\n<pre><code class=\"java\">0000NBB04T3MD6M:~ asbobryako$ find \/var\/folders\/_y\/gd8sxnq91z9glrxjlkrj98tnbsxn37\/T\/generatedClasses | sed -e \"s\/[^-][^\\\/]*\\\/\/ |\/g\" -e \"s\/|\\([^ ]\\)\/|-\\1\/\"  | | | | |-generatedClasses  | | | | | |-e79fb148-e12a-44fd-985b-171dff3d9b8d  | | | | | | |-TestEvolvedClass  | | | | | | | |-adef541d-b155-4f36-807a-66cc8269a49d  | | | | | | | | |-source  | | | | | | | | | |-TestEvolvedClass.java  | | | | | | | | | |-TestEvolvedClass.class  | | | | | |-b064ff0c-8f86-473b-8ba6-262c4114a816  | | | | | | |-TestEvolvedClass  | | | | | | | |-44410981-1662-47ca-8f49-c3c22b67618c  | | | | | | | | |-source  | | | | | | | | | |-TestEvolvedClass.java  | | | | | | | | | |-TestEvolvedClass.class 0000NBB04T3MD6M:~ asbobryako$ <\/code><\/pre>\n<p><a class=\"anchor\" name=\"11\" id=\"11\"><\/a><\/p>\n<h4>ClassLoaderUtils<\/h4>\n<p>\u041a\u043b\u0430\u0441\u0441 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u0434\u043b\u044f \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0438\u0437 Java-\u043a\u043e\u0434\u0430:<\/p>\n<pre><code class=\"java\">@UtilityClass public class ClassLoaderUtils {     @SneakyThrows    public static URLClassLoader writeAndCompile(File root, String className, String source) {        final var file = writeSourceToFile(root.toPath().resolve(\"source\").toFile(), createJavaFileName(className), source);        compileClass(file);        return createClassLoader(file.getParentFile(), Thread.currentThread().getContextClassLoader());    }     private static String createJavaFileName(String className) {        return className + \".java\";    }     @SneakyThrows    private static File writeSourceToFile(File root, String filename, String source) {        final var file = new File(root, filename);        if (!file.getParentFile().mkdirs()) {            throw new IllegalStateException(format(\"Failed to create directory: [%s]\", file));        }        try (var fileWriter = new FileWriter(file)) {            fileWriter.write(source);        }        return file;    }     @SneakyThrows    private static void compileClass(File sourceFile) {        JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();        compiler.run(                null,                null,                null,                \"-proc:none\",                \"-classpath\",                sourceFile.getParent() + \":\" + System.getProperty(\"java.class.path\"),                sourceFile.getPath());    }     private static URLClassLoader createClassLoader(File root, ClassLoader parent)            throws MalformedURLException {        return new URLClassLoader(new URL[]{root.toURI().toURL()}, parent);    } }<\/code><\/pre>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043c\u0435\u0442\u043e\u0434 \u0443 \u043d\u0430\u0441 \u2014 writeAndCompile. \u041d\u0430 \u0432\u0445\u043e\u0434 \u043e\u043d \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0435\u043c \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441\u044b, \u0438\u0445 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0432 \u0432\u0438\u0434\u0435 \u0441\u0442\u0440\u043e\u043a (\u043f\u043e \u0441\u0443\u0442\u0438 \u0432\u0441\u0435, \u0447\u0442\u043e \u0432\u043d\u0443\u0442\u0440\u0438 \u043d\u0430\u0448\u0435\u0433\u043e src\/test\/resources\/state\/TestEvolvedClass\/v1.txt).<\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u0435\u0442\u043e\u0434 writeAndCompile \u0441\u043e\u0437\u0434\u0430\u0435\u0442 TestEvolvedClass.java \u0432 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u043e\u0434\u043f\u0430\u043f\u043a\u0435 \/source \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u043e\u0439 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438. \u0417\u0430\u0442\u0435\u043c \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442 \u044d\u0442\u043e\u0442 \u0444\u0430\u0439\u043b \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 compileClass(file) \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 JavaCompiler. \u042d\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432\u044b\u0437\u043e\u0432\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u0430 compiler.run() \u0441 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435\u0439 \u0432\u0441\u0435\u0445 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043f\u0440\u043e \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0432 <a href=\"https:\/\/docs.oracle.com\/en\/java\/javase\/11\/docs\/api\/java.compiler\/javax\/tools\/JavaCompiler.html\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a>. <strong>\u0412\u0430\u0436\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442<\/strong> \u2014 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 java.class.path-\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430 \u043a\u043e \u0432\u0441\u0435\u043c \u043a\u043b\u0430\u0441\u0441\u0430\u043c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u043c \u0432 \u043d\u0430\u0448\u0435\u043c \u043a\u043e\u0434\u0435 \u0441\u0445\u0435\u043c.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0448\u0430\u0433 \u2014 \u044d\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 URLClassLoader, \u043d\u0430 \u0432\u0445\u043e\u0434 \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043a\u0430\u043a \u0440\u0430\u0437 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044f \u0441\u043e \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c TestEvolvedClass.class-\u043a\u043b\u0430\u0441\u0441\u043e\u043c. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u0434\u0432\u0435 \u0440\u0430\u0437\u043d\u044b\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u0438 \u0442\u043e\u0433\u043e \u0436\u0435 \u043a\u043b\u0430\u0441\u0441\u0430 TestEvolvedClass.class \u0432 \u0432\u0438\u0434\u0435 \u0434\u0432\u0443\u0445 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 v1.txt \u0438 v2.txt. \u041c\u044b \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0438\u0445 \u043a\u0430\u043a .java-\u0444\u0430\u0439\u043b\u044b \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438, \u0437\u0430\u0442\u0435\u043c \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u043c \u0438 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0440\u0430\u0437\u043d\u044b\u043c\u0438 classloader. <\/p>\n<p><a class=\"anchor\" name=\"12\" id=\"12\"><\/a><\/p>\n<h3>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0442\u0435\u0441\u0442\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u044d\u0432\u043e\u043b\u044e\u0446\u0438\u0438 \u0441\u0445\u0435\u043c\u044b<\/h3>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0432\u0441\u0435 \u043d\u0443\u0436\u043d\u044b\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b. \u041c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u0447\u0442\u043e \u044d\u0432\u043e\u043b\u044e\u0446\u0438\u044f \u0441\u0445\u0435\u043c\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 \u043e\u0431\u0435 \u0441\u0442\u043e\u0440\u043e\u043d\u044b: \u0438\u0437 v1 \u0432 v2 \u0438 \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442. <\/p>\n<p>\u0414\u043b\u044f \u0442\u0435\u0441\u0442\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b:<\/p>\n<pre><code class=\"java\">private static Stream&lt;Arguments&gt; evolveClasses() {    final var className = \"TestEvolvedClass\";    return Stream.of(        arguments(className, 1, 2),        arguments(className, 2, 1)    ); }<\/code><\/pre>\n<p>\u041f\u0435\u0440\u0435\u0434 \u043d\u0430\u0447\u0430\u043b\u043e\u043c \u0442\u0435\u0441\u0442\u0430 \u0433\u043e\u0442\u043e\u0432\u0438\u043c \u0440\u0435\u0441\u0443\u0440\u0441\u044b \u0438 \u043d\u0430\u0437\u043d\u0430\u0447\u0430\u0435\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u043f\u043e\u0434 RocksDB \u0438 savepoint: <\/p>\n<pre><code class=\"java\">class JacksonStateSerializerUnitTest {    @TempDir    private Path tmpFolder;    private File savepointDir;    private File rocksDbDir;     @BeforeEach    @SneakyThrows    void init() {        savepointDir = new File(tmpFolder.toFile(), \"savepoints\");        rocksDbDir = new File(tmpFolder.toFile(), \"rocksDb\");        if (!savepointDir.mkdirs() || !rocksDbDir.mkdirs()) {            fail(format(\"Test setup failed: failed to create temporary directories: %s\",                    List.of(savepointDir.toString(), rocksDbDir.toString())));        }    } \/\/ ... }<\/code><\/pre>\n<p>\u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u0442\u0435\u0441\u0442\u0443, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043e\u0442\u0440\u0430\u0436\u0430\u0435\u0442 \u0441\u0445\u0435\u043c\u0443 \u0438\u0437 \u043d\u0430\u0447\u0430\u043b\u0430 \u0442\u0435\u043a\u0441\u0442\u0430:<\/p>\n<pre><code class=\"java\">@ParameterizedTest @MethodSource(\"evolveClasses\") @SneakyThrows @Timeout(value = 15, unit = SECONDS) void shouldRestoreEvolvedState(String className, int baseVersion, int evolvedVersion) {    \/\/ job to store base state in savepoint    final var objectTypeClassLoaderDto = compileStateClass(className, baseVersion);     var cluster = createMiniCluster();    startMiniClusterWithClasspath(cluster, Arrays.asList(objectTypeClassLoaderDto.getClassLoader().getURLs()));    final var jacksonStateSerializer = new JacksonStateSerializer&lt;&gt;(objectTypeClassLoaderDto.getType());    final var statefulCounter = new TestStatefulMapCounter&lt;&gt;(jacksonStateSerializer);    final var fullObjectSink = new TestListSink&lt;&gt;();    @Cleanup final var env = createEnvironmentWithRockDb(rocksDbDir);     final var object = objectTypeClassLoaderDto.getObject();    env.addSource(TestUnboundedSource.fromElements(List.of(object)))            .returns(objectTypeClassLoaderDto.getType())            .keyBy(value -&gt; \"static_key\")            .flatMap(statefulCounter).uid(\"id_stateful\")            .sinkTo(fullObjectSink);    final var jobClient = env.executeAsync(env.getStreamGraph());    await()            .atMost(ofSeconds(5))            .until(() -&gt; fullObjectSink.getHandledEvents().size() == 1);    assertEquals(0, statefulCounter.getStatefulCounter(), \"Stateful counter has state for current object key\");    final var savepoint = jobClient.triggerSavepoint(savepointDir.toString(), NATIVE).get(2, SECONDS);    jobClient.cancel().get(2, SECONDS);    cluster.after();     \/\/ job with restored state from savepoint for evolved schema    final var evolvedObjectTypeClassLoaderDto = compileStateClass(className, evolvedVersion);     cluster = createMiniCluster();    startMiniClusterWithClasspath(cluster, Arrays.asList(evolvedObjectTypeClassLoaderDto.getClassLoader().getURLs()));    final var evolvedJacksonStateSerializer = new JacksonStateSerializer&lt;&gt;(evolvedObjectTypeClassLoaderDto.getType());    final var evolvedStatefulCounter = new TestStatefulMapCounter&lt;&gt;(evolvedJacksonStateSerializer);    final var evolvedSink = new TestListSink&lt;&gt;();    @Cleanup final var evolvedEnv = createEnvironmentWithRockDb(rocksDbDir);    final var evolvedObject = evolvedObjectTypeClassLoaderDto.getObject();    evolvedEnv.addSource(TestUnboundedSource.fromElements(List.of(evolvedObject)))            .returns(evolvedObjectTypeClassLoaderDto.getType())            .keyBy(value -&gt; \"static_key\")            .flatMap(evolvedStatefulCounter).uid(\"id_stateful\")            .sinkTo(evolvedSink);    final var streamGraph = evolvedEnv.getStreamGraph();    streamGraph.setSavepointRestoreSettings(SavepointRestoreSettings.forPath(savepoint));    final var evolvedJobClient = evolvedEnv.executeAsync(streamGraph);    await()            .atMost(ofSeconds(5))            .until(() -&gt; evolvedSink.getHandledEvents().size() == 1);    assertEquals(1, evolvedStatefulCounter.getStatefulCounter(),            \"Stateful counter has no state for the current object key, which must be restored from a savepoint\");    evolvedJobClient.cancel().get(2, SECONDS);    cluster.after(); }<\/code><\/pre>\n<p>\u0412 \u043d\u0435\u043c \u0432\u0441\u0435 \u043f\u0440\u0435\u0434\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e. \u0412 \u043f\u0435\u0440\u0432\u044b\u0439 \u0440\u0430\u0437 \u043e\u043d \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0441\u044f \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 (TestEvolvedClass, 1, 2), \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430 \u0441\u0442\u0430\u0440\u0442\u0435 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043e\u0431\u044a\u0435\u043a\u0442-\u0434\u0442\u043e objectTypeClassLoaderDto \u0434\u043b\u044f \u043a\u043b\u0430\u0441\u0441\u0430 \u0432\u0435\u0440\u0441\u0438\u0438 v1 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u0440\u0430\u043d\u0435\u0435 \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0439. \u0417\u0430\u0442\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u043a\u043b\u0430\u0441\u0442\u0435\u0440 \u0441 \u0434\u0436\u043e\u0431\u043e\u0439 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435\u0439 classpath \u043d\u0430\u0448\u0435\u0439 \u0441\u0445\u0435\u043c\u044b v1. \u0412 \u0434\u0436\u043e\u0431\u0435 \u0441\u043e\u0437\u0434\u0430\u0435\u043c stateful-\u043c\u0430\u043f\u043f\u0435\u0440, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0439 \u043d\u0430\u0448 JacksonStateSerializer. <\/p>\n<p>\u0422\u0443\u0442 \u0432\u0430\u0436\u043d\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u043e\u0432:<\/p>\n<ul>\n<li>\n<p>\u0412 .keyBy \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0430 \u043b\u044f\u043c\u0431\u0434\u0430-\u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u043a\u043b\u044e\u0447 \u201cstatic_key\u201d, \u0447\u0442\u043e\u0431\u044b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0437\u0430\u043f\u0443\u0441\u043a \u0434\u0436\u043e\u0431\u044b \u043d\u0430\u0448\u0435\u043b \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0434\u043b\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0441\u043e \u0441\u0445\u0435\u043c\u043e\u0439 v2.\u00a0<\/p>\n<\/li>\n<li>\n<p>\u041f\u0435\u0440\u0435\u0434 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u043e\u0439 \u0434\u0436\u043e\u0431\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u043f\u043e\u0441\u0442\u0443\u043f\u0438\u043b\u043e \u043d\u0430 sink, \u0438 <strong>\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e <\/strong>\u0441\u043d\u0438\u043c\u0430\u0435\u043c savepoint \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c triggerSavepoint(savepointDir.toString(), NATIVE).get(2, SECONDS). \u042d\u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u0437\u0430\u043f\u0443\u0441\u043a \u0434\u0436\u043e\u0431\u044b \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432 <strong>\u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u043c<\/strong> \u0440\u0435\u0436\u0438\u043c\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0430\u0448\u0435\u0433\u043e \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 TestUnboundedSource, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0438\u0441\u0430\u043b \u0432 \u043f\u0440\u043e\u0448\u043b\u044b\u0445 \u0441\u0442\u0430\u0442\u044c\u044f\u0445.\u00a0<\/p>\n<\/li>\n<li>\n<p>\u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c uid \u0434\u043b\u044f stateful-\u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430. \u042d\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0434\u043b\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0433\u043e \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0438\u0437 savepoint \u0432 \u043d\u0443\u0436\u043d\u044b\u0439 \u043d\u0430\u043c \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 \u043f\u0440\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u0434\u0436\u043e\u0431\u044b. \u042d\u0442\u043e \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0435\u0441\u043b\u0438 \u043d\u0430\u0448\u0430 \u0434\u0436\u043e\u0431\u0430 \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432.<\/p>\n<\/li>\n<\/ul>\n<p>\u041d\u0430 \u0434\u0430\u043d\u043d\u043e\u043c \u044d\u0442\u0430\u043f\u0435 (\u0441\u0435\u0440\u0435\u0434\u0438\u043d\u0435 \u043b\u0438\u0441\u0442\u0438\u043d\u0433\u0430 \u0432\u044b\u0448\u0435) \u0438\u043c\u0435\u0435\u043c \u0441\u043d\u044f\u0442\u044b\u0439 savepoint, \u0433\u0434\u0435 \u043b\u0435\u0436\u0438\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0434\u043b\u044f stateful-\u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430. \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 Flink MiniCluster \u0432\u044b\u0437\u043e\u0432\u043e\u043c cluster.after(). \u0412 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u043e\u0439 statefulCounter.getStatefulCounter() = 0 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u0434\u0436\u043e\u0431\u044b \u043d\u0435 \u0431\u044b\u043b\u043e \u043d\u0430\u0439\u0434\u0435\u043d\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c\u044b\u0439 \u043a\u0430\u0443\u043d\u0442\u0435\u0440 \u043f\u0440\u0438 \u0438\u0445 \u043d\u0430\u043b\u0438\u0447\u0438\u0438 \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0438\u0442\u0441\u044f \u0441 \u0442\u0435\u043a\u0443\u0449\u0438\u043c \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u043c \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043a\u043b\u044e\u0447\u043e\u043c static_key.<\/p>\n<p>\u0412\u0442\u043e\u0440\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0442\u0435\u0441\u0442\u0430 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0445\u043e\u0436\u0430 \u043d\u0430 \u043f\u0435\u0440\u0432\u0443\u044e, \u043d\u043e \u043c\u044b \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0432 classpath \u0434\u0436\u043e\u0431\u044b \u043a\u043b\u0430\u0441\u0441 TestEvolvedClass \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b v2. \u041f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u0434\u0436\u043e\u0431\u044b \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 savepoint. \u042d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u0432\u044b\u0437\u043e\u0432 streamGraph:<\/p>\n<pre><code class=\"java\">final var streamGraph = evolvedEnv.getStreamGraph(); streamGraph.setSavepointRestoreSettings(SavepointRestoreSettings.forPath(savepoint)); final var evolvedJobClient = evolvedEnv.executeAsync(streamGraph);<\/code><\/pre>\n<p><strong>\u0412\u043d\u0438\u043c\u0430\u043d\u0438\u0435!<\/strong> \u041f\u043e\u0441\u043b\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 StreamGraph \u0432\u044b <strong>\u0442\u0435\u0440\u044f\u0435\u0442\u0435<\/strong> \u0432\u0441\u0435 \u0432\u044b\u0437\u0432\u0430\u043d\u043d\u044b\u0435 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043d\u0430\u0434 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c environment. \u041f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 env.execute \u0432\u0435\u0440\u043d\u0435\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435, \u0447\u0442\u043e \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u043e \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432, \u0431\u0443\u0434\u0442\u043e \u0432\u044b \u043d\u0435 \u0434\u0435\u043b\u0430\u043b\u0438 env.fromSource().map() \u0438 \u0442.\u00a0\u0434. \u0423\u0447\u0438\u0442\u044b\u0432\u0430\u0439\u0442\u0435 \u044d\u0442\u043e: <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/0d9\/d0c\/f93\/0d9d0cf93d95bf03d12d2d0837615717.png\" width=\"547\" height=\"174\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/0d9\/d0c\/f93\/0d9d0cf93d95bf03d12d2d0837615717.png\"\/><\/figure>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0433\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0434\u0436\u043e\u0431\u044b \u043c\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u0432 sink \u043f\u043e\u043f\u0430\u043b\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 v2 \u0438 \u0447\u0442\u043e \u043a\u0430\u0443\u043d\u0442\u0435\u0440 \u0438\u0437 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0438\u043b\u0441\u044f: assertEquals(1, evolvedStatefulCounter.getStatefulCounter(). \u042d\u0442\u043e \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442, \u0447\u0442\u043e \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u043e\u0448\u0438\u0431\u043e\u043a \u043f\u0440\u0438 \u0434\u0435\u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0435 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e. \u0412 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043d\u0430 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0435 \u043f\u043e\u043b\u044f \u0438 \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043d\u043e\u0432\u044b\u0445 \u043f\u043e\u043b\u0435\u0439 \u0432 \u0441\u0445\u0435\u043c\u0435 v2.<\/p>\n<p>\u0412 \u0438\u0442\u043e\u0433\u0435 \u0442\u0435\u0441\u0442 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/615\/015\/c5c\/615015c5c0fbd2dd76cd19d397fdb54b.png\" width=\"1180\" height=\"236\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/615\/015\/c5c\/615015c5c0fbd2dd76cd19d397fdb54b.png\"\/><\/figure>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0432 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438. \u042d\u0442\u0438\u043c \u043c\u044b \u0437\u0430\u0439\u043c\u0435\u043c\u0441\u044f \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0447\u0430\u0441\u0442\u0438. \u042f \u043f\u043e\u043a\u0430\u0436\u0443, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u0432\u043e\u0439 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0435\u0441\u0442\u044b, \u0447\u0442\u043e\u0431\u044b \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f \u0432 \u0434\u043e\u043b\u0436\u043d\u043e\u043c \u043f\u043e\u043a\u0440\u044b\u0442\u0438\u0438 \u0442\u0435\u0441\u0442\u0430\u043c\u0438 \u043b\u044e\u0431\u043e\u0433\u043e \u0431\u0435\u0437\u0434\u0443\u043c\u043d\u043e\u0433\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0441\u0445\u0435\u043c\u044b. <\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/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\/articles\/873436\/\"> https:\/\/habr.com\/ru\/articles\/873436\/<\/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 article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><\/figure>\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! \u041d\u0430 \u0441\u0432\u044f\u0437\u0438 \u0410\u043b\u0435\u043a\u0441\u0430\u043d\u0434\u0440 \u0411\u043e\u0431\u0440\u044f\u043a\u043e\u0432, \u0442\u0435\u0445\u043b\u0438\u0434 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u041c\u0422\u0421 \u0410\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0430. \u042d\u0442\u043e \u043c\u043e\u0439 \u043e\u0434\u0438\u043d\u043d\u0430\u0434\u0446\u0430\u0442\u044b\u0439 \u043f\u043e\u0441\u0442 \u043f\u0440\u043e Apache Flink. \u0412 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u043e Flink, \u043d\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0449\u0438\u0439 \u044d\u0432\u043e\u043b\u044e\u0446\u0438\u044e \u0441\u0445\u0435\u043c\u044b \u0434\u043b\u044f Flink-\u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0432 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0435 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 Jackson. <\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043c\u044b \u043d\u0430\u0443\u0447\u0438\u043c\u0441\u044f \u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0435\u0441\u0442\u044b \u043d\u0430 \u044d\u0432\u043e\u043b\u044e\u0446\u0438\u044e \u0441\u0445\u0435\u043c\u044b \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0441\u0432\u043e\u0435\u0433\u043e \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430.<\/p>\n<p>\u0412\u0435\u0441\u044c \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0435\u043c\u044b\u0439 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 <a href=\"https:\/\/github.com\/AlexanderBobryakov\/flink-spring\">AlexanderBobryakov\/flink-spring<\/a>. \u0412 master-\u0432\u0435\u0442\u043a\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u0438\u0442\u043e\u0433\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u043f\u043e \u0432\u0441\u0435\u0439 \u0441\u0435\u0440\u0438\u0438. \u042d\u0442\u043e\u0442 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0440\u0435\u043b\u0438\u0437\u043d\u043e\u0439 \u0432\u0435\u0442\u043a\u0435 \u0441 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c <a href=\"https:\/\/github.com\/AlexanderBobryakov\/flink-spring\/tree\/release\/10_test_JacksonStateSerializer\">release\/10_test_JacksonStateSerializer<\/a>. <\/p>\n<p>\u041f\u043e \u043c\u0435\u0440\u0435 \u0432\u044b\u0445\u043e\u0434\u0430 \u043d\u043e\u0432\u044b\u0445 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u043e\u0432 \u043d\u0430 \u0425\u0430\u0431\u0440\u0435 \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u043d\u0438\u0445 \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u043d\u0438\u0436\u0435.<\/p>\n<details class=\"spoiler\">\n<summary>\u0421\u043f\u0438\u0441\u043e\u043a \u043c\u043e\u0438\u0445 \u043f\u043e\u0441\u0442\u043e\u0432 \u043f\u0440\u043e Flink:<\/summary>\n<div class=\"spoiler__content\">\n<ol>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/companies\/ru_mts\/articles\/772898\/\">\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432 Apache Flink: \u043e\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u043c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u043d\u0430 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/companies\/ru_mts\/articles\/775970\/\">\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u043e\u0434 Apache Flink: \u0441 \u0447\u0435\u0433\u043e \u043d\u0430\u0447\u0430\u0442\u044c?<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/companies\/ru_mts\/articles\/786012\/\">Apache Flink. \u041a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0434\u0435\u0434\u0443\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u043f\u043e\u0442\u043e\u043a\u0435 Kafka-to-Kafka?<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/companies\/ru_mts\/articles\/798667\/\">\u0414\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0442\u043e\u043f\u0438\u043a\u0430<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/companies\/ru_mts\/articles\/801693\/\">\u041a\u0430\u043a \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 unit-\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 Flink-\u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432: Test Harness<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/companies\/ru_mts\/articles\/812905\/\">Unit-\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 Flink-\u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432, Job: Flink MiniCluster<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/companies\/ru_mts\/articles\/819681\/\">E2E-\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 Flink Job \u0441 Kafka<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/companies\/ru_mts\/articles\/839520\/\">\u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0439 \u043f\u043e \u0442\u0430\u0439\u043c\u0435\u0440\u0443 \u0432 Apache Flink<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/companies\/ru_mts\/articles\/853200\/\">Unit \u0438 E2E-\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0441 \u0442\u0430\u0439\u043c\u0435\u0440\u0430\u043c\u0438 \u0432 Apache Flink<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/companies\/ru_mts\/articles\/856774\/\">Apache Flink: \u0421\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0438 JacksonStateSerializer<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/companies\/ru_mts\/articles\/873436\/\"><strong>Apache Flink: \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f<\/strong><\/a><\/p>\n<\/li>\n<\/ol>\n<\/div>\n<\/details>\n<p><strong>\u041e\u0433\u043b\u0430\u0432\u043b\u0435\u043d\u0438\u0435:<\/strong><\/p>\n<ul>\n<li>\n<p><a href=\"#1\">\u0412\u0432\u043e\u0434\u043d\u044b\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#2\">\u0422\u0435\u0441\u0442 \u044d\u0432\u043e\u043b\u044e\u0446\u0438\u0438 \u0441\u0445\u0435\u043c\u044b \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#3\">\u0421\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u0442\u0435\u0441\u0442\u0430<\/a><\/p>\n<ul>\n<li>\n<p><a href=\"#4\">\u041f\u0435\u0440\u0432\u044b\u0439 \u044d\u0442\u0430\u043f: \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0442\u043e\u0447\u043a\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#5\">\u0412\u0442\u043e\u0440\u043e\u0439 \u044d\u0442\u0430\u043f: \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0439 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u0438<\/a><\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><a href=\"#6\">\u0412\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u0442\u0435\u0441\u0442\u0430<\/a><\/p>\n<ul>\n<li>\n<p><a href=\"#7\">MiniClusterUtils<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#8\">TestStatefulMapCounter<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#9\">ObjectTypeClassLoaderDto<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#10\">StateClassLoadingUtil<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#11\">ClassLoaderUtils<\/a><\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><a href=\"#12\">\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0442\u0435\u0441\u0442\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u044d\u0432\u043e\u043b\u044e\u0446\u0438\u0438 \u0441\u0445\u0435\u043c\u044b<\/a><\/p>\n<\/li>\n<\/ul>\n<p><a class=\"anchor\" name=\"1\" id=\"1\"><\/a><\/p>\n<h2>\u0412\u0432\u043e\u0434\u043d\u044b\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430<\/h2>\n<p>\u0412 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u0441\u0432\u043e\u0439 JacksonStateSerializer, \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 TypeSerializer. \u041e\u043d \u0434\u043e\u043b\u0436\u0435\u043d \u0443\u043c\u0435\u0442\u044c \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0438 \u0434\u0435\u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 ValueState. \u0415\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u043b\u044f stateful-\u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0441 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u043c \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:<\/p>\n<pre><code class=\"java\">private ValueState&lt;AlertState&gt; state;  @Override public void open(Configuration parameters) {    final var descriptor = new ValueStateDescriptor&lt;&gt;(\"state\", new JacksonStateSerializer&lt;&gt;(AlertState.class));    state = getRuntimeContext().getState(descriptor); }<\/code><\/pre>\n<p>\u041e\u0434\u043d\u0430 \u0438\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u2014 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u044d\u0432\u043e\u043b\u044e\u0446\u0438\u044e \u0441\u0445\u0435\u043c\u044b. \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e:<\/p>\n<ol>\n<li>\n<p>\u041c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b\u0438 \u0441\u0445\u0435\u043c\u0443 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0443\u0436\u0435 \u0434\u043e\u043b\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0431\u044a\u0435\u043a\u0442\u044b \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0442\u0441\u044f \u0432 \u0431\u044d\u043a\u0435\u043d\u0434 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0441\u0445\u0435\u043c\u0435.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0432\u0441\u0435\u0433\u043e \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u0441\u0445\u0435\u043c\u0443 \u043f\u043e \u0431\u0438\u0437\u043d\u0435\u0441-\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044e (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0443\u0434\u0430\u043b\u044f\u0435\u043c \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u043e\u043b\u044f).<\/p>\n<\/li>\n<\/ol>\n<p>\u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0443\u0436\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u0441\u0442\u0430\u0440\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0431\u0435\u0437 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0434\u0435\u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b\u0438\u0441\u044c \u0432 \u043d\u043e\u0432\u0443\u044e \u0441\u0445\u0435\u043c\u0443. \u0414\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0432\u043e\u0437\u044c\u043c\u0435\u043c \u044d\u0432\u043e\u043b\u044e\u0446\u0438\u044e \u0441\u0445\u0435\u043c\u044b \u043a\u043b\u0430\u0441\u0441\u0430 TestEvolvedClass <a href=\"https:\/\/habr.com\/ru\/companies\/ru_mts\/articles\/856774\/#TestEvolvedClass\">\u0438\u0437 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u0442\u0435\u043a\u0441\u0442\u0430<\/a>:<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u0412\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0443\u0434\u0430\u043b\u0438\u043b\u043e\u0441\u044c \u0441\u0442\u0430\u0440\u043e\u0435 \u043f\u043e\u043b\u0435 intField, \u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u043e\u0441\u044c \u043d\u043e\u0432\u043e\u0435 \u2014 newField. \u0415\u0433\u043e \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432\u044b\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435 \u043a\u043b\u0430\u0441\u0441\u0430. \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 @JsonIgnoreProperties(ignoreUnknown = true) \u043c\u044b \u043e\u0436\u0438\u0434\u0430\u0435\u043c, \u0447\u0442\u043e \u0434\u0435\u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043a\u043b\u0430\u0441\u0441\u0430 v1 \u0432 \u043d\u043e\u0432\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e v2 \u0434\u043e\u043b\u0436\u043d\u0430 \u043f\u0440\u043e\u0439\u0442\u0438 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u043f\u0440\u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0438 intField, \u0430 \u043d\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u0435 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432 \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 default_value.<\/p>\n<p><a class=\"anchor\" name=\"2\" id=\"2\"><\/a><\/p>\n<h2>\u0422\u0435\u0441\u0442 \u044d\u0432\u043e\u043b\u044e\u0446\u0438\u0438 \u0441\u0445\u0435\u043c\u044b \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f<\/h2>\n<p><a class=\"anchor\" name=\"3\" id=\"3\"><\/a><\/p>\n<h3>\u0421\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u0442\u0435\u0441\u0442\u0430<\/h3>\n<p><a class=\"anchor\" name=\"4\" id=\"4\"><\/a><\/p>\n<h4>\u041f\u0435\u0440\u0432\u044b\u0439 \u044d\u0442\u0430\u043f: \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0442\u043e\u0447\u043a\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f<\/h4>\n<figure class=\"full-width\"><\/figure>\n<ol>\n<li>\n<p>\u0411\u0435\u0440\u0435\u043c Jackson-\u0441\u0445\u0435\u043c\u0443 v1 \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0432 stateful-\u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0435.<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c Flink MiniCluster, \u043f\u043e\u0434\u043b\u043e\u0436\u0438\u0432 \u0432 classpath \u0441\u0445\u0435\u043c\u0443 v1.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u043e\u0433\u043e\u043d\u044f\u0435\u043c \u043e\u0434\u043d\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0432 \u043f\u043e\u0442\u043e\u043a\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f (\u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438) \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p>\u0421\u043d\u0438\u043c\u0430\u0435\u043c \u0442\u043e\u0447\u043a\u0443 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f savepoint.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043a\u043b\u0430\u0441\u0442\u0435\u0440.<\/p>\n<\/li>\n<\/ol>\n<p><a class=\"anchor\" name=\"5\" id=\"5\"><\/a><\/p>\n<h4>\u0412\u0442\u043e\u0440\u043e\u0439 \u044d\u0442\u0430\u043f: \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0439 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u0438<\/h4>\n<figure class=\"full-width\"><\/figure>\n<ol>\n<li>\n<p>\u0411\u0435\u0440\u0435\u043c Jackson-\u0441\u0445\u0435\u043c\u0443 v2 \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c stateful-\u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0435.<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c Flink MiniCluster \u0438\u0437 \u0441\u043d\u044f\u0442\u043e\u0439 \u0442\u043e\u0447\u043a\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f, \u043f\u043e\u0434\u043b\u043e\u0436\u0438\u0432 \u0432 classpath \u0441\u0445\u0435\u043c\u0443 v2.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u043e\u0433\u043e\u043d\u044f\u0435\u043c \u043e\u0434\u043d\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0432 \u043f\u043e\u0442\u043e\u043a\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u0434\u0435\u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0441\u0445\u0435\u043c\u044b \u0432\u0435\u0440\u0441\u0438\u0438 v1 (\u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u043d\u043e\u0433\u043e \u0440\u0430\u043d\u0435\u0435 \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438) \u0443\u0436\u0435 \u0432 \u0441\u0445\u0435\u043c\u0443 \u0432\u0435\u0440\u0441\u0438\u0438 v2.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u043e\u0431\u044a\u0435\u043a\u0442 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0434\u0435\u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u0432 \u0441\u0445\u0435\u043c\u0443 \u0432\u0435\u0440\u0441\u0438\u0438 v2.<\/p>\n<\/li>\n<\/ol>\n<p><a class=\"anchor\" name=\"6\" id=\"6\"><\/a><\/p>\n<h3>\u0412\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u0442\u0435\u0441\u0442\u0430<\/h3>\n<p>\u0414\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043b\u043e\u0433\u0438\u043a\u0438 \u0442\u0435\u0441\u0442\u0430 \u043f\u043e \u0441\u0445\u0435\u043c\u0435 \u0432\u044b\u0448\u0435 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0438:<\/p>\n<p><a class=\"anchor\" name=\"7\" id=\"7\"><\/a><\/p>\n<h4>MiniClusterUtils<\/h4>\n<p>\u0412 \u0442\u0435\u0441\u0442\u0435 \u043c\u044b \u0434\u0432\u0430 \u0440\u0430\u0437\u0430 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c Flink MiniCluster, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u044b\u043d\u0435\u0441\u0435\u043c \u0435\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 createMiniCluster(). \u0412 \u043d\u0435\u043c \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0432\u0441\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438: \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0437\u043c, \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e TaskManager \u0438 \u0442.\u00a0\u0434.<\/p>\n<pre><code class=\"java\">@UtilityClass public class MiniClusterUtils {     @NotNull    public static MiniClusterWithClientResource createMiniCluster() {        final var configuration = new Configuration();        configuration.set(CoreOptions.DEFAULT_PARALLELISM, 2);        return new MiniClusterWithClientResource(                new MiniClusterResourceConfiguration.Builder()                        .setConfiguration(configuration)                        .setNumberTaskManagers(2)                        .setNumberSlotsPerTaskManager(1)                        .build());    }     @SneakyThrows    public static void startMiniClusterWithClasspath(MiniClusterWithClientResource cluster, Collection&lt;URL&gt; classpath) {        cluster.before();        TestStreamEnvironment.setAsContext(cluster.getMiniCluster(), 1, emptyList(), classpath);    }     @NotNull    public static StreamExecutionEnvironment createEnvironmentWithRockDb(File rocksDbStoragePath) {        final var env = StreamExecutionEnvironment.getExecutionEnvironment();        final var rocksDb = new EmbeddedRocksDBStateBackend(false);        rocksDb.setDbStoragePath(rocksDbStoragePath.toString());        env.setStateBackend(rocksDb);        env.getConfig().disableForceKryo();        env.setMaxParallelism(2);        env.setParallelism(2);        return env;    } }<\/code><\/pre>\n<p>\u041e\u0434\u043d\u0430 \u0438\u0437 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0437\u0434\u0435\u0441\u044c \u2014 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0434\u0432\u0443\u0445 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u0439 \u043a\u043b\u0430\u0441\u0441\u0430 TestEvolvedClass. \u0412\u0441\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u0432 Java \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043a\u043b\u0430\u0441\u0441\u0430 \u0437\u0430\u0434\u0430\u0435\u0442\u0441\u044f \u043f\u043e \u0441\u0432\u044f\u0437\u0438 \u043f\u043e\u043b\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u0441 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c\u044b\u043c \u0435\u0433\u043e ClassLoader. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u0442\u0435\u0441\u0442\u0430 \u0434\u0432\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 \u043e\u0434\u043d\u043e\u0433\u043e TestEvolvedClass, \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0432 \u0438\u0445 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 ClassLoader. \u0414\u0430\u043b\u0435\u0435 \u044d\u0442\u0438 \u043a\u043b\u0430\u0441\u0441\u044b \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u043f\u043e\u0434\u043a\u0438\u0434\u044b\u0432\u0430\u0442\u044c \u0432\u043e Flink MiniCluster. \u041a\u0430\u043a \u0440\u0430\u0437 \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u043c\u0435\u0442\u043e\u0434 startMiniClusterWithClasspath(), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 MiniCluster, \u0443\u043a\u0430\u0437\u0430\u0432 \u0435\u043c\u0443 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 classpath \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u043a\u043b\u0430\u0441\u0441\u043e\u0432. <\/p>\n<p>TestStreamEnvironment.setAsContext \u2014 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434. \u0412 \u043d\u0435\u043c \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0443\u0442\u044c \u0434\u043b\u044f classpaths, \u043d\u043e \u0438 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 jar-\u043f\u0430\u043a\u0435\u0442\u044b: <\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0432 \u043d\u0430\u0448\u0435\u043c MiniClusterUtils \u0435\u0441\u0442\u044c \u043c\u0435\u0442\u043e\u0434 createEnvironmentWithRockDb(). \u041e\u043d \u043d\u0443\u0436\u0435\u043d \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f TestStreamEnvironment \u0441 RocksDB, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043d\u0430 \u043f\u0440\u043e\u0434\u0435. \u0422\u0430\u043a \u043c\u044b \u0443\u0434\u043e\u0441\u0442\u043e\u0432\u0435\u0440\u0438\u043c\u0441\u044f \u0432 \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c\u043e\u0433\u043e \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u0445. \u041d\u0430 \u0432\u0445\u043e\u0434 \u043c\u0435\u0442\u043e\u0434 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e, \u0433\u0434\u0435 \u0431\u0443\u0434\u0443\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c\u0441\u044f \u0432\u0441\u0435 \u0444\u0430\u0439\u043b\u044b \u0434\u043b\u044f RocksDB, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435.<\/p>\n<p><a class=\"anchor\" name=\"8\" id=\"8\"><\/a><\/p>\n<h4>TestStatefulMapCounter<\/h4>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043f\u043e \u0441\u0445\u0435\u043c\u0435 \u043d\u0430\u043c \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 stateful-\u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c\u043e\u0433\u043e \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0441\u0442\u044c \u0434\u0435\u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0442\u0430\u043a\u043e\u0433\u043e \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0439 \u043c\u0430\u043f\u043f\u0435\u0440:<\/p>\n<pre><code class=\"java\">public class TestStatefulMapCounter&lt;T&gt; extends RichFlatMapFunction&lt;T, T&gt; {    private static final long serialVersionUID = 1L;    private static final AtomicInteger statefulCounter = new AtomicInteger(0);    private TypeSerializer&lt;T&gt; stateSerializer;    private Class&lt;T&gt; classType;     private ValueState&lt;T&gt; state;     public TestStatefulMapCounter(TypeSerializer&lt;T&gt; stateSerializer) {        this.stateSerializer = stateSerializer;    }     public TestStatefulMapCounter(Class&lt;T&gt; classType) {        this.classType = classType;    }     @Override    public void open(Configuration parameters) {        final var descriptor = stateSerializer != null                ? new ValueStateDescriptor&lt;&gt;(\"state\", stateSerializer)                : new ValueStateDescriptor&lt;&gt;(\"state\", classType);        state = getRuntimeContext().getState(descriptor);    }     @Override    public void flatMap(T value, Collector&lt;T&gt; out) throws Exception {        final var stateElement = state.value();        if (stateElement != null) {            statefulCounter.incrementAndGet();        } else {            state.update(value);        }        out.collect(value);    }     @Override    public void close() {        statefulCounter.set(0);    }     public int getStatefulCounter() {        return statefulCounter.get();    } }<\/code><\/pre>\n<p>\u0412 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u043c \u0441\u0430\u043c \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u0430 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f. \u0412\u043d\u0443\u0442\u0440\u0438 flatMap-\u043c\u0435\u0442\u043e\u0434\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441\u0430\u043c\u043e\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435. \u0415\u0441\u043b\u0438 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0438\u0437 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f, \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u044f \u0441\u0447\u0435\u0442\u0447\u0438\u043a, \u0442\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0441 \u0442\u0430\u043a\u0438\u043c \u0436\u0435 \u043a\u043b\u044e\u0447\u043e\u043c \u0443\u0436\u0435 \u0431\u044b\u043b\u043e \u0440\u0430\u043d\u044c\u0448\u0435. \u0415\u0441\u043b\u0438 \u043d\u0435\u0442, \u0442\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0435\u0433\u043e \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435. \u0422\u0430\u043a\u0436\u0435 \u0435\u0441\u0442\u044c \u043c\u0435\u0442\u043e\u0434 getStatefulCounter \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435 \u0432 \u0441\u0430\u043c\u0438\u0445 \u0442\u0435\u0441\u0442\u0430\u0445. \u042d\u0442\u043e\u0442 \u043c\u0430\u043f\u043f\u0435\u0440 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0441 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u043e\u0439 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u043f\u043e\u043b\u0435\u0439.<\/p>\n<p><a class=\"anchor\" name=\"9\" id=\"9\"><\/a><\/p>\n<h4>ObjectTypeClassLoaderDto<\/h4>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u0441\u0430\u043c\u043e\u043c\u0443 \u0441\u043b\u043e\u0436\u043d\u043e\u043c\u0443 \u2014 \u043d\u0430\u0443\u0447\u0438\u043c\u0441\u044f \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441\u044b \u0440\u0430\u0437\u043d\u044b\u043c\u0438 classLoaders. \u041d\u0430 \u0441\u0442\u0430\u0440\u0442\u0435 \u0442\u0435\u0441\u0442\u0430 \u043a\u043b\u0430\u0441\u0441\u044b \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u044b, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043c \u0434\u0432\u0435 \u043d\u0430\u0448\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u0438 TestEvolvedClass \u0432 \u0432\u0438\u0434\u0435 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 \u0432 \u0440\u0435\u0441\u0443\u0440\u0441\u044b:<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u0412\u0430\u0436\u043d\u043e: \u043f\u0430\u043f\u043a\u0443 \u0431\u0443\u0434\u0435\u043c \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043f\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044e \u043a\u043b\u0430\u0441\u0441\u0430, \u0430 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 \u044d\u0432\u043e\u043b\u044e\u0446\u0438\u0438 \u0441\u0445\u0435\u043c\u044b \u2014 \u043f\u043e \u043d\u043e\u043c\u0435\u0440\u0443 \u0432\u0435\u0440\u0441\u0438\u0438. <\/p>\n<p>\u0417\u0430\u0442\u0435\u043c \u0443\u0434\u043e\u0431\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0435\u0439:<\/p>\n<pre><code class=\"java\">@Getter @RequiredArgsConstructor public final class ObjectTypeClassLoaderDto&lt;T&gt; {    private final T object;    private final Class&lt;T&gt; type;    private final URLClassLoader classLoader; }<\/code><\/pre>\n<p>\u0415\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 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0432 \u043f\u043e\u043b\u0435 object. \u0415\u0433\u043e \u0431\u0443\u0434\u0435\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u043d\u0430 \u0432\u0445\u043e\u0434 \u0442\u0435\u0441\u0442\u0443 \u0432 source. \u041a\u043b\u0430\u0441\u0441 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 type \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0432\u0435\u043d TestEvolvedClass, \u043d\u043e \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u0441\u044f \u0440\u0430\u0437\u043d\u044b\u043c\u0438 ClassLoaders \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043f\u0435\u0440\u0432\u043e\u0439 \u0438\u043b\u0438 \u0432\u0442\u043e\u0440\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u043a\u043b\u0430\u0441\u0441\u0430. \u0421\u0430\u043c ClassLoader \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438\u0437 \u043f\u043e\u043b\u044f classLoader. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 ClassLoader \u0443\u0434\u043e\u0431\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c URLClassLoader, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b TestEvolvedClass \u043d\u0443\u0436\u043d\u043e \u043a\u0443\u0434\u0430-\u043d\u0438\u0431\u0443\u0434\u044c \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0430 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043d\u0438\u043c \u0441\u0440\u0430\u0437\u0443 \u0441\u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u043e \u0438\u0445 URL.<\/p>\n<p><a class=\"anchor\" name=\"10\" id=\"10\"><\/a><\/p>\n<h4>StateClassLoadingUtil<\/h4>\n<p>\u042d\u0442\u043e\u0442 \u043a\u043b\u0430\u0441\u0441 \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043d\u0430\u0448\u0435\u0439 \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0434\u0442\u043e ObjectTypeClassLoaderDto. \u0415\u0433\u043e \u043a\u043e\u0434 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"java\">@UtilityClass public class StateClassLoadingUtil {     @NotNull    @SneakyThrows    @SuppressWarnings(\"unchecked\")    public static &lt;E&gt; ObjectTypeClassLoaderDto&lt;E&gt; compileStateClass(String className, int version) {        final var<\/code><\/pre>\n<\/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-444992","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/444992","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=444992"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/444992\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=444992"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=444992"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=444992"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}