内部类访问外部类方法中的参数-使用final

public synchronized <T extends MetricsSource> T register(final String name,
			final String desc, final T source) {
		if (this.monitoring) {
			registerSource(name, desc, source);
		}

		register(new MetricsSystem.AbstractCallback() {
			public void postStart() {
				MetricsSystemImpl.this.registerSource(name, desc,
						source);
			}

		});
		return source;
	}
posted @ 2014-10-16 14:25  JerryShao  阅读(209)  评论(0编辑  收藏  举报