⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 attributestore.java

📁 java concurrency in practice 源码. JAVA并发设计
💻 JAVA
字号:
package net.jcip.examples;import java.util.*;import java.util.regex.*;import net.jcip.annotations.*;/** * AttributeStore * <p/> * Holding a lock longer than necessary * * @author Brian Goetz and Tim Peierls */@ThreadSafepublic class AttributeStore {    @GuardedBy("this") private final Map<String, String>            attributes = new HashMap<String, String>();    public synchronized boolean userLocationMatches(String name,                                                    String regexp) {        String key = "users." + name + ".location";        String location = attributes.get(key);        if (location == null)            return false;        else            return Pattern.matches(regexp, location);    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -