Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 12 for toNanos (0.29 sec)

  1. okhttp/src/test/java/okhttp3/internal/concurrent/TaskRunnerRealBackendTest.kt

      @AfterEach fun tearDown() {
        backend.shutdown()
      }
    
      @Test fun test() {
        val t1 = System.nanoTime() / 1e6
    
        val delays = mutableListOf(TimeUnit.MILLISECONDS.toNanos(1000), -1L)
        queue.schedule("task", TimeUnit.MILLISECONDS.toNanos(750)) {
          log.put("runOnce delays.size=${delays.size}")
          return@schedule delays.removeAt(0)
        }
    
        assertThat(log.take()).isEqualTo("runOnce delays.size=2")
    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)
  2. mockwebserver/src/main/kotlin/mockwebserver3/MockResponse.kt

          throttlePeriodNanos = unit.toNanos(period)
        }
    
        /**
         * Set the delayed time of the response body to [delay]. This applies to the response body
         * only; response headers are not affected.
         */
        fun bodyDelay(
          delay: Long,
          unit: TimeUnit,
        ) = apply {
          bodyDelayNanos = unit.toNanos(delay)
        }
    
        fun headersDelay(
          delay: Long,
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Tue Jan 23 14:31:42 GMT 2024
    - 13.3K bytes
    - Viewed (1)
  3. okhttp/src/main/kotlin/okhttp3/internal/connection/FastFallbackExchangeFinder.kt

     */
    internal class FastFallbackExchangeFinder(
      override val routePlanner: RoutePlanner,
      private val taskRunner: TaskRunner,
    ) : ExchangeFinder {
      private val connectDelayNanos = TimeUnit.MILLISECONDS.toNanos(250L)
      private var nextTcpConnectAtNanos = Long.MIN_VALUE
    
      /**
       * Plans currently being connected, and that will later be added to [connectResults]. This is
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 5.8K bytes
    - Viewed (0)
  4. okhttp/src/test/java/okhttp3/WholeOperationTimeoutTest.kt

          client.newBuilder()
            .callTimeout(Duration.ofMillis(456))
            .build()
        val call = timeoutClient.newCall(request)
        assertThat(call.timeout().timeoutNanos())
          .isEqualTo(TimeUnit.MILLISECONDS.toNanos(456))
      }
    
      @Test
      fun timeoutWritingRequest() {
        server.enqueue(MockResponse())
        val request =
          Request.Builder()
            .url(server.url("/"))
            .post(sleepingRequestBody(500))
    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)
  5. okhttp/src/main/kotlin/okhttp3/internal/ws/RealWebSocket.kt

              minimumDeflateSize = minimumDeflateSize,
            )
          this.writerTask = WriterTask()
          if (pingIntervalMillis != 0L) {
            val pingIntervalNanos = MILLISECONDS.toNanos(pingIntervalMillis)
            taskQueue.schedule("$name ping", pingIntervalNanos) {
              writePingFrame()
              return@schedule pingIntervalNanos
            }
          }
    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)
  6. okhttp-testing-support/src/main/kotlin/okhttp3/internal/concurrent/TaskFaker.kt

        override fun poll(): T = delegate.poll()
    
        override fun poll(
          timeout: Long,
          unit: TimeUnit,
        ): T? {
          taskRunner.lock.withLock {
            val waitUntil = nanoTime + unit.toNanos(timeout)
            while (true) {
              val result = poll()
              if (result != null) return result
              if (nanoTime >= waitUntil) return null
              val editCountBefore = editCount
    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)
  7. okhttp/src/main/kotlin/okhttp3/internal/-UtilJvm.kt

        if (timeout().hasDeadline()) {
          timeout().deadlineNanoTime() - nowNs
        } else {
          Long.MAX_VALUE
        }
      timeout().deadlineNanoTime(nowNs + minOf(originalDurationNs, timeUnit.toNanos(duration.toLong())))
      return try {
        val skipBuffer = Buffer()
        while (read(skipBuffer, 8192) != -1L) {
          skipBuffer.clear()
        }
        true // Success! The source has been exhausted.
    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)
  8. okhttp/src/main/kotlin/okhttp3/internal/connection/RealConnectionPool.kt

      internal val connectionListener: ConnectionListener,
      private val exchangeFinderFactory: (RealConnectionPool, Address, ConnectionUser) -> ExchangeFinder,
    ) {
      internal val keepAliveDurationNs: Long = timeUnit.toNanos(keepAliveDuration)
    
      @Volatile
      private var addressStates: Map<Address, AddressState> = mapOf()
    
      private val cleanupQueue: TaskQueue = taskRunner.newQueue()
      private val cleanupTask =
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sat Apr 20 17:03:43 GMT 2024
    - 16.2K bytes
    - Viewed (0)
  9. okhttp/src/test/java/okhttp3/InterceptorTest.kt

        assertFailsWith<SocketTimeoutException> {
          call.execute()
        }
        val elapsedNanos = System.nanoTime() - startNanos
        org.junit.jupiter.api.Assertions.assertTrue(
          elapsedNanos < TimeUnit.SECONDS.toNanos(5),
          "Timeout should have taken ~100ms but was " + elapsedNanos / 1e6 + " ms",
        )
      }
    
      @Test
      fun chainWithReadTimeout() {
        val interceptor1 =
          Interceptor { chainA: Interceptor.Chain ->
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sun Jan 14 10:20:09 GMT 2024
    - 27.8K bytes
    - Viewed (0)
  10. okhttp/src/main/kotlin/okhttp3/internal/http2/Http2Connection.kt

      // Guarded by this.
      private val currentPushRequests = mutableSetOf<Int>()
    
      init {
        if (builder.pingIntervalMillis != 0) {
          val pingIntervalNanos = TimeUnit.MILLISECONDS.toNanos(builder.pingIntervalMillis.toLong())
          writerQueue.schedule("$connectionName ping", pingIntervalNanos) {
            val failDueToMissingPong =
              this.withLock {
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sat Apr 20 17:03:43 GMT 2024
    - 32.6K bytes
    - Viewed (0)
Back to top