Example usage for java.util.concurrent ConcurrentHashMap ConcurrentHashMap

List of usage examples for java.util.concurrent ConcurrentHashMap ConcurrentHashMap

Introduction

In this page you can find the example usage for java.util.concurrent ConcurrentHashMap ConcurrentHashMap.

Prototype

public ConcurrentHashMap() 

Source Link

Document

Creates a new, empty map with the default initial table size (16).

Usage

From source file:com.jivesoftware.os.upena.shared.ReleaseGroup.java

@JsonCreator
public ReleaseGroup(@JsonProperty("type") Type type, @JsonProperty("name") String name,
        @JsonProperty("email") String email, @JsonProperty("rollbackVersion") String rollbackVersion,
        @JsonProperty("version") String version, @JsonProperty("repository") String repository,
        @JsonProperty("description") String description, @JsonProperty("autoRelease") boolean autoRelease,
        @JsonProperty("properties") Map<String, String> properties) {
    this.type = type == null ? Type.stable : type;
    this.name = name;
    this.email = email;
    this.rollbackVersion = rollbackVersion;
    this.version = version;
    this.repository = repository;
    this.description = description;
    this.autoRelease = autoRelease;
    this.properties = properties == null ? new ConcurrentHashMap<>() : properties;
}

From source file:com.heyzap.http.SDKCookieStore.java

/**
 * Construct a persistent cookie store.//from  ww w.j  a va2s. co  m
 */
public SDKCookieStore(Context context) {
    cookiePrefs = context.getSharedPreferences(COOKIE_PREFS,
            Context.MODE_WORLD_READABLE | Context.MODE_WORLD_WRITEABLE);
    cookies = new ConcurrentHashMap<String, Cookie>();
    this.context = context;

    addCookies(HeyzapCookies.getCookie(context));
}

From source file:com.jmeter.alfresco.utils.HttpUtils.java

/**
 * Gets the login response.//from w  w w  .j ava 2  s . c  o  m
 *
 * @param authURI the path
 * @param username the username
 * @param password the password
 * @return the login response
 * @throws ParseException the parse exception
 * @throws IOException Signals that an I/O exception has occurred.
 */
public Map<String, String> getAuthResponse(final String authURI, final String username, final String password)
        throws ParseException, IOException {

    LOG.debug("Authenticating request..");
    final Map<String, String> responseMap = new ConcurrentHashMap<String, String>();
    GetMethod getRequest = null;
    try {
        final HttpClient httpclient = new HttpClient();
        getRequest = new GetMethod(getAuthURL(authURI, username, password));
        final int statusCode = httpclient.executeMethod(getRequest);
        LOG.debug("Auth Response Status: " + statusCode + "|" + getRequest.getStatusText());

        responseMap.put(Constants.RESP_BODY, getRequest.getResponseBodyAsString());
        responseMap.put(Constants.CONTENT_TYPE,
                getRequest.getResponseHeader(Constants.CONTENT_TYPE_HDR).getValue());
        responseMap.put(Constants.STATUS_CODE, String.valueOf(statusCode));

    } finally {
        if (getRequest != null) {
            getRequest.releaseConnection();
        }
    }
    return responseMap;
}

From source file:edu.isi.karma.kr2rml.writer.N3KR2RMLRDFWriter.java

public N3KR2RMLRDFWriter(URIFormatter uriFormatter, PrintWriter writer) {
    this.outWriter = writer;
    this.uriFormatter = uriFormatter;
    generatedTriples = new ConcurrentHashMap<>();
}

From source file:eu.trentorise.smartcampus.ac.provider.repository.memory.AcDaoMemoryImpl.java

