Java Thread Lock getInstance()

Here you can find the source of getInstance()

Description

get Instance

License

Open Source License

Declaration

public static Gson getInstance() 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.InstanceCreator;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;

public class Main {
    private static final Gson SERIALIZER = new GsonBuilder().setPrettyPrinting()
            .registerTypeAdapter(ReadWriteLock.class,
                    (InstanceCreator<ReadWriteLock>) type -> new ReentrantReadWriteLock(true)) //Dont really care about 1:1 serialization of this
            .create();// w w w.j  a  v a 2  s . co  m

    public static Gson getInstance() {
        return SERIALIZER;
    }
}

Related

  1. createConcurrentStack()
  2. downgradeWriteLock(final ReadWriteLock lock)
  3. fillReadWriteLocks(List readLocks, List writeLocks, int curSize, int size)
  4. getAllMessages()
  5. getGradingReadLock()
  6. getLocaleProperties(Locale locale)
  7. getPropLock(String s)
  8. loadClass(String className)
  9. loadClassWithRegisteredClassLoaders(String className)