Package com.google.common.collect

Examples of com.google.common.collect.GenericMapMaker


            objectName = new ObjectName(MBEAN_NAME);
        } catch (Exception e) {
            throw new ManagerException(e);
        }

        GenericMapMaker mapMaker = null;
        mapMaker = new MapMaker().expireAfterAccess(5, TimeUnit.MINUTES)
            .softValues()
            .evictionListener(new MapEvictionListener<Long, MBeanServerConnection>() {

                public void onEviction(Long nid, MBeanServerConnection mbeanServer) {
                    // do nothing
                }
            });

        mbeanServers = mapMaker.makeComputingMap(new Function<Long, MBeanServerConnection>() {

            public MBeanServerConnection apply(Long nid) {
                Node node = nodeService.findById(nid);
                String ip = node.getIp();
                if (node.getParameters().getUseExternalIp()) {
View Full Code Here


    // ================================ helper method ==========================

    private void initTables(final JdbcTemplate jdbcTemplate) {
        // soft引用设置,避免内存爆了
        GenericMapMaker mapMaker = null;
        mapMaker = new MapMaker().softValues().evictionListener(new MapEvictionListener<List<String>, Table>() {

            public void onEviction(List<String> names, Table table) {
                logger.warn("Eviction For Table:" + table);
            }
        });

        this.tables = mapMaker.makeComputingMap(new Function<List<String>, Table>() {

            public Table apply(List<String> names) {
                Assert.isTrue(names.size() == 2);
                try {
                    beforeFindTable(jdbcTemplate, names.get(0), names.get(0), names.get(1));
View Full Code Here

    // ================================ helper method ==========================

    private void initTables(final JdbcTemplate jdbcTemplate) {
        // soft引用设置,避免内存爆了
        GenericMapMaker mapMaker = null;
        mapMaker = new MapMaker().softValues().evictionListener(new MapEvictionListener<List<String>, Table>() {

            public void onEviction(List<String> names, Table table) {
                logger.warn("Eviction For Table:" + table);
            }
        });

        this.tables = mapMaker.makeComputingMap(new Function<List<String>, Table>() {

            public Table apply(List<String> names) {
                Assert.isTrue(names.size() == 2);
                try {
                    beforeFindTable(jdbcTemplate, names.get(0), names.get(0), names.get(1));
View Full Code Here

            objectName = new ObjectName(MBEAN_NAME);
        } catch (Exception e) {
            throw new ManagerException(e);
        }

        GenericMapMaker mapMaker = null;
        mapMaker = new MapMaker().softValues().evictionListener(new MapEvictionListener<Long, MBeanServerConnection>() {

            public void onEviction(Long nid, MBeanServerConnection mbeanServer) {
                // do nothing
            }
        });

        mbeanServers = mapMaker.makeComputingMap(new Function<Long, MBeanServerConnection>() {

            public MBeanServerConnection apply(Long nid) {
                Node node = nodeService.findById(nid);
                String ip = node.getIp();
                if (node.getParameters().getUseExternalIp()) {
View Full Code Here

    // 第一层pipelineId , 第二层DbMediaSource id
    private Map<Long, Map<DbMediaSource, DbDialect>> dialects;

    public DbDialectFactory(){
        // 构建第一层map
        GenericMapMaker mapMaker = null;
        mapMaker = new MapMaker().softValues().evictionListener(new MapEvictionListener<Long, Map<DbMediaSource, DbDialect>>() {

                                                                    public void onEviction(Long pipelineId,
                                                                                           Map<DbMediaSource, DbDialect> dialect) {
                                                                        if (dialect == null) {
                                                                            return;
                                                                        }

                                                                        for (DbDialect dbDialect : dialect.values()) {
                                                                            dbDialect.destory();
                                                                        }
                                                                    }
                                                                });

        dialects = mapMaker.makeComputingMap(new Function<Long, Map<DbMediaSource, DbDialect>>() {

            public Map<DbMediaSource, DbDialect> apply(final Long pipelineId) {
                // 构建第二层map
                return new MapMaker().makeComputingMap(new Function<DbMediaSource, DbDialect>() {
View Full Code Here

    // ================================ helper method ==========================

    private void initTables(final JdbcTemplate jdbcTemplate) {
        // soft引用设置,避免内存爆了
        GenericMapMaker mapMaker = null;
        mapMaker = new MapMaker().softValues().evictionListener(new MapEvictionListener<List<String>, Table>() {

            public void onEviction(List<String> names, Table table) {
                logger.warn("Eviction For Table:" + table);
            }
        });

        this.tables = mapMaker.makeComputingMap(new Function<List<String>, Table>() {

            public Table apply(List<String> names) {
                Assert.isTrue(names.size() == 2);
                try {
                    beforeFindTable(jdbcTemplate, names.get(0), names.get(0), names.get(1));
View Full Code Here

     */
    private Map<Long, Map<DbMediaSource, DataSource>> dataSources;

    public DBDataSourceService(){
        // 设置soft策略
        GenericMapMaker mapMaker = new MapMaker().softValues();
        mapMaker = ((MapMaker) mapMaker).evictionListener(new MapEvictionListener<Long, Map<DbMediaSource, DataSource>>() {

            public void onEviction(Long pipelineId, Map<DbMediaSource, DataSource> dataSources) {
                if (dataSources == null) {
                    return;
View Full Code Here

     */
    private Map<Long, Map<DbMediaSource, DataSource>> dataSources;

    public MediaPushDataSourceHandler(){
        // 设置soft策略
        GenericMapMaker mapMaker = new MapMaker().softValues();
        mapMaker = ((MapMaker) mapMaker).evictionListener(new MapEvictionListener<Long, Map<DbMediaSource, DataSource>>() {

            public void onEviction(Long pipelineId, Map<DbMediaSource, DataSource> dataSources) {
                if (dataSources == null) {
                    return;
View Full Code Here

     */
    private Map<Long, Map<DbMediaSource, DataSource>> dataSources;

    public DBDataSourceService(){
        // 设置soft策略
        GenericMapMaker mapMaker = new MapMaker().softValues();
        mapMaker = ((MapMaker) mapMaker).evictionListener(new MapEvictionListener<Long, Map<DbMediaSource, DataSource>>() {

            public void onEviction(Long pipelineId, Map<DbMediaSource, DataSource> dataSources) {
                if (dataSources == null) {
                    return;
View Full Code Here

            objectName = new ObjectName(MBEAN_NAME);
        } catch (Exception e) {
            throw new ManagerException(e);
        }

        GenericMapMaker mapMaker = null;
        mapMaker = new MapMaker().softValues().evictionListener(new MapEvictionListener<Long, MBeanServerConnection>() {

            public void onEviction(Long nid, MBeanServerConnection mbeanServer) {
                // do nothing
            }
        });

        mbeanServers = mapMaker.makeComputingMap(new Function<Long, MBeanServerConnection>() {

            public MBeanServerConnection apply(Long nid) {
                Node node = nodeService.findById(nid);
                String ip = node.getIp();
                int port = node.getPort().intValue() + 1;
View Full Code Here

TOP

Related Classes of com.google.common.collect.GenericMapMaker

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.