首页 \ 问答 \ 如何使用OpenLDAP API选择LDAP客户端绑定的地址?(How do you select which address the LDAP client binds to using OpenLDAP API?)

如何使用OpenLDAP API选择LDAP客户端绑定的地址?(How do you select which address the LDAP client binds to using OpenLDAP API?)

有没有办法使用OpenLDAP API在多宿主机器上的LDAP客户端上设置用于套接字绑定的特定网络接口地址; 就像使用Microsoft的LDAP客户端使用LDAP_OPT_SOCKET_BIND_ADDRESSES选项一样。


Is there a way using the OpenLDAP API to set a particular network interface address to be used for socket bind on the LDAP client on a multi homed machine; like you do with the LDAP_OPT_SOCKET_BIND_ADDRESSES option with Microsoft's LDAP client.


原文:https://stackoverflow.com/questions/26047690
更新时间:2023-07-03 12:07

最满意答案

我们不提供这样的API,因为它可能导致误用。 例如检查一份工作是否存在以决定是否添加(因为这是竞争条件的处方)。

如果你真的需要这个,你可以覆盖持久队列并提供你自己的队列,在那里你可以追踪工作增加/删除。 有关详细信息,请参阅JobManager配置WIKI:

https://github.com/yigit/android-priority-jobqueue/wiki/Job-Manager-Configuration

编辑:一个示例竞赛条件

有人可能会写这样的代码:

if (!jobManager.hasJobOfType(ImportantJob.class)) {
    jobManager.addJob(new ImportantJob());
} else {
    // it is already added, no need to re add
}

这里hasJobOfType返回true,但同时Job将要被取消。 现在,没有工作要运行:/。 另一种竞争条件是,代码可能在其他地方调用了addJobInBackground因此它将被添加,但它在hasJobOfType调用时尚未添加。

这种情况下的最佳解决方案是在onCancel中重新创建另一项工作,或手动处理onRun方法中的以前作业的取消(使用全局计数器等)。 另一个选择是使用其回调版本的cancelAsync方法。

http://yigit.github.io/android-priority-jobqueue/javadoc/index.html


We don't provide such an API because it may lead to mis-uses. e.g. checking a job if it exists to decide whether to add or not (because that is recipe for race conditions).

If you really need this, you can override the persistent queue and provide your own queue where you can track job additions/removals. See the JobManager configuration WIKI for details:

https://github.com/yigit/android-priority-jobqueue/wiki/Job-Manager-Configuration

edit: An example race condition

Someone may write a code like this:

if (!jobManager.hasJobOfType(ImportantJob.class)) {
    jobManager.addJob(new ImportantJob());
} else {
    // it is already added, no need to re add
}

There is a potential race condition here where hasJobOfType returns true but meanwhile Job is about to be canceled. Now, there is no job to run :/. Another race condition is, somewhere else the code might have called addJobInBackground so it will be added but it is not yet added at the time of the hasJobOfType call.

The best solution for this kind of cases is to re-create another job in onCancel or manually handling the cancelation of previous jobs in onRun method (with a global counter etc). Another option is to use cancelAsync method with its callback version.

http://yigit.github.io/android-priority-jobqueue/javadoc/index.html

相关问答

更多
  • 看了一些源代码,我想你需要的: 还有一件事你应该注意:正在运行的作业的数量等于rq worker的数量。 因为工人一次只能处理一份工作。 from rq import Queue from redis import Redis from rq.registry import StartedJobRegistry from jobs import count_words_at_url redis_conn = Redis() q = Queue('default', connection=redis_c ...
  • 为什么不直接给这些即时调用优先级并使用priority-job-queue运行它们呢? Why not just give those instant calls a higher priority and run them using priority-job-queue as well?
  • 这基本上是在yarn api上通过elapsedTime获取应用程序的变体 。 在你的情况下,你可以使用RM Cluster Applications API来获取所有的应用程序(不幸的是它不会过滤name ),然后过滤名称等于distcp的应用程序。 以下显示了如何使用jq进行过滤: $ curl 'RMURL/ws/v1/cluster/apps' | jq '.apps.app[] | select (.name == "distcp")' 对于您的情况,如果您只对活动作业感兴趣,则可以将state ...
  • 考虑在/ var / log / syslog中检查日志中的cron 还请确保您可以实际写入文件/目录(chmod权限)。 进一步确保crontab userlevel也可以写入文件/目录。 我只是尝试了你的文件,它确实对我来说执行得很好,会尝试以与你相同的方式将其作为crontab int。 编辑:把它作为一个cronjob,并运作良好,不知道是什么问题! Apparently crond wasn't running.... #service crond restart Stopping crond: ...
  • 实际上,你无法获得当前Keyboard.Detail的引用(请记得阅读评论。)。 I try get height of virtual keyboard Android like this [Is there any way in android to get the height of virtual keyboard of device But I do not get heigth - only get heigth of screen. (I make android plugin for Uni ...
  • 我们不提供这样的API,因为它可能导致误用。 例如检查一份工作是否存在以决定是否添加(因为这是竞争条件的处方)。 如果你真的需要这个,你可以覆盖持久队列并提供你自己的队列,在那里你可以追踪工作增加/删除。 有关详细信息,请参阅JobManager配置WIKI: https://github.com/yigit/android-priority-jobqueue/wiki/Job-Manager-Configuration 编辑:一个示例竞赛条件 有人可能会写这样的代码: if (!jobManager.ha ...
  • 取决于你的数据库结构,你可以这样做 SELECT * FROM jobs WHERE active = 1 AND closingdate >= NOW() depending on your database structure, you could do SELECT * FROM jobs WHERE active = 1 AND closingdate >= NOW()
  • 注意:尝试从uri获取文件名是错误的。 不要这样做! 内容提供商还可以共享任何文件中不存在的任意数据,或者文件名可能会产生误导。 例如content://downloads/some_secret_data可能指向不在downloads文件夹中的文件。 所以最好的办法是立即从内容提供商处读取/复制数据,然后使用该数据做任何你想做的事情。 就我而言,我上传了它。 以前的错误答案(不要这样做!): 这就是我所做的,对我来说工作正常。 如果有人有更好的解决方案,请分享。 我有android.permission. ...
  • 您的服务器将向您推送联系人的状态信息:可用状态 - >用户上线。 存在不可用 - >用户离线。 当您第一次连接并启动会话时,服务器将向您发送在线联系人的所有状态。 从那时起,只要您的某个联系人更改其状态,您就会收到在线状态。 所以你总是更新。 客户有责任(就是你)根据这一点保持联系人列表的当前状态。 imho,没有标准的方法来查询服务器中的活动成员。 也许有些服务器实现了这个功能,不知道。 Your server will push to you presence information from your ...
  • 我猜你在旋转时重新创造了这个工作,那么你最终得到了2个工作。 当活动更改配置(也称为旋转)时,您不应将其排队两次。 I'm guessing you are re-creating the job when you rotate so then you end up with 2 jobs. You should not enqueue it twice when activity changes configuration (a.k.a. rotation).

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)