Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 132 for thread (0.18 sec)

  1. okhttp/src/main/kotlin/okhttp3/internal/concurrent/TaskRunner.kt

      /**
       * When we need a new thread to run tasks, we call [Backend.execute]. A few microseconds later we
       * expect a newly-started thread to call [Runnable.run]. We shouldn't request new threads until
       * the already-requested ones are in service, otherwise we might create more threads than we need.
       *
       * We use [executeCallCount] and [runCallCount] to defend against starting more threads than we
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Apr 29 00:33:04 GMT 2024
    - 10.6K bytes
    - Viewed (0)
  2. okhttp-testing-support/src/main/kotlin/okhttp3/internal/concurrent/TaskFaker.kt

          throw AssertionError("Thread ${Thread.currentThread().name} MUST hold lock on $this")
        }
      }
    
      @Suppress("NOTHING_TO_INLINE")
      internal inline fun Any.assertThreadDoesntHoldLock() {
        if (assertionsEnabled && taskRunner.lock.isHeldByCurrentThread) {
          throw AssertionError("Thread ${Thread.currentThread().name} MUST NOT hold lock on $this")
        }
      }
    
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Apr 29 00:33:04 GMT 2024
    - 12.6K bytes
    - Viewed (0)
  3. docs/contribute/concurrency.md

    #### Shared reader thread
    
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sun Feb 06 16:35:36 GMT 2022
    - 7K bytes
    - Viewed (0)
  4. okhttp/src/main/kotlin/okhttp3/internal/-UtilJvm.kt

      if (assertionsEnabled && !this.isHeldByCurrentThread) {
        throw AssertionError("Thread ${Thread.currentThread().name} MUST hold lock on $this")
      }
    }
    
    @Suppress("NOTHING_TO_INLINE")
    internal inline fun Any.assertThreadHoldsLock() {
      if (assertionsEnabled && !Thread.holdsLock(this)) {
        throw AssertionError("Thread ${Thread.currentThread().name} MUST hold lock on $this")
      }
    }
    
    @Suppress("NOTHING_TO_INLINE")
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Tue Jan 09 12:33:05 GMT 2024
    - 10.5K bytes
    - Viewed (0)
  5. okhttp-testing-support/src/main/kotlin/okhttp3/OkHttpClientTestRule.kt

            .connectionPool(ConnectionPool(connectionListener = connectionListener))
        }
    
      private fun loomThreadFactory(): ThreadFactory {
        val ofVirtual = Thread::class.java.getMethod("ofVirtual").invoke(null)
    
        return Class.forName("java.lang.Thread\$Builder")
          .getMethod("factory")
          .invoke(ofVirtual) as ThreadFactory
      }
    
      private fun isLoom(): Boolean {
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 10.5K bytes
    - Viewed (0)
  6. okhttp-testing-support/src/test/kotlin/okhttp3/OkHttpClientTestRuleTest.kt

        }
    
      @Test fun uncaughtException() {
        val testRule = OkHttpClientTestRule()
        testRule.beforeEach(extensionContext)
    
        val thread =
          object : Thread() {
            override fun run() {
              throw RuntimeException("boom!")
            }
          }
        thread.start()
        thread.join()
    
        assertFailsWith<AssertionError> {
          testRule.afterEach(extensionContext)
        }.also { expected ->
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 1.7K bytes
    - Viewed (0)
  7. okhttp/src/main/kotlin/okhttp3/internal/ws/RealWebSocket.kt

      }
    
      /** Receive frames until there are no more. Invoked only by the reader thread. */
      @Throws(IOException::class)
      fun loopReader(response: Response) {
        try {
          listener.onOpen(this@RealWebSocket, response)
          while (receivedCloseCode == -1) {
            // This method call results in one or more onRead* methods being called on this thread.
            reader!!.processNextFrame()
          }
        } catch (e: Exception) {
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Apr 01 14:21:25 GMT 2024
    - 22.1K bytes
    - Viewed (0)
  8. docs/features/calls.md

    Calls are executed in one of two ways:
    
     * **Synchronous:** your thread blocks until the response is readable.
     * **Asynchronous:** you enqueue the request on any thread, and get [called back](https://square.github.io/okhttp/4.x/okhttp/okhttp3/-callback/) on another thread when the response is readable.
    
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sun Feb 06 02:19:09 GMT 2022
    - 3.9K bytes
    - Viewed (0)
  9. okhttp/src/test/java/okhttp3/internal/connection/ConnectionPoolTest.kt

        assertThat(realTaskRunner.activeQueues()).isNotEmpty()
        Thread.sleep(100)
        val threads = arrayOfNulls<Thread>(Thread.activeCount() * 2)
        Thread.enumerate(threads)
        for (t in threads) {
          if (t != null && t.name == "OkHttp TaskRunner") {
            t.interrupt()
          }
        }
        Thread.sleep(100)
        assertThat(realTaskRunner.activeQueues()).isEmpty()
      }
    
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Wed Apr 24 04:40:49 GMT 2024
    - 12.7K bytes
    - Viewed (0)
  10. okhttp/src/test/java/okhttp3/internal/concurrent/TaskRunnerRealBackendTest.kt

    package okhttp3.internal.concurrent
    
    import assertk.assertThat
    import assertk.assertions.isCloseTo
    import assertk.assertions.isEmpty
    import assertk.assertions.isEqualTo
    import assertk.assertions.isTrue
    import java.lang.Thread.UncaughtExceptionHandler
    import java.util.concurrent.LinkedBlockingDeque
    import java.util.concurrent.ThreadFactory
    import java.util.concurrent.TimeUnit
    import org.junit.jupiter.api.AfterEach
    import org.junit.jupiter.api.Tag
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 3.5K bytes
    - Viewed (0)
Back to top