ConcurrentHashMap clear - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for ConcurrentHashMap clear method.

This code example shows how to use the following methods:clear
	public void clearBody() throws JMSException { 
		this.text = null;
	} 
 
	public void clearProperties() throws JMSException { 
		this.properties.clear();
	} 
 
	public boolean getBooleanProperty(String name) throws JMSException {
		Object value = this.properties.get(name);
		return (value instanceof Boolean) ? ((Boolean) value).booleanValue() : false;
	} 
 
	public byte getByteProperty(String name) throws JMSException {
		Object value = this.properties.get(name);
		return (value instanceof Byte) ? ((Byte) value).byteValue() : 0;
	} 
 
	public double getDoubleProperty(String name) throws JMSException {
		Object value = this.properties.get(name);
6
CodeRank
This code example shows how to use the following methods:clear
     * This deletes the global map of namespaces to mediators. Calling this in 
     * production would result in undetected locking failures and data 
     * corruption. 
     */ 
    public void clear() { 
        mediators.clear(); 
    } 
 
    /** 
     * Only use this in testing. 
     * <p> 
     * This deletes all entries in the global map of namespaces to mediators 
     * whose namespace key equals the argument. 
     * 
     * @param prefix 
     */ 
    public void clear(String namespace) { 
        Iterator<Entry<String, LocalLockMediator<?>>> iter = mediators.entrySet().iterator(); 
 
        while (iter.hasNext()) { 
6
CodeRank
This code example shows how to use the following methods:clear
        this(session.getId(), session.getServletContext(), session.getLastAccessedTime(), session.getMaxInactiveInterval());
        copyAttributes(session);
    } 
 
    public void destroy() { 
        attributes.clear(); 
    } 
 
    @Override 
    public long getCreationTime() { 
        if (!valid.get()) throw new IllegalStateException();
        return creationTime;
    } 
 
    @Override 
    public String getId() {
        if (!valid.get()) throw new IllegalStateException();
        return sessionId;
    } 
 
6
CodeRank
This code example shows how to use the following methods:clear, putIfAbsent, size
     * @since 2.5 
     */ 
    public V putIfAbsent(K key, V value) {
        // not 100% optimal semantically, but better from correctness (never exceeds 
        // defined maximum) and close enough all in all: 
        if (_map.size() >= _maxEntries) {
            synchronized (this) {
                if (_map.size() >= _maxEntries) {
                    clear(); 
                } 
            } 
        } 
        return _map.putIfAbsent(key, value);
    } 
     
    // NOTE: key is of type Object only to retain binary backwards-compatibility 
    public V get(Object key) {  return _map.get(key); }
 
    public void clear() { _map.clear(); }
    public int size() { return _map.size(); }

6
CodeRank
This code example shows how to use the following methods:clear, put
			} 
		} 
	} 
	 
	public void clearGroups() { 
		groups.clear();
		groups.put("", mainGroup);
	} 
	 
} 
5
CodeRank
This code example shows how to use the following methods:clear
    /** 
     *  start over 
     *  @since 0.7.11 
     */ 
    public void clear() { 
        this.map.clear();
    } 
} 
 
5
CodeRank
This code example shows how to use the following methods:clear
        } 
    } 
 
    @Before 
    public void setUp() throws Exception {
        sessionsWithTimeouts.clear();
    } 
 
    @After 
    public void tearDown() throws Exception {
    } 
 
    @Test
    public void testLearnerSessionTracker() throws Exception {
        Expirer expirer = new Expirer(1);
        // With local session on 
        LearnerSessionTracker tracker = new LearnerSessionTracker(expirer,
                sessionsWithTimeouts, TICK_TIME, expirer.sid, true);
 
        // Unknown session 
5
CodeRank
This code example shows how to use the following methods:clear
    } 
 
 
    @Override 
    public void close() throws IOException { 
        this.map.clear(); 
    } 
 
} 
5
CodeRank
This code example shows how to use the following methods:clear
      } 
    } 
  } 
 
  public void reset() { 
    map.clear();
  } 
 
  private static NativeSerialization instance = new NativeSerialization();
 
  public static NativeSerialization getInstance() { 
    return instance;
  } 
} 
5
CodeRank
This code example shows how to use the following methods:clear
	/** 
	 * Removes all of the elements from this set. The set will be empty after 
	 * this call returns. 
	 */ 
	public void clear() { 
		map.clear(); 
	} 
 
} 
5
CodeRank
clear Method Overview
Removes all of the mappings from this map.
See Code Examples for other Java 8 ConcurrentHashMap Methods: