<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Abhimanyu on Medium]]></title>
        <description><![CDATA[Stories by Abhimanyu on Medium]]></description>
        <link>https://medium.com/@abhimanyu081?source=rss-fb079e28e726------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*hDkWmjPO4ZQQlR6whNgerw.jpeg</url>
            <title>Stories by Abhimanyu on Medium</title>
            <link>https://medium.com/@abhimanyu081?source=rss-fb079e28e726------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 02:34:17 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@abhimanyu081/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Redis Keys Expire — Things you need to know.]]></title>
            <link>https://abhimanyu081.medium.com/redis-keys-expire-things-you-need-to-know-cf6fc82898bc?source=rss-fb079e28e726------2</link>
            <guid isPermaLink="false">https://medium.com/p/cf6fc82898bc</guid>
            <category><![CDATA[redis]]></category>
            <category><![CDATA[system-design-interview]]></category>
            <category><![CDATA[spring]]></category>
            <category><![CDATA[cache]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[Abhimanyu]]></dc:creator>
            <pubDate>Tue, 15 Sep 2020 02:52:47 GMT</pubDate>
            <atom:updated>2020-09-15T02:52:47.222Z</atom:updated>
            <content:encoded><![CDATA[<h3>Redis Keys Expire — Things you need to know.</h3><p>Whenever we create a key in Redis, this key is created without any timeout or expiration value. So they live forever in the Redis server, even if they will not be used after a period of time. So it is a good practice to set a timeout for your Redis keys.</p><p>Redis key timeout can be set either while creating a new key or at any time after creating the key.</p><p>e.g while setting value using the SET command a given key, we can set timeout by using the following options along with the SET command.</p><ul><li>EX <em>seconds</em> -- Set the specified expire time, in seconds.</li><li>PX <em>milliseconds</em> -- Set the specified expire time, in milliseconds.</li><li>KEEPTTL -- Retain the time to live associated with the key.</li></ul><h4>Example commands of setting timeout while creating a KEY.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/724/1*dFjMrdMLu7BRUlqe3oP6ZQ.png" /><figcaption>Set timeout with SET command</figcaption></figure><h4>Example commands of setting timeout after creating a KEY.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vLxEpToM1qiEOLkefjvkJA.png" /></figure><p>when the key expires after the specified timeout, the GET command returns (nil).</p><h4>Redis supports the following operations related to Key expiration.</h4><ol><li>Set timeout or time to live for a given key.</li><li>Check the timeout.</li><li>Remove the timeout.</li></ol><h4>Set timeout — Redis supports below 4 commands to set the timeout.</h4><p>EXPIRE — sets the timeout in seconds</p><p>PEXPIRE — sets the timeout in milliseconds</p><p>EXPIREAT — set timeout to the epoch Unix timestamp value in seconds</p><p>PEXPIREAT — set timeout to the epoch Unix timestamp value in milliseconds</p><h4>Check timeout — Redis provides below 2 commands to check the timeout</h4><p>PTTL — returns the timeout in milliseconds</p><p>TTL — returns the timeout in seconds</p><h4>Remove the expiration or timeout</h4><p>PERSIST — command to remove the timeout</p><h4>You can visit the official Redis website to check the commands in detail.</h4><p><a href="https://redis.io/commands">Command reference - Redis</a></p><h4>Below are some important points about KEY expirations.</h4><ul><li>A key with an expiration time set is called volatile in Redis terminology.</li><li>The timeout or expiration time will be cleared automatically by some commands. The commands which delete or overwrite the value at the provided key will remove the expiration time also. Such commands are DEL, SET, GETSET, and all *STORE commands.</li><li>This means that the commands that conceptually alter the value for a key without replacing its value, will not remove the timeouts. Such commands are INCR, LPUSH, HSET, etc.</li><li>If we rename a key using the command RENAME, the timeout will be transferred to the new key name.</li><li>If we set a -ve value for commands EXPIRE, PEXPIRE, the key will be deleted immediately.</li><li>Similarly, If we set an epoch timestamp value from the past for the commands EXPIREAT, PEXPIREAT, the key will be deleted immediately.</li><li>Note that in both of the above points I have mentioned that the keys will be deleted (instead of expiring), so the event emitted from the command will be <strong>del</strong> and not <strong>expired</strong>. Try out this.</li><li>Setting the expiration value to a key that already has some expiration set, the expiration time will be updated to the new timeout value.</li></ul><h4>What is the accuracy of the key Expiration?</h4><p>In Redis 2.4 the expire error could be between zero to one second out.</p><p>Since Redis 2.6 the expire error is from 0 to 1 millisecond.</p><h4>How does Redis Stores the expiration time?</h4><p>Redis stores the expiration information as absolute Unix timestamps in milliseconds (for Redis versions &gt;2.6). So the time flows even when the Redis server is not active. This means that the keys will expire surely whenever the Redis server becomes active again.</p><p>To work the expiration accurately, the server clock must be stable even in case of a server crash, system failures, etc.</p><h4>How Redis expire keys?</h4><p>A key is passively expired, whenever a client accesses a key and that key has already timed-out.</p><p>But there might be some keys that may not be accessed forever, So these keys also need to be expired.</p><p>For this situation, Redis does the following.</p><ol><li>Test some random keys from the set of keys having some expiration value.</li><li>Delete the keys that are expired from this randomly sampled keys.</li><li>Repeated steps 1 and 2 until the deleted keys from step 2 becomes less than 25%.</li></ol><h4>How does Redis handle Expiration in Replicated Redis servers?</h4><p>In a master-slave replicated setup, the master drives the expiration of keys and the replicated server follows their master.</p><p>The replicated servers do not expire the keys themselves, they wait for the DEL command from the master server.</p><p>Whenever a key is expired, the master server sends a DEL command to each of its replicated servers, and then replicated servers delete the expired keys.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cf6fc82898bc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Leetcode problem 1022: Sum of Root To Leaf Binary Numbers]]></title>
            <link>https://abhimanyu081.medium.com/leetcode-problem-1022-sum-of-root-to-leaf-binary-numbers-257b2ad99061?source=rss-fb079e28e726------2</link>
            <guid isPermaLink="false">https://medium.com/p/257b2ad99061</guid>
            <category><![CDATA[trees]]></category>
            <category><![CDATA[leetcode]]></category>
            <category><![CDATA[data-structures]]></category>
            <category><![CDATA[binary-tree]]></category>
            <dc:creator><![CDATA[Abhimanyu]]></dc:creator>
            <pubDate>Tue, 08 Sep 2020 14:53:56 GMT</pubDate>
            <atom:updated>2020-09-08T14:53:56.537Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jkpseNVO9-6Ba4clzuYZqQ.png" /></figure><p>In this problem, we need to find the sum of all binary numbers that are formed by traversing each root to leaf path in the tree. Please refer below link to read the full problem statement.</p><p><a href="https://leetcode.com/problems/sum-of-root-to-leaf-binary-numbers/">Sum of Root To Leaf Binary Numbers - LeetCode</a></p><p>In this problem, we will do a preorder traversal and keep track of the current sum from the root till the current node in a variable called curr .</p><p>At a particular node, the value of the current sum will be <strong>2*currSum+node.val</strong>. When we reach any of the leaf nodes, we return te current sum value i.e curr, because we have completed a valid root to leaf path and we need a return and add this value to the overall result.</p><p>If the current node is not a leaf node, we add the values returned from calling this sum on both left and right subtrees.</p><p>Below is the accepted solution.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/558a296d97d4eefd3eb6897963147d36/href">https://medium.com/media/558a296d97d4eefd3eb6897963147d36/href</a></iframe><p>The time complexity of this solution will be O(N) since we are doing a preOrder traversal. In this case, we will visit a node at max 3 times, one while calling the method on the root and 2 visits when returning from the root’s left and right recursion calls. So overall time complexity will be linear only.</p><p>Space complexity will be O(h) for the recursion calls.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=257b2ad99061" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Weird Autoboxing In Java]]></title>
            <link>https://abhimanyu081.medium.com/weird-autoboxing-in-java-c9c2fb2493ef?source=rss-fb079e28e726------2</link>
            <guid isPermaLink="false">https://medium.com/p/c9c2fb2493ef</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[java-tips]]></category>
            <category><![CDATA[integer]]></category>
            <category><![CDATA[autoboxing]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[Abhimanyu]]></dc:creator>
            <pubDate>Sat, 26 Oct 2019 08:08:09 GMT</pubDate>
            <atom:updated>2019-10-26T08:08:09.965Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>The Problem.</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5732b24d51c1f5e0ff580a2fc2c779b2/href">https://medium.com/media/5732b24d51c1f5e0ff580a2fc2c779b2/href</a></iframe><p><em>What is the problem in the above program?</em></p><p>In the above problem first statement prints true, whereas the second print statement prints false.</p><p>When a1,a2 contain same value and b1,b2 contain same value, then why only a1==a2 is true but b1==b2 is false;</p><p>Let’s understand why java shows this weird behaviour. First, let us understand what is autoboxing.</p><p><strong>The Autoboxing</strong></p><p>Whenever we assign a primitive int value to an Integer reference type, like b1=1000: java creates*(or returns from cache) an Integer object with value 1000 and assigns it to the reference variable (b1).</p><p>This automatic conversion of primitive int to Integer object is called autoboxing in java.</p><p>The reason a1==a2 returns true and b1==b2 returns false is that, java caches cache Integer objects in range [-128,127] inclusive.</p><p>So whenever we create an integer object with value in the range [-128,127] java returns the object instance from the cache. Because of this a1 and a2 point to same Integer object with value 100 in the cache, hence a1==a2 returns true. But for b1 and b2 new objects are created hence b1 and b2 both point to different objects, hence b1==b2 returns false.</p><blockquote>Caching is applied only when we get the Integer object with either Integer.parseInt(i) method or Integer.valueOf(i) methods. (valueOf(i) method calls parseInt(i) method internally).</blockquote><p>If we create two Integer objects with the same value explicitly (using new operator), then no cached objects are returned and new objects are created for each int value.</p><p>Refer the program below</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7f1e53d2423601f49e28468602a1b860/href">https://medium.com/media/7f1e53d2423601f49e28468602a1b860/href</a></iframe><p>In this above example both print statements print false, unlike the previous example.</p><blockquote>To avoid this problem we should always compare the integer objects using equals method instead of == operator. (equals method in Integer class is overloaded and compares two objects by value.)</blockquote><p><strong>Why java does this optimization?</strong></p><p>This is done to save memory and optimizing code at the same time. Caching these objects allows better programs optimization due to better cache efficiency as it is not required to create an Integer object of each int literal and can be returned directly from the cache. (an Integer object takes up something like 12 bytes)</p><p><strong>Now, why only catching integers in range -128 to 127?</strong></p><p>This default cache range might be JVM implementation-dependent and may vary.</p><p>This is also based on the assumption that theses small integers will occur more often than other integers, that&#39;s why it make sense to avoid the overhead of creating an Integer object for same ints values repeatedly.</p><p><strong>Integer Caching in java</strong></p><p>When JVM initialises, an Integer cache is created for the int values in the range -128 to 127. The size of the cache can be controlled with flag.</p><p><strong>-XX:AutoBoxCacheMax=&lt;size&gt;</strong></p><p>Caching is applied only when we get the Integer object with either Integer.parseInt(i) method or Integer.valueOf(i) methods, not applicable when we create a new object with <em>new</em> operator (new Integer());</p><p>below is the snippet from open-JDK Integer class implementation to show this cache.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d908e774cd646778fe2c32f8e74d62df/href">https://medium.com/media/d908e774cd646778fe2c32f8e74d62df/href</a></iframe><p>Refer this link to see Integer class implementation.</p><p><a href="http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/687fd7c7986d/src/share/classes/java/lang/Integer.java">Integer class open JDK implementation</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c9c2fb2493ef" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Tomcat 9.0.16 throws 404 error in eclipse]]></title>
            <link>https://abhimanyu081.medium.com/tomcat-9-0-16-throws-404-error-in-eclipse-426271db75fe?source=rss-fb079e28e726------2</link>
            <guid isPermaLink="false">https://medium.com/p/426271db75fe</guid>
            <category><![CDATA[tomcat]]></category>
            <category><![CDATA[eclipse-ide]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[tomcat9]]></category>
            <category><![CDATA[eclipse]]></category>
            <dc:creator><![CDATA[Abhimanyu]]></dc:creator>
            <pubDate>Tue, 19 Mar 2019 11:22:23 GMT</pubDate>
            <atom:updated>2019-03-19T11:22:23.757Z</atom:updated>
            <content:encoded><![CDATA[<p>Today I installed a new eclipse version through eclipse installer and then configured tomcat 9.0.16 as server. But tomcat started throwing 404 not found error when hitting <a href="http://localhost:8080/">http://localhost:8080/</a> in browser.</p><p>Although starting tomcat outside of eclipse, it worked fine. So after searching on internet for some time below solution worked for me.</p><ol><li>Click on Servers tab in eclipse</li><li>Right click on the tomcat9 instance and click on properties.</li><li>Click on general tab and then click on switch location button.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*E0g7HMGkTYCsZJk_EFJJ5g.png" /></figure><p>After click the switch location button location looks like below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/643/1*hoO_CwUkp7jFE6D-sVMe7A.png" /></figure><p>4. Click apply and close.</p><p>5. Now double click on tomcat 9 instance and go to “Server Locations” options and select the option “Use Tomcat Installation” and then save this configurations using ctrl+s.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kqQHUtc1FUVkGO2AVQ63_Q.png" /></figure><p>Now hit <a href="http://localhost:8080/">http://localhost:8080/</a> and tomcat home page should open after starting the tomcat instance.</p><p>Software Details.</p><p>Tomcat Version — 9.0.16</p><p>Eclipse Version: 2018–12 (4.10.0)</p><p>Eclipse Build id: 20181214–0600</p><p>OS — windows 8.1 pro</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=426271db75fe" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Java’s Metadata And Annotations, Part 1 : Introduction]]></title>
            <link>https://abhimanyu081.medium.com/javas-metadata-and-annotations-part-1-introduction-e882454151f0?source=rss-fb079e28e726------2</link>
            <guid isPermaLink="false">https://medium.com/p/e882454151f0</guid>
            <category><![CDATA[annotations]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[Abhimanyu]]></dc:creator>
            <pubDate>Wed, 20 Feb 2019 16:16:22 GMT</pubDate>
            <atom:updated>2019-02-20T16:16:22.486Z</atom:updated>
            <content:encoded><![CDATA[<h3>Java’s Metadata And Annotations, Part 1 : Introduction</h3><p>Java Annotations provide a way to specify metadata about various java constructs like Classes, Methods, constructors or package.</p><p>In this series of articles we will understand what is annotation, its purpose, need and runtime/compile time usage.</p><blockquote><em>What is an annotation?</em></blockquote><ul><li>Annotation is an special kind of java construct that is used to attach metadata or additional information to java program elements</li><li>These elements could be a class, method, instance variable etc.</li><li>An annotation starts with the symbol @ followed by annotation type name and placed just before a program element being annotated.</li><li>Below is an example of the simplest annotation</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/70dc8483669609b44f658ba99ea2f583/href">https://medium.com/media/70dc8483669609b44f658ba99ea2f583/href</a></iframe><p>@Override annotation depicts that this method is overriding a parent method.</p><ul><li><em>You can annotate classes, methods, fields, parameters, variables, constructors or whole package (through package-info.java file).</em></li></ul><p><strong>Built-in Annotations</strong></p><p>Java provides three standard user level annotations.</p><ol><li>@Override</li><li>@Deprecated</li><li>@SuppressWarnings</li></ol><p><strong>@Override</strong></p><p>It lets us add a new additional compiler check to our code. Its presence on a method indicates that the method is intended to override a method in a super class. So if the compiler detects that the method is not overriding anything or improperly overriding then It throws error at compile time.</p><p><strong>@Deprecated</strong></p><p>Its presence on a method indicates that the method is either is not efficient or badly written suggesting not to use further. @Deprecated is generally accompanied by @deprecated which is a standard java documentation annotation and appears only in a java comment and can be used to provide additional description string about the deprecated method. Please note the difference between both annotation. One start with ‘@D’ appears outside a java comment and second starts with ‘@d’ and appears in a comment.</p><p><strong>@SuppressWarnings</strong></p><p>This annotation acts as a directive to the compiler telling it to ignore certain warnings within the annotated code element. For Example</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0c4b272f9c2f78fc1de6d116a5e7c0a7/href">https://medium.com/media/0c4b272f9c2f78fc1de6d116a5e7c0a7/href</a></iframe><p>We can suppress selected warnings only by passing the name of the warning type into the annotation.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e882454151f0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How java HashMap handles null keys and null values.]]></title>
            <link>https://abhimanyu081.medium.com/how-java-hashmap-handles-null-keys-and-null-values-67b7cf7c1f95?source=rss-fb079e28e726------2</link>
            <guid isPermaLink="false">https://medium.com/p/67b7cf7c1f95</guid>
            <category><![CDATA[java8]]></category>
            <category><![CDATA[java-collection]]></category>
            <category><![CDATA[core-java]]></category>
            <category><![CDATA[hashmap]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Abhimanyu]]></dc:creator>
            <pubDate>Sat, 17 Nov 2018 09:09:43 GMT</pubDate>
            <atom:updated>2018-11-17T09:09:43.742Z</atom:updated>
            <content:encoded><![CDATA[<p>When we put a null key to java hashmap <strong>hashcode()</strong> method is not called on the null, instead puts the key in bucket 0. Java uses linked list to manage multiple objects in the bucket. So if there are already objects in bucket 0, null object will be appended to the linkedlist of bucket 0.</p><p>While getting value at null key from HashMap, Java searches for value at null key in bucket 0.</p><p>There can be only one null key in Java HashMap.</p><blockquote>Since Java 1.8 LinkedList in a bucket can be replaced with a Balanced Tree when the size of the linked list grows beyond a threshold value.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=67b7cf7c1f95" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Three Cursors in Java Collections]]></title>
            <link>https://abhimanyu081.medium.com/three-cursors-in-java-collections-c93f75f69b16?source=rss-fb079e28e726------2</link>
            <guid isPermaLink="false">https://medium.com/p/c93f75f69b16</guid>
            <category><![CDATA[interview]]></category>
            <category><![CDATA[interview-questions]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[collection]]></category>
            <category><![CDATA[java-collection]]></category>
            <dc:creator><![CDATA[Abhimanyu]]></dc:creator>
            <pubDate>Mon, 12 Nov 2018 14:50:54 GMT</pubDate>
            <atom:updated>2018-11-12T16:28:17.616Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>1. Enumeration</strong></p><ol><li>Used to retrieve elements one by one from a collection.</li><li>Enumerations are also used to specify the input streams to a <em>SequenceInputStream</em></li><li>How to create Enumeration on collections : call <em>elements() method.</em></li></ol><p><strong>Limitations:</strong></p><ul><li>Not a universal Iterator i.e only applicable to elements of a vector and keys and values of Hashtable.</li><li>Can not modify collection while iterating through enumeration.</li><li>Only forward iteration is possible.</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ee292edf02c98ce5ce63f28ae8a4185a/href">https://medium.com/media/ee292edf02c98ce5ce63f28ae8a4185a/href</a></iframe><p><strong>2. Iterator</strong></p><ol><li>Iterators in java enable us to retrieve elements one by one.</li><li>Iterator support both read and remove operations unlike Enumeration.</li><li>Iterators are universal, can be applied to all collections.</li><li>Iterator can be created by calling iterator() method on any collection.</li></ol><p><strong>Iterators differ from enumerations in two ways:</strong></p><ul><li>Iterators allow the caller to remove elements from the underlying collection during the iteration with well-defined semantics.</li><li>Method names have been improved.</li></ul><p><strong>Limitations:</strong></p><ul><li>Single Direction (forward) cursor only.</li><li>Only read/remove is supported. add/replace is not supported.</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c9870a6b16b07008c7e3210e04ecdda7/href">https://medium.com/media/c9870a6b16b07008c7e3210e04ecdda7/href</a></iframe><p><strong>3. What is ListIterator?</strong></p><ol><li>An iterator for lists that allows the programmer to traverse the list in either direction.</li><li>Modify the list during iteration i.e add ,set or replace, remove element.</li><li>Obtain the iterator’s current position in the list.</li><li>ListIterator Can also be started from a specific index in the list.</li><li>ListIterator extends Iterator.</li></ol><p><em>Check all methods:</em></p><p><a href="https://docs.oracle.com/javase/8/docs/api/java/util/ListIterator.html">https://docs.oracle.com/javase/8/docs/api/java/util/ListIterator.html</a></p><p><strong>Limitations:</strong></p><p>We can only create listIterator on a List object only(Since <em>listIterator()</em> method is defined in <strong><em>List </em></strong>interface) not on other collections like HashSet, TreeSet etc.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9d6c685ddb311faba511d63d269b1704/href">https://medium.com/media/9d6c685ddb311faba511d63d269b1704/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c93f75f69b16" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flink :- No JobSubmissionResult returned, please make sure you called…]]></title>
            <link>https://abhimanyu081.medium.com/flink-no-jobsubmissionresult-returned-please-make-sure-you-called-10dfd94e8839?source=rss-fb079e28e726------2</link>
            <guid isPermaLink="false">https://medium.com/p/10dfd94e8839</guid>
            <category><![CDATA[scala]]></category>
            <category><![CDATA[apache-flink]]></category>
            <category><![CDATA[streaming]]></category>
            <category><![CDATA[flink]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[Abhimanyu]]></dc:creator>
            <pubDate>Fri, 09 Nov 2018 15:41:40 GMT</pubDate>
            <atom:updated>2018-11-09T15:46:41.177Z</atom:updated>
            <content:encoded><![CDATA[<h3>Flink :- No JobSubmissionResult returned, please make sure you called ExecutionEnvironment.execute()</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4yVS4irozUSx-02ohplFsQ.png" /><figcaption>Image courtesy — <a href="https://flink.apache.org/">https://flink.apache.org</a></figcaption></figure><p>Last week I was working on one of my Apache Flink based project, in which I added several more sub-tasks to the stream. And while submitting the job through flink CLI I got No JobSubmissionResult returned error.</p><p>We know that No JobSubmissionResult occurs also when we forget to call ExecutionEnvironment.execute(). But in my case I had called env.execute(“Stream Job”) still it failed when I tried to deploy using Flink CLI using command, although when I tried to deploy the task jars to the web interface, task got deployed successfully.</p><pre>./flink run /opt/flink-jobs/stock-ohlc-job.jar</pre><p>I noticed below in the stack trace, which threw the job not found exception.</p><pre>ERROR akka.remote.EndpointWriter - Transient association error (association remains live)<br><strong>akka.remote.OversizedPayloadException: Discarding oversized payload sent to Actor[akka.tcp://flink@172.XX.XX.XX:6123/user/jobmanager#467971694]: max allowed size 10485760 bytes, actual size of encoded class org.apache.flink.runtime.messages.JobManagerMessages$LeaderSessionMessage was 13846328 bytes.</strong></pre><pre>Caused by: org.apache.flink.runtime.client.JobExecutionException: Couldn&#39;t retrieve the JobExecutionResult from the JobManager.<br>at org.apache.flink.runtime.client.JobClient.awaitJobResult(JobClient.java:300)<br>at org.apache.flink.runtime.client.JobClient.submitJobAndWait(JobClient.java:387)<br>at org.apache.flink.client.program.ClusterClient.run(ClusterClient.java:481)<br>... 19 more<br>Caused by: org.apache.flink.runtime.client.JobClientActorSubmissionTimeoutException: Job submission to the JobManager timed out. You may increase &#39;akka.client.timeout&#39; in case the JobManager needs more time to configure and confirm the job submission.<br>at org.apache.flink.runtime.client.JobSubmissionClientActor.handleCustomMessage(JobSubmissionClientActor.java:127)<br>at org.apache.flink.runtime.client.JobClientActor.handleMessage(JobClientActor.java:251)<br>at org.apache.flink.runtime.akka.FlinkUntypedActor.handleLeaderSessionID(FlinkUntypedActor.java:92)<br>at org.apache.flink.runtime.akka.FlinkUntypedActor.onReceive(FlinkUntypedActor.java:71)<br>at akka.actor.UntypedActor$$anonfun$receive$1.applyOrElse(UntypedActor.scala:165)<br>at akka.actor.Actor$class.aroundReceive(Actor.scala:502)<br>at akka.actor.UntypedActor.aroundReceive(UntypedActor.scala:95)<br>at akka.actor.ActorCell.receiveMessage(ActorCell.scala:526)<br>at akka.actor.ActorCell.invoke(ActorCell.scala:495)<br>at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:257)<br>at akka.dispatch.Mailbox.run(Mailbox.scala:224)<br>at akka.dispatch.Mailbox.exec(Mailbox.scala:234)<br>at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)<br>at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)<br>at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)<br>at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)<br>2018</pre><p>We can see part of the stacktrace in bold, its suggesting that it discarded some part of the payload, I researched on internet and came to know with following solution.</p><p>I added below line to flink-conf.yml</p><p>Solution :- increase Akka Frame Size in flink-conf.yml</p><blockquote>## Akka<br>akka.framesize: 209715200b</blockquote><blockquote>Reference link : <a href="http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/flink-akka-OversizedPayloadException-error-td12218.html">http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/flink-akka-OversizedPayloadException-error-td12218.html</a></blockquote><p>Although stacktrace also suggested about increasing ‘akka.client.timeout’ bit it didn’t work in my case.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=10dfd94e8839" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Sprin MVC : Content Type is not being set correctly]]></title>
            <link>https://abhimanyu081.medium.com/sprin-mvc-content-type-is-not-being-set-correctly-3946706b0b2a?source=rss-fb079e28e726------2</link>
            <guid isPermaLink="false">https://medium.com/p/3946706b0b2a</guid>
            <category><![CDATA[spring]]></category>
            <category><![CDATA[spring-web]]></category>
            <category><![CDATA[spring-mvc]]></category>
            <category><![CDATA[restcontroller]]></category>
            <category><![CDATA[mvc]]></category>
            <dc:creator><![CDATA[Abhimanyu]]></dc:creator>
            <pubDate>Fri, 25 Aug 2017 02:07:45 GMT</pubDate>
            <atom:updated>2018-11-12T16:43:00.027Z</atom:updated>
            <content:encoded><![CDATA[<h3>Sprin MVC : Content Type is not being set correctly</h3><p><strong>Problem</strong>: content type always being set as “text/html”</p><p>The problem is when you set your method return type as string then spring by default uses StringHttpMessageConverter and thus sets the Content-type header to text/plain. If you want to return a JSON string yourself and set the header to application/json, use a return type of ResponseEntity and add appropriate headers to it.</p><pre><a href="http://twitter.com/RequestMapping">@RequestMapping</a>(value = &quot;/json&quot;, method = RequestMethod.GET, produces = &quot;application/json&quot;) public ResponseEntity &lt; String &gt; foo() {<br> final HttpHeaders httpHeaders = new HttpHeaders();<br> httpHeaders.setContentType(MediaType.APPLICATION_JSON);<br> return new ResponseEntity &lt; String &gt; (&quot;{\&quot;message\&quot;: \&quot;hello\&quot;}&quot;, httpHeaders, HttpStatus.OK);<br>}</pre><p>And if you are wondering why its content type not set to application/json even after you adding produces = “application/json”. Then thing you need to understand is that the RequestMapping#produces() element in</p><pre>@RequestMapping(value = &quot;/json&quot;, method = RequestMethod.GET, produces = &quot;application/json&quot;)</pre><p>serves only to restrict the mapping for your request handlers. It does nothing else.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3946706b0b2a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>