@Override
public <T extends AcObject> long create(T acObj) {
    acObj.setId(getNextId(acObj.getClass()));
    Map<Long, T> map;
    synchronized (cache) {
        map = (Map<Long, T>) cache.get(acObj.getClass());
        if (map == null) {
            map = new ConcurrentHashMap();
            cache.put(acObj.getClass(), map);
        }/*from  w  w  w . j ava  2 s . c  om*/
    }
    map.put(acObj.getId(), acObj);
    if (acObj instanceof User) {
        User user = (User) acObj;
        for (Attribute a : user.getAttributes()) {
            create(a.getAuthority());
        }
    }
    return acObj.getId();
}

From source file:org.mimacom.sample.integration.patterns.user.service.web.AsyncUserController.java

public AsyncUserController(AsyncSearchServiceIntegration asyncSearchServiceIntegration) {
    this.asyncSearchServiceIntegration = asyncSearchServiceIntegration;
    this.userRepository = new ConcurrentHashMap<>();
}

From source file:azkaban.flowtrigger.plugin.FlowTriggerDependencyPluginManager.java

@Inject
public FlowTriggerDependencyPluginManager(final String pluginDir) throws FlowTriggerDependencyPluginException {
    this.dependencyTypeMap = new ConcurrentHashMap<>();
    this.pluginDir = pluginDir;
    this.prevClassLoader = Thread.currentThread().getContextClassLoader();
}

From source file:com.blazeroni.reddit.http.PersistentCookieStore.java

/**
* Construct a persistent cookie store./*w w  w. j a  v a2s  .c  o  m*/
*/
public PersistentCookieStore(Context context) {
    this.cookiePrefs = context.getSharedPreferences(COOKIE_PREFS, MODE_PRIVATE);
    this.cookies = new ConcurrentHashMap<String, Cookie>();

    // Load any previously stored cookies into the store
    String storedCookieNames = this.cookiePrefs.getString(COOKIE_NAME_STORE, null);

    if (storedCookieNames != null) {
        String[] cookieNames = TextUtils.split(storedCookieNames, ",");
        for (String name : cookieNames) {
            String encodedCookie = this.cookiePrefs.getString(COOKIE_NAME_PREFIX + name, null);
            if (encodedCookie != null) {
                Cookie decodedCookie = decodeCookie(encodedCookie);
                if (decodedCookie != null) {
                    this.cookies.put(name, decodedCookie);
                }
            }
        }

        // Clear out expired cookies
        clearExpired(new Date());
    }
}

From source file:com.ushahidi.swiftriver.core.rules.DropFilterQueueConsumerTest.java

@Before
public void setUp() {
    mockRulesExecutor = mock(RulesExecutor.class);
    rulesRegistry = new RulesRegistry();
    rulesRegistry.setRulesMap(new ConcurrentHashMap<Long, Map<Long, Rule>>());
    mockAmqpTemplate = mock(AmqpTemplate.class);

    dropFilterQueueConsumer = new DropFilterQueueConsumer();
    dropFilterQueueConsumer.setRulesExecutor(mockRulesExecutor);
    dropFilterQueueConsumer.setRulesRegistry(rulesRegistry);
    dropFilterQueueConsumer.setAmqpTemplate(mockAmqpTemplate);
    dropFilterQueueConsumer.setObjectMapper(objectMapper);
}

From source file:org.another.logserver.config.Configurator.java

/**
 * Initializes the component./*from  w w  w. j  av a 2s  .co m*/
 */
@PostConstruct
public void init() {
    LOGGER.debug("Defined endpoints: {}", (Object[]) endPoints);

    this.configuredEndPoints = new ConcurrentHashMap<>();

    HashSet<String> endPointsHashSet = new HashSet<>();
    Collections.addAll(endPointsHashSet, endPoints);

    if (endPointsHashSet.contains(EndPointDefinition.REST_ENDPOINT.getShortDefinition())) {
        configureRestEndPoint();
    }

    if (endPointsHashSet.contains(EndPointDefinition.TCP_ENDPOINT.getShortDefinition())) {
        configureTCPEndPoint();
    }

    LOGGER.debug("Finalizing Configure task");

}