首页 \ 问答 \ 现有的ForkJoinPool还是ExecutorService?(Existing ForkJoinPool or ExecutorService?)

现有的ForkJoinPool还是ExecutorService?(Existing ForkJoinPool or ExecutorService?)

我有一个愚蠢的问题,我需要一个ExecutorService(而ForkJoinPool就是这样的东西)但我真的不想初始化一个新的并保留该引用,我记得有一段时间回到运行JDK类维护一个静态的ForkJoinPool对于各种用途,可以被其他进程使用,但我似乎无法找到它,并且没有关于这样的在线信息。 有没有人知道这样的事情是否存在?


I have a silly problem, I need an ExecutorService (and ForkJoinPool is such a thing) but I don't really want to initialise a new one and keep that reference, I remember a while back running into a JDK class that maintained an static ForkJoinPool for various uses and that could be used by other processes, but I can't seem to find it and there is not that much info about such a thing online. Does any know if such a thing exists ?


原文:https://stackoverflow.com/questions/32137240
更新时间:2024-01-01 20:01

最满意答案

LUR是将缓存过期并将新项添加到缓存的算法。 当缓存满时,此算法将在缓存中过期最近使用最少的项目。 MemoryCache是​​.net 4中的一个类,之后是一种在堆内存中实现缓存的方法。 缓存可以根据您可以缓存在硬盘驱动器或内存上的缓存介质以不同的方式进行分类,具体取决于内存的位置,您可以将其分类为内存(在内存中)和内存(a)例如在另一台服务器上的堆内存)。 c#中的MemoryCaching使用内存,你必须小心,因为它可以使用你的应用程序的所有内存。 所以如果你有多个节点,最好不要使用它。

另外需要考虑的是,当您将对象缓存在外部存储器中时,该对象应该是可序列化的。 但是内存中缓存可以缓存任何对象而无需序列化。


LUR is a algorithm of expiring the cache and adding new Item to your cache. the this algorithm expires the least recently used Item in your cache when the cache is full. The MemoryCache is a class in .net 4 and after which is a way of implementing caching inside the heap memory. Caching can be categorise in different ways base on the media that you cache you can cache on hard drive or memory, based on the location of the memory you can categorize it as in-memory (inside the heap memory) and out-memory (a memory out side the heap for example on another server). MemoryCaching in c# uses in-memory and you have to be careful because it can use all the memory of your application. So its better not to use it if you have more than one node.

One another things you have to take into consideration is that you when you cache an object in an out-memory the object should be serializable. But the in-memory caching can cache any object without serializing.

相关问答

更多
  • 如果有人想重新使用上述任何代码,我只会使用http响应缓存而不使用LRU缓存,因为特别是如果你正在缓存webservice响应,例如JSON,xml。 为什么? 由于上面的LRU缓存实现,我曾经丢失了200MB的设备存储空间。 HTTPResponseCache的优点: 缓存对文件系统的HTTP和HTTPS响应,以便可以重用它们,从而节省时间和带宽 HttpUrlConnection:自动处理缓存机制, 在HttpResponseCache的帮助下加快应用程序的响应时间 它已经可用,因为API级别1 =>它 ...
  • Memoization是缓存的一种特定形式,它涉及到缓存基于其参数的函数返回值。 缓存是一个更通用的术语; 例如,HTTP缓存是缓存,但不是记忆。 维基百科说 : 虽然与缓存有关,但是memoization是指这种优化的具体情况,将其与缓存或页面替换等缓存形式区分开来。 Memoization is a specific form of caching that involves caching the return value of a function based on its parameters. ...
  • 听起来像是在使用IIS缓存。 首先,如果这是您的路由 - 如果您有可能使用缓存的程序集(如果可用),则需要创建用于检查HTTPcontext Caching程序集。 如果它为null - 您在IIS之外运行并且缓存将不可用。 如果您使用最高为3.5的框架,则可以选择下载Enterprise Library Caching块 。 如果您使用FW4.0 +,则使用system.runtime.caching。 这种方式缓存将始终可用。 还有AppFaric和一些第三方缓存实现,但这可能超出了您的范围。 对于您的 ...
  • 如何在客户端存储数据并不重要。 不过,我会考虑使用IsolatedStorage。 可能更难的是告诉缓存何时变为陈旧。 这实际上是System.Runtime.Caching所擅长的。 服务器数据是根本更改,还是仅在应用程序的新版本发生后更改? 如果数据仅在新版本之后发生更改,您可能希望将其作为资源包含在应用程序设置中。 如果没有,您必须有一些超时或信号告诉客户端是时候检查服务器上的更改数据了。 您是否已经考虑过延迟加载数据? 这样,延迟可能不会在应用程序启动时发生,并且不太明显,甚至可能您甚至不必将完整数 ...
  • 相关帖子表明一个哈希表有一个双向链表,但我甚至不清楚双链表如何保持LRU。 我只是在这里猜测,但你可以做这样的事情(在这里使用伪C因为我很懒)。 以下是基本数据结构: struct File { // hash key string Name; // doubly-linked list File* Previous; File* Next; // other file data... } struct Cache { HashTable
  • 我知道我有偏见,但我真的必须强烈推荐我们的MapMaker 。 使用softKeys()或softValues()功能,具体取决于它是关键的GC集合还是更适合描述条目何时清理的值的值。 I know I'm biased, but I really have to strongly recommend our MapMaker for this. Use the softKeys() or softValues() feature, depending on whether it's GC collecti ...
  • 答案是,你不能在你的问题之前,但现在你可以。 如果你从github获得最新的klepto ,并提供新的标志purge=False - 那么你就会得到你正在寻找的行为。 我刚刚添加了这个以回应你的问题。 在你的情况下: lru_cache(cache=dir_archive(cached=False), keymap=mymap, ignore='self', maxsize=5, purge=False) 或者,例如: @lru_cache(maxsize=3, cache=dict_archive('te ...
  • LUR是将缓存过期并将新项添加到缓存的算法。 当缓存满时,此算法将在缓存中过期最近使用最少的项目。 MemoryCache是.net 4中的一个类,之后是一种在堆内存中实现缓存的方法。 缓存可以根据您可以缓存在硬盘驱动器或内存上的缓存介质以不同的方式进行分类,具体取决于内存的位置,您可以将其分类为内存(在内存中)和内存(a)例如在另一台服务器上的堆内存)。 c#中的MemoryCaching使用内存,你必须小心,因为它可以使用你的应用程序的所有内存。 所以如果你有多个节点,最好不要使用它。 另外需要考虑的是 ...
  • 我不知道在Scala中实现了什么,但你可以使用诸如concurrentlinkedhashmap或Guava之类的Java库。 I'm not aware of something implemented in Scala, but you can use Java libraries such as concurrentlinkedhashmap or Guava.
  • 运行代码我收到以下错误: python cache.py (1, 3) (2, 3) (1, 3) Traceback (most recent call last): File "cache.py", line 68, in if cache_key not in cache: File "cache.py", line 20, in __contains__ self.move_item_to_the_top(key, value) File "cache. ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。