src/java/org/apache/cassandra/db/DataTracker.java
/**
     * Switch the current memtable.
     * This atomically adds the current memtable to the memtables pending
     * flush and replace it with a fresh memtable.
     *
     * @return the previous current memtable (the one added to the pending
     * flush)
     */
Switch the current memtable.
This atomically adds the current memtable to the memtables pending
flush and replace it with a fresh memtable.

@return the previous current memtable (the one added to the pending
flush)
Switch the current memtable . This atomically adds the current memtable to the memtables pending flush and replace it with a fresh memtable . @return the previous current memtable ( the one added to the pending flush )
public Memtable switchMemtable()
    {
        Memtable newMemtable = new Memtable(cfstore);
        Memtable toFlushMemtable;
        View currentView, newView;
        do
        {
            currentView = view.get();
            toFlushMemtable = currentView.memtable;
            newView = currentView.switchMemtable(newMemtable);
        }
        while (!view.compareAndSet(currentView, newView));
        return toFlushMemtable;
    }
public Memtable switchMemtable ( ) { Memtable newMemtable = new Memtable ( cfstore ) ; Memtable toFlushMemtable ; View currentView , newView ; do { currentView = view . get ( ) ; toFlushMemtable = currentView . memtable ; newView = currentView . switchMemtable ( newMemtable ) ; } while ( ! view . compareAndSet ( currentView , newView ) ) ; return toFlushMemtable ; }
Switch the current memtable.
Switch the current memtable .
// atomically change the current memtable