{"id":5308,"date":"2023-10-20T15:36:26","date_gmt":"2023-10-20T22:36:26","guid":{"rendered":"https:\/\/ioflood.com\/blog\/?p=5308"},"modified":"2024-02-19T20:49:04","modified_gmt":"2024-02-20T03:49:04","slug":"java-sleep","status":"publish","type":"post","link":"https:\/\/ioflood.com\/blog\/java-sleep\/","title":{"rendered":"Thread.sleep(): Your Guide to Pausing Execution in Java"},"content":{"rendered":"<div class=\"wp-block-image\">\n<figure class=\"alignright size-full is-resized\"><img decoding=\"async\" src=\"https:\/\/ioflood.com\/blog\/wp-content\/uploads\/2023\/10\/java_sleep_computer_night_moon_sleeping-300x300.jpg\" alt=\"java_sleep_computer_night_moon_sleeping\" width=\"300\" height=\"300\" title=\"\"><\/figure>\n<\/div>\n<p>Are you finding it difficult to pause your Java program? You&#8217;re not alone. Many developers find themselves in a bind when it comes to managing the flow of their Java programs, but there&#8217;s a solution.<\/p>\n<p>Like a well-timed conductor, Java&#8217;s sleep method can halt the execution of your program, providing a crucial pause. This pause can be instrumental in managing the flow of your program, especially in complex multi-threaded applications.<\/p>\n<p><strong>This guide will walk you through the ins and outs of using Java&#8217;s sleep method<\/strong>, from basic usage to advanced techniques. We&#8217;ll cover everything from the basics of the sleep method, its practical applications, to dealing with common issues and their solutions.<\/p>\n<p>So, let&#8217;s dive in and start mastering the Java sleep method!<\/p>\n<h2>TL;DR: How Do I Pause or Delay Execution in Java?<\/h2>\n<blockquote><p>\n  To pause execution in Java, you use the <code>Thread.sleep()<\/code> method. This method can halt the execution of your program for a specified period of time.\n<\/p><\/blockquote>\n<p>Here&#8217;s a simple example:<\/p>\n<pre><code class=\"language-java line-numbers\">public class Main {\n    public static void main(String[] args) {\n        try {\n            System.out.println(\"Sleeping...\");\n            Thread.sleep(1000);\n            System.out.println(\"Awake!\");\n        } catch (InterruptedException e) {\n            e.printStackTrace();\n        }\n    }\n}\n\n# Output:\n# Sleeping...\n# (waits for 1 second)\n# Awake!\n<\/code><\/pre>\n<p>In this example, we use <code>Thread.sleep(1000);<\/code> to pause the program for 1000 milliseconds (or 1 second). The program first prints &#8216;Sleeping&#8230;&#8217;, then waits for 1 second, and finally prints &#8216;Awake!&#8217;.<\/p>\n<blockquote><p>\n  This is a basic way to use <code>Thread.sleep()<\/code> in Java, but there&#8217;s much more to learn about pausing execution and managing the flow of your programs. Continue reading for more detailed information and advanced usage scenarios.\n<\/p><\/blockquote>\n<h2>Exploring the Basics of Java Sleep<\/h2>\n<p>The <code>Thread.sleep()<\/code> method in Java is used to pause the execution of the current thread for a specified period of time. It&#8217;s a static method of the Thread class and it takes a single argument: the length of time to sleep in milliseconds.<\/p>\n<p>Here&#8217;s a simple example of how to use <code>Thread.sleep()<\/code>:<\/p>\n<pre><code class=\"language-java line-numbers\">public class BasicSleep {\n    public static void main(String[] args) {\n        try {\n            System.out.println(\"Sleep starts\");\n            Thread.sleep(2000);\n            System.out.println(\"Sleep ends\");\n        } catch (InterruptedException e) {\n            e.printStackTrace();\n        }\n    }\n}\n\n# Output:\n# Sleep starts\n# (waits for 2 seconds)\n# Sleep ends\n<\/code><\/pre>\n<p>In this example, the current thread sleeps for 2000 milliseconds, or 2 seconds, between printing &#8216;Sleep starts&#8217; and &#8216;Sleep ends&#8217;.<\/p>\n<p>The <code>Thread.sleep()<\/code> method can be incredibly useful in a variety of situations. For instance, it can be used to simulate network latency in a testing environment, or to create a delay in an animation.<\/p>\n<p>However, it&#8217;s important to note that while <code>Thread.sleep()<\/code> is a simple and straightforward method to implement, it&#8217;s not always the best choice for managing the timing of your program. One of the main drawbacks of <code>Thread.sleep()<\/code> is that it can lead to less responsive applications, especially if used excessively or with very long sleep durations. This is because while a thread is sleeping, it&#8217;s not able to do anything else, which can make your program seem unresponsive or slow.<\/p>\n<h2>Advanced Techniques with Java Sleep<\/h2>\n<p>As your Java programming skills advance, you&#8217;ll find more complex and nuanced uses for <code>Thread.sleep()<\/code>. One such use is within loops, where you can control the execution flow of iterative operations. Another is in conjunction with other methods to manage more complex scenarios.<\/p>\n<p>Let&#8217;s explore these scenarios in more detail.<\/p>\n<h3>Using Java Sleep within Loops<\/h3>\n<p>You can use <code>Thread.sleep()<\/code> within a loop to pause the execution of each iteration. This can be useful in scenarios where you want to space out the operations being performed in the loop.<\/p>\n<p>Here&#8217;s a simple example:<\/p>\n<pre><code class=\"language-java line-numbers\">public class SleepInLoop {\n    public static void main(String[] args) {\n        try {\n            for (int i = 0; i &lt; 5; i++) {\n                System.out.println(\"Iteration: \" + i);\n                Thread.sleep(1000);\n            }\n        } catch (InterruptedException e) {\n            e.printStackTrace();\n        }\n    }\n}\n\n# Output:\n# Iteration: 0\n# (waits for 1 second)\n# Iteration: 1\n# (waits for 1 second)\n# Iteration: 2\n# (waits for 1 second)\n# Iteration: 3\n# (waits for 1 second)\n# Iteration: 4\n<\/code><\/pre>\n<p>In this example, the loop iterates five times, printing the iteration number each time. After each print statement, the thread sleeps for 1 second. This creates a one-second pause between each iteration of the loop.<\/p>\n<h3>Java Sleep in Conjunction with Other Methods<\/h3>\n<p><code>Thread.sleep()<\/code> can also be used in conjunction with other methods to manage more complex scenarios. For instance, you might use <code>Thread.sleep()<\/code> with <code>System.currentTimeMillis()<\/code> to measure the actual time that your thread sleeps. This can be useful for understanding how long your thread is actually sleeping, as the sleep time can sometimes be longer than you requested due to factors like system load or thread scheduling.<\/p>\n<p>Here&#8217;s an example:<\/p>\n<pre><code class=\"language-java line-numbers\">public class SleepWithTimeCheck {\n    public static void main(String[] args) {\n        try {\n            long start = System.currentTimeMillis();\n            System.out.println(\"Sleeping...\");\n            Thread.sleep(2000);\n            long end = System.currentTimeMillis();\n            System.out.println(\"Awake! Slept for \" + (end - start) + \" milliseconds.\");\n        } catch (InterruptedException e) {\n            e.printStackTrace();\n        }\n    }\n}\n\n# Output:\n# Sleeping...\n# (waits for 2 seconds)\n# Awake! Slept for 2001 milliseconds.\n<\/code><\/pre>\n<p>In this example, we first record the current time in milliseconds before the sleep. After the sleep, we record the time again and subtract the start time from it to get the actual sleep time. This allows us to see the actual duration of the sleep, which in this case was 2001 milliseconds, slightly more than the 2000 milliseconds we requested.<\/p>\n<p>These advanced uses of <code>Thread.sleep()<\/code> provide more control over your Java program&#8217;s execution flow and can be incredibly powerful tools in your Java programming toolkit.<\/p>\n<h2>Exploring Alternatives to Java Sleep<\/h2>\n<p>While <code>Thread.sleep()<\/code> is a handy tool, it&#8217;s not the only way to pause execution in Java. Other methods, like the <code>wait()<\/code> method and the <code>ScheduledExecutorService<\/code>, offer alternative approaches. These can be more suitable for certain scenarios and can provide more control over your program&#8217;s execution.<\/p>\n<h3>Using the <code>wait()<\/code> Method<\/h3>\n<p>The <code>wait()<\/code> method is part of Java&#8217;s object class and is used in multi-threaded environments to pause the execution of a thread until another thread invokes the <code>notify()<\/code> or <code>notifyAll()<\/code> method for the same object.<\/p>\n<p>Here&#8217;s a simple example of how <code>wait()<\/code> can be used:<\/p>\n<pre><code class=\"language-java line-numbers\">public class WaitExample {\n    public static void main(String[] args) {\n        synchronized (args) {\n            try {\n                System.out.println(\"Waiting...\");\n                args.wait(2000);\n                System.out.println(\"Resumed!\");\n            } catch (InterruptedException e) {\n                e.printStackTrace();\n            }\n        }\n    }\n}\n\n# Output:\n# Waiting...\n# (waits for 2 seconds)\n# Resumed!\n<\/code><\/pre>\n<p>In this example, the <code>wait(2000)<\/code> method causes the current thread to wait for 2000 milliseconds, similar to <code>Thread.sleep(2000)<\/code>. However, unlike <code>Thread.sleep()<\/code>, <code>wait()<\/code> also allows other threads to interrupt the wait by calling <code>notify()<\/code> or <code>notifyAll()<\/code> on the same object.<\/p>\n<h3>Using the <code>ScheduledExecutorService<\/code><\/h3>\n<p>The <code>ScheduledExecutorService<\/code> is a more sophisticated service for scheduling tasks to run after a delay, or to execute periodically. It offers more flexibility and control compared to <code>Thread.sleep()<\/code>.<\/p>\n<p>Here&#8217;s a simple example of how to use <code>ScheduledExecutorService<\/code> to create a delay:<\/p>\n<pre><code class=\"language-java line-numbers\">import java.util.concurrent.Executors;\nimport java.util.concurrent.ScheduledExecutorService;\nimport java.util.concurrent.TimeUnit;\n\npublic class ScheduledExecutorServiceExample {\n    public static void main(String[] args) {\n        ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor();\n\n        Runnable task = () -&gt; {\n            System.out.println(\"Task executed\");\n        };\n\n        System.out.println(\"Scheduling task to be executed after 2 seconds\");\n        executorService.schedule(task, 2, TimeUnit.SECONDS);\n        executorService.shutdown();\n    }\n}\n\n# Output:\n# Scheduling task to be executed after 2 seconds\n# (waits for 2 seconds)\n# Task executed\n<\/code><\/pre>\n<p>In this example, a task is scheduled to run after a delay of 2 seconds. The <code>ScheduledExecutorService<\/code> provides more control over task scheduling and is generally more flexible than <code>Thread.sleep()<\/code>, but it&#8217;s also more complex to use.<\/p>\n<p>These alternative methods to <code>Thread.sleep()<\/code> each have their own benefits and drawbacks. The <code>wait()<\/code> method can be useful in multi-threaded environments, while the <code>ScheduledExecutorService<\/code> offers more control over task scheduling. However, they&#8217;re also more complex to use than <code>Thread.sleep()<\/code>. When choosing between these methods, consider your specific needs and the complexity of your program.<\/p>\n<h2>Troubleshooting Java Sleep Issues<\/h2>\n<p>While <code>Thread.sleep()<\/code> is a powerful tool, it&#8217;s not without its potential pitfalls. One of the most common issues you might encounter when using <code>Thread.sleep()<\/code> is <code>InterruptedException<\/code>. This exception is thrown when another thread interrupts the current thread while it&#8217;s sleeping or waiting.<\/p>\n<h3>Handling <code>InterruptedException<\/code><\/h3>\n<p>When a thread is interrupted during a sleep, it receives an <code>InterruptedException<\/code>. This is a checked exception, meaning you need to handle it in your code. Most often, you&#8217;ll either throw the exception or handle it with a try-catch block.<\/p>\n<p>Here&#8217;s an example of how to handle an <code>InterruptedException<\/code>:<\/p>\n<pre><code class=\"language-java line-numbers\">public class InterruptedExceptionExample {\n    public static void main(String[] args) {\n        try {\n            System.out.println(\"Going to sleep...\");\n            Thread.sleep(1000);\n        } catch (InterruptedException e) {\n            System.out.println(\"Was interrupted during sleep\");\n        }\n        System.out.println(\"Woke up!\");\n    }\n}\n\n# Output:\n# Going to sleep...\n# (if interrupted, prints: Was interrupted during sleep)\n# Woke up!\n<\/code><\/pre>\n<p>In this example, if the thread is interrupted during the sleep, it catches the <code>InterruptedException<\/code> and prints &#8216;Was interrupted during sleep&#8217;. If it&#8217;s not interrupted, it simply goes to sleep, wakes up after 1 second, and prints &#8216;Woke up!&#8217;.<\/p>\n<h3>Best Practices<\/h3>\n<p>When using <code>Thread.sleep()<\/code>, there are a few best practices to keep in mind:<\/p>\n<ul>\n<li><strong>Don&#8217;t rely on <code>Thread.sleep()<\/code> for precise timing<\/strong>. Due to factors like system load and thread scheduling, <code>Thread.sleep()<\/code> isn&#8217;t always precisely accurate. If you need more precise timing, consider using other tools like <code>ScheduledExecutorService<\/code>.<\/p>\n<\/li>\n<li>\n<p><strong>Avoid long sleep times<\/strong>. Long sleep times can make your application seem unresponsive or slow. If you need to delay operations, consider using other techniques like scheduling tasks or using wait\/notify.<\/p>\n<\/li>\n<li>\n<p><strong>Always handle <code>InterruptedException<\/code><\/strong>. When a thread is interrupted during a sleep, it receives an <code>InterruptedException<\/code>. Always handle this exception to ensure your program can deal with interruptions gracefully.<\/p>\n<\/li>\n<\/ul>\n<p>By understanding the potential issues and following these best practices, you can use <code>Thread.sleep()<\/code> effectively and avoid common pitfalls.<\/p>\n<h2>Understanding Java&#8217;s Threading Model<\/h2>\n<p>Before diving deeper into the methods to pause execution in Java, it&#8217;s crucial to understand the underlying concept &#8211; Java&#8217;s threading model. The threading model is the foundation of how Java handles multiple threads of execution within a single program.<\/p>\n<p>In Java, a thread is a lightweight process or, in other words, a unit of execution. Each Java application can have multiple threads, all executing concurrently. This concurrency is managed by the Java Virtual Machine (JVM), which schedules threads using an internal algorithm.<\/p>\n<h3>Pausing Execution: Why and When?<\/h3>\n<p>Pausing execution, as we do with <code>Thread.sleep()<\/code>, is a way to control the flow of these concurrent threads. By pausing a thread, we can simulate delays, control the timing of certain operations, or even allow other threads to complete their tasks.<\/p>\n<h3>Thread Scheduling and Synchronization<\/h3>\n<p>Thread scheduling is the process by which the JVM determines which thread to execute at any given time. It&#8217;s a complex process that involves factors like thread priority and thread state.<\/p>\n<p>Synchronization, on the other hand, is a mechanism that controls the access of multiple threads to shared resources. Without synchronization, it&#8217;s possible for one thread to modify a shared variable while another thread is in the process of using or updating that same variable. This leads to significant errors.<\/p>\n<p>Here&#8217;s a simple example of synchronization in Java:<\/p>\n<pre><code class=\"language-java line-numbers\">public class SynchronizedCounter {\n    private int c = 0;\n\n    public synchronized void increment() {\n        c++;\n    }\n\n    public synchronized void decrement() {\n        c--;\n    }\n\n    public synchronized int value() {\n        return c;\n    }\n}\n<\/code><\/pre>\n<p>In this example, the <code>increment()<\/code>, <code>decrement()<\/code>, and <code>value()<\/code> methods are all declared as <code>synchronized<\/code>. This means that only one thread can access these methods at a time, preventing issues with concurrent access to the shared <code>c<\/code> variable.<\/p>\n<p>Understanding these fundamental concepts is key to mastering the use of <code>Thread.sleep()<\/code> and other methods for pausing execution in Java.<\/p>\n<h2>Practical Applications of Pausing Execution in Java<\/h2>\n<p>Pausing execution in Java has numerous practical applications. It&#8217;s not just a theoretical concept, but a practical tool that you can use to solve real-world problems in your Java programs.<\/p>\n<h3>Creating Animations<\/h3>\n<p>One of the most common uses of pausing execution is in creating animations. By controlling the timing of your animation frames, you can create smooth and visually appealing animations. Here&#8217;s a simple example:<\/p>\n<pre><code class=\"language-java line-numbers\">public class AnimationExample {\n    public static void main(String[] args) {\n        try {\n            for (int i = 0; i &lt; 10; i++) {\n                System.out.println(\"Frame \" + i);\n                Thread.sleep(500);\n            }\n        } catch (InterruptedException e) {\n            e.printStackTrace();\n        }\n    }\n}\n\n# Output:\n# Frame 0\n# (waits for 0.5 seconds)\n# Frame 1\n# (waits for 0.5 seconds)\n# Frame 2\n# ...\n# Frame 9\n<\/code><\/pre>\n<p>In this example, we simulate an animation with 10 frames. Each frame is displayed for 0.5 seconds, creating a smooth animation effect.<\/p>\n<h3>Simulating Time-Consuming Tasks<\/h3>\n<p>Another practical application of pausing execution is to simulate time-consuming tasks. This can be especially useful in testing environments, where you might need to simulate a network delay or a long-running computation.<\/p>\n<pre><code class=\"language-java line-numbers\">public class SimulationExample {\n    public static void main(String[] args) {\n        try {\n            System.out.println(\"Starting long-running task...\");\n            Thread.sleep(5000);\n            System.out.println(\"Task completed!\");\n        } catch (InterruptedException e) {\n            e.printStackTrace();\n        }\n    }\n}\n\n# Output:\n# Starting long-running task...\n# (waits for 5 seconds)\n# Task completed!\n<\/code><\/pre>\n<p>In this example, we simulate a long-running task by sleeping for 5 seconds. This can be useful for testing how your program handles delays or long-running operations.<\/p>\n<h3>Further Resources for Mastering Java Sleep<\/h3>\n<p>To continue your journey in mastering Java&#8217;s sleep method and other concurrency utilities, check out these resources:<\/p>\n<ul>\n<li><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/ioflood.com\/blog\/loops-in-java\/\">Java Loops Tutorial: Getting Started<\/a> &#8211; Learn about the do-while loop and its application in Java.<\/p>\n<\/li>\n<li>\n<p><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/ioflood.com\/blog\/recursion-java\/\">Java Recursion Basics<\/a> &#8211; Learn about base cases, recursive cases, and termination conditions.<\/p>\n<\/li>\n<li>\n<p><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/ioflood.com\/blog\/conditions-in-java\/\">Using Conditions in Java<\/a> &#8211; Master handling various conditions effectively in Java programming.<\/p>\n<\/li>\n<li>\n<p><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/docs.oracle.com\/javase\/tutorial\/essential\/concurrency\/\" target=\"_blank\" rel=\"noopener\">Oracle&#8217;s Java Tutorials: Concurrency<\/a> &#8211; Delve into Oracle&#8217;s guide on managing simultaneous operations in Java.<\/p>\n<\/li>\n<li>\n<p><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/www.baeldung.com\/java-executor-service-tutorial\" target=\"_blank\" rel=\"noopener\">Guide to the Java ExecutorService<\/a> &#8211; Uncover how to optimize thread execution in Java with Baeldung&#8217;s guide.<\/p>\n<\/li>\n<li>\n<p><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/www.javaworld.com\/article\/2074217\/java-concurrency\/java-101--understanding-java-threads--part-1--introducing-threads-and-runnables.html\" target=\"_blank\" rel=\"noopener\">Understanding Java Threads<\/a> &#8211; Master the operation and application of threads in Java with this tutorial from JavaWorld.<\/p>\n<\/li>\n<\/ul>\n<p>These resources provide in-depth discussions and tutorials on Java&#8217;s concurrency utilities, including <code>Thread.sleep()<\/code>, and can help you deepen your understanding and improve your skills.<\/p>\n<h2>Wrapping Up: Mastering Java Sleep for Pausing Execution<\/h2>\n<p>In this comprehensive guide, we&#8217;ve explored the nuances of Java&#8217;s sleep method, a powerful tool for pausing the execution of your Java programs.<\/p>\n<p>We began with the basics, showing you how to use <code>Thread.sleep()<\/code> to create a simple pause in your program&#8217;s execution. We then delved into more complex uses, such as using <code>Thread.sleep()<\/code> within loops and in conjunction with other methods to manage more intricate scenarios.<\/p>\n<p>Along the way, we tackled common challenges you might face when using <code>Thread.sleep()<\/code>, like handling <code>InterruptedException<\/code>, and provided solutions to help you navigate these issues. We also ventured into alternatives to <code>Thread.sleep()<\/code>, such as the <code>wait()<\/code> method and the <code>ScheduledExecutorService<\/code>, and discussed when these might be more appropriate tools for pausing execution.<\/p>\n<table>\n<thead>\n<tr>\n<th>Method<\/th>\n<th>Use Case<\/th>\n<th>Complexity<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>Thread.sleep()<\/code><\/td>\n<td>Simple delays, testing environments<\/td>\n<td>Low<\/td>\n<\/tr>\n<tr>\n<td><code>wait()<\/code><\/td>\n<td>Multi-threaded environments, waiting for specific conditions<\/td>\n<td>Moderate<\/td>\n<\/tr>\n<tr>\n<td><code>ScheduledExecutorService<\/code><\/td>\n<td>Precise scheduling, recurring tasks<\/td>\n<td>High<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Whether you&#8217;re just starting out with Java or you&#8217;re a seasoned developer looking to better manage the flow of your programs, we hope this guide has given you a deeper understanding of how to pause execution in Java using <code>Thread.sleep()<\/code> and its alternatives.<\/p>\n<p>With the ability to control the timing and flow of your program, you&#8217;re well equipped to handle a wide variety of programming scenarios. Happy coding!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Are you finding it difficult to pause your Java program? You&#8217;re not alone. Many developers find themselves in a bind when it comes to managing the flow of their Java programs, but there&#8217;s a solution. Like a well-timed conductor, Java&#8217;s sleep method can halt the execution of your program, providing a crucial pause. This pause [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":9777,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[154,121],"tags":[],"class_list":["post-5308","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-java","category-programming-coding","cat-154-id","cat-121-id","has_thumb"],"_links":{"self":[{"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/posts\/5308","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/comments?post=5308"}],"version-history":[{"count":8,"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/posts\/5308\/revisions"}],"predecessor-version":[{"id":17567,"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/posts\/5308\/revisions\/17567"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/media\/9777"}],"wp:attachment":[{"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/media?parent=5308"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/categories?post=5308"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/tags?post=5308"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}