• Synchronized methods and blocks allow a thread to lock an object on entry and unlock the object on exit (to the method or block).

    同步方法代码允许线程入口处锁定对象出口处解锁(针对方法代码)。

    youdao

  • If you have two operations that require synchronization separated by a small block of thread-safe code, you are generally better just using a single synchronized block.

    要是一小线程安全代码要求同步两个操作隔开那么使用一个同步一般更好些

    youdao

  • When one thread is executing a synchronized block, any thread waiting to enter that block is stalled.

    线程正在执行同步时,任何等待进入块的线程都将被阻塞。

    youdao

  • Under those conditions the values in the synchronized block will never be contended for.

    这种条件下同步中的永远不会存在竞争。

    youdao

  • Similarly, as part of acquiring the monitor when entering a synchronized block, local caches are invalidated so that subsequent reads will go directly to main memory and not the local cache.

    与此类似作为获得监视一部分,进入一个同步时,本地缓存失效使之后的操作直接进入内存不是本地缓存。

    youdao

  • In cases where synchronization is necessary, the synchronized code block should be minimized.

    必要进行同步场合下,应该尽量缩小同步代码

    youdao

  • Creating the synchronized block yielded 16 lines of bytecode, whereas synchronizing the method returned just 5.

    创建同步代码产生16行的字节码创建同步方法产生了5行。

    youdao

  • These locks do not require block structures, so they are more flexible than synchronized methods or statements.

    这些需要使用语句结构所以它们同步方法语句灵活

    youdao

  • The percentage performance penalty implied by this fixed delay depends on how much work is being done in the synchronized block.

    一固定延迟带来的性能损失百分比取决于同步块内多少工作

    youdao

  • Synchronized method or synchronized block?

    同步方法同步代码

    youdao

  • The longer a synchronized code block requires for execution, the longer other threads wait to enter that block.

    同步代码所需执行时间其他线程等待进入代码块的时间就越长。

    youdao

  • But if the hashes differ, the out-of-date block is marked as out of sync, and subsequent synchronization ensures that the block is properly synchronized.

    如果列值不相同过期数据标记同步随后同步确保数据块正确同步的。

    youdao

  • The reason is that the synchronized block in Listing 5 prevents parallel execution.

    原因清单5同步代码阻止并行执行

    youdao

  • If it is not small enough, you should analyze your code and refactor it in such a way that anything that could run asynchronously is located outside of the synchronized block.

    如果同步代码不够应该对代码进行分析,对其重构,以使所有可以异步运行代码均位于同步代码块之外

    youdao

  • When a thread exits a synchronized block as part of releasing the associated monitor, the JMM requires that the local processor cache be flushed to main memory.

    线程释放相关监视器而退出一个同步时,J MM要求本地处理器缓冲刷新存中

    youdao

  • In Listing 6, the loop is out of a synchronized block, so it can be executed by several threads in parallel.

    清单6中,循环同步语句所以可能多个线程并行执行

    youdao

  • Do code path analysis to see if there is a synchronized block in the code that is blocking requests to execute concurrently.

    进行代码路径分析查看阻塞请求并发执行代码是否存在同步阻塞

    youdao

  • In light of our observation it seems as if we should be able to optimize access in the case where a thread is looping over a synchronized block of code.

    根据我们观察我们似乎需要一些锁的访问进行优化,比如线程执行同步代码循环体中。

    youdao

  • This synchronized code block acquires the lock associated with the customer class object before it executes.

    同步代码执行之前需要客户对象相关

    youdao

  • Also, each Home instance is cached once found, so that subsequent lookups will obtain it from the cache, and this cache access is protected with a synchronized block.

    而且一旦找到缓存的主机实例随后查找都可以缓存获取这种缓存访问受到同步块的保护。

    youdao

  • Lock coarsening occurs when adjacent synchronized blocks may be merged into one synchronized block.

    多个彼此靠近同步可以合并到一起,形成一个同步块的时候,就会进行化。

    youdao

  • In WebSphere Process Server V7, the method to claim a task USES a query table and combines the query and claim methods previously used to eliminate the need for the synchronized block.

    WebSphereProcessServerv 7中声明任务方法一个查询表结合早期用于消除同步需求查询声明方法

    youdao

  • And, if this process is applied repeatedly, the entire loop can be collapsed into a single synchronized block with a single "counter=10000000" operation.

    而且如果重复应用这个过程整个循环缩水单独同步,这个同步块中只有一个 "counter=10000000"操作

    youdao

  • It also ensures that the compiler does not move instructions from inside a synchronized block to outside (although it can in some cases move instructions from outside a synchronized block inside).

    确保编译器不会指令一个同步内部外部(虽然某些情况下把指令从同步块的外部移到内部)。

    youdao

  • Multiple instances can be created even if you add a synchronized (this) block to the constructor call, as in Listing 4.

    即使构造方法调用加上同步控制多个实例的现象出现,见清单4

    youdao

  • Most programmers know that the synchronized keyword enforces a mutex (mutual exclusion) that prevents more than one thread at a time from entering a synchronized block protected by a given monitor.

    大多数程序员都知道synchronized关键字强制实施互斥锁(互相排斥),这个互斥锁防止每次多个线程进入一个给定监控器所保护同步语句

    youdao

  • It is crucial to accurately identify which code block truly needs to be synchronized and to synchronize as little as possible.

    准确地识别哪些代码真正需要同步尽可能进行同步非常重要。

    youdao

  • The synchronized statement enbales only one thread to enter a code block at a time.

    同步语句次仅允许一个线程进入代码

    youdao

  • Then, one thread enters the synchronized block to initialize instance, while the other is blocked.

    然后线程进入synchronized初始化instance一个线程则阻断。

    youdao

  • When the first thread exits the synchronized block, the waiting thread enters and creates another Singleton object.

    第一线程退出synchronized时,等待着的线程进入创建另一个Singleton对象

    youdao

$firstVoiceSent
- 来自原声例句
小调查
请问您想要如何调整此模块?

感谢您的反馈,我们会尽快进行适当修改!
进来说说原因吧 确定
小调查
请问您想要如何调整此模块?

感谢您的反馈,我们会尽快进行适当修改!
进来说说原因吧 确